I would like to know if there is any elegant way to treat specific words as symbols, and automatically wrap them with a \texttt command. This would come handy with API names for instance, so \texttt doesn't have to be added manually to every mention of the API.

closed as too localized by Joseph Wright Aug 6 '12 at 9:23

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Please provide a minimal example of your current setup that highlights the problem. – Werner Apr 13 '12 at 18:12
  • Minimal setup is \texttt wrapping around every mention of an API name. Nothing else. What I want is something at the beginning of the document that wraps them in texttt. Similar to the hyphenation command. – soze Apr 13 '12 at 18:17
  • Are you hyphenating the API names? If so, I would create a macro for each API name. For example, \newcommand{\MyMapApp}{\texttt{My\-Map\-App}} that explicitly states the hyphenation for each API name. – Werner Apr 13 '12 at 18:21
  • 1
    @soze If you have solved your problem in the meantime, please share. Otherwise try providing some examples of what you need. – egreg May 5 '12 at 21:12
  • 1
    See also Is it possible to have certain words in the document always in bold?. The question explores the similar problem of typesetting variable names in a book about a programming language. The answers explore several solutions. – Christian Lindig May 6 '12 at 9:32