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} 
8
  • 1
    I find this notation very confusing, particularly for the primary level. Commented May 15, 2016 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. Commented May 15, 2016 at 23:24
  • 3
    @egreg This is the notation that is regularly used in school textbooks of my country and others. Commented May 15, 2016 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. Commented May 15, 2016 at 23:27
  • 1
    @cfr Definitely with a + in between; no sign means multiplication Commented May 16, 2016 at 7:40

1 Answer 1

5

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.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.