Math & Scienceamsmath | Font Size of Fractions in the »cases« Environment

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

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

Post by Karlo »

Hello,

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

My code is:

Code: Select all

\begin{equation}
 \pi(\boldsymbol{\theta}\!\mid\!\boldsymbol{x}) =
    \begin{cases}
     	  \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})} 
             & \text{if $\int_{\Theta} q(\boldsymbol{\theta}) r(\boldsymbol{x}\!\mid\!\boldsymbol{\theta}) \: \emph{d} \lambda(\boldsymbol{\theta}) \neq 0$} \\ 
             0 & \text{else} 
     \end{cases}
\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.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

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

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

Post by localghost »

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.

Code: Select all

\documentclass{scrartcl}
\usepackage[T1]{fontenc}
\usepackage{mathtools}  % loads »amsmath«

\begin{document}
  \begin{equation}
    \pi(\boldsymbol{\theta}\!\mid\!\boldsymbol{x}) =
    \begin{dcases}
      \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})}
      & \text{if $\int_{\Theta} q(\boldsymbol{\theta}) r(\boldsymbol{x}\!\mid\!\boldsymbol{\theta}) \: \emph{d} \lambda(\boldsymbol{\theta}) \neq 0$} \\
      0 & \text{else}
    \end{dcases}
  \end{equation}
\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
Karlo
Posts: 2
Joined: Sun Jul 22, 2012 2:10 am

Re: amsmath | Font Size of Fractions in the »cases« Environm

Post by Karlo »

Yeah,

that's it.

Thanks again for your help,

K.
Post Reply