[OS X TeX] eqnarray and \def statements

Maarten Sneep maarten.sneep at xs4all.nl
Thu Sep 16 07:57:21 EDT 2004


On 16 sep 2004, at 13:36, Sylvan Jacques wrote:

> I am using a new eqnarray command someone has provided, and
> am reading in "A Not so Short Intro" on how to do this.

Don't try to mess with eqnarray yourself. Use the amsmath package,
it gives much better spacing, and are better documented.

See
     ftp://ftp.tex.ac.uk/tex-archive/info/math/voss/
for a free overview of mathematical typesetting.

> The file I want to implement starts with
>
> \makeatletter
>
> \def\eqnalign{%
>    \stepcounter{equation}%
>    \def\@currentlabel{\p at equation\theequation}%

don't use \def, unless you _really_ understand what it does. The book 
by Lamport (the original author of LaTeX) has the following qoute: 
"Macho TeX programmers sometimes remove the braces around the first 
argument of \newcommand; don't do it yourself.", followed by: "Macho 
TeX programmers also use the TeX command \def to define commands; don't 
you do it."

So, try to get hold of the original author of that piece of TeX code 
and ask him/her to explain the lot to you.

> and has several \def\name  lines, which I take
> to be the new commands.

Sort of, but dangerous versions...

> Reading further, I see that "Not so Short..." talks of
> \newcommand, but I can't find \def, even in the index.

For good reason, if you're starting in LaTeX (you are reading the 
introduction, so I guess you are starting afresh...) you shouldn't be 
using \def. \newcommand and \renewcommand can do the same, but they do 
it with sanity checks. \def has too many opportunities to shoot 
yourself in the foot.

> I am using TexShop, and my first question is, should I try
> to modify my tetex files,

No, never.

> or keep this as some kind of
> macro in TexShop (which I prefer if possible).

yes. The \makeatletter, tells me that this fragment is supposed to be 
used in the preamble of you document.

> On installing packages, I read that I must run latex on the
> .ins file and extract a .sty file.
>
> Is that necessary? Can't I just creat a macro in TexShop?

keep you macros straight!

- macro in texshop might mean an applescript to do something.
- macro in tex is what you do with \newcommand & friends.

just open the .ins file and run tex on it (tex or latex, either will 
work). The result is not a typeset document, but a prepared .sty file 
for use with latex. you can load the macros (tex sense) in the document 
by using the \usepackage{package} (where package.sty is produced). 
There are many older posts on where to install the .sty files 
(~/Library/texmf/tex/latex/.... should work, ~ is your home directory), 
but for testing purposes, you can leave them next to the .tex file in 
which you use them.

HTMH

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>





More information about the MacOSX-TeX mailing list