[OS X TeX] help with \newcommand

Herbert Schulz herbs at wideopenwest.com
Sat Jun 5 10:15:45 EDT 2010


On Jun 5, 2010, at 9:10 AM, Ramón Figueroa-Centeno wrote:

> 
> Aloha,
> 
> I want to define a new command that will make my life a lot easier. Here is
> what I would like:
> 
> \newcommand{\foo}[1]{#1 $\#1$}
> 
> So that I could invoke it as "\foo{aleph}" I get the same as if I typed
> "aleph $\aleph$" (no backslash on the first character).
> 
> Also, much harder (I think):
> 
> a command that would do URL encoding right from within LaTeX to pass
> arguments to the hyperref package:
> 
> \newcommand{\foo2}[1]{\href{<#1 url encoded>}{#1}}
> 
> so that "\foo2{Hello you}" would yield the same as typing
> "\href{http://Hello%20you}{Hello you}"
> 
> Thanks,
> 
> Ramón

Howdy,

Try newcommand{\foo}[1]{#1 $\csname #1\endcsname$}. Not sure it's will work but...

Good Luck,

Herb Schulz
(herbs at wideopenwest dot com)






More information about the MacOSX-TeX mailing list