Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.
\begin{numcases}
{Opt\left(P, i, \ell, s, r\right)=min }
\nonumber (3)\hspace{2 mm} Opt(P,i+1,''Skip'',r - 1) + C1\label{eq:3} & $r\geq1$ \\
\nonumber (4)\hspace{2 mm} 0  & $i = |P|$ and $ r \geq 0$ \\
\nonumber (5)\hspace{2 mm} \infty & $r < 0$
\end{numcases}

but I want to control the amount of horizontal space it uses after the first column. The reason is that right now Latex uses too much and one of the conditions is not fully displayed and cut on the page.

Thank you!

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

A sloppy way is to decrease the width of the longest entry by adding negative space, see the first equation of the following example file.

Equations (2) and (3) use package amsmath and its environment cases instead. Also some other oddities (unrelated to the question) are resolved.

\documentclass{article}
\usepackage{amsmath}
\usepackage{cases}

\DeclareMathOperator{\Opt}{Opt}

\begin{document}

\subsection*{Original example with added \texttt{\textbackslash hspace*}:}

\begin{numcases}
{Opt\left(P, i, \ell, s, r\right)=min }
\nonumber (3)\hspace{2 mm} Opt(P,i+1,''Skip'',r - 1) + C1\label{eq:3}\hspace*{-1em}& $r\geq1$ \\
\nonumber (4)\hspace{2 mm} 0  & $i = |P|$ and $ r \geq 0$ \\
\nonumber (5)\hspace{2 mm} \infty & $r < 0$
\end{numcases}

\subsection*{Example with \textsf{amsmath} and automatically shifted equation number:}

\begin{gather}
\label{eq:foo}
\Opt(P, i, \ell, s, r)=\min
\begin{cases}
  \Opt(P,i+1,\text{``Skip''},r - 1) + \text{C1} & r\geq1 \\
  0  & \text{$i = |P|$ and $ r \geq 0$} \\
  \infty & r < 0
\end{cases}
\end{gather}

\subsection*{Example with \textsf{amsmath} and environment \textsf{multline}:}

\begin{multline}
\Opt(P, i, \ell, s, r)=\\
\min
\begin{cases}
  \Opt(P,i+1,\text{``Skip''},r - 1) + \text{C1} & r\geq1 \\
  0  & \text{$i = |P|$ and $ r \geq 0$} \\
  \infty & r < 0
\end{cases}
\label{eq:bar}
\end{multline}

\end{document}

Result:

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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