D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Latex Again

 

> ./latex-1.tex:54:Missing $ inserted. {^
> ./latex-1.tex:54:Undefined control sequence. {^{33}_{17}Cl^{16}\ghtarrow
> ./latex-1.tex:54:Extra }, or forgotten $.
> ...ghtarrow{n,n}~^{31}_{15}P^{16 }+~^4_2He^2}

This means that, apart from what I suggested, you will also need to
put $'s around the formula. It is in math mode, after all (otherwise
exponents won't work).

LaTeX is semi-fool proof: if the syntax isn't 100% correct, the
interpreter will give an error. But if you press enter for every error
(or 'r' once), it will 'guess' what you could have meant and try to
output a reasonably looking document. In cases as yours, it will
probably output what you wanted in the first place. Of course it's bad
practise to use this as an excuse to ignore the warnings, but if I'd
got a penny for every time I saw someone use LaTeX that way, I'd be
rich by now...

You might the following command useful, that I just found on the net.
Include it in the header of your document (or, if you've written one,
in your own package file) :

\newcommand{\chem}[1]{}\ensuremath{mathrm{#1}}

Now you can write
\chem{yourlongformulahere}
and:
- it ensures you are in math mode, so the interpreter won't complain
about those $'s any longer
- it will still print the letters in normal text, rather than italic
which is the default for mathematical symbols (but unwanted for names
of chemical elements)

You'll still need those \mbox{}'s though.

Martijn.

-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html