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.

I have used the following code in LaTeX -

\documentclass{article}
\usepackage{amssymb,amsmath}
\begin{document}

\begin{table}[H]
\centering
  \begin{tabular}{c|c}
  \hline 
  { $X=y+z$}  & { 
   \parbox[c]{0.75\columnwidth}{
    $C_L = \begin{cases} 
        min\left[\left(Re\right),\: f(B)\right]\:;\: A<4\\   
        f(E)\:;\:4\le E<10\\
         -0.29\:;\: E\ge10
        \end{cases}$\\ 
    $f(E) = E^{3}-0.0159E^{2}-0.0204E+0.474$\\
  }
}\tabularnewline \hline
\end{tabular} 
\end{table}


\end{document}

In the output, I would like the equals sign of C_L and f(E) to be aligned with each other. I have tried to use align environment, but it doesn't work. Can anyone please help?

imageoutput

share|improve this question

4 Answers 4

up vote 5 down vote accepted

You can push the cases content to the right the same amount as f(E) using

$\phantom{f(E)}\llap{$C_L$} = \begin{cases}
%...

The left overlap makes a right-aligned, zero-width box to not let C_L influence the spacing.

enter image description here

Ps. You may want to use \min instead of just typing min in math mode.

share|improve this answer

You can use the align environment, which is provided by the amsmath package. I see you load it anyway:

\documentclass{article}
\usepackage{amssymb,amsmath}
\begin{document}

\begin{table}[H]
\centering
  \begin{tabular}{c|c}
  \hline 
  { $X=y+z$}  & { 
   \parbox[c]{0.75\columnwidth}{
   \begin{align}
   C_L&= \begin{cases} 
        min\left[\left(Re\right),\: f(B)\right]\:;\: A<4\\   
        f(E)\:;\:4\le E<10\\
         -0.29\:;\: E\ge10
        \end{cases}\\ 
    f(E)&= E^{3}-0.0159E^{2}-0.0204E+0.474
   \end{align}
  }
}\tabularnewline \hline
\end{tabular} 
\end{table}

\end{document}

The ampersands before the equal signs set the characters that need to be aligned, meaning that if you used it in another place, the character that follows will be aligned.

And here's the output of the code:

enter image description here

share|improve this answer

use of the aligned environment seems the simplest fix to me:

\documentclass{article}
\usepackage{amssymb,amsmath}
\begin{document}

\begin{table}[H]
\centering
  \begin{tabular}{c|c}
  \hline 
  { $X=y+z$}  & { 
   \parbox[c]{0.75\columnwidth}{
   \( \begin{aligned}
   C_L&= \begin{cases} 
        min\left[\left(Re\right),\: f(B)\right]\:;\: A<4\\   
        f(E)\:;\:4\le E<10\\
         -0.29\:;\: E\ge10
        \end{cases}\\ 
    f(E)&= E^{3}-0.0159E^{2}-0.0204E+0.474
   \end{aligned} \)
  }
}\tabularnewline \hline
\end{tabular} 
\end{table}

\end{document}

two things to notice:

  • within a \parbox, the aligned environment needs to be put explicitly into math mode;
  • the original example had more space at the bottom than at the top; this was caused by an extra \\ after the last line, which has been removed here.

output of example code

share|improve this answer

This is just a comment to Barbaras suggestion (the answer allows better formatting). Instead of the inner cases, I'd use alignedat in order to also align the conditions within the cases

\left\{
 \begin{alignedat}{2}
   &\min[(Re),\: f(B)]\:;&\quad A&<4\\   
   &f(E)\:; &4&\le E<10\\
   &-0.29\:; &E&\ge10
 \end{alignedat}
\right.

Also I've removed the \left...\right constructions from within the \min as they did not contribute anything.

Edit: Added visuals

enter image description here

share|improve this answer

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.