1

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.

Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036
  • 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. – blahblahblahdev 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
  • When they are too long, yes. That looks awful in the long run. I will have more than a dozen separate commands and it does not make it much better for me. I want something more elegant than that. Think the way glossaries work, that might be a good example. Every acronym gets referenced. – blahblahblahdev Apr 13 '12 at 18:27
  • 1
    @soze If you have solved your problem in the meantime, please share. Otherwise try providing some examples of what you need. – egreg May 05 '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 06 '12 at 09:32
  • With no clear example, this is 'too localized' I think. Ask for reopening if a nice clear demo can be given. – Joseph Wright Aug 06 '12 at 09:23

0 Answers0