Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'd like to create a cover letter where I can insert the company name, and various other consistent pieces of information as a macro to be expanded when the document is compiled. I'm very new to LaTeX, but I'm certain this can be done with a macro; how can I do this?

I'd like it to be this sort of thing:

\define{compname}{European XFEL}{European X-Ray Free Electron Laser}

So that when some command reading compname is compiled it spits out the long or short form.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

There are lots of ways of doing this. The glossaries package is pretty good for defining acronyms (things with long and short versions), but it might be overkill for this.

You could just do

\documentclass{letter}
\newcommand{\shortname}{}
\newcommand{\longname}{}
\newcommand{\compname}[2]{\renewcommand{\shortname}{#1}\renewcommand{\longname}{#2}}

\compname{European XFEL}{European X-Ray Free Electron Laser}
\begin{document}
The short version of the name is: \shortname

The long version of the name is: \longname
\end{document}
share|improve this answer
    
I did not realise how simple that would be. Fantastic. –  Pureferret Feb 2 '12 at 17:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.