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'm trying to define an environment to use with equations' systems. So far, the best solution was

\newenironment{eqsys}{\begin{equation}\begin{cases}}{\end{cases}\end{equation}}

but I noticed that if the equations had, say, partial derivative, which are fractions, those are squeezed. So I modified it, adding \displaystyle so the environment looked like this

\newenironment{eqsys}{\begin{equation}\begin{cases}\displaystyle}{\end{cases}\end{equation}}

but with this trick, only the first equation in the system is correctly typeset.

The code to get the results I get is

\documentclass{scrbook}

\usepackage{amsmath}
\usepackage{mathtools}

\newenvironment{eqsys}{\begin{equation}\begin{cases}\displaystyle}{\end{cases}\end{equation}}

\begin{document}
\begin{eqsys}
    \tan(\theta) = \frac{\sin(\theta)}{\cos(\theta)}\\
    \text{cotan}(\theta) = \frac{\cos(\theta)}{\sin{\theta}}
\end{eqsys}
\end{document}

How can I make \displaystyle repeat for each equation in the set?

share|improve this question
2  
Please compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. –  Peter Grill Nov 28 '11 at 23:30
    
Sorry, just forgot it. The MWE I provided will recreate the odd condition I get. –  Marcello Massaro Nov 29 '11 at 9:53
add comment

2 Answers

up vote 11 down vote accepted

You could use dcases from the mathtools package

screenshot

\documentclass{article}
\usepackage{amsmath}
\usepackage{mathtools}

\newenvironment{eqsys}{\begin{equation}\begin{dcases}}{\end{dcases}\end{equation}}

\begin{document}

\begin{eqsys}
 \frac{1}{2}    \\
 \frac{2}{5}
\end{eqsys}
\end{document}

Alternatively there is \dfrac from the amsmath package, which can be used instead of \displaystyle\frac25, but it sounds like this would be too manual for what you want.


Here is how the dcases performs with @PeterGrill's test case

screenshot

\begin{eqsys}
    e = 2 \frac{1}{2}\\
    e = 2 \frac{1}{2}
\end{eqsys}
share|improve this answer
    
This is just what I was looking for, I didn't know about dcases! –  Marcello Massaro Nov 29 '11 at 9:55
add comment

A solution to make \displaystyle repeat for each equation would be to use \everymath={\displaystyle}, which is applied at the start of any math material. I renamed your original version as eqsysOLD and used it following the new version of eqsys for two purposes:

  1. compare the output
  2. test that the setting of \everymath is local and does not effect subsequent math material

enter image description here

Known Issues:

  • Even though this solution illustrates how to apply a specific command to each equation, dcases provides better vertical spacing. So in this specific case the solution of @cmhughes is a better alternative.

Code:

\documentclass{article}
\usepackage{amsmath}

\newenvironment{eqsysOLD}{\begin{equation}\begin{cases}\displaystyle}{\end{cases}\end{equation}}

\newenvironment{eqsys}{\begin{equation}\everymath={\displaystyle}\begin{cases}}{\end{cases}\end{equation}}

\begin{document}
\begin{eqsys}
    e = 2 \frac{1}{2}\\
    e = 2 \frac{1}{2}
\end{eqsys}

\begin{eqsysOLD}
    e = 2 \frac{1}{2}\\
    e = 2 \frac{1}{2}
\end{eqsysOLD}
\end{document}
share|improve this answer
    
Compare the results on your test code to that when using dcases- you'll see that dcases performs significantly better –  cmhughes Nov 29 '11 at 0:28
    
@cmhughes: Excellent point. Have included that info. –  Peter Grill Nov 29 '11 at 0:39
    
Thanks; would you mind if I include your test case in my answer? –  cmhughes Nov 29 '11 at 0:40
    
@cmhughes: No of course not. –  Peter Grill Nov 29 '11 at 0:43
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.