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.


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


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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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