2

The arcs package is useful to put an arc over or under a piece of text.

It is a package that works in text-mode, but could be another one that works only in text-mode and not necessarily the one that I have chosen.

enter image description here

I think it's just a specific package that is only used in text mode but not in mathematical mode. I never have used this package. With this MWE I have an error

\documentclass[a4paper,12pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc} 
\usepackage{amssymb, amsmath}
\usepackage{arcs}

\begin{document} \overarc{A} \end{document}

LaTeX Font Warning: Font shape OML/cmm/m/it in size <3.59999> not available(Font)

At this moment I remember very little. What could be the strategies in LaTeX to transform a specific package in text-mode into a math-mode?

Sebastiano
  • 54,118
  • 1
    I think this package is just broken, because this results in an infinite loop: http://dpaste.com/3JVAWDALV (expires in 10 days) – Henri Menke Jul 27 '20 at 23:52
  • @HenriMenke I'm always very lucky . I have chosen the corrupt package. Yes I have seen that I have a loop of errors . Very nice dpaste, that I not knew. <4.19997> not available(Font) and <2.99998> not available(Font) for OT1, OML, cmr, cmm, etc. The package can be found inside the symbol guide on page 23. If it doesn't work, what do you do? – Sebastiano Jul 27 '20 at 23:58
  • @HenriMenke With the latest version of MikTeX, I have no errors and no bugs in this package. – AndréC Jul 28 '20 at 04:44
  • When you say you want it to work "in math mode", do you want the arc over an italic letter, or over a roman letter in math mode? Also, are you expecting to have math kernings? – Steven B. Segletes Jul 28 '20 at 09:15
  • @StevenB.Segletes Always nice Steven maybe my question is not clear. I have taken as an example a generic package in text-mode. It can be any package to trasform in math-mode. I not have understood the significance of Also, are you expecting to have math kernings? Best regards. – Sebastiano Jul 28 '20 at 11:23
  • @Sebastiano For example, in math mode, I could say \mbox{\overarc{A}}. I think it would work. It would produce an over-arced A in the text mode font, but would operate in math mode. Also, anything else in the \mbox would not have math mode kernings (compare \textit{abc} with $abc$) – Steven B. Segletes Jul 28 '20 at 11:24
  • @StevenB.Segletes I have edited my question now before your comment. Ah, now I have understood. I thinked with a macro using \newcommand. However, it would be nice for me to understand the switch of a purely textual package in math-mode. – Sebastiano Jul 28 '20 at 11:28
  • The most simple fix, to force it into math mode, would be \makeatletter \renewcommand{\overarc}[2][1]{\over@under@arc{#1}{$#2$}\z@} \renewcommand{\underarc}[2][1]{\over@under@arc{#1}{$#2$}\@ne} \makeatother. However, it suffers from the fact that it does not shift the arc, to account for the italic slant. – Steven B. Segletes Jul 28 '20 at 15:21
  • @StevenB.Segletes Always thank you for your efforts. But is this a general rule or for the specific package arcs? – Sebastiano Jul 28 '20 at 15:24
  • 1
    It is specific for the arcs package. The only change from the package definitions is to add the $s around #2. – Steven B. Segletes Jul 28 '20 at 15:52
  • @StevenB.Segletes Please, can you edit your answer adding the comments and with a screenshot? THKS – Sebastiano Jul 28 '20 at 16:05
  • I did as you asked, also needing to incorporate the \@gobblethree, as given in the other answer. – Steven B. Segletes Jul 28 '20 at 16:25

2 Answers2

2

To fix the infinite loop, this should work:

\documentclass{article}
\usepackage{arcs}

\usepackage{xpatch} \makeatletter \xpatchcmd\over@under@arc {\let \rs@size@warning = @gobbletwo} {\let \rs@size@warning = @gobblethree} {}{\fail} \makeatother

\begin{document} \overarc{A}\overarc{a} \par \underarc{A}\underarc{a} \end{document}

But I'm not capable of providing a math-mode variant. Sorry.

Update:

A poor attempt: $\overarc{$A$}, \underarc{$a$}$.

Or, you can use \overparen and \underparen provided by unicode-math package. This package requires unicode-aware engine like XeTeX or LuaTeX. Those two commands are documented in unimath-symbols.pdf, sec. 5 & 6.

\documentclass{article}

% this uses otf math font "Latin Modern Math" by default \usepackage{unicode-math}

\begin{document} [ \overparen{a} \overparen{A} \overparen{AB} \underparen{a} \underparen{A} \underparen{AB} ] \end{document}

enter image description here

There is a wonderful TeX-SX answer providing updated info about available otf math fonts.

muzimuzhi Z
  • 26,474
  • I, meanwhile, thank you very much from the bottom of my heart. You don't have to worry about me at all if you haven't been able to give a complete answer. My philosophy is simple and you can see it in my profile: to vote positively for the effort, the time dedicated, ...and then above all we should all be united and in solidarity. Only in this way can we make our world slightly better. – Sebastiano Jul 28 '20 at 07:24
  • 1
    @Sebastiano Hi, I've added a unicode-math example. Hope that helps. – muzimuzhi Z Jul 28 '20 at 09:16
  • Always welcome and appreciated every addition. – Sebastiano Jul 28 '20 at 11:20
2

Rather than use the arcs package, I borrowed from my answer at Big tilde in math mode, to adapt for the present purposes. See ADDENDUM for arcs package approach.

Note that I did some vertical squeezing (not in the macro definitions) in the MWE presentation to not have it run off my screen capture.

\documentclass{article}
\usepackage{scalerel}
\usepackage{stackengine,wasysym}

\newcommand\reallywideoverarc[1]{\ThisStyle{% \setbox0=\hbox{$\SavedStyle#1$}% \stackengine{-.5\LMpt}{$\SavedStyle#1$}{% \stretchto{\scaleto{\SavedStyle\mkern.2mu\frown}{.4\wd0}}{.6\ht0}% }{O}{c}{F}{T}{S}% }} \newcommand\reallywideunderarc[1]{\ThisStyle{% \setbox0=\hbox{$\SavedStyle#1$}% \stackengine{1.5\LMpt}{$\SavedStyle#1$}{% \stretchto{\scaleto{\SavedStyle\mkern.2mu\smile}{.4\wd0}}{.6\ht0}% }{U}{c}{F}{T}{S}% }}

\def\test#1{$% \reallywideoverarc{#1}, \scriptstyle\reallywideoverarc{#1}, \scriptscriptstyle\reallywideoverarc{#1} $\par\vspace{-4pt}$% \reallywideunderarc{#1}, \scriptstyle\reallywideunderarc{#1}, \scriptscriptstyle\reallywideunderarc{#1} $\par\vspace{-2pt}}

\parskip 1ex \begin{document}

\test{abcdefghijklm} \test{abcdefghijk} \test{abcdefghi} \test{abcdefg} \test{abcde} \test{abc} \test{ab} \end{document}

enter image description here

p.s. I later found I had done at least a partial answer to this sort of question here: Strange result with patch of \overarc


ADDENDUM

Based on a comment, the OP asked me to elaborate as part of my answer. In trying to actually use the arcs package, I discovered, as did another answer to this question, that the package was not well behaved. The fix to that problem given in the other answer was to change the \@gobbletwo to \@gobblethree in the definition of \over@under@arc. However, that still leaves the result in text mode. To achieve math mode as a default, two additional changes are needed:

\renewcommand{\overarc}[2][1]{\over@under@arc{#1}{$#2$}\z@}
\renewcommand{\underarc}[2][1]{\over@under@arc{#1}{$#2$}\@ne}

With those three changes the result will be set in math mode. However, the \overarc` does not have an italic correction to the arc itself.

\documentclass[a4paper,12pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc} 
\usepackage{amssymb, amsmath}
\usepackage{arcs}
\usepackage{xpatch}
\makeatletter
\xpatchcmd\over@under@arc
  {\let \rs@size@warning = \@gobbletwo}
  {\let \rs@size@warning = \@gobblethree}
  {}{\fail}
\renewcommand{\overarc}[2][1]{\over@under@arc{#1}{$#2$}\z@}
\renewcommand{\underarc}[2][1]{\over@under@arc{#1}{$#2$}\@ne}
\makeatother
\begin{document}
\overarc{A}
\overarc{AB}
\underarc{A}
\underarc{AB}
\end{document}

enter image description here