4

Hello! Anyone knows how to create the "typical arc or hat" that goes over the periodic numbers/repeating or recurring decimal in LaTeX? Thank you!!

Magda
  • 41
  • Related: https://tex.stackexchange.com/questions/75284/how-do-i-write-a-recurring-decimal-in-latex – egreg Sep 22 '18 at 16:49

2 Answers2

7

EDIT: I was not aware of https://tex.stackexchange.com/a/451459/128553 when I made my first post. Here are other solutions.

I still think that the overline notation is the best for following reasons:

  • it is more or less internationally known,
  • it takes less horizontal space,
  • some of the solutions are too bold to fit to the typeface and attract to much attention,
  • if the number of digits is too long then the arc is not covering all digits, is ridiculously large, or is "too flat" to be easily distinguishable from a rotated bracket.

For some comparison: https://en.wikipedia.org/wiki/Repeating_decimal.


Variant A: Þe auld tikz: You can play around with the coordinates of wideArcAnchorA and wideArcAnchorB to get a shape of your taste.

\documentclass{article}

\usepackage{amsmath,tikz}
\usetikzlibrary{calc,topaths}

\newcommand\wideparen[1]{%
\tikz[baseline=(wideArcAnchor.base)]{
    \node[inner sep=0] (wideArcAnchor) {$#1$}; 
    \coordinate (wideArcAnchorA) at ($0.9*(wideArcAnchor.north west) + 0.1*(wideArcAnchor.north east)+(0.0em,0.75ex)$);
    \coordinate (wideArcAnchorB) at ($0.1*(wideArcAnchor.north west) + 0.9*(wideArcAnchor.north east)+(0.0em,0.75ex)$);
%   
    \draw[line width=0.1ex,line cap=round] 
        ($(wideArcAnchor.north west)+(0.0em,0.1ex)$) 
            .. controls (wideArcAnchorA) and (wideArcAnchorB) ..
        ($(wideArcAnchor.north east)+(0.0em,0.1ex)$)        
    ;
}}
\newcommand\widearc[1]{%
\tikz[baseline=(wideArcAnchor.base)]{
    \node[inner sep=0] (wideArcAnchor) {$#1$}; 
    \coordinate (wideArcAnchorA) at ($(wideArcAnchor.north west) + (0.1em,0.0ex)$);
    \coordinate (wideArcAnchorB) at ($(wideArcAnchor.north east) + (-0.1em,0.0ex)$);
%
    \draw[line width=0.1ex,line cap=round,out=45,in=135] (wideArcAnchorA) to (wideArcAnchorB);
}}

\begin{document}
\centering{}Test foo bar. 
\begin{align*}
    \zeta
        &=0.00\overline{1}\\
        &=0.00\widehat{1}\\
        &=0.00\wideparen{1}\\
        &=0.00\widearc{1}\\
        &\neq0.00\overline{12}\\
        &=0.00\widehat{12}\\
        &=0.00\wideparen{12}\\
        &=0.00\widearc{12}\\
        &\neq0.00\overline{1234567890}\\
        &=0.00\widehat{1234567890}\\
        &=0.00\wideparen{1234567890}\\
        &=0.00\widearc{1234567890}.
\end{align*}
\end{document}

enter image description here


Variant B: Taken from https://ctan.org/pkg/comprehensive.

\documentclass{article}

\usepackage{amsmath}

\makeatletter
%Taken from https://ctan.org/pkg/comprehensive
\def\downparenthfill{$\m@th\braceld\leaders\vrule\hfill\bracerd$}
\def\wideparen#1{\mathop{\vbox{\ialign{##\crcr\noalign{\kern3\p@}
         \downparenthfill\crcr\noalign{\kern3\p@\nointerlineskip}
         $\hfil\displaystyle{#1}\hfil$\crcr}}}\limits}
\makeatother

\begin{document}
\centering{}Test foo bar. 
\begin{align*}
    \zeta
        &=0.00\overline{12}\\
        &=0.00\widehat{12}\\
        &=0.00\wideparen{12}\\
        &\neq0.00\overline{1234567890}\\
        &=0.00\widehat{1234567890}\\
        &=0.00\wideparen{1234567890}.\\
\end{align*}

\end{document}

enter image description here


Variant C:

\documentclass{article}

\usepackage{amsmath}
\usepackage{mathabx}\begin{document}
\centering{}Test foo bar. 
\begin{align*}
    \zeta
        &=0.00\overline{12}\\
        &=0.00\widehat{12}\\
        &=0.00\wideparen{12}\\
        &\neq0.00\overline{1234567890}\\
        &=0.00\widehat{1234567890}\\
        &=0.00\wideparen{1234567890}.\\
\end{align*}
\end{document}

enter image description here


Variant D: use Utopia which might be a restriction for your use:

\documentclass{article}

\usepackage{amsmath,fourier}
\begin{document}
\centering{}Test foo bar. 
\begin{align*}
    \zeta
        &=0.00\overline{12}\\
        &=0.00\widehat{12}\\
        &=0.00\widearc{12}\\
        &\neq0.00\overline{1234567890}\\
        &=0.00\widehat{1234567890}\\
        &=0.00\widearc{1234567890}.\\
\end{align*}
\end{document}

enter image description here


Variant E: The arcs package should provide a better solution but seems to be broken. The hack mentioned on http://tug.org/pipermail/xetex/2013-August/024674.html works on LuaLaTeX and XeLaTeX on my system.

CampanIgnis
  • 4,624
2

If you want to stck to the default font, you hace the \wideparen from yhmath:

\documentclass{article}

\usepackage{amsmath, yhmath}

\begin{document}

    \[ \frac{12}{35} = 0.3\wideparen{428\,571}\]%

\end{document} 

enter image description here

Bernard
  • 271,350