It frequently happens that you using the same, long term in your document. For example, my implementation is called "Copacabana". Creating an abbreviation has many advantages: First, when you decide to change the name, it suffices to change the name in one place only. Secondly, the same holds for formatting.
Here's how not to do it:
\newcommand{\copa}{Copacabana}
Why not? Imagine the following LaTeX source:
The tool \copa is the best!
results in the following output:
The tool Copacabanais the best!
The solution is using \xspace! This command inserts a space only where it makes sense, e.g., between two words, but not between the word and a punctuation mark.
\newcommand{\copa}{Copacabana\xspace}
Nice, ey? For using \xspace, you must add the following to the header of your LaTeX file:
\usepackage{xspace}
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment