## LaTeX forum ⇒ Text Formatting ⇒ Restore Centering for Equations in custom Class

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
BinaryBen
Posts: 15
Joined: Mon Feb 18, 2013 8:54 pm

### Restore Centering for Equations in custom Class

Hi,

I've got a template, and in the class file (*.cls) it has:
\AtBeginDocument{\@ifpackageloaded{amsmath}{\@mathmargin\z@}{}}%

I want to override this and restore equation centering -
I can do:
\makeatletter\setlength{\@mathmargin}{50pt}\makeatother

Which indents it - however, online it says the default is \@centering. I've tried this.
\makeatletter\setlength{\@mathmargin}{\@centering}\makeatother

Although, this seems to do nothing - still fully left aligned.

Am I missing something? Can I restore equation centering?

Thanks,
Last edited by Stefan Kottwitz on Thu Feb 21, 2013 5:29 pm, edited 1 time in total.

Tags:

kaiserkarl13
Posts: 593
Joined: Tue Mar 25, 2008 5:02 pm
The following code does not reproduce your problem:
\documentclass{article}\usepackage{amsmath} \makeatletter\AtBeginDocument{\@ifpackageloaded{amsmath}{\@mathmargin\z@}{}}%\makeatother \begin{document}\begin{equation}    a x^2 + bx + c = 0\end{equation}\end{document}

It is something else in the document class that is determining this behavior. Please post a minimal working example to proceed further. Even the name of the document class you're using (or even the name of the class it is based on, if there is such a thing) would help.

BinaryBen
Posts: 15
Joined: Mon Feb 18, 2013 8:54 pm
My example is using the svjour3 class, e.g.:

\documentclass[twocolumn]{svjour3}

which contains the command:
\AtBeginDocument{\@ifpackageloaded{amsmath}{\@mathmargin\z@}{}}%

Thanx

Ben
Last edited by cgnieder on Sun Feb 24, 2013 10:19 pm, edited 1 time in total.

svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am
Where is the minimal working example as kaiserkarl13 asked for?
In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)

cgnieder
Site Moderator
Posts: 1988
Joined: Sat Apr 16, 2011 7:27 pm
Hi.

svjour3 is not a standard class and is for example not part of a TeX Live installation. It would be very helpful if you could do two things:
2. adapt kaiserkarl's MWE (minimal working example) to one that shows the unwanted behaviour so we can immediately reproduce the issue.
If you do these things I'm confident an answer can be found.

Regards
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim

Stefan Kottwitz
Posts: 8882
Joined: Mon Mar 10, 2008 9:44 pm
Hi Ben,

when I tested it, also with svjour3 the problem doesn't happen. So there's something in your code which you did not show. Please have a look at the web site Karl and Svend linked to, to learn why a minimal example is important and nearly a guarantee for getting a solution.

Stefan

jhargis
Posts: 2
Joined: Wed Feb 26, 2014 12:55 am
I'm having the same problem and came upon this thread. My minimum working example is as follows:

\documentclass[twocolumn]{svjour3}\usepackage{amsmath} \makeatletter\AtBeginDocument{\@ifpackageloaded{amsmath}{\@mathmargin\z@}{}}%\makeatother \begin{document}\begin{equation}6x=2\end{equation}\end{document}

After doing this, I too can't get the equation to be centered. The equation centers fine if in single column mode, but not in two column mode. Any thoughts?
Last edited by cgnieder on Wed Feb 26, 2014 1:07 am, edited 1 time in total.
Reason: changed code markup from inline to block

jhargis
Posts: 2
Joined: Wed Feb 26, 2014 12:55 am
Actually, I also just found the solution (well, sort of). I went into the svjour3 cls file and found where the equations in two column mode are default set "fleqn" (line 42 of the code I believe). Just delete the "fleqn" inside the curly brackets , {}, and you'll get centered equations. Again, this is in the svjour3 style file itself that this must be done.

Good luck...

mandrake
Posts: 1
Joined: Tue Jan 20, 2015 3:19 pm
I got the same issue with equation environment. In two-column document it does not center properly, in one-column document it stays fine. Deleting 'fleqn' from line #42 in svjour3.cls helps, thank you. Do you have any idea whether this can be solved within the source .tex? It is not a problem if I compile the document myself with my own svjour3.cls, but if the journal administration does it, I won't be sure whether they will use svjour3.cls with 'fleqn' removed. I will contact the publisher on this but I'm not sure how fast they will respond on such request.

Johannes_B
Site Moderator
Posts: 3763
Joined: Thu Nov 01, 2012 4:08 pm
This is a journal you are tallking about, every article in that journal is suppossed to have a uniform look, so i don't think they will be open for discussion.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.