2

I have several formulas that are too long to fit into the \textwidth of my page. That's why I want them underbraced with the result-formulation beneath them. Something like this.

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

\begin{document}

\begin{flalign*}
&\lefttext{\hspace{1cm}odd :} & \mathclap{\mathbf{Dark}\mathrm{[Bias]$-$}pix_\frac{n+1}{2}(x,y)} &&\\
&\lefttext{\hspace{1cm}even :} & \mathclap{\underbrace{ \dfrac{1}{2}\left(\mathbf{Dark}\mathrm{[Bias]}\text{-}pix_\frac{n}{2}(x,y) + \mathbf{Dark}\mathrm{[Bias]}\text{-}pix_{\frac{n}{2}+1}(x,y)\right)}_{= \text{Master-\textbf{Dark}[Bias]-}pix(x,y)}}
\end{flalign*}

\end{document}

My questions are the following two. How can I make the underbrace look as if it does not only refer to the longer one under which it is located? With a little vertical space this might be more clear. Sorry, everything is a bit complicated with the two \lefttext{} for each equation. And second how can I make the result line look like a part of the whole equation rather than just a small text explanation under some part of some equation? The problem is that it does not very much look like a whole equation. If anyone has another solution for presenting long equations without ripping them apart I am grateful too.

0

1 Answer 1

2

Here's a solution that uses multline, to split your equation into multiple lines, combined with cases or with drcases depending on what you prefer most:

\documentclass{article}
\usepackage{mathtools}

\begin{document}

\begin{multline*}
    \text{Master-\textbf{Dark}[Bias]-}pix(x,y) \\
    =
    \begin{cases}
        \mathbf{Dark}\mathrm{[Bias]}\text{-}pix_{\frac{n+1}{2}}(x,y) & \text{if $n$ is odd,} \\
        \dfrac{1}{2}\left(\mathbf{Dark}\mathrm{[Bias]}\text{-}pix_{\frac{n}{2}}(x,y) + \mathbf{Dark}\mathrm{[Bias]}\text{-}pix_{\frac{n}{2}+1}(x,y)\right) & \text{if $n$ is even.} \\
    \end{cases} 
\end{multline*}

\begin{multline*}
    \text{Master-\textbf{Dark}[Bias]-}pix(x,y) \\
    =
    \begin{cases}
        \text{if $n$ is odd:} & \mathbf{Dark}\mathrm{[Bias]}\text{-}pix_\frac{n+1}{2}(x,y) \\
        \text{if $n$ is even:} & \dfrac{1}{2}\left(\mathbf{Dark}\mathrm{[Bias]}\text{-}pix_{\frac{n}{2}}(x,y) + \mathbf{Dark}\mathrm{[Bias]}\text{-}pix_{\frac{n}{2}+1}(x,y)\right) \\
    \end{cases} 
\end{multline*}

\begin{multline*}
    \begin{drcases}
        \text{if $n$ is odd:} & \mathbf{Dark}\mathrm{[Bias]}\text{-}pix_{\frac{n+1}{2}}(x,y) \\
        \text{if $n$ is even:} & \dfrac{1}{2}\left(\mathbf{Dark}\mathrm{[Bias]}\text{-}pix_{\frac{n}{2}}(x,y) + \mathbf{Dark}\mathrm{[Bias]}\text{-}pix_{\frac{n}{2}+1}(x,y)\right) \\
    \end{drcases}  \\
    = \text{Master-\textbf{Dark}[Bias]-}pix(x,y)
\end{multline*}

\begin{multline*}
    \begin{drcases}
        \mathbf{Dark}\mathrm{[Bias]}\text{-}pix_{\frac{n+1}{2}}(x,y) & \text{if $n$ is odd,} \\
        \dfrac{1}{2}\left(\mathbf{Dark}\mathrm{[Bias]}\text{-}pix_{\frac{n}{2}}(x,y) + \mathbf{Dark}\mathrm{[Bias]}\text{-}pix_{\frac{n}{2}+1}(x,y)\right) & \text{if $n$ is even.} \\
    \end{drcases}  \\
    = \text{Master-\textbf{Dark}[Bias]-}pix(x,y)
\end{multline*}

\end{document}

Or the very same with abbreviation commands:

\documentclass{article}
\usepackage{mathtools}

\newcommand\B{[\mathrm{Bias}]}
\newcommand\D{\mathbf{Dark}}

\begin{document}

\begin{multline*}
    \text{Master-\textbf{Dark}[Bias]-}pix(x,y) \\
    =
    \begin{cases}
        \D\B\text{-}pix_{\frac{n+1}{2}}(x,y) & \text{if $n$ is odd,} \\
        \dfrac{1}{2}\left(\D\B\text{-}pix_{\frac{n}{2}}(x,y) + \D\B\text{-}pix_{\frac{n}{2}+1}(x,y)\right) & \text{if $n$ is even.} \\
    \end{cases} 
\end{multline*}

\begin{multline*}
    \text{Master-\textbf{Dark}[Bias]-}pix(x,y) \\
    =
    \begin{cases}
        \text{if $n$ is odd:} & \D\B\text{-}pix_{\frac{n+1}{2}}(x,y) \\
        \text{if $n$ is even:} & \dfrac{1}{2}\left(\D\B\text{-}pix_{\frac{n}{2}}(x,y) + \D\B\text{-}pix_{\frac{n}{2}+1}(x,y)\right) \\
    \end{cases} 
\end{multline*}

\begin{multline*}
    \begin{drcases}
        \text{if $n$ is odd:} & \D\B\text{-}pix_{\frac{n+1}{2}}(x,y) \\
        \text{if $n$ is even:} & \dfrac{1}{2}\left(\D\B\text{-}pix_{\frac{n}{2}}(x,y) + \D\B\text{-}pix_{\frac{n}{2}+1}(x,y)\right) \\
    \end{drcases}  \\
    = \text{Master-\textbf{Dark}[Bias]-}pix(x,y)
\end{multline*}

\begin{multline*}
    \begin{drcases}
        \D\B\text{-}pix_{\frac{n+1}{2}}(x,y) & \text{if $n$ is odd,} \\
        \dfrac{1}{2}\left(\D\B\text{-}pix_{\frac{n}{2}}(x,y) + \D\B\text{-}pix_{\frac{n}{2}+1}(x,y)\right) & \text{if $n$ is even.} \\
    \end{drcases}  \\
    = \text{Master-\textbf{Dark}[Bias]-}pix(x,y)
\end{multline*}

\end{document}

enter image description here

EDIT: As to your request of having the formulae centered and using an underbrace:

Use \array to get something centered. Then put an \underbrace under the entire array:

\documentclass{article}
\usepackage{MnSymbol}

\newcommand\B{[\mathrm{Bias}]}
\newcommand\D{\mathbf{Dark}}

\begin{document}

\begin{equation*}
    \underbrace{
    \begin{array}{rc}
        \text{if $n$ is odd:} & \D\B\text{-}pix_{\frac{n+1}{2}}(x,y) \\
        \text{if $n$ is even:} & \dfrac{1}{2}\left(\D\B\text{-}pix_{\frac{n}{2}}(x,y) + \D\B\text{-}pix_{\frac{n}{2}+1}(x,y)\right)
    \end{array}     
    }_{= \text{Master-\textbf{Dark}[Bias]-}pix(x,y)}
\end{equation*}

\end{document}

enter image description here

2
  • Can the smaller formula be centered with respect to the longer formula? For curiosity: isn't it possible to really place a nice underbrace below the whole equation part?
    – Lucas
    Mar 4, 2015 at 10:15
  • 1
    @Lucas I edited my answer to get your formulae centered and to get the underbrace Mar 4, 2015 at 13:06

You must log in to answer this question.

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