2

Is it possible to align equations to "=" without merging the below equations into one environment?

\documentclass{article}
\begin{document}
Sample
\begin{equation}
a + b = c
\end{equation}

\begin{equation}
aaaa + bbbb = sss
\end{equation}

\end{document}

This is necessary because the document will be converted into XML.

For XML purpose, each equation should have unique id and citation link, for that purpose the equation have to be separated, but for PDF/DVI view, the equations should be in aligned format.

This will be done with typesetting services (Latex->PDF and XML).

CarLaTeX
  • 62,716
user52124
  • 413
  • 1
    yes, you could put the Left Hand Sides of each equation into a fixed width box with makebox, but if you could explain why you want to do this, someone might come up with a better solution. – Thruston Mar 01 '17 at 08:48
  • My problem is my client wants this equation to be in split mode but he requires equal alignment for consecutive equations, that's why i am in need of this – user52124 Mar 01 '17 at 08:51
  • Will your "client" pay for our help too! (Only joking). – Thruston Mar 01 '17 at 08:52
  • @Thruston ha ha ha :-) – user52124 Mar 01 '17 at 08:54
  • 1
    you should never have consecutive equation environments or a blank line before an equation as the spacing tex produces in those cases is all wrong, so there is no good way to have two consecutive equation environments even without aligning. – David Carlisle Mar 01 '17 at 08:56
  • What do you mean by “split mode”? If what you need is that LaTeX splits an align across pages, add \allowdisplaybreaks in the document preamble. – egreg Mar 01 '17 at 09:18
  • @egreg, what i need is without using eqalign, i have to align the equations in 2 equation environment – user52124 Mar 01 '17 at 09:25
  • @user52124 Sorry, but it's very unclear. – egreg Mar 01 '17 at 09:27
  • @egreg could you see the equation i posted above, my requirement is, i have to align those equations without using align or array environment – user52124 Mar 01 '17 at 09:35
  • 1
    @user52124: But why? – Bernard Mar 01 '17 at 09:49
  • @Bernard that is what my client is asking – user52124 Mar 01 '17 at 10:02
  • They are converting the Tex files to XML, for XML purpose, each equation should have unique id and Citation link, for that purpose they need the equation separated but for PDF/DVI view, the Equation should be in aligned format, I hope you guys knew about typesetting services (Latex->PDF and XML) – user52124 Mar 01 '17 at 10:28
  • @CarLaTeX nice one :-) – user52124 Mar 01 '17 at 10:45
  • It sounds to me like getting the XML converter to cope with align makes much more sense here. – Dai Bowen Mar 01 '17 at 10:51
  • We tried that too, but we process Latex XML Workflow for creating DVI/PDF, Process 1: Latex to XML Conversion, Process 2: Edits done in XML and then Converting it to Latex for PDF output, so in these case, Equation splitting and re merging is a pain, Is there any way to align without align environment – user52124 Mar 01 '17 at 10:54
  • If you have edits in XML then just modify the LaTeX output obtained from that XML - this can probably be quite easily done using RegEx. – Dai Bowen Mar 01 '17 at 15:06
  • 2
    It should be noted that one can also align equations using \makebox. See http://tex.stackexchange.com/questions/207797/how-to-align-two-equation-arrays-when-combined-with-lateral-braces/207839?s=54|0.0000#207839 for example. – John Kormylo Mar 01 '17 at 15:09
  • 1
    I had an approach that did something like this. See https://tex.stackexchange.com/questions/115534/align-separate-equations/115549#115549, and https://tex.stackexchange.com/questions/122069/align-all-equal-signs-in-the-document/131140#131140 – Steven B. Segletes Sep 21 '17 at 12:36

1 Answers1

1

This is just an implementation of the suggestion in Thruston's first comment (Mar 1) to OP, aligning the = signs in the center, and assuming no side of any equation is longer than 2in. Of course these can easily be adjusted.

A much more complete solution by Steven Segletes (allowing changing of the aligning throughout the document) is linked in his Sep 21 comment (also to OP). One of those links is marked as a duplicate, but Steven's answer (not the selected one) is not a duplicate.

It seems that OP may be looking for a simple solution, but I don't want to give the appearance of using someone else's answer as my own. If this is inappropriate, let me know and I'll delete this answer. (Still relatively new to TeX.SX).

enter image description here

Code is here:

\documentclass{article}

\newcommand{\aligneq}[2]{\makebox[2in][r]{#1}=\makebox[2in][l]{#2}}

\begin{document}
Sample
\begin{equation}
\aligneq{a+b}{c}
\end{equation}
\begin{equation}
\aligneq{aaaa + bbbb}{sss}
\end{equation}

\end{document}
Sandy G
  • 42,558