4

I have a short description for each of my equations. I want to have them flushleft (similar to the equation numbers which are flushright). How can I do that?

Here is a MWE:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\text{this is my first equation: } z = x
\end{equation}
\begin{equation}
\text{this is my second equation: } z = x+y
\end{equation}
\end{document}

And my desired output is like this: enter image description here

1
  • 2
    Don't. Your readers will be grateful. ;-)
    – egreg
    Commented Jun 17, 2013 at 20:44

2 Answers 2

2

A regular align with some macro-involvement would obtain the desired result:

enter image description here

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\newcommand{\alignmath}[2]{\makebox[0pt][#1]{$\displaystyle#2$}}
\newcommand{\lmath}[1]{\alignmath{l}{#1}}
\newcommand{\rmath}[1]{\alignmath{r}{#1}}
\newcommand{\cmath}[1]{\alignmath{c}{#1}}
\begin{document}

\begin{align}
  & \text{this is my first equation:}  & \cmath{z=x}   & \\
  & \text{this is my second equation:} & \cmath{z=x+y} & \\
  & \text{this is my third equation:} & \lmath{z=x+y}  & \\
  & \text{this is my fourth equation:} & \rmath{z=x+y} & \\
  & \text{this is my last equation:} & z &= x+y
\end{align}
\end{document}

\cmath inserts a zero-width box that is centred. The advantage here is that you maintain the align-like vertical spacing.

I've added \lmath and \rmath for completeness, since \makebox allows for left- and right-aligned boxes. Also, the vertical rule indicates the horizontal alignment with respect to the default align - also supported in the above syntax.

0

The following example uses environment tabular* to simulate the equations and to achieve the alignment requests:

\documentclass{article}
\usepackage{amsmath}
\usepackage{array}
\begin{document}
\noindent A\hfill Z

\begin{center}
\begin{tabular*}{\linewidth}{%
  @{}l% description
  @{\extracolsep{\fill}}%
  >{$\displaystyle}c<{$}% simulate displayed equation
  >{\refstepcounter{equation}\thetag\theequation}r@{}% equation number
}
this is my first equation:& z = x &\\
this is my second equation:& z = x + y &\\
\end{tabular*}
\end{center}

\noindent A\hfill Z
\end{document}

Result

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .