4

I'd like to insert a cornered block of text centered between two equations in an align environment. Within the block might go an explanation, an aligned environment, a paragraph, etc. I do not want to put the explanation off to the right side of the equations, as is usually done (I know how to do that anyway).

How can I do this?

Problems with my MWE:

  • The code seems too messy.
  • The corners seem too small.
  • The spacing is off. In particular, either more space should be added between the first line of the cornered text and its top corner or else less space should be added between the last line of the cornered text and its bottom corner.
  • In the event that there are multiple such blocks within a single, long align environment, the blocks should be aligned (say, on their left corners).

    \documentclass[10pt]{article}
    
    \usepackage{amsmath,amssymb,amsfonts}
    
    \begin{document}
    \title{Title}
    \author{Author}
    \date{Date}
    \maketitle
    
    Here is my work:
    \begin{align*}
        \int \tan x \, dx 
        &= \int \dfrac{\sin x}{\cos x} \, dx  \\[1ex]
        &\phantom{{}={}}
            \qquad
            \ulcorner
            {\begin{aligned}[t]
            u &= \cos x \\
            du &= - \sin x \, dx 
            \end{aligned}}
            \\
        &\phantom{{}={}}
            \qquad
            \llcorner
            \\[1ex]
        &= \int \dfrac{-1}{u} \, du \\
        &= - \ln | u | + C \\
        &= - \ln | {\cos x} | + C \quad \text{or} \quad \ln | {\sec x} | + C.
    \end{align*}
    
    \end{document}
    

enter image description here

  • For 3, you can use \end{aligned}}\\[-4\jot]. You can even define an environment butI gotta go now. – user11232 Jan 21 '15 at 1:07
1

I would go like in the following. If you need that a lot, you may want to define an environment or some more macros.

% arara: pdflatex

\documentclass[10pt]{article}
\usepackage{mathtools,amsfonts}
\newcommand*{\lhsInBox}[1]{\hspace{3em}\mathllap{#1}}
\newcommand*{\dx}{\,\mathrm{d}x}
\newcommand*{\du}{\,\mathrm{d}u}
\newcommand*{\intConst}{\mathrm{C}}

\begin{document}
Here is my work:
\begin{align*}
    \int\tan\dx &= \int\frac{\sin x}{\cos x}\dx \\
                &\quad\ulcorner\\[-3\jot]       
                &\lhsInBox{u} = \cos x \\
                &\lhsInBox{\du} = - \sin x\dx \\[-3\jot]
                &\quad\llcorner \\
                &= \int\frac{-1}{u}\du \\
                &= - \ln|u| + \intConst \\
                &\quad\ulcorner \\[-3\jot]      
                &\lhsInBox{\intConst} = \text{some constant} \\[-3\jot]
                &\quad\llcorner \\
                &= - \ln|\cos x| + \intConst \quad \vee \quad \ln|\sec x| + \intConst
\end{align*}        
\end{document}

enter image description here

Your Answer

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