3

I'd like to get fractions as they appear below (from Improved kerning in fractions?):

enter image description here

However, my current code typesets them as follows:

enter image description here

Here is a MWE that reproduces these fractions.

\documentclass{report}
\usepackage[sloped]{fourier}
\DeclareSymbolFont{mathit}{T1}{fut\mathfamilyextension}{m}{it}
\DeclareMathSymbol{1}{\mathalpha}{mathit}{`1}

\begin{document}

\begin{equation}
    1\frac{1}{1}
\end{equation}
\end{document}

I have not been able to find the way of making the fractions look as fancy as I desire. Basically:

  1. Reduce spacing between numerator and the bar; and reduce spacing between denominator and the bar.

  2. Change the alignment such that it does not look as weird as it currently does.

Does anyone know how to re-define fractions such that they look as I want? Thank you all in advance for your time.

  • 1
    Maybe you could wrap 1\textstyle\frac{\,1}{\!\!1} into some kind of macro. – Steven B. Segletes Mar 29 '17 at 13:18
  • Thanks a lot for your comment. However, I must admit that I wouldn't know how to do that you propose. Moreover, I'd like all fractions of my document (and not only this one in particular) to look fancy. – Héctor Mar 29 '17 at 13:19
2

REVISED APPROACH

\itfrac shown in \displaystyle, \textstyle, \scriptstyle, and \scriptscriptstyle.

\documentclass{report}
\usepackage[sloped]{fourier}
\DeclareSymbolFont{mathit}{T1}{fut\mathfamilyextension}{m}{it}
\DeclareMathSymbol{0}{\mathalpha}{mathit}{`0}
\DeclareMathSymbol{1}{\mathalpha}{mathit}{`1}
\DeclareMathSymbol{2}{\mathalpha}{mathit}{`2}
\DeclareMathSymbol{4}{\mathalpha}{mathit}{`4}
\DeclareMathSymbol{5}{\mathalpha}{mathit}{`5}
\usepackage{scalerel}
\newcommand\itfrac[2]{\mathchoice
  {{\textstyle\frac{\,\displaystyle#1}{\!\!\displaystyle#2}}}
  {{\frac{\,\scriptstyle#1}{\!\!\scriptstyle#2}}}
  {{\frac{\,\scriptscriptstyle#1}{\!\!\scriptscriptstyle#2}}}
  {{\frac{\,\scriptscriptstyle#1}{\!\!\scriptscriptstyle#2}}}
}
\begin{document}
\centering
\[
    1\itfrac{1}{1} + \itfrac{12}{24} = \itfrac{250}{100}
\]
\[\textstyle
    1\itfrac{1}{1} + \itfrac{12}{24} = \itfrac{250}{100}
\]
\[\scriptstyle
    1\itfrac{1}{1} + \itfrac{12}{24} = \itfrac{250}{100}
\]
\[\scriptscriptstyle
    1\itfrac{1}{1} + \itfrac{12}{24} = \itfrac{250}{100}
\]
\end{document}

enter image description here

It is possible the \itfrac macro can be simplified as

\newcommand\itfrac[2]{\mathchoice
  {{\textstyle\frac{\,\displaystyle#1}{\!\!\displaystyle#2}}}
  {\frac{\,#1}{\!\!#2}}
  {\frac{\,#1}{\!\!#2}}
  {\frac{\,#1}{\!\!#2}}
}

It works the same in this MWE, but I am not 100% sure whether that would be the case for all use cases.

ORIGINAL APPROACH

To elaborate on a comment made (though not really an answer, per se, this is what I was indicating..., calling it \itfrac.

\documentclass{report}
\usepackage[sloped]{fourier}
\DeclareSymbolFont{mathit}{T1}{fut\mathfamilyextension}{m}{it}
\DeclareMathSymbol{0}{\mathalpha}{mathit}{`0}
\DeclareMathSymbol{1}{\mathalpha}{mathit}{`1}
\DeclareMathSymbol{2}{\mathalpha}{mathit}{`2}
\DeclareMathSymbol{4}{\mathalpha}{mathit}{`4}
\DeclareMathSymbol{5}{\mathalpha}{mathit}{`5}
\newcommand\itfrac[2]{\textstyle\frac{\,#1}{\!\!#2}}
\begin{document}

\begin{equation}
    1\itfrac{1}{1} + \itfrac{12}{24} = \itfrac{250}{100}
\end{equation}
\end{document}

enter image description here

  • Lovely! Is there any way of reducing the vertical space without using \textstyle? I'm asking because \textstyle reduces the size of the numbers as well; and I'd like to avoid that. Maybe \raisebox? – Héctor Mar 29 '17 at 13:30
  • 1
    @Héctor Please see my edit – Steven B. Segletes Mar 29 '17 at 13:42
  • The edit is perfect and the output looks exactly as desired. Hence, answer accepted. Thanks a lot. – Héctor Mar 29 '17 at 13:45

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.