Math & ScienceFraction off center within delimiters

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
profylno
Posts: 2
Joined: Mon Jan 18, 2010 8:55 am

Fraction off center within delimiters

Post by profylno »

I am trying to make a fraction which has a \dfrac in the bottom, but just a "1" on top, and put it between brackets. LaTeX treats the numerator as if it was as tall as the denominator, and so it centers the whole thing too low within the brackets (and makes the brackets too big).
The relevant code is

Code: Select all

\usepackage{amsmath}
\left[\frac{1}{\dfrac{1}{\sqrt{13}-3}-a_1}\right]
Does anyone know a way around this?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

Fraction off center within delimiters

Post by phi »

This is a design decision that is normally left unaltered (the reasoning being that delimiters and fractions should both be centered on the math axis). However, you can get around with the \vcenter primitive:

Code: Select all

\documentclass{minimal}
\usepackage{amsmath}
\makeatletter
\newcommand*{\vertcent}{\mathpalette\vertc@nt}
\newcommand*{\vertc@nt}[2]{\vcenter{\hbox{$\m@th#1#2$}}}
\makeatother
\begin{document}
\[ a + \left[ \vertcent{\frac{1}{\dfrac{1}{\sqrt{13} - 3} - a_1}} \right] + b \]
\end{document}
profylno
Posts: 2
Joined: Mon Jan 18, 2010 8:55 am

Fraction off center within delimiters

Post by profylno »

Thanks.
I actually wasn't sure if it would look better or worse when centered, but I had no way to tell because I couldn't produce it.
To be honest, I'm still not sure which I like better, so I may just forget about it as you suggest (though it is comforting to know that it can be done, in any case).
Thanks again.
Post Reply