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}
jub0bs
  • 58,916
minthao_2011
  • 4,534
  • 7
  • 36
  • 61

4 Answers4

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

egreg
  • 1,121,712
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}
jub0bs
  • 58,916
  • I find \triangleq ugly and unnecessary. – egreg Mar 01 '14 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 01 '14 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 01 '14 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 01 '14 at 17:35
  • @Manuel You're right. See my edit. – jub0bs Mar 01 '14 at 18:08
  • I'd use \equiv to define something. so (\alpha \equiv \widehat{BDC}) – Nasser Mar 01 '14 at 18:40
  • @Nasser I wouldn't but thanks for the suggestion :) – jub0bs Mar 01 '14 at 22:35
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}
Mico
  • 506,678
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}
cmhughes
  • 100,947