Problem with \_ in hyperref. Was Re: [OS X TeX] Verbatim mode question...

Joshua S. Hodas hodas at
Tue Jun 18 14:59:51 EDT 2002

>>Most special characters can be obtained by simple macros:
>>  \$ \@ \_ \% \&   ( \^{} \~{} are not quite right )

This leads me to a problem I have run into in the last couple of days.

The \href macro from the hyperref package somehow manages to accept a 
first argument that contain the _ character. (How does it do that?) 
It does NOT like arguments that contain the escaped form \_, and 
generates the following error:

	Undefined control sequence.
	<argument> ...hrule width.3em}\OT1\textunderscore
	l.59 \href{foo\_bar}{blah}

Unfortunately, I want to call \href from within my own macro:

If I try to use \_ in an \href (from the hyperref package) as in:

	{\href{}{{\sf #1} (#2)}}

The problem is that if I use it as in:


the \sf does NOT like the unescaped underscore.

Is there a way for me to deal with this without a kludge like having 
to give it 3 arguments, with 2 of them being the same except for how 
underscores are given, as in:


Josh Hodas / Associate Professor        Office Phone: (909) 621-8650
Director, Computer Science Clinic       Clinic Sec'y: (909) 607-8379
Computer Science / Harvey Mudd College  Home Phone:   (909) 625-1179
1250 North Dartmouth Avenue             E-Mail:       hodas at
Claremont, CA 91711                     WWW :

Threaded list archives can be found at:
To UNSUBSCRIBE, send email to <info at> with
"unsubscribe macosx-tex" (no quotes) in the body.
For additional HELP, send email to <info at> with
"help" (no quotes) in the body.

More information about the MacOSX-TeX mailing list