R: [texhax] \newcommand

Herbert Gintis hgintis at comcast.net
Thu Sep 25 22:46:03 CEST 2003


At 02:04 AM 9/26/2003 +0200, Philip G. Ratcliffe wrote:
> > None of the suggestions worked for me. I don't know what is the matter
> > with
> > the code. BUT this does work:
>
>Well, I assure you they do work.
>
>Note that your
>
> > \def\mybox(#1,#2){%
>
>requires
>
> > \mybox(72,Zn)
>
>while the original
>
>\newcommand{\mybox}[2]{%
>
>requires
>
>\mybox{72}{Zn}
>
>This is the only difference.
         I can assure you that the original code gave me the same error 
message as in the original post, the suggested fixes gave various error 
messages, but the above code works properly on my system.
Here is a copy of the code that works:
\makeatletter
\def\mybox(#1,#2){%
\setlength{\unitlength}{1pt}%
\begin{picture}(\strip at pt\linewidth,#1)%
\put(0,0){\framebox(\strip at pt\linewidth,#1)[tl]{#2}}%
\end{picture}
}
\makeatother
\begin{document}
\mybox(72,Zn)
\end{document}

There are two differences, not one. The first is that the above uses the 
TeX primitive \def rather than the LaTeX \newcommand. The second is that I 
use (#1,#2), not {#1}{#2}. The latter does not work with \def. I don't know 
why.

Herb




>Cheers,  Phil

Herbert Gintis
Emeritus Professor of Economics, University of 
Massachusetts
External Faculty, Santa Fe Institute, Santa Fe, NM
15 Forbes Avenue, Northampton, MA 01060
413-586-7756  (Home Office) 206-984-9873 (Fax)
Recent papers are posted on my <http://www-unix.oit.umass.edu/~gintis>web site.
Get Game Theory Evolving (Princeton, 2000) at 
<http://www.amazon.com/exec/obidos/tg/detail/-/0691009430/qid=1057311870/sr=1-1/ref=sr_1_1/002-8882889-4632849?v=glance&s=books>Amazon.com.
New Email Address is hgintis at comcast.net
There is no sorrow so great that does not find
its background in joy.
                                                 Niels Bohr (1938)

                                  


More information about the texhax mailing list