4

I'm using the Quattrocento font in a beamer presentation (which my audience likes a lot) but I have a small problem with inline fractions like 33 1/3, which do not look very good. Specifically the "1" and "3" are placed respectively a little too low and too high, and the fraction looks too "wide".

This is the example code you require:

\documentclass{beamer}
\usepackage[sfdefault]{quattrocento}
\usepackage{xfrac}
\begin{document}
\begin{frame}
33\sfrac{1}{3} $33\sfrac{1}{3}$
\end{frame}
\end{document} 

The mathmode version looks a bit better but I still don't like it. This happens also with other fractions, 33 1/3 is just an example case. I'm searching for a way to improve the appearance of the inline fraction as specified above: some kind of more compact look.

Since this happens a lot, I'd like a solution that does not clutter the code and also something that works both in normal and mathmode.

I already tried with nicefrac but I think the output is even worse.

I'm open to different approaches like changing the font only for the relevant fractions, as long as the new font doesn't look too different from Quattrocento.

  • 33\enspace1/3 – egreg Jun 12 '13 at 14:47
  • @egreg I want to keep the xfrac inline look – f.boc Jun 12 '13 at 16:23
6

I don't have your font, but based on your comment that you would like to shift the 1 and the 3 vertically, I can propose this solution, based on a different font. The v-shift, set to 2pt, may be changed to your taste. EDITED to add an h-shift, per the questioner's request.

\documentclass{beamer}
%\usepackage[sfdefault]{quattrocento}
\usepackage{verbatimbox}
\newlength\vshft
\newlength\hshft
\vshft=2pt
\hshft=1pt
\newcommand\revfrac[2]{%
  \sfrac{\addvbuffer[-\the\vshft\ \the\vshft]{#1\hspace{-\hshft}}}
{\addvbuffer[\the\vshft\ -\the\vshft]{\hspace{-\hshft}#2}}
}
\usepackage{xfrac}
\begin{document}
\begin{frame}
Original 33\sfrac{1}{3} Revised 33\revfrac{1}{3}
\end{frame}
\end{document} 

enter image description here

  • is it also possible to reduce the gap between the numbers and the fraction symbol? With Quattrocento the fraction is also very wide and doesn't look good. – f.boc Jun 12 '13 at 16:22
  • 1
    @f.boc Done, per your request. – Steven B. Segletes Jun 12 '13 at 16:34
  • only downside is that this does not work in math mode, but the mathmode default look is acceptable, so it doesn't matter much – f.boc Jun 12 '13 at 17:36

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.