[OS X TeX] Make Command with more then one parapmeter?

Ueliisa ueliisa at gmx.net
Mon Apr 25 07:18:15 EDT 2005


Thanks it is Great
but is there a place where I can learn about all this basics ?



On 25.04.2005, at 10:01, Maarten Sneep wrote:

> On 25 apr 2005, at 9:23, Ueliisa wrote:
>
>> I will expand a newcommand to use more then one parameter
>>
>> 	\newcommand {\hlink}[1]{\href{http://#1}{http://#1}}
>
> This is correct.
>
>> 	\newcommand {\mg} [1 2] {#1 
>> \glossary{name={#1},description={#2},sort=#3} }}
>> This definittion does not throw an error -- so I think it is ok?
>
> No, it isn't.
>
> \newcommand{\msg}[4][default]{definition using #1, #2, #3 and #4, with 
> the default for #1 set to `default'}
>
> in other words:
>     The first optional parameter to \newcommand is the number of 
> parameters (9 is the maximum)
>     The second optional parameter sets the default value for parameter 
> number 1. If there is no
> 	default value, just leave the second optional parameter out.
>
> usage:
>     \msg{blah}{example}{end of nonsensical garbage}
> or (if the default first parameter has to be changed):
>     \msg[special]{blah}{example}{end of nonsensical garbage}
>
>> But how I can set the next parameters
>> 	\hlink{www.myURL.com}
>
> try teh url package: it defines a \url command, which does what you 
> want, and takes care of proper line breaking.
>
>> 	\mg{MyGlos}{Dies is the description}{Sort by this}  %<<== ???
>
> Yes, with the correct definition:
>     \newcommand{\mg}[3]{%
> 	#1%
> 	\glossary{name={#1},%
> 	    description={#2},%
> 	    sort=#3}%
> 	}%
>     }
>
> (Note that I suppressed spurious spaces with comment marks)
>
> 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 MacOSX-TeX mailing list