# \overarc command from arcs package and xwatermark

I was trying to use the \overarc command on a new document and it didn't compile, it just took forever and I had to stop the compilation.

I tried it on another document with a few more packages loaded and it worked fine. As I eliminated the packages I found that I had to load the package xwatermark along with arcs for it to work.

Does anyone know why this happens?

\documentclass{article}

\usepackage{xwatermark}
\usepackage{arcs}

\begin{document}
$$\overarc{AB}$$
\end{document}

• The arcs package has severe bugs, as far as I know. Can you please make an example? – egreg Jan 5 '18 at 21:50
• it's a simple document, just document class and if you put only the arcs package, it won't work and with the package xwatermark it does, it's really weird because the arcs documentation has no reference to xwatermark. – Concept7 Jan 5 '18 at 22:10
• Better to show it anyway. – egreg Jan 5 '18 at 22:11
• I added it to the original post. If you don't load xwatermark it just keeps compiling and shows no result. – Concept7 Jan 5 '18 at 22:15
• xwatermark loads fix-cm and this seems to be needed. – Ulrike Fischer Jan 5 '18 at 22:42

The arcs package tries to find the correct size for the arc by starting with a rather small font size and then doing a loop in which it increases the font size until it find a matching arc.

The problem is that to increase the font size it uses the relsize package. And if the fonts have a "discrete" font scaling (as is the default for computer modern) then it doesn't do what the arcs package expects as it then uses a rather high tolerance:

\documentclass{article}

\usepackage{relsize}

\begin{document}
% default \RSpercentTolerance=30%:
\relsize{-10}a
\relsize{+1}a
\relsize{+1}a
\relsize{+1}a
\relsize{+1}a
\relsize{+1}a
\relsize{+1}a
\relsize{+1}a
\relsize{+1}a

\renewcommand\RSpercentTolerance{5} %now 5%
\relsize{-10}a
\relsize{+1}a
\relsize{+1}a
\relsize{+1}a
\relsize{+1}a
\relsize{+1}a
\relsize{+1}a
\relsize{+1}a
\relsize{+1}a

\end{document}


As one can see the font doesn't get larger and so one get an infinite loop.

To avoid the problem one can load fix-cm which makes all font scalings continous, or patch the arcs command like this (egregs patch should be applied too):

\documentclass{article}

\usepackage{arcs}
\usepackage{etoolbox}

\makeatletter
\patchcmd{\over@under@arc}
{\relsize{-10}}{\renewcommand\RSpercentTolerance{5}\relsize{-10}}{}{\fail}
\makeatother
\begin{document}
$$\overarc{AB}$$

\end{document}

• Thanks! If you load the fix-cm package do you still have to apply the patch? I've tried it with and without the patch and can't see any difference, could you explain to me what it's doing? – Concept7 Jan 7 '18 at 16:19
• With fix-cm you don't need the patch with your example as then relsize sets the tolerance to 5% on its own. But the patch doesn't harm and prevents the problem also for other fonts not only cmr (but this is rather theoretic, I don't know a concrete example of font family with discrete scaling where you would get the same loop). – Ulrike Fischer Jan 7 '18 at 16:29

It's quite curious. ;-) On the other hand the output is wrong, but it can be fixed by doing a patch:

\documentclass{article}

\usepackage{xwatermark}
\usepackage{arcs}
\usepackage{etoolbox}

\makeatletter
\providecommand\@gobblethree[3]{}
\patchcmd{\over@under@arc}
{\@gobbletwo}
{\@gobblethree}
{}{}
\makeatother

\begin{document}

text $a$ $$\overarc{AB}$$

\end{document}


As Ulrike Fischer points out in a comment, the really needed package is fix-cm.