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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

204 Chapter 8. User Cus<strong>to</strong>mizations<br />

The entry My opinion of \<strong>LaTeX</strong>:\\ \twentylove now produces:<br />

My opinion of L AT E X:<br />

I love L AT E X! I love L AT E X! I love L AT E X! I love L AT E X! I love L AT E X!<br />

I love L AT E X! I love L AT E X! I love L AT E X! I love L AT E X! I love L AT E X!<br />

I love L AT E X! I love L AT E X! I love L AT E X! I love L AT E X! I love L AT E X!<br />

I love L AT E X! I love L AT E X! I love L AT E X! I love L AT E X! I love L AT E X!<br />

Indenting the lines of the definition, as shown above, can help <strong>to</strong> keep track of<br />

the nesting levels; each line of the same level starts in the same column, ignoring<br />

braces.<br />

If both the inner <strong>and</strong> outer definitions are <strong>to</strong> be provided with arguments,<br />

! the symbols for the inner <strong>and</strong> outer dummy arguments must be distinguished.<br />

The symbols for the inner definition are ##1 ... ##9, while those for the outer<br />

one are the normal #1 ... #9. For example:<br />

\newcomm<strong>and</strong>{\thing}[1]{{\newcomm<strong>and</strong>{\color}[2]{The ##1 is ##2.}<br />

\color{#1}{red} \color{#1}{green} \color{#1}{blue}}}<br />

The entry The colors of the objects are\\<br />

\thing{dress}\\ \thing{book}\\ \thing{car} produces<br />

The colors of the objects are<br />

The dress is red. The dress is green. The dress is blue.<br />

The book is red. The book is green. The book is blue.<br />

The car is red. The car is green. The car is blue.<br />

The separate definition <strong>and</strong> calling as in Section 8.5.5 is easier <strong>to</strong> follow <strong>and</strong><br />

would be:<br />

\newcomm<strong>and</strong>{\thing[1]}{\color{#1}{red} \color{#1}{green}<br />

\color{#1}{blue}<br />

\newcomm<strong>and</strong>{\color}[2]{The #1 is #2.}<br />

If one were ever <strong>to</strong> go <strong>to</strong> a third level of definitions, the dummy arguments<br />

! are given as ####1 . . . ####9. And for the fourth level one writes 8 # signs!

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

Saved successfully!

Ooh no, something went wrong!