[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

word wrapping in TeX columns -- was: A place for line-item notes on the invoice?



Jeff Kowalczyk wrote:
On Tue, 13 May 2008 07:14:29 -0400, Luke wrote:
  
<?lsmb itemnotes ?>
    

I'd like to have the 'itemnotes' list just above the 'notes' field,
instead of the item rows. Some of my item notes are quite lengthy and must
word-wrap like the notes field does.
  
Apologies for the orthogonal answer, but you can wrap words in a column of a table by using the "p" alignment setting for the column.  Here's my line-item table (for a professional services business):

\begin{tabularx}{\textwidth..hidden..@{}}
  \textbf{Date} & \textbf{Description} & & & \textbf{Rate} & \textbf{Amount} \hfill \\ [0.5em]
<?lsmb foreach number ?>
  <?lsmb deliverydate ?> & <?lsmb description ?> & 
    <?lsmb qty ?> & <?lsmb unit ?> & <?lsmb sellprice ?> & <?lsmb linetotal ?> \\
    \hfill
  & <?lsmb itemnotes ?> & & & & \\
    \hfill
<?lsmb end number ?>
\end{tabularx}
Forgive me if this is too elemental... See the first line with the "..hidden..@{}}"?  That specifies the Each row starts and ends with empty space -- "@{}" (got that from the default template, I assume it's for filling the horizontal space.  Don't know why /hfill won't work.).  The first column is left justified ("l").  The second column ("p{11cm}") wraps (p is for paragraph) and is 11cm wide.  The subsequent columns, respectively, are right, left, right, and right justified.

Question:
------------
With the extra line, I have problems with pagination.  I believe this field has something to do with it:
<?lsmb pagebreak 65 27 37 ?>
What do the numbers mean?
What's the tex syntax for a simple numbered repeating paragaph sequence

<?lsmb foreach number ?>
  <?lsmb runningnumber ?> & <?lsmb itemnotes ?> \\
<?lsmb end number ?>

e.g:

  1) Notes for line item 1

  2) Notes for line item 2
  
Two things: 

(1) "&" is a column separator in a table.  I don't think it will behave the way you want outside of a tabularx block.  If you use tabularx, it won't wrap without the "p{width}" specifier I mentioned above. 

(2) You'll have to explicitly include the ") " (space included) to get it to look the way you want.

  \hfill
  ..hidden..@{}}
    & Subtotal & <?lsmb subtotal ?> \\
  <?lsmb foreach tax ?>
    & <?lsmb taxdescription ?> on <?lsmb taxbase ?> & <?lsmb tax ?> \\
  <?lsmb end tax ?>
  <?lsmb if paid ?>
    & Paid & - <?lsmb paid ?> \\
  <?lsmb end paid ?>
    \hline
  <?lsmb if total ?>
    & Balance Due & <?lsmb total ?>
  <?lsmb end total ?>
  \end{tabularx}
  
  \vspace{0.3cm}
  
  <?lsmb text_amount ?> ***** <?lsmb decimal ?>/100
  \hfill
  All prices in \textbf{<?lsmb currency ?>}.
  
  \vspace{12pt}
  
  <?lsmb foreach number ?>
    <?lsmb runningnumber ?> & <?lsmb itemnotes ?> \\
  <?lsmb end number ?>
  )
  
  \vspace{12pt}
  
  <?lsmb notes ?>
  }
  
  \vfill

Thanks,
Jeff
  
I hope that helps.

Regards.