7

I am trying to receive this look of fractions enter image description here

I need the red numbers, which are over the fractions. *They need to be normal, not handwritten-like. Here is my code

\documentclass[10pt,oneside,a5paper]{article}
\usepackage{amsmath}
\begin{document}
    $\dfrac{13}{25}, \dfrac{9}{20}, \dfrac{3}{4},
    \dfrac{3}{4}, \dfrac{3}{5}, \dfrac{1}{6};$
\end{document}
4
  • Do they also have to be printed in such a handwritten-like font?
    – siracusa
    Dec 8, 2018 at 14:50
  • They need to be normal, not handwritten-like. Dec 8, 2018 at 14:51
  • Do you need the curved lines below the numbers?
    – Sigur
    Dec 8, 2018 at 14:53
  • It would be nice. Dec 8, 2018 at 14:59

4 Answers 4

10

Why take the risk of an error in computing ?

\documentclass{article}
\usepackage{amsmath}
\usepackage{xintgcd}

\newsavebox\mybox
\newcommand{\fractionswithlcm}[1]{%
  \sbox\mybox{\gdef\simeondenominators{}%
      \def\fracm##1##2{\xdef\simeondenominators{\simeondenominators{##2}}}%
      $#1$}%
  \edef\simeonlcm{\xintLCMof{\simeondenominators}}%
  {\underbrace{#1}_{\displaystyle\simeonlcm}}%
}
\newcommand{\fracm}[2]{%
  \overset{\xintiiQuo{\simeonlcm}{#2}}%
          {\overset{\displaystyle\smile}{\frac{#1}{#2}}}%
}

\begin{document}

\[
\fractionswithlcm{
  \fracm{13}{25},
  \fracm{9}{20},
  \fracm{3}{4},
  \fracm{3}{5},
  \fracm{1}{6}
}
\]

\end{document}

enter image description here


As per OP request in a comment, here is with only the numbers on top but not anymore the big underbrace.

\documentclass{article}
\usepackage{amsmath}
\usepackage{xintgcd}

\newsavebox\mybox
\newcommand{\fractionswithlcm}[1]{%
  \sbox\mybox{\gdef\simeondenominators{}%
      \def\fracm##1##2{\xdef\simeondenominators{\simeondenominators{##2}}}%
      $#1$}%
  \edef\simeonlcm{\xintLCMof{\simeondenominators}}%
  #1%
}
\newcommand{\fracm}[2]{%
  \overset{\xintiiQuo{\simeonlcm}{#2}}%
          {\overset{\displaystyle\smile}{\frac{#1}{#2}}}%
}

\begin{document}

\[
\fractionswithlcm{
  \fracm{13}{25},
  \fracm{9}{20},
  \fracm{3}{4},
  \fracm{3}{5},
  \fracm{1}{6}
}
\]

\end{document}

enter image description here

10
  • I was kind of expecting it. :-)
    – egreg
    Dec 8, 2018 at 22:18
  • Conversely, why take the risk of an error in code? ;-) Dec 9, 2018 at 3:48
  • 1
    @R.. there is indeed a risk here as I should probably not have the \fracm globally defined to use the \xintiiQuo{\simeonlcm}{#2} operation. In this approach the \fracm should arguably be a macro whose usage is strictly restricted to inside \fractionswithlcm argument...
    – user4686
    Dec 9, 2018 at 12:02
  • @egreg your answer without expl3/xparse demonstrates indeed that one can vanquish addictions :) ... I am not as strong !
    – user4686
    Dec 9, 2018 at 12:05
  • Amazing. Can you remove the big bracket with number 300. I need only the fractions with the curves. Dec 9, 2018 at 12:54
12

For the curved symbol you can use \smile:

\documentclass{article}
\usepackage{amsmath}

\newcommand{\fractionswithlcm}[2]{%
  {\underbrace{#1}_{\displaystyle#2}}%
}
\newcommand{\fracm}[3]{%
  \overset{#1}{\overset{\displaystyle\smile}{\frac{#2}{#3}}}%
}

\begin{document}

\[
\fractionswithlcm{
  \fracm{12}{13}{25},
  \fracm{15}{9}{20},
  \fracm{75}{3}{4},
  \fracm{60}{3}{5},
  \fracm{50}{1}{6}
}{300}
\]

\end{document}

enter image description here

4

With \widehat instead of curves:

mew

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\overset{\underbrace{
\underset{\widehat{\dfrac{13}{25},}}{12}
\underset{\widehat{\dfrac{9}{20}},}{15}
\underset{\widehat{\dfrac{3}{4}},\ }{75}
\underset{\widehat{\dfrac{1}{6}},\ }{60}
\underset{\widehat{\dfrac{3}{5}}\ }{50}
}}{300}$
\end{document}

Edit: Ok, with curves

mwe

\documentclass{article}
\usepackage{amsmath}
% https://tex.stackexchange.com/a/191042/11604
\makeatletter
\def\widebreve#1{\mathop{\vbox{\m@th\ialign{##\crcr\noalign{\kern3\p@}%
      \brevefill\crcr\noalign{\kern3\p@\nointerlineskip}%
      $\hfil\displaystyle{#1}\hfil$\crcr}}}\limits}

\def\brevefill{$\m@th \setbox\z@\hbox{$\braceld$}%
  \bracelu\leaders\vrule \@height\ht\z@ \@depth\z@\hfill\braceru$}
\makeatletter

\begin{document}
$\overset{\underbrace{
\underset{\widebreve{\dfrac{13}{\makebox[1em]{25}}},}{12}
\underset{\widebreve{\dfrac{9}{\makebox[1em]{20}}},}{15}
\underset{\widebreve{\dfrac{3}{\makebox[1em]{4}}},}{75}
\underset{\widebreve{\dfrac{1}{\makebox[1em]{6}}},}{60}
\underset{\widebreve{\dfrac{3}{\makebox[1em]{5}}}}{50}
}}{300}$
\end{document}
4
  • But I think that the mark should be below the top numbers, not above the 2nd row numbers.
    – Sigur
    Dec 8, 2018 at 16:03
  • It should be curved up, like half circle.
    – Sigur
    Dec 8, 2018 at 18:00
  • I think they should be under and centered with the 1st row numbers. Lets see.
    – Sigur
    Dec 8, 2018 at 18:28
  • BTW not relevant to the TeX part, but in this answer 3/5 and 1/6 are switched relative to the question (while the numbers above are not). Dec 8, 2018 at 20:26
3

What about this?

\documentclass[10pt,oneside,a5paper]{article}
\usepackage{amsmath}
\newcommand{\myfrac}[3]{\overset{#1}{\dfrac{#2}{#3}}}

\begin{document}
$\myfrac{12}{13}{25}, \myfrac{15}{9}{20}, \myfrac{75}{3}{4}, \myfrac{60}{3}{5}, \myfrac{50}{1}{6}$
\end{document}

enter image description here

1
  • I like it. But I need the curved lines above. I don't know if it's possible.Thank you! Dec 8, 2018 at 15:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .