4

If you render the code below, you'll see a large space over the top of the fraction. How to remove that space?

\begin{equation}
  \left[\frac{x}{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x}}}}}}}}}}}}}}}}}}}\right]
\end{equation}

I want to achieve this desired effect:

enter image description here

Note how the space above is removed, while the alignment of the equation is still as before (the horizontal line of the fraction is in its place).

4

I'm not sure you really want to do it, because the fraction will be misaligned with respect to everything else in the equation.

\documentclass{article}
\usepackage{amsmath}
\usepackage{delarray}

\begin{document}

\begin{equation}
\begin{array}\lbrack{@{}c@{}}\rbrack
  \dfrac{x}{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x}}}}}}}}}}}}}}}}}}}
\end{array}
\end{equation}

\end{document}

enter image description here

In order to properly realign the fraction line, some moving around is needed:

\documentclass{article}
\usepackage{amsmath}
\usepackage{delarray}

\begin{document}

\begin{equation}
\sbox{0}{$\dfrac{x}{y}$}
y=\raisebox{\dimexpr\ht0-\height}{%
  $\begin{array}\lbrack{@{}c@{}}\rbrack
   \dfrac{x}{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x}}}}}}}}}}}}}}}}}}}
\end{array}$}
\end{equation}

\end{document}

enter image description here

  • Is your answer a reply to John Kormylos answer, to use a \raisebox. At least, thats, what I read from your "you don't want to do it" ... If I am right, please add that in your text. – Jan Jan 10 '17 at 18:54
  • @Jan No, it's a reply to the OP – egreg Jan 10 '17 at 20:34
  • 1
    @Jan I really can't understand what your comment is about. I answered the OP, adding that it's better to not doing something like this. What's wrong with it? – egreg Jan 10 '17 at 21:00
  • I added a figure depicting what I want to achieve. It turns out that none of the solutions that are provided here actually do what I want. – caveman Jan 12 '17 at 8:11
  • 1
    @caveman Exactly what I predicted. ;-) I added the trick, but I find the result awful. – egreg Jan 12 '17 at 9:08
4

The \left \right syntax will vertically center the baseline (actually, a point about 2.5pt above the baseline) in the reserved space. To move the baseline up or down, use \raisebox.

\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{equation}
  \left[\raisebox{\dimexpr 2.5pt+0.5\depth-0.5\height}%
  {$\displaystyle \frac{x}{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x}}}}}}}}}}}}}}}}}}}$}%
  \right]
\end{equation}
\end{document}

demo

3
\newcommand{\CenterObject}[1]{\ensuremath{\vcenter{\hbox{#1}}}}
\begin{equation}
\left[\CenterObject{$\displaystyle\frac{x}{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x_{x}}}}}}}}}}}}}}}}}}}$}\right]
\end{equation}

enter image description here

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.