LaTeX forum ⇒ Math & Scienceamsmath | Font Size of Fractions in the »cases« Environment Topic is solved

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Karlo
Posts: 2
Joined: Sun Jul 22, 2012 2:10 am

amsmath | Font Size of Fractions in the »cases« Environment

Postby Karlo » Sun Jul 22, 2012 3:09 am

Hello,

I am trying to write Bayes theorem, using cases environment in amsmath package.

My code is:
  1. \begin{equation}
  2. \pi(\boldsymbol{\theta}\!\mid\!\boldsymbol{x}) =
  3. \begin{cases}
  4. \frac{q(\boldsymbol{\theta}) r(\boldsymbol{x}\mid\boldsymbol{\theta})}{\int_{\Theta} q(\boldsymbol{\theta}) r(\boldsymbol{x}\mid\boldsymbol{\theta}) \: \emph{d} \lambda(\boldsymbol{\theta})}
  5. & \text{if $\int_{\Theta} q(\boldsymbol{\theta}) r(\boldsymbol{x}\!\mid\!\boldsymbol{\theta}) \: \emph{d} \lambda(\boldsymbol{\theta}) \neq 0$} \\
  6. 0 & \text{else}
  7. \end{cases}
  8. \end{equation}


I have a problem with the size of the fraction in it. It's too small, I'd like to give it more space so that the integral in the fraction is as big as the integral after if. Is there an easy way how to make it happen? Hope it's understandable from my description where my problem is:)

Thanks a lot,

K.

Tags:

User avatar
localghost
Site Moderator
Posts: 9204
Joined: Fri Feb 02, 2007 12:06 pm

Postby localghost » Sun Jul 22, 2012 12:49 pm

The cases environment of amsmath can be enhanced by several packages.


Let's take a look at a solution with mathtools because it offers the right stuff here.
  1. \documentclass{scrartcl}
  2. \usepackage[T1]{fontenc}
  3. \usepackage{mathtools} % loads »amsmath«
  4.  
  5. \begin{document}
  6. \begin{equation}
  7. \pi(\boldsymbol{\theta}\!\mid\!\boldsymbol{x}) =
  8. \begin{dcases}
  9. \frac{q(\boldsymbol{\theta}) r(\boldsymbol{x}\mid\boldsymbol{\theta})}{\displaystyle\int_{\Theta} q(\boldsymbol{\theta}) r(\boldsymbol{x}\mid\boldsymbol{\theta}) \: \emph{d} \lambda(\boldsymbol{\theta})}
  10. & \text{if $\int_{\Theta} q(\boldsymbol{\theta}) r(\boldsymbol{x}\!\mid\!\boldsymbol{\theta}) \: \emph{d} \lambda(\boldsymbol{\theta}) \neq 0$} \\
  11. 0 & \text{else}
  12. \end{dcases}
  13. \end{equation}
  14. \end{document}

What has been done here:

  • The cases environment has been replaced by dcases. This activates \displaystyle in the whole environment and thus increases font size for fractions.
  • In the denominator of the first fraction it is necessary to enable \displaystyle separately in order to let the integral symbol appear in the familiar size.

Further reading:



Best regards and welcome to the board
Thorsten
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

Karlo
Posts: 2
Joined: Sun Jul 22, 2012 2:10 am

Postby Karlo » Sun Jul 22, 2012 2:20 pm

Yeah,

that's it.

Thanks again for your help,

K.


Return to “Math & Science”

Who is online

Users browsing this forum: No registered users and 2 guests