Math & ScienceMy formula is too long

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
quasar987
Posts: 4
Joined: Tue Jan 13, 2009 6:03 am

My formula is too long

Post by quasar987 »

Hi,

I am working on slides and when I enter the following code,

Code: Select all

\begin{displaymath}
f(x)=
\begin{cases} 
n & \text{if } x \in \mathbb{Q} \ \text{and } x=m/n \ \text{where } n>0 \ \text{and } gcd(m,n)=1 \\
0 & \text{otherwise}
\end{cases}
\end{displaymath}
the forumla is too long for the width of the slide. What I would like to do is write the condition "if x \in [...] gcd(m,n)=1" on two lines nicely.

How would I do something like that?

Thanks!

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

My formula is too long

Post by localghost »

You can try something like the following.

Code: Select all

\begin{displaymath}
  f(x)=
  \begin{cases}
    n & \text{if } x \in \mathbb{Q} \ \text{and } x=m/n \ \text{where } \\
    & n>0 \ \text{and } gcd(m,n)=1 \\
    0 & \text{otherwise}
  \end{cases}
\end{displaymath}
Where to exactly set the line break is up to you.


Best regards
Thorsten¹
quasar987
Posts: 4
Joined: Tue Jan 13, 2009 6:03 am

Re: My formula is too long

Post by quasar987 »

Oh, perfect! Thanks.
Post Reply