[OS X TeX] ifthenelse and an empty value
Ueliisa
ueliisa at gmx.net
Tue Apr 26 21:59:54 CEST 2005
Thanks Maarten
I quickly tried your tip. But it works only with 3 parameters. I tried
change parameter araoun and set the 4. as first or last ...???
Can you help my again - hat I missunderstand?
\newcommand{\myacronym}[4][]{%
\ifthenelse{\equal{#1}{}}%
{\newacronym{#2}{#3}{name=#3~(#2),description=#4}}%
{\newacronym[#4]{#4}{#1}{#2}{name=#2~(#1),description=#3}}%
}
OR
\newcommand{\myacronym}[4][]{%
\ifthenelse{\equal{#1}{}}%
{\newacronym{#2}{#3}{name=#3~(#2),description=#4}}%
{\newacronym[#1]{#1}{#2}{#3}{name=#3~(#2),description=#2}}%
}
\myacronym{cmd}{ABC}{Alphanummeric}{TEST TEST TEST}
\myacronym{ABC}{Alphanummeric}{TEST TEST TEST}{cmd}
ueliisa
On 26.04.2005, at 18:14, Maarten Sneep wrote:
> On 26 apr 2005, at 16:54, Ueliisa wrote:
>
>> I try to make an \newcommand that could have 3 or 4 parameters.
>> With \ifthenelse I want check about is the 4. value set or not an
>> then use another command set:
>>
>> \newcommand{\newcmd}[4]{\ifthenelse{#4={}}{#1 - #2 - #3}{#1 - #2 - #3
>> - #4}
>
> Better use the optional parameter as discussed before:
>
> \newcommand{\newcmd}[4][]{%
> \ifthenelse{\equal{#1}{}}%
> {#2 - #3 - #4}%
> {#1 - #2 - #3 - #4}%
> }
>
> Note that the first parameter is what you called as #4, and if
> present, must be placed between square brackets:
>
> \newcmd[param4]{param 1}{param 2}{param 3}{param 4} or if param 4
> isn't given: \newcmd{param 1}{param 2}{param 3}. Note that the
> parameters shift!
>
> Maarten
>
> --------------------- Info ---------------------
> Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
> & FAQ: http://latex.yauh.de/faq/
> TeX FAQ: http://www.tex.ac.uk/faq
> List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>
>
>
--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
& FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>
More information about the macostex-archives
mailing list