3
\begin{flalign}
  x &= 4^2 - 1\\
  &= 16 - 1\\
  &= 15&
\end{flalign}

The code above would result in (1) to the right of x = 4^2 - 1, and so on for each line.

I want to put normal words next to the (1), (2), etc..

So hypothetically, something like this:

\begin{flalign}
  x &= 4^2 - 1 \someFunction{given}\\
  &= 16 - 1 \someFunction{exponent}\\
  &= 15 \someFunction{substraction}&
\end{flalign}
onepiece
  • 133
  • \tag{by reflexive property}? But that's not the intended use… – Manuel Feb 23 '15 at 23:47
  • Do you want to keep the number or to replace it? If the later, you can use \begin{equation}a=a \tag{text here}\end{equation}. – Sigur Feb 23 '15 at 23:47
  • @Sigur Keep the number, if possible. I realized I had flalign* in my original edit, I removed the asterisk. And how would I use flalign for several equations in this format? – onepiece Feb 23 '15 at 23:56
  • Do you want the next flushed near the number? Or could it be in front of the formula? – Sigur Feb 24 '15 at 00:02
  • @Sigur I've edited the code to show my intended usage. – onepiece Feb 24 '15 at 00:23
  • Is this what you want? http://tex.stackexchange.com/questions/173970/add-equation-name-besides-equation-number-so-that-eqref-inserts-only-the-numbe or maybe http://tex.stackexchange.com/questions/167460/how-to-place-text-flushed-right-in-math-mode-next-to-equation-number or for labels on the left: http://tex.stackexchange.com/questions/159800/how-to-put-a-text-label-before-an-equation – Steven B. Segletes Feb 24 '15 at 00:24
  • Why flalign? It should be used rarely. Use align instead, the first line can be x&=4^2-1 &&\text{given} \\ – egreg Feb 24 '15 at 00:25
  • @egreg, few seconds faster... lol – Sigur Feb 24 '15 at 00:27
  • @egreg thanks that solved it. Why should flalign be rarely used? I believe it is just the flush left version of align. – onepiece Feb 24 '15 at 00:51

2 Answers2

4

I would never use flalign for the reasons explained below; take your pick.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\section{Bad example with \texttt{flalign}}

This is bad because the tags are too far away from the equations
\begin{flalign}
&&  x &= 4^{2} - 1 && \text{given}\\
&&    &= 16 - 1    && \text{exponent}\\
&&    &= 15        && \text{subtraction}
\end{flalign}

\section{Better example with \texttt{align}}

This is better because the tags are not mingled with the
equation number
\begin{align}
x &= 4^{2} - 1 && \text{given}\\
  &= 16 - 1    && \text{exponent}\\
  &= 15        && \text{subtraction}
\end{align}

\section{Even better example with \texttt{alignat}}

Here we set the tags nearer to the equations, which is
where they belong
\begin{alignat}{2}
x &= 4^{2} - 1 && \qquad\text{(given)}\\
  &= 16 - 1    && \qquad\text{(exponent)}\\
  &= 15        && \qquad\text{(subtraction)}
\end{alignat}

\end{document}

enter image description here

egreg
  • 1,121,712
2

Here are two variants: the first one places the central group of equations taking into account the width of the text next to the equation number, the second puts the text in a box of zero width, and looks more as an align environment, with no text:

\documentclass[12pt,a4paper,twoside]{article}
\usepackage[utf8]{inputenc}
\usepackage[showframe, nomarginpar]{geometry}
\usepackage{amsmath}

\begin{document}

\begin{flalign}
  & & x &= 4^2 - 1 & \text{given}\\
  & & &= 16 - 1 & \text{exponent}\\
  & & &= 15 & \text{substraction}
\end{flalign}

\begin{flalign}
  & & x &= 4^2 - 1 & \llap{given}\\
  & & &= 16 - 1 & \llap{exponent}\\
  & & &= 15 & \llap{substraction}
\end{flalign}

\begin{align}
   x &= 4^2 - 1 \\
   &= 16 - 1 \\
   &= 15 
\end{align}

\end{document} 

enter image description here

Bernard
  • 271,350