4

If my fraction has a taller numerator than denominator, e.g.:

\frac{\begin{array}{c} t\\a\\l\\l\\ \end{array}}{small}

a nice fraction

I like the way it is still adjusted to the baseline.


However, something weird happens if I need to enclose it with \left and \right delimiters, see:

\left(\frac{\begin{array}{c} t\\a\\l\\l\\ \end{array}}{small}\right)

a weird fraction

Why is there so much empty space under the denominator then?
How can I get rid of this empty space while still keeping the fraction bar aligned with the baseline?

I am aware this would imply that the parentheses are not centered with the fraction bar anymore. But I don't mind.

  • \left and \right just stretch the delimiters keeping them vertically centred on the math axis, and covering the height and depth of the content. Your other option is to use \Biggl( and then raise "by hand" – David Carlisle Mar 3 '17 at 15:12
  • @DavidCarlisle If you don't mind, I will consider this other option a hackish solution ;) If I understand well, \left and \right try to both keepVerticallyCentered and coverHeightAndDepth. How do I optionally disable the first of these two constraints? – iago-lito Mar 3 '17 at 15:18
  • 3
    You can not. TeX does not offer that possibility. If you are really doing this a lot and don't want to raise by hand, first set the inner fraction, measure its height then lower it so it is vertically centred, then add the \left \right, then raise the entire construct by the amount that you lowered. (This is how delarray package puts brackets around a bottom aligned array) – David Carlisle Mar 3 '17 at 15:25
  • @DavidCarlisle Too bad :\ Is there a way I can automatically adapt \Biggl( to the size of my fraction then? And automatically center it right? – iago-lito Mar 3 '17 at 15:27
  • another question addressing this topic: Regarding sizing of delimiters – barbara beeton Mar 3 '17 at 16:06
4

You should use a different way to express your formulas, I believe.

Anyway, here's a possible solution using delarray.

The syntax is

\delfrac<left>{<numerator>}{<denominator>}<right>

If you need brackets [] you have to use \lbrack and \rbrack, for implementation reasons due to delarray.

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


\makeatletter
\newsavebox{\del@frac@box}
\newcommand\delfrac[4]{\mathpalette\del@frac{{#1}{#2}{#3}{#4}}}
\newcommand{\del@frac}[2]{\del@@frac{#1}#2}
\newcommand{\del@@frac}[5]{%
  \sbox\del@frac@box{$\m@th#1\frac{#3}{#4}$}%
  \sbox\z@{$\begin{array}#2{@{}c@{}}#5\usebox{\del@frac@box}\end{array}$}%
  \raisebox{\dimexpr\depth-\dp\del@frac@box}{\box\z@}%
}
\makeatother

\begin{document}

baseline $\left\{\frac{a}{b}\right\}$ $\delfrac\{{a}{b}\}$
$\delfrac\{{\begin{array}{c} t\\a\\l\\l \end{array}}{small}\}$ is here

\[
x+\delfrac\{{\begin{array}{c} t\\a\\l\\l \end{array}}{small}\}+y
\]

\[
x_{t\delfrac\lbrack{\substack{a\\b\\c\mathstrut}}{\substack{\mathstrut d\\e}}\rbrack}
\]
\end{document}

enter image description here

  • Perfect. Cheers ! I like how neat the final syntax is :) – iago-lito Mar 6 '17 at 14:55
4

enter image description here

I'm not sure it looks that nice:-) but if that's what you want:

\documentclass{article}

\def\zzz#1{%
\sbox0{$#1$}%
\dimen0=0.5\dimexpr\ht0+\dp0\relax
\sbox0{$\left(\lower\dimen0 \box0 \right)$}%
\raise\dimen0 \box0 
}


\begin{document}


text here $1+\zzz{\frac{\begin{array}{c} t\\a\\l\\l\\ \end{array}}{small}}$ zzz
\end{document}
  • You could fiddle with the exact shift to take account of math axis, and/or decrease the delimitershortfall but this should give the basic idea. – David Carlisle Mar 3 '17 at 15:40
  • \vcenter is suggested in one of the answers to the question to which i posted a link in a comment above. not that i like it ... – barbara beeton Mar 3 '17 at 16:08
  • yes but that's for the option not requested here of keeping the delimters centered but lowing the fraction so it is centred not aligned to the math axis. so it's like this answer with the \lower but not the \raise – David Carlisle Mar 3 '17 at 16:20
  • Interesting, thanks ! Too bad that the shift must be adjusted manually tough.. – iago-lito Mar 6 '17 at 14:54
  • there shouldn't be any manual correction needed, I just meant change 0.5\dimexpr\ht0+\dp0\relax to something more exact then exactly half the height+depth, at least offset by \fontdimen22 (the height of the math axis) – David Carlisle Mar 6 '17 at 15:17

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.