Math & ScienceCentering equations in equation arrays ?

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
ankhi
Posts: 32
Joined: Sun Aug 26, 2012 6:07 pm

Centering equations in equation arrays ?

Post by ankhi »

cgnieder wrote:
localghost wrote:It is their job to correct that and to provide a template that uses modern LaTeX.
While I agree in general I think we should also try to deal with such problems.

AGU are not the only ones to demand older (La)TeX. Springer is also known to demand {eqnarray}, for example. Other journals demand that you don't use e-TeX, let alone biblatex. I remember having read comments from Barbara Beaton (responsible for AMS typesetting and the ams classes and packages) explaining why it is not a simple task for them to switch to a modern system (but couldn't find it any more, unfortunately :( ). So all in all it repeatedly is a problem for users having to deal with such demands.

Thus my question/request to ankhi: the »AGUTeX« class is no standard class so it is not available to us. Maybe you can attach it to forum in your next post?

Regards
Thanks for the understanding....
I have other problems with this class also.... should I open a new thread about it?
I wouldnt mind attaching but I dont know how to attach files here... :shock:

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Re: Centering equations in equation arrays ?

Post by Stefan Kottwitz »

Hi ankhi,

have a look below the text edit field, when writing a post, there's an "Upload attachment" link which you can click.

Stefan
LaTeX.org admin
ankhi
Posts: 32
Joined: Sun Aug 26, 2012 6:07 pm

Re: Centering equations in equation arrays ?

Post by ankhi »

ok.... here we go.. :)
Attachments
agutmpl.tex
(17.1 KiB) Downloaded 342 times
agutex.cls
(219.21 KiB) Downloaded 362 times
agu-ps.sty
(30.72 KiB) Downloaded 335 times
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Centering equations in equation arrays ?

Post by cgnieder »

First of all: the behaviour of the {eqnarray} environment in this class is deliberate. If you're writing an article for submission to one of their journals you should not bother with the layout at all. That's the job of the journal editors, anyway.

The definition they use is not LaTeX's default definition. Looking into the class file you posted you find

Code: Select all

%% variation on code taken from fleqn.clo
\def\eqnarray{%
\let\label\ylabel
    \def\@currentlabel{\p@equation\theequation}%
    \global\@eqnswtrue\m@th
    ...
which means they want this layout!

However, it is possible to get LaTeX's default again by copying the definition of {eqnarray} from latex.tlx (the LaTeX kernel), slightly modified:

Code: Select all

\documentclass[jgrga]{agutex}
\lefthead{Albert Author}
\righthead{Awesome Title}
\usepackage{lipsum}

\usepackage{etoolbox}
\makeatletter
\def\eqnarray{%
   \let\label\ylabel
   \def\@currentlabel{\p@equation\theequation}%
   \global\@eqnswtrue
   \m@th
   \global\@eqcnt\z@
   \tabskip\@centering
   \let\\\@eqncr
   $$\everycr{}\halign to\displaywidth\bgroup
       \hskip\@centering$\displaystyle\tabskip\z@skip{##}$\@eqnsel
      &\global\@eqcnt\@ne\hskip \tw@\arraycolsep \hfil${##}$\hfil
      &\global\@eqcnt\tw@ \hskip \tw@\arraycolsep
         $\displaystyle{##}$\hfil\tabskip\@centering
      &\global\@eqcnt\thr@@ \hb@xt@\z@\bgroup\hss##\egroup
         \tabskip\z@skip
      \cr
}
\makeatother

\begin{document}

\lipsum[1]

\begin{eqnarray}
  x_{1} & = & (x - x_{0}) \cos \Theta \nonumber \\
        && + (y - y_{0}) \sin \Theta  \nonumber \\
  y_{1} & = & -(x - x_{0}) \sin \Theta \nonumber \\
        && + (y - y_{0}) \cos \Theta.
\end{eqnarray}

\lipsum[2]

\end{document}
Regards
site moderator & package author
ankhi
Posts: 32
Joined: Sun Aug 26, 2012 6:07 pm

Centering equations in equation arrays ?

Post by ankhi »

Thanks a lot :D... I found that they have a option aguleftmath to make all equations left aligned. Served my aesthetic sense. I have another question but making separate thread for that.
Post Reply