1

For the LaTeX code below,

 \begin{equation}
Fitness(\CS)=
\begin{cases}
    0.5 + 0.5 \cdot G(\CS)                        & if\ V(\CS)=0 \\
    0.5\cdot G(\CS)-\frac{V(\CS)}{V_{Tot}(\CS)}   & otherwise.
\end{cases}~\label{eq:fitness}
\end{equation}

I get the output

enter image description here

It looks like the fraction \frac{V(\CS)}{V_{Tot}(\CS)} is a bit squeezed here,I would prefer

enter image description here

which looks less squeezed. How could I do that?

1
  • @Werner The dcases environment is defined by mathtools
    – egreg
    Nov 21 '12 at 0:12
5

mathtools defined dcases which puts the entries inside in display math mode. This causes fractions and other mode-varying elements to conform to their largest size:

enter image description here

\documentclass{article}
% mathtools also loads amsmath (http://ctan.org/pkg/amsmath)
\usepackage{mathtools}% http://ctan.org/pkg/mathtools
\newcommand{\CS}{CS}
\DeclareMathOperator{\Fitness}{Fitness}
\begin{document}

% Original cases
\begin{equation}
  Fitness(\CS)=
  \begin{cases}
    0.5 + 0.5 \cdot G(\CS)                        & if\ V(\CS)=0 \\
    0.5\cdot G(\CS)-\frac{V(\CS)}{V_{Tot}(\CS)}   & otherwise.
  \end{cases}\label{eq:fitness1}
\end{equation}

% Updated dcases, operator definition and text
\begin{equation}
  \Fitness(\CS)=
  \begin{dcases}
    0.5 + 0.5 \cdot G(\CS)                        & \text{if\ }V(\CS)=0 \\
    0.5\cdot G(\CS)-\frac{V(\CS)}{V_{\text{Tot}}(\CS)}   & \text{otherwise.}
  \end{dcases}\label{eq:fitness2}
\end{equation}

\end{document}

Textual elements are forced as text using \text, while an operator like Fitness should also be declared as such. See the amsmath documentation for more on these topics.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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