Centering display equations with org-latex-preview?
Asked Answered
S

1

6

For some reason, org-mode is left-aligning my display equations when I run org-latex-preview (C-c C-x C-l). But the margin between each equation and its equation number is calculated, as if the equation was centered, which ruins the alignment between the equation numbers.

Is it possible to turn on Centering for displayed equations, so that the equation numbers line up (like with AUCTeX)?

Here is a sample .org document with display equations:

A numbered display equation:

\begin{equation}
\frac{\partial u}{\partial t}-\alpha\nabla^2u=0\tag{1}
\end{equation}

A second numbered equation:

\begin{equation}
E=MC^2\tag{2}
\end{equation}

And here is a screenshot of org-mode after running org-latex-preview:

enter image description here

Sheehan answered 29/9, 2014 at 19:19 Comment(0)
S
4

It looks like the alignment can be altered by editing org-format-latex-header.

Here are three different configurations:

  1. Equations on the left: \documentclass[reqno]{article}

enter image description here

  1. Equations on the right: \documentclass[leqno]{article}

enter image description here

  1. Equations justified: \documentclass[fleqn]{article}

enter image description here

So option (2) actually centers display equations. But only if they are numbered! Option (3) probably looks the cleanest, with equations on the left and numbers aligned on the right. And option (1) for some reason refuses to center...??

I notice however, that enabling Clean Mode M-x org-indent-mode throws everything off. Here we can see how the alignment of the equation numbers in option (3) changes:

enter image description here

It would be great if someone could explain why option (1) does not center and why the unnumbered equations in (2) remain left-aligned... Maybe someone else can offer some eLisp to adjust things for org-indent-mode...?

Best,

-Adam

Sheehan answered 10/10, 2014 at 7:43 Comment(2)
Just wanted to follow up on your question @Adam. Were you able to figure out what is going on here and what was your final solution? thanks!Fuegian
Hi @Fuegian - the only way I was able to deal with this is to place the equation numbers on the left. But John Kitchin has a script that addresses this.Sheehan

© 2022 - 2024 — McMap. All rights reserved.