[OS X TeX] macros with \

Herb Schulz herbs at wideopenwest.com
Tue Jan 18 08:35:05 EST 2005

On 1/17/05 10:29 PM, "John Burt" <burt at brandeis.edu> wrote:

> I'm trying something that should be simple, and in fact it's something I
> used to do all the time in version 7. I just want to make a macro to
> insert a LaTeX command into the text. I find that the macro keeps
> interpreting the \ character as something else. How do I get \ into a macro?
> John


I'm assuming you're using LaTeX. The command is \textbackslash. You can do

\newcommand{\cmd}[1]{\texttt{\textbackslash #1}}

to get it into the typewriter font, etc. If I've got a short command I
simply use \verb|\command| in-line but that doesn't work in footnotes, etc.,
although a \protect might help it there. It also puts things into a box so
it won't break between lines. Another way is to use the url package and then
\url{\command(s)} works nicely and breaks at line ends.

Good Luck,

Herb Schulz
(herbs at wideopenwest.com)

--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>

More information about the MacOSX-TeX mailing list