## LaTeX forum ⇒ General ⇒ Renaming \newcommand args from #1 to a variable name

LaTeX specific issues not fitting into one of the other forums of this category.
eggmanneo
Posts: 10
Joined: Wed Apr 21, 2010 9:03 pm

### Renaming \newcommand args from #1 to a variable name

I was wondering if there was a way to replace the name of arguments in \newcommand from #1 to another variable name. For exmple, I have this latex code to write the multivariate normal CDF

`\newcommand{\mvncdf}[3]{\Phi_{#1}\left(#2\middle|#3\right)}  `

I would like to replace the #1, #2, and #3 names of the arguments to somethis else, like naming #1 "n" and #3 "\Sigma". Is there a way to do this?

Tags:

cgnieder
Site Moderator
Posts: 1985
Joined: Sat Apr 16, 2011 7:27 pm
Location: Germany
Contact:
I'm afraid I don't quite understand what you mean... can you add an example code that shows how you would like to use newcommand?

Regards
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim

hugovdberg
Posts: 133
Joined: Sat Feb 25, 2012 6:12 pm
Location: Rosmalen, Netherlands
I think I understand what you're after: using named variables in the macro definition like
`\newcommand{foo}[bar]{#bar}`

But as far as I know that's not possible, and I'm not sure why you should want it. Unless you're after optional arguments with key/value pairs, like in this post on tex.sx.
Ubuntu 13.10 + Tex Live 2013 + Texmaker / Windows 7 Pro + MikTex 2.9 + TexnicCenter / Android 4.3 + TexPortal + DroidEdit

cgnieder
Site Moderator
Posts: 1985
Joined: Sat Apr 16, 2011 7:27 pm
Location: Germany
Contact:
hugovdberg wrote:I think I understand what you're after: using named variables in the macro definition like
`\newcommand{foo}[bar]{#bar}`

But as far as I know that's not possible, and I'm not sure why you should want it.

If that is the goal: this is indeed impossible.

Regards
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim