4

I'm trying to replicate some guidelines in the calculus book for my students to use as a reference, but the formatting is getting messed up. As you can see, there are several formatting issues. First off, how can I get the "2k+1" to be the regular exponent size? Secondly, those giant gaps in the second integral need to go! I haven't really played with over/underbraces much, so I really don't know what I'm doing! Thanks for your help! =)

Output

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{align*}
    \int\!\sin^{\overbrace{2k+1}^{\text{odd}}}x\cos^n x \,dx
    = \int\!\overbrace{(\sin^2x)^k}^{\text{convert to cosines}}\cos^n x\overbrace{\sin x\,dx}^{\text{save for $du$}}
    = \int\!(1-\cos^2x)^k\cos^n x\sin x\,dx
\end{align*}

\end{document}

EDIT: Thanks to all that replied, but now I have a second issue. When the exponent is even, the overbrace seems to be too small. I have tried fiddling with mathclap, but it doesn't solve the issue. =( Not sure if this needs to be posted as a new question, but I'll try just posting it here first. The code for the new issue is below.

\documentclass{article}
\usepackage{amsmath}
\usepackage{mathtools}

\begin{document}

\begin{align*}
    \int\!\sec{\overbrace{^{2k}}^{\text{even}}}x\tan^n x\,dx
    = \int\!\overbrace{(\sec^2x)^{k-1}}^{%
            \substack{\text{convert to} \\ \text{tangents}}}
                \tan^n x\overbrace{\sec^2 x\,dx}^{\text{save for $du$}}
    = \int\!(1+\tan^2 x)^{k-1}\tan^nx\sec^2x\,dx
\end{align*}

\end{document}
3

An another solution:

\documentclass{article}
\usepackage{amsmath}

    \begin{document}
\begin{align*}
    \int\!\sin{\overbrace{^{2k+1}}^{\text{odd}}}x\cos^n x \,dx
    = \int\!\overbrace{(\sin^2x)^k}^{%
        \substack{\text{convert to}\\\text{cosines}}}
            \cos^n x\overbrace{\sin x\,dx}^{\text{save for $du$}}
    = \int\!(1-\cos^2x)^k\cos^n x\sin x\,dx
\end{align*}
    \end{document}

The problem of exponent in the first integral I solve with put all exponent in \overbrace, for second comment I suggest to wrote it in two lines by help of \substack and on this way it make shorter.

enter image description here

Edit: As I mentioned in comment, overbrace is not possible make shorter from its minimal length. In such cases the solution can be to use bracket from mathools package instead braces. With it and help of mathclap (also from mathtools) you can obtain:

enter image description here

\documentclass{article}
\usepackage{amsmath}
\usepackage{mathtools}

\begin{document}

\begin{align*}
\int \sec\overbracket[0.5pt]{^{2k}}^{\mathclap{\text{even}}}x\tan^n x\,dx
    & = \int \overbrace{(\sec^2x)^{k-1}}^{%
            \substack{\text{convert to} \\ \text{tangents}}}
                \tan^n x\overbrace{\sec^2 x\,dx}^{\text{save for $du$}} \\
    & = \int (1+\tan^2 x)^{k-1}\tan^nx\sec^2x\,dx
\end{align*}

\end{document}
| improve this answer | |
  • Thanks! I edited a follow up question, if you wouldn't mind taking a look at it. – Jon May 20 '15 at 23:02
  • @Jon, this is problem of braces. If distance between both ends of brace is shorter then necessary length to draw arches of braces, the it is extent to its minimum length. With other words, you need to redefine brace. Other way is that you use bracket instead of brace. For this see manual for mathtools. Since here is very late, I need go to sleep, so the example how to use brackets, I will prove in the morning, if this will be still actual. – Zarko May 20 '15 at 23:24
7

I would use a combination of things to make the output look a little better:

enter image description here

\documentclass{article}
\usepackage{mathtools}

\begin{document}

\begin{align*}
    \int \sin^{\overbrace{\scriptstyle 2k+1}^{\scriptstyle\text{odd}}}x\cos^n x \,\mathrm{d}x
    = \int \overbrace{(\sin^2x)^k}^{\mathclap{\text{convert to cosines}}}\cos^n x\overbrace{\sin x\,\mathrm{d}x\vphantom{{}^k}s}^{\mathclap{\text{save for $\mathrm{d}u$}}}
    = \int (1-\cos^2x)^k\cos^n x\sin x\,\mathrm{d}x
\end{align*}

\end{document}
  1. A forced \scriptstyle inserts a superscript/exponent-size font.

  2. mathtools provides \mathclap which removes any horizontal spacing inserted by math content (thereby letting the \overbrace content spill over the \overbrace edge). Also, a vertical strut the height of a k-exponent makes the latter two \overbraces line up better.


For very narrow \overbraces, results are sub-optimal. Perhaps you can just point to it using an arrow:

enter image description here

\documentclass{article}
\usepackage{mathtools}

\begin{document}

\begin{align*}
    \int \sec^{\overset{\underset{\downarrow}{\mathclap{\scriptstyle\text{even}}}}{2k}}x\tan^n x \,\mathrm{d}x
    = \int \overbrace{(\sec^2x)^{k-1}}^{\mathclap{\text{convert to tangents}}}\tan^n x\overbrace{\sec^2 x\,\mathrm{d}x}^{\mathclap{\text{save for $\mathrm{d}u$}}}
    = \int (1+\tan^2x)^{k-1}\tan^n x\sec^2 x\,\mathrm{d}x
\end{align*}

\end{document}
| improve this answer | |
  • it looks to me like "odd" has gone down a size.. another \scriptstyle just before \text{odd} would fix that. i tried patching the definition of \overbrace to keep the argument in the appropriate size, but that affected the positioning of the "limit", which shifted off to the side (as would be appropriate for \limits in anything smaller than \textstyle). – barbara beeton May 20 '15 at 21:58
  • @barbarabeeton: Thanks for that, I missed it. – Werner May 20 '15 at 23:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.