12

I've got a very long radical in a display-math environment, so long that the equation spills in the right margin. How can I break that equation over multiple lines, so that it doesn't go into the right margin?

enter image description here

\documentclass[12pt,a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{fourier}
\usepackage[left=3cm,right=3cm,top=2.5cm,bottom=2cm]{geometry}

\begin{document}
\[
    V_{DABC}=\dfrac{1}{6}\cdot DA \cdot DB \cdot DC \cdot \sqrt{1+2\cdot
    \cos \widehat{ADB}\cdot \cos \widehat{BDC}\cdot \cos \widehat{ADC}
    -\cos^2 \widehat{ADB} -\cos^2 \widehat{ADC} -\cos^2 \widehat{BDC}} 
    =\dfrac{2\sqrt{2}}{3}.
\]
\end{document}
2
  • 4
    The first suggestion is to use \alpha, \beta and so on instead of naming angles by points.
    – egreg
    Mar 1, 2014 at 16:27
  • How about using )^{1/2} instead of a root? would be easier to split up.
    – Ingo
    Mar 3, 2014 at 16:50

4 Answers 4

12

I'd much prefer Jubobs's approach, but just to show another method, you can split into two lines the radicand:

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{fourier}
\usepackage[left=3cm,right=3cm,top=2.5cm,bottom=2cm]{geometry}
\begin{document}
\[
  V_{DABC}=\dfrac{1}{6}\cdot DA \cdot DB \cdot DC \cdot
  \sqrt{
    \begin{aligned}
     1+&2\cos\widehat{ADB}\cos\widehat{BDC}\cos\widehat{ADC} \\
     & -\cos^2 \widehat{ADB} -\cos^2 \widehat{ADC} -\cos^2 \widehat{BDC}
    \end{aligned}
  }
  =\dfrac{2\sqrt{2}}{3}.
\]
\end{document}

I removed the unnecessary centered dots.

enter image description here

3
  • 2
    To avoid the (minimal) manual adjustment, one could use multlined environment from mathtools.
    – Manuel
    Mar 1, 2014 at 17:18
  • @Manuel Yes, that's a possibility.
    – egreg
    Mar 1, 2014 at 17:20
  • Inasmuch as I like the other answers that provide simpler equations for clarity's sake, +1 for actually answering the question. Mar 1, 2014 at 18:15
10

As suggested by egreg in his comment, the angles take up a lot of horizontal space, which you can claim back by defining shorter variables for them (alpha, beta, gamma, in my code).

enter image description here

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb} % <---- for \triangleq
\usepackage{fourier}
\usepackage[left=3cm,right=3cm,top=2.5cm,bottom=2cm,showframe]{geometry}
\begin{document}
\begin{align*}
  V_{DABC} &=\dfrac{1}{6}\cdot DA \cdot DB \cdot DC \cdot
    \sqrt{
      1 + 2 \cos\alpha \cos\beta \cos\gamma
        -\cos^2 \alpha -\cos^2 \beta -\cos^2 \gamma
    } \\
           &= \dfrac{2\sqrt{2}}{3}\,,
\end{align*}
%
where \(\alpha \triangleq \widehat{BDC}\),
\(\beta \triangleq \widehat{ADC}\),
and \(\gamma \triangleq \widehat{ADB}\).
\end{document}
7
  • I find \triangleq ugly and unnecessary.
    – egreg
    Mar 1, 2014 at 16:37
  • @egreg Personally, I find \triangleq useful to distinguish between an equality between two quantities that have already been introduced, and a definition, i.e. "we introduce the LHS and define it as equal to the RHS". I guess it's a matter of personal opinion. I'm curious... Do you use another symbol? Or do you not make that distinction?
    – jub0bs
    Mar 1, 2014 at 16:40
  • 2
    I find that = is sufficient. Mathematicians have gone through without := or similar symbols for centuries. Saying “where A=B” is usually clear; one can say “where we set A=B” if greater clarity seems needed.
    – egreg
    Mar 1, 2014 at 16:43
  • Even more, you could omit \cdot between cosines. In my opinion 2 \cos \gamma \cos \alpha \cos \beta is absolutely readable.
    – Manuel
    Mar 1, 2014 at 17:35
  • @Manuel You're right. See my edit.
    – jub0bs
    Mar 1, 2014 at 18:08
8

An approach that produces a result that's very similar to the one in @egreg's answer relies on the \splitfrac macro of the mathtools package.

In the example below, I also utilize a macro called \V that typesets its argument in text italics instead of math italics. The macro is applied to the strings "DABC", "ADB", "DA", etc to keep TeX from typesetting them as if they were separate variables named "A", "B", "C", etc.

enter image description here

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{mathtools} % for \splitfrac macro
\usepackage{fourier}
\usepackage[hmargin=3cm,top=2.5cm,bottom=2cm,showframe]{geometry} 
\newcommand{\V}[1]{\textit{#1}} % shorthand macro, typesets its argument in text italics
\begin{document}
\[
V_{\V{DABC}}
=\frac{1}{6}\, \V{DA} \cdot \V{DB} \cdot \V{DC} \cdot
\sqrt{\splitfrac{
1+2\cos \widehat{\V{ADB}} \cdot \cos \widehat{\V{BDC}} \cdot \cos \widehat{\V{ADC}}}{
-\cos^2 \widehat{\V{ADB}} -\cos^2 \widehat{\V{ADC}}  -\cos^2 \widehat{\V{BDC}}}\,} 
=\frac{2\sqrt{2}}{3}\,.
\]
\end{document}
0
7

I think this is one of those cases where a local definition may help; in the code below, I have introduced f(A,B,C,D) under your radical, and then defined it immediately below.

screenshot

% arara: pdflatex
% !arara: indent: {overwrite: yes}
\documentclass[12pt,a4paper]{article}
\usepackage{amsmath}
\usepackage[left=3cm,right=3cm,top=2.5cm,bottom=2cm]{geometry}
\begin{document}
\begin{align}
    V_{DABC} & =\dfrac{1}{6}\cdot DA \cdot DB \cdot DC \cdot \sqrt{f(A,B,C,D)} \\
             & =\dfrac{2\sqrt{2}}{3}.
\end{align}
where
\begin{align*}
    f(A,B,C,D)  = 1 & +2\cdot \cos \widehat{ADB}\cdot \cos \widehat{BDC}\cdot \cos \widehat{ADC} \\
                    & -\cos^2 \widehat{ADB}-\cos^2 \widehat{ADC}-\cos^2 \widehat{BDC}
\end{align*}
\end{document}
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .