[OS X TeX] ifthenelse and an empty value

Maarten Sneep maarten.sneep at xs4all.nl
Tue Apr 26 18:36:23 EDT 2005

On 26 apr 2005, at 21:59, Ueliisa wrote:

> 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  ...???

try this simple example:

\newcommand{\mycommand}[2][default value]{the first parameter: ``#1'' 
and the second parameter: ``#2''}


\mycommand[optional test]{more test}


I hope this makes it clear how to handleoptional parameters. While it 
is possible to handle optional parameters at the end of the parameter 
list, it isn't easy, and would strongly recommend you don't try it.

> Can you help my again - hat I missunderstand?

The references mailed to the list yesterday contain all this material, 
and were written over a much longer time than anything

> \newcommand{\myacronym}[4][]{%
>     \ifthenelse{\equal{#1}{}}%
>     {\newacronym{#2}{#3}{name=#3~(#2),description=#4}}%
>     {\newacronym[#4]{#4}{#1}{#2}{name=#2~(#1),description=#3}}%
> }

Wrong, wrong: the [4] in \newcommand{\blah}[4]{...} indicates already 
that there are four parameters, no argument list as in many other 
programming languages. When _using_ the command, you have to specify 
the argument (obviously). I hope this remark, together with the sample 
will help you enough, because I can't really figure out from this code 
what you want to do.


--------------------- 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 MacOSX-TeX mailing list