8

I have a string of equations, each with a label that I would like to format nicely. I want the equation labels to be at the same horizontal position and the start of the equation to be at the same horizontal location. Additionally, I want each equation to have a label.

There seem to be a large number of ways this could be done, but I can't get anything to work correctly. A tabbing seems to not work with equations. Also tried putting the equation in a \vbox with tabbing, but that kills the formatting.

Example:

      Label:           Equation
      Longer label:    Equation
      Lab:             Equation

What I'm working with

%+++++++++++
\begin{equation}
\label{e:failuniaxlocal}
Uniaxial Local Buckling: MOS=\frac{\sigma_Y}{\sigma}-1
\end{equation}
%+++++++++++


%+++++++++++
\begin{equation}
\label{e:failuniaxlocal}
Uniaxial Local Buckling:
\end{equation}
%+++++++++++

%+++++++++++
\begin{equation}
\label{e:failshearlocal}
Shear Local Buckling:
\end{equation}
%+++++++++++

%+++++++++++
\begin{equation}
\label{e:failinterlocal}
Uniaxial-Shear Interaction:
\end{equation}
%+++++++++++

%+++++++++++
\begin{equation}
\label{e:failstffbck}
Stiffener buckling: MOS=\frac{pi^2 H_{22}}{P L^2}-1
\end{equation}
%+++++++++++

enter code here
Werner
  • 603,163
August
  • 153
  • Do you want equations to be numbered? –  Feb 27 '14 at 00:35
  • If you want them numbered then this http://tex.stackexchange.com/questions/159800/how-to-put-a-text-label-before-an-equation/159803#159803 can help. And since you say you want labels, I think it is a pretty good assumption that you want them numbered (or else, what will you \ref?) – Steven B. Segletes Feb 27 '14 at 00:49

2 Answers2

7

If you're going to spread out the content with some paragraphs between them, then you could surely use a construction like the one below:

enter image description here

\documentclass{article}%
\newcommand{\labeleqn}[3][150pt]{%
  \makebox[0pt]{\makebox[\linewidth][l]{#2}}% Set label
  \makebox[0pt]{\makebox[\linewidth][l]{\hspace*{#1}$\displaystyle#3$}}}% Set equation

\begin{document}

%+++++++++++
\begin{equation}
\labeleqn{Uniaxial Local Buckling:}{MOS = \frac{\sigma_Y}{\sigma} - 1}
\label{e:failuniaxlocal}
\end{equation}
%+++++++++++

%+++++++++++
\begin{equation}
\labeleqn{Shear Local Buckling:}{f(x)=ax^2 + bx + c}
\label{e:failshearlocal}
\end{equation}
%+++++++++++

%+++++++++++
\begin{equation}
\labeleqn{Uniaxial-Shear Interaction:}{e = mc^2}
\label{e:failinterlocal}
\end{equation}
%+++++++++++

%+++++++++++
\begin{equation}
\labeleqn{Stiffener buckling:}{MOS=\frac{\pi^2 H_{22}}{P L^2} - 1}
\label{e:failstffbck}
\end{equation}
%+++++++++++

\end{document}

\labeleqn[<width>]{<label>}{<eqn>} sets <eqn> starting <width> (default is 150pt) from the left margin while also adding <label> flush with the left margin.

Alternatively one can use amsmath's align environment to align the equations at the =.

Werner
  • 603,163
  • Thanks, this works well. I did try amsmath align, but was having trouble getting it to work with the equation numbering. – August Feb 27 '14 at 02:42
5

Another solution using alignat:

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{alignat}{2}
&\text{Uniaxial Local Buckling:}     &\qquad &MOS=\frac{\sigma_Y}{\sigma}-1   \label{e:failuniaxlocal}\\
&\text{Shear Local Buckling:}        &       &MOS=\frac{1}{2}                 \label{e:failshearlocal}\\
&\text{Uniaxial-Shear Interaction:}  &       &MOS=\frac{1}{4}                 \label{e:failinterlocal}\\
&\text{Stiffener buckling:}          &       &MOS=\frac{pi^2 H_{22}}{P L^2}-1 \label{e:failstffbck}
\end{alignat}

\end{document} 

enter image description here

karlkoeller
  • 124,410
  • Interesting, I attempted this, but it must have conflicted with other settings in my document. The equation numbers don't show up in my document. – August Feb 27 '14 at 16:46
  • @August you have probably used alignat* (starred version) instead of alignat – karlkoeller Feb 27 '14 at 17:50