# [OS X TeX] help with \newcommand

Yan Zhou zhouyan1014 at gmail.com
Sat Jun 5 16:22:15 CEST 2010

The first problem can be solved using \csname#1\endcsname

i have little idea about the second as i don't know how to "encode" url

-----Original Message-----
From: Ramón Figueroa-Centeno
Sent:  05/06/2010 15:10:39
Subject:  [OS X TeX] help with \newcommand

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
--
View this message in context: http://macosx-tex.576846.n2.nabble.com/help-with-newcommand-tp5142889p5142889.html
Sent from the MacOSX-TeX mailing list archive at Nabble.com.
----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: http://email.esm.psu.edu/mac-tex/
List Archive: http://tug.org/pipermail/macostex-archives/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: http://email.esm.psu.edu/mailman/listinfo/macosx-tex