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

Joshua S. Hodas hodas at cs.hmc.edu
Tue Jun 18 20:59:51 CEST 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
  	                                                bar
	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:

	\newcommand{\ljuser}[2]
	{\href{http://www.livejournal.com/userinfo.bml?user=#1}{{\sf #1} (#2)}}

The problem is that if I use it as in:

	\ljuser{foo_bar}{blah}

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:

	\ljuser{foo_bar}{foo\_bar}{blah}


Josh
-- 
----------------------------------------------------------------------------
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 cs.hmc.edu
Claremont, CA 91711                     WWW :  http://www.cs.hmc.edu/~hodas/

-----------------------------------------------------------------
Threaded list archives can be found at:
<http://www.masda.vxu.se/~pku/MacOSX_TeX/>
-----------------------------------------------------------------
To UNSUBSCRIBE, send email to <info at email.esm.psu.edu> with
"unsubscribe macosx-tex" (no quotes) in the body.
For additional HELP, send email to <info at email.esm.psu.edu> with
"help" (no quotes) in the body.
-----------------------------------------------------------------




More information about the macostex-archives mailing list