2

In some math textbooks for primary level, the mixed numbers are written with the integer almost the same height as the fraction. For example: enter image description here

I want to write in LaTeX mixed numbers like the above image, in math mode and in a text line using \dfrac for write the fraction. My first approach (MWE) is very grotesque, but it does illustrate what I want:

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\setlength{\parindent}{0pt}
\begin{document}
In text mode:
{\Huge 3}$\dfrac{1}{5}$.\\
In math mode:
$$\textrm{\Huge 3}\dfrac{1}{5}+\textrm{\Huge 2}\dfrac{4}{7}$$
\end{document} 
  • I find this notation very confusing, particularly for the primary level. – egreg May 15 '16 at 23:12
  • 1
    @egreg How would you write it? As far as I recall, this is what fractions looked like when I first learnt them in primary school. – cfr May 15 '16 at 23:24
  • 3
    @egreg This is the notation that is regularly used in school textbooks of my country and others. – G. Aguilera May 15 '16 at 23:26
  • 1
    $$...$$ ought not be used in LaTeX. \\ ought not be used to break a line outside special contexts such as tabular and array. – cfr May 15 '16 at 23:27
  • 1
    @egreg At primary level, no sign doesn't have that meaning. Isn't the point that this is supposed to make clear that this is one number and not two? In any case, if this is what the text books do, then this is the notation it makes sense to use in this context even if it would not be the best choice starting from scratch. And it might be better, starting from scratch, not to assign multiplication to no sign, of course. – cfr May 16 '16 at 11:19
4

This is what the scalerel package was intended to do (the package was inspired here: Making a summation sign adjust to contents of summation). It makes the first argument the same vertical extent as the second argument, processing arguments in math mode, and preserving the current math style.

\documentclass{article}
\usepackage{scalerel,amsmath}
\begin{document}
\centering
This is in text mode $\scalerel{5}{\dfrac{1}{3}}$.
\[
\scalerel{5}{\dfrac{1}{3}}\quad xyz
\]
\end{document}

enter image description here

As a compromise, line spacing can be preserved if this process is executed in \scriptstyle using $\scalerel{5}{\scriptstyle\frac{1}{3}}$:

enter image description here

A star version of the \scalerel macro does the same thing, but without actually printing out the 2nd argument.

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.