[Tex/LaTex] How to raise the output of \genfrac

amsmathmath-mode

I want to write rational numbers in mixed-numeral notation. To do so, I currently use \tfrac (AmSLaTeX):

\frac{5}{4} = 1\tfrac{1}{4}

But the fractional part is still too big for my taste. Therefore I defined \ttfrac with respect to genfrac as suggested in the "User's Guide for the amsmath Package" [amsldoc] (subsection 4.11.3):

\newcommand{\ttfrac}[2]{\genfrac{}{}{}{2}{#1}{#2}}

The above code then becomes:

\frac{5}{4} = 1\ttfrac{1}{4}

It fits better my taste, but now the fractional part is shifted down. What is the best way to raise it up a bit ?

Best Answer

You shouldn't write numbers that way, because it's ambiguous. Anyway, for raising the scriptsize fraction you can use \vcenter:

\documentclass{article}
\usepackage{amsmath}

\newcommand{\ttfrac}[2]{\vcenter{\hbox{$\genfrac{}{}{}{2}{#1}{#2}$}}}

\begin{document}

$1\ttfrac{1}{4}$ versus $1\tfrac{1}{4}$

\end{document}

enter image description here