Most technical writers will immediately see how I'd like to use this. I'm writing a paper about something I'll call That Which Will Be Abbreviated (TWWBA). I'd like to have a macro, \TWWBA{}, that will produce That Which Will Be Abbreviated (TWWBA) the first time it is called, and TWWBA on all following invocations.

Is there a way to do this?

  • I'd actually like to see a general solution to the problem. Presumably it would be a macro that would be defined to redefine itself on its first usage?
    – Seamus
    Nov 16, 2011 at 16:25
  • @Seamus: Either that or a macro that changes a flag on first use that tells it to use the other text on the following uses. I slightly changed the title of this question to make it acronym-specific, hoping that users who don't know glossaries or acronym would get help here. I'd recommend looking for a general solution in another question? Just to keep the purposes separate -- acronyms vs. general usage.
    – doncherry
    Nov 16, 2011 at 16:34
  • Wow, thanks for the great response and the edits. I'm all set in terms of the article I'm writing, but another answer that explained how this could be done with conditionals would be great, if only for completeness.
    – Colin K
    Nov 16, 2011 at 18:15

3 Answers 3


I recommend using glossaries or acronym (with a preference for the former). For limited use one can also define them directly:

\newcommand{\newacronym}[3]{\newcommand#1{#3 (#2)\gdef#1{#2}}}


\newacronym{\TWWBA}{TWWBA}{That Which Will Be Abbreviated}

will allow to write \TWBBA and get

That Which Will Be Abbreviated (TWWBA)

the first time and


thereafter. This is roughly what the two packages do (but they do better): the first execution of the command redefines itself. It's necessary to use low level commands, because the higher level LaTeX commands are unable to make global definitions of commands.

  • I'm marking this as the answer because it answers the question exactly as I asked it as well as pointing me to acronym and glossary, which are both excellent.
    – Colin K
    Nov 16, 2011 at 18:12
  • @ColinK You shouldn't.
    – egreg
    Nov 16, 2011 at 18:27
  • Why not? It includes the basics of the other answers, and tells me what I wanted to know about writing macros.
    – Colin K
    Nov 16, 2011 at 20:37
  • This is the most comprehensive answer, so it gets my vote!
    – qubyte
    Nov 16, 2011 at 23:59
\newacronym{twwba}{TWWBA}{That Which Will Be Abbreviated}
text \gls{twwba}

more text \gls{twwba} 

This is handled nicely by the acronym package. I recommend it.


As mentioned by egreg in the comment below, the glossaries package is particularly useful for this too.

  • Also the glossaries package has this feature and is more customizable.
    – egreg
    Nov 16, 2011 at 16:03
  • Indeed it does. I used that one for my thesis and was very pleased with the result.
    – qubyte
    Nov 16, 2011 at 16:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .