Multiline text in multiline equation

I have an assignment to copy the picture below in LaTeX. I got stuck with the (A.4) equation in attached picture. Specifically, I need the text part of that equation to be in two lines but the way I did it the text just goes through the margins. I used itemize for the numbering and dcases* for the equation.

Also as a bonus question, I'm not sure how to do the footer copyright exactly as on the picture.

Text in two lines

This can be realized in lots of ways.

Environment tabular:

\begin{tabular}[t]{@{}l@{}
First line\\
Second line
\end{tabular}


However the tabular environment sets \struts to enforce full line heights and depths. In this case I would go for the other options.

Environment minipage:

\begin{minipage}[t]{123pt}% a magic number
First line\\
Second line
\end{minipage}


Disadvantage: The width of the minipage is set manually.

Environment varwdith:

\usepackage{varwidth}

\begin{varwidth}[t]{\linewidth}
First line\\
Second line
\end{varwidth}


The advantage of varwidth over minipage is that varwidth automatically shrinks the width of the lines.

\oalign:

\oalign{%
First line\hfil\cr
Second line\hfil
}%


\oalign is automatically top aligned and the lines are separated by a vertical space of 0.25ex.

Extra space in cases between lines

The case lines of environment cases of (A.4) are additionally separated by extra vertical space. This is achieved by

\noalign{\kern1ex}


to insert vertical space between the cases lines.

The optional argument of \\ does not work well, if the depth of the line is larger than the depth of the inserted strut.

Equation number left below

The reading order is organized in lines from left to right and the lines are read from top to bottom. If the equation number should go to the left side, it means the equation number goes before the equation. If the equation number needs to be shifted vertically, because the equation is too large, then amsmath puts the equation number above the equation to preserve the reading order: first equation number, then equation.

Otherwise, if the equation should come first, I would not use leqno, but would go for the default, option reqno (equation numbering to the right).

Nevertheless the internals of package amsmath can be tweaked to put the shifted equation number below if option leqno is active. The example shows this for environment gather. Environment align might work also, but there are some cases left, e.g. probably multline stuff.

Footer

The copyright notice can be put into \fancyfoot[R] of package fancyhdr. The example just redefines page style plain. But this can be done differently, the point is the code inside \fancyfoot[R]. The two lines are set via a tabular. The base line of the top line is aligned with the base line of the page number.

Example

\documentclass[twocolumn]{article}

% \usepackage[T1]{fontenc}
% \usepackage{lmodern}
\usepackage{varwidth}
\usepackage{fancyhdr}

\fancypagestyle{plain}{%
\fancyhf{}%
\fancyfoot[C]{\textsf{\thepage}}%
\fancyfoot[R]{%
\sffamily
\footnotesize
\begin{tabular}[t]{@{}l@{}}%
\end{tabular}%
}%
\renewcommand*{\footrulewidth}{0pt}%
}
\pagestyle{plain}

\usepackage[leqno]{amsmath}
\makeatletter
\def\place@tag@gather{%
\iftagsleft@
\kern-\gdisplaywidth@
\ifshifttag@
\rlap{\vtop{%
\raise@tag
\normalbaselines
\setbox\@ne\null
\dp\@ne\lineht@
\box\@ne
\boxz@
}}%
%      \rlap{\vbox{%
%        \normalbaselines
%        \boxz@
%        \vbox to\lineht@{}%
%        \raise@tag
%      }}%
\global\shifttag@false
\else
\rlap{\boxz@}%
\fi
\else
\ifdim\totwidth@>\displaywidth
\dimen@\totwidth@
\kern-\dimen@
\fi
\ifshifttag@
\llap{\vtop{%
\raise@tag
\normalbaselines
\setbox\@ne\null
\dp\@ne\lineht@
\box\@ne
\boxz@
}}%
\global\shifttag@false
\else
\llap{\boxz@}%
\fi
\fi
}
\def\set@gather@field{%
\global\lineht@\dp\z@
\kern\eqnshift@
\boxz@
\hfil
}
\def\place@tag{%
\iftagsleft@
\kern-\tagshift@
\if1\shift@tag\row@\relax
\rlap{\vtop{%
\raise@tag
\normalbaselines
\setbox\@ne\null
\dp\@ne\lineht@
\box\@ne
\boxz@
}}%
%      \rlap{\vbox{%
%        \normalbaselines
%        \boxz@
%        \vbox to\lineht@{}%
%        \raise@tag
%      }}%
\else
\rlap{\boxz@}%
\fi
\kern\displaywidth@
\else
\kern-\tagshift@
\if1\shift@tag\row@\relax
\llap{\vtop{%
\raise@tag
\normalbaselines
\setbox\@ne\null
\dp\@ne\lineht@
\box\@ne
\boxz@
}}%
\else
\llap{\boxz@}%
\fi
\fi
}
\def\set@field{%
\column@plus
\ifdim\dp\z@>\lineht@
\global\lineht@\dp\z@
\fi
\boxz@
}
\renewcommand{\raisetag}[1]{\skip@#1\relax
\xdef\raise@tag{\vskip-\the\skip@\relax}%
}
\makeatother

\begin{document}
\setcounter{page}{743}
\renewcommand*{\theequation}{A.\arabic{equation}}
\setcounter{equation}{3}
\null\newpage
\vspace*{\fill}

\begin{gather}
\hat\omega_{ij} =
\begin{cases}
\min\{
\hat\omega^A_{ij} / \hat\omega^B_{ij},
\hat\omega^B_{ij} / \hat\omega^A_{ij}
\}
%    & \oalign{if $\hat\omega^A_{ij}$ and $\hat\omega^B_{ij}$ have\cr
%      the same sign\hfil}
& \begin{varwidth}[t]{\linewidth}
if $\hat\omega^A_{ij}$ and $\hat\omega^B_{ij}$ have\\
the same sign
\end{varwidth}
\\
\noalign{\kern1ex}
\max\{
\hat\omega^A_{ij} / \hat\omega^B_{ij},
\hat\omega^B_{ij} / \hat\omega^A_{ij}
\}
%    & \oalign{if $\hat\omega^A_{ij}$ and $\hat\omega^B_{ij}$ have\cr
%      the opposite signs\hfil}
& \begin{varwidth}[t]{\linewidth}
if $\hat\omega^A_{ij}$ and $\hat\omega^B_{ij}$ have\\
the opposite signs
\end{varwidth}
\\
\noalign{\kern1ex}
1 & \text{if } \hat\omega^A_{ij} = \hat\omega^B_{ij} = 0 \\
\noalign{\kern1ex}
0 & \text{otherwise}
\end{cases}
\\
\hat\omega^A_{ij} =
\begin{cases}
\dfrac{a_i - a_j}{a_{\text{max}} - a_{\text{min}}}
& \text{if } a_{\text{max}} \ne a_{\text{min}}
\\
\noalign{\kern1ex}
0 & \text{otherwise}
\end{cases}
\\
\hat\omega^B_{ij} =
\begin{cases}
\dfrac{b_i - b_j}{b_{\text{max}} - b_{\text{min}}}
& \text{if } b_{\text{max}} \ne b_{\text{min}}
\\
\noalign{\kern1ex}
0 & \text{otherwise}
\end{cases}
\end{gather}

\end{document}


A simple method is to use parboxes. You just have to play around with the width to get line breaks that look ok.

\documentclass[12pt,twocolumn]{article}
\usepackage{mathtools}
\usepackage{microtype}
\usepackage{lipsum}
\begin{document}
\lipsum[1-3]
\begin{equation*}
a =
\begin{dcases}
b^2 + c^2 + d^2 & \parbox{125pt}{quite a long description really} \\
e & \parbox{125pt}{another fairly long description}
\end{dcases}
\end{equation*}
\end{document}


EDIT

You can use the [leqno] option for mathtools to put the numbers on the left. However, this places the numbers for long equations above left. To move a number below left, you could use an align environment with an empty bottom line (an old trick from the days when I still used eqnarray).

\documentclass[12pt,twocolumn]{article}
\usepackage[leqno]{mathtools}
\usepackage{microtype}
\usepackage{lipsum}
\begin{document}
\lipsum[1-3]
\begin{align}
a =
\begin{dcases}
b^2 + c^2 + d^2 & \parbox{125pt}{quite a long description really} \\
e & \parbox{125pt}{another fairly long description}
\end{dcases} \nonumber \\
\end{align}
\end{document}


• And you can align them with \parbox[t]{… for instance. – Manuel Jun 7 '14 at 11:23
• Yes that really helped, but I have another problem now. How do I make the (A.4) numbering appear at the lower left part of the equation like in the picture. I was using itemize and \item[(A.4)] to make the numbering look like that – Matija Jun 7 '14 at 11:29
• @Matija --- I have edited my answer. – Ian Thompson Jun 7 '14 at 12:01