28.03.2013 Views

Guide to LaTeX (4th Edition) (Tools and Techniques

Guide to LaTeX (4th Edition) (Tools and Techniques

Guide to LaTeX (4th Edition) (Tools and Techniques

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

4.8. Tables 101<br />

4 & Daysdon Bombers & 14 & 10 & 9 & 66:50 & 38:28 \\<br />

The column format now consists of only seven column definitions, rlrrrcc.<br />

! The previous third column c has been removed, <strong>and</strong> so each row contains one less<br />

column separation symbol &. The new third column, the number of games won,<br />

begins with the second & <strong>and</strong> is separated from the club name by the contents<br />

of @{ 33 }, which is entered au<strong>to</strong>matically without any additional & symbol.<br />

The last two columns give the relations between goals <strong>and</strong> points won<br />

<strong>and</strong> lost as a centered entry of the form m:n. The colons ‘:’ are only<br />

coincidentally ordered exactly over one another since two-digit numbers<br />

appear in every case on both sides of the colon. If one entry had been<br />

9:101, the colon would have been shifted slightly <strong>to</strong> the left as the entire<br />

entry was centered.<br />

A vertical alignment of the ‘:’ independent of the number of digits<br />

can also be achieved using an @-expression of the form r@{:}l in the<br />

column format. This means that a colon is placed in every row between a<br />

right <strong>and</strong> a left justified column. The column formatting argument in the<br />

example now becomes<br />

{rl@{ 33 }rrrr@{:}lr@{:}l} or<br />

{|r|l||@{ 33 }|rrr|r@{:}l|r@{:}l|}<br />

<strong>and</strong> the row entry is<br />

4 & Daysdon Bombers & 14 & 10 & 9 & 66 & 50 & 38 & 28 \\<br />

Each of the former c columns has been replaced by the two columns in<br />

! r@{:}l. An @-expression inserts its text between the neighboring columns,<br />

removing the intercolumn spacing that would normally be there. Thus the r<br />

column is justified flush right with the ‘:’ <strong>and</strong> the following l column flush left.<br />

The same method can be employed when a column consists of numbers with<br />

decimal points <strong>and</strong> a varying number of digits.<br />

The entries for the goal <strong>and</strong> point relationships are now made up of<br />

two columns positioned about the ‘:’ symbol. This causes no problems<br />

for entering the number of goals won <strong>and</strong> lost or for the number of plus<br />

<strong>and</strong> minus points, since each entry has its own column. The column<br />

headings, however, are the words ‘Goals’ <strong>and</strong> ‘Points’, stretching over<br />

two columns each <strong>and</strong> without the colon. This is accomplished with the<br />

\multicolumn comm<strong>and</strong>, which merges selected columns in a particular<br />

row <strong>and</strong> redefines the column format. The first row of the unframed<br />

soccer table is then<br />

Position& Club & W & T & L & \multicolumn{2}{c}{Goals}<br />

& \multicolumn{2}{c}{Points}\\[0.5ex]<br />

Here \multicolumn{2}{c}{Goals} means that the next two columns<br />

are <strong>to</strong> be combined in<strong>to</strong> a centered column, containing the text ‘Goals’.<br />

For the framed table, the new formatting argument in the \multicolumn<br />

comm<strong>and</strong>s must be {c|} since the vertical line symbol | was also removed<br />

when the old columns were combined. In deciding what belongs <strong>to</strong> a given

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!