[texhax] \newcommand

Barbara Beeton bnb at ams.org
Thu Sep 25 18:19:02 CEST 2003


the \makeatletter ... \makeatother convention is automatically
taken care of in a .sty file called with \usepackage.

the \makeatletter ... \makeatother is only needed if that style
wrapper isn't provided, such as in a preamble.
							-- bb

---------- Forwarded message ----------
Date: Thu, 25 Sep 2003 15:21:30 -0500
From: Phil Parker <phil at math.twsu.edu>
To: texhax at tug.org
Subject: re: [texhax] \newcommand


On 09/25/2003 at 03:42 PM, Barbara Beeton <bnb at ams.org> wrote:

>control sequences containing @ signs are "internal" ones,
>and must be given special attention.  the fix, fortunately,
>is simple.  two possibilities:

> - put your new command in a file named whatever.sty and
>   then \usepackage{whatever}

> - leave the definition in the preamble of your document
>   and surround it by the commands
>     \makeatletter
>     ...
>     \makeatother

in reference to the following command which does not work as-is in a
preamble.

>\newcommand{\mybox}[2]{%
>  \setlength{\unitlength}{1pt}
>  \makeatletter
>  \begin{picture}(\strip at pt\linewidth,#1)
>    \put(0,0){\framebox(\strip at pt\linewidth,#1)[tl]{#2}}
>  \end{picture}
>  \makeatother}

If the entire thing is enclosed in \makeatletter...\makeatother (or
equivalently put in a style file), then the \makeatletter...\makeatother
inside the command (lines 3 and 7 above) is not necessary, correct?

-- 
    Phil Parker
--------------------------------------------
URL http://www.math.twsu.edu/Faculty/Parker/
Random quote:
  Don't be humble; you're not that great.---Golda Meir


More information about the texhax mailing list