-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

LaTeX Beginner's Guide

We will use \newcommand
again, but this time we will introduce a parameter that will contain our keyword. Let's just use it on some terms that we've got to know in this chapter:
Type this code example:
\documentclass{article} \newcommand{\keyword}[1]{\textbf{#1}} \begin{document} \keyword{Grouping} by curly braces limits the \keyword{scope} of \keyword{declarations}. \end{document}
Typeset and notice the look of the keywords in the output:
Let's look at the highlighted line in the code. The number 1
in the square brackets marks the number of arguments that we want to use in the command. #1
will be replaced by the value of the first argument. #2
would refer to a second argument, and so on.
Now if you want to modify the appearance of all keywords to be italic, just modify the definition of \keyword
and the change will be global.
In one preceding example, we've used \newcommand
with two arguments...