# Re: long part numbers

• Subject: Re: long part numbers
• From: Stroller <..hidden..>
• Date: Thu, 24 Sep 2009 05:18:51 +0100


On 23 Sep 2009, at 15:43, Joseph wrote:

...
Here is a typical part number:
CP-D-1X4-1315-25%-900/250-1-1-LC/PCx1-4x60mm

When I print in html to the screen it nicely splits into two lines
CP-D-1X4-1315-25%-900/250-1-1
LC/PCx1-4x60mm


so there is enough room for longer description. But tex template just prints the entire part number on one line, so the description is squeeze into few columns. It does not look good, and there is a lot of white space waisted as the part number column is long and empty below and description is squeezed
into narrow space, so it takes a lot of space.

I'm using default invoice.tex template.
I think this is the section from the template:

..hidden..@{}}

\textbf{Pos} & \textbf{Number} & \textbf{Description} & & \textbf{Qt'y} & \textbf{Unit} & \textbf{Price} & \textbf{Disc \%} & \textbf{Amount} \\ [0.5em]
<?lsmb FOREACH number ?>
<?lsmb lc = loop.count - 1 ?>
<?lsmb runningnumber.${lc} ?> & <?lsmb number.${lc} ?> &
<?lsmb description.${lc} ?> & <?lsmb deliverydate.${lc} ?> &
<?lsmb qty.${lc} ?> & <?lsmb unit.${lc} ?> &
<?lsmb sellprice.${lc} ?> & <?lsmb discountrate.${lc} ?> &
<?lsmb linetotal.\${lc} ?> \\
<?lsmb END ?>
\end{tabularx}



You may wish to:
\usepackage{hyphenat}


But I _believe_ this is inherent to tabularx. I'm pretty sure I changed to longtable for similar reasons.


I have this notion that tabularx is rubbish, and I think it caused another poster problems with multipage invoices. See the archives for 18-19 May this year (Subject: "2 persistant bugs; Seeking ideas where to look."). I think longtable is a bunch better, and it will be used in the default templates in the future.


Suggest you make a test.tex file in your homedir and filling it with static fields:

\documentclass{minimal}
\usepackage{tabularx}

\begin{document}

Pos & Number & Description & Qt'y & Unit & Price & Disc & Amount \\
1234 & 1 & Oranges & 3 & 1 & £0.42 & 0% & £1.26 \\

CP-D-1X4-1315-25%-900/250-1-1-LC/PCx1-4x60mm & 2 & Paper probably & 8 & 1 & £1 & 0% & £8 \\
  ...
\end{document}


You can copy & paste the "\begin{tabularx}" and "\end{tabularx}" lines from your invoice.tex and you should see the same problem reproduced. I think that if you port the table to longtable you will see better results.

Docs: http://www.maths.nottingham.ac.uk/common/resources/latex/longtable.pdf

Stroller.