where <vertical space> is extra vertical spacing between rows, if required. There is also a longer equivalent:
[Alignment tab changed to
\cr]If you have used something like
as the specifier for your last column, you must use
\tabularnewline instead of \\
to indicate the row break otherwise you will get the following
! Extra alignment tab has been changed to \cr. <recently read> \endtemplate
Let's have two columns, the first left justified and the second right justified:
Recall from §2. Some Definitions that LaTeX ignores spaces at the start of a line and treats multiple spaces as a single space, so I could just have easily done:
and still have got the same result, but now the code is easier to read.
Item & ex VAT & inc VAT\\
Video & 8.99 & 10.56 \\
CD & 9.11 & 10.70 \\
DVD & 15.00 & 17.63 \\
\bfseriesTotal & 33.10 & 39.89
Example (Aligning on a Decimal Point):
If you want to align on the decimal point, it's best to use the siunitx package. That's beyond the scope of this book, but for simple data this can be achieved using the @ inter-column specifier. For example:
Video & 8 & 99\\
CD & 9 & 11\\
DVD & 15 & 00\\
\bfseriesTotal & 33 & 10
This book is also available as A4 PDF or 12.8cm x 9.6cm PDF or paperback (ISBN 978-1-909440-00-5).
Last modified: 2017-02-06.
The free resources on this site are funded by book sales, not by adverts. If you would like to help keep this site free of annoying third-party ads, please consider buying a book.