2

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}
Concept7
  • 645

2 Answers2

5

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}

enter image description here

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

egreg
  • 1,121,712
  • For some reason, this solution still works using package versions available in 2021, unlike the other suggested solutions. – Mirlan Jun 01 '21 at 18:46
3

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}

enter image description here

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}
Ulrike Fischer
  • 327,261
  • 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 07 '18 at 16:19
  • 1
    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 07 '18 at 16:29
  • Looks like now it's not enough just to load fix-cm: I typed "Look at arc $\overarc{ABC}$" and got the output "Look at arc 5.0pt 24.88pt ABC". – Mirlan Jun 01 '21 at 18:42