6

I have a chain of equations in AMS align environment in LyX, and I want to cite numbered equations as justification for some of my steps in the chain (see the picture).enter image description here

I don't know if there's a standard way to do this. My current method is to introduce horizontal space and then to cite the reasoning to the right. However, when I do this the displayed chain is pushed to the left (hence no longer centered) and the amount of horizontal spacing needed changes dramatically. Is there a uniform way to justify steps on the right of the chain while keeping the chain centered? If there's a more standard way to justify steps in a chain, I'm open to suggestions. Thanks in advance.

MWE:

\documentclass[english,reqno]{amsart}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{amstext}
\usepackage{amsthm}
\usepackage{setspace}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\numberwithin{figure}{section}

\makeatother

\usepackage{babel}
\begin{document}
\begin{singlespace}
\begin{align*}
A= & B\\
= & C\qquad\qquad\text{by \ensuremath{\left(3\right)}}
\end{align*}
\end{singlespace}
  • If you want them to line up, just add another & and lose the quads. – John Kormylo Dec 15 '15 at 22:50
  • @JohnKormylo How do I enter a new one? When I use AMS align environment, it only gives 2 columns. – The Substitute Dec 15 '15 at 22:54
3

In LyX, enter display math mode (Ctrl+Shift+M), and then right click on the region to select AMS align environment. You'll see

enter image description here

At the bottom of the screen, you should see

enter image description here

Click on the circled icon to add a column to the right. You can then write your justification in that third column as in

enter image description here

Note that this will right-aligned the justifications

enter image description here

If you want the justifications to be left-aligned, simply add a fourth column, and write your justifications there (and leave the third one blank).

enter image description here

The output will be

enter image description here

  • Is there a way to do this so that the equalities are centered? – The Substitute Dec 16 '15 at 4:21
  • @TheSubstitute: A dirty trick is to add two columns to the left of A and C (so you have six columns in total, with the first two being empty). But I don't know if this is necessarily more aesthetically pleasing... – Herr K. Dec 16 '15 at 4:57
  • Does LyX really insert =&? If so it's a big mistake, because it should be &=. – egreg Dec 16 '15 at 21:59
  • @egreg: I think in the code the OP posted, he entered = in the first column, that's why you see =& in the underlying code. He should have put the = sign in the second column, which I do in my example. You can the spacing in my output is correct. – Herr K. Dec 16 '15 at 22:08
2

Every other & is assumed to start a new equation, so will have a much larger gap. It doesn't look so bad if the equation is longer.

\documentclass[english,reqno]{amsart}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{amstext}
\usepackage{amsthm}
\usepackage{setspace}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\numberwithin{figure}{section}

\makeatother

\usepackage{babel}
\begin{document}
\begin{singlespace}
\begin{align*}
A &= B\\
 &= C  &&\text{by \ensuremath{\left(3\right)}}
\end{align*}
\end{singlespace}
\end{document}
  • I am using LyX. I don't what sequence of steps I need to do in order to get your source code. – The Substitute Dec 15 '15 at 23:35
0

Try the alignat environment from AMSmath.

For example:

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{alignat*}{2}
     A=&B && \\
    =&C&&\textrm{ by (3)}\\
    \hphantom{\textrm{ by (6)}}\hspace{1cm}=&\sqrt{\frac{D+D^2}{E}}\hspace{1cm}&&\textrm{ by (6)}
\end{alignat*}

\end{document}

You can make any number of aligned columns, aligned right where the last one left off. If you want to reposition, just add horizontal space (or negative horizontal space) right after the single longest line on the previous column. To center the first column, simply place horizontal space before the first alignment tab equal to the space before and after the second alignment tab.

Credit: Multiple alignment -- I didn't even know how to answer this question when I saw it. I just got lucky browsing stackexchange on an unrelated matter.

Here is the output of my LaTeX

Another centering option: if you are worried about centering something complicated, you can use \textrm{\put(x,y){text}} on each justification, with y=0 and x an appropriate positive size (experiment). This will push them off to the right and keep the main equation centered. In that case, alignat isn't actually necessary.

  • I'm not quite sure where I can put \textrm{\put(x,y){text}} in LyX. I try to enter it in ERT, but that doesn't seem to work while in math mode. – The Substitute Dec 16 '15 at 2:32
  • The other solution should work, I believe. I recently edited a new centering method into my solution where I simply insert space before the first alignment tab. Google indicates that you can do hphantom and alignat. Does that work for you? – Zorgoth Dec 16 '15 at 2:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.