How can I, using standard tools and packages, draw a "smile" over a letter?
For example, I can typeset \wideparen{x}
using yhmath
package, but I need that arc to be upside down. Of course I want it to be extandable as \wideparen
did. Which standard command should I use?
2 Answers
Loosely based on answer at Big tilde in math mode (but this update avoids the use of array
environment):
\documentclass{article}
\usepackage{scalerel}
\usepackage{stackengine}
\stackMath
\newcommand\reallywidesmile[1]{%
\stackon[0.5pt]{#1}{%
\stretchto{%
\scaleto{%
\scalerel*[\widthof{#1}]{\mkern-1.5mu\smile\mkern-2mu}%
{\rule[-\textheight/2]{1ex}{\textheight}}%
}{\textheight}%
}{0.8ex}}%
}
\parskip 1ex
\begin{document}
$\reallywidesmile{zbcdefghijklm}$
$\reallywidesmile{zbcdefghijk}$
$\reallywidesmile{zbcdefghi}$
$\reallywidesmile{zbcdefg}$
$\reallywidesmile{zbcde}$
$\reallywidesmile{zbc}$
$\reallywidesmile{zb}$
$\reallywidesmile{z} = 0$
\end{document}
-
(+1) for your effort, but it is not a standard tool, it is the one you invented. As it was pointed in comments, it seems that there is no standard command here.– NorbertJan 6, 2014 at 14:44
On a french forum (mathematex), they offer to define a new \wideinvparen{}
command using the \wideparen{}
command of the yhmath
package as below:
\makeatletter
\newlength{\temp@wip@width}
\newlength{\temp@wip@height}
\newcommand{\wideinvparen}[1]{%
\vfuzz=30pt% BAD: to remove overfull vbox warnings...
\setlength{\temp@wip@width}{\widthof{$#1$}}%
\setlength{\temp@wip@height}{\heightof{$#1$}}%
#1\hspace{-\temp@wip@width}%
\raisebox{\temp@wip@height+1pt}[\heightof{$\wideparen{#1}$}]%
{\rotatebox[origin=c]{180}{\vbox to 0pt{\hbox{$\wideparen{\hphantom{#1}}$}}}}%
}
\makeatother
It requires to use the packages graphicx
and calc
too and it is written on the forum that it can't be used as a subscript/superscript.
Minimal working example
\documentclass[varwidth,margin=0.5cm]{standalone}
\DeclareSymbolFont{yhlargesymbols}{OMX}{yhex}{m}{n} % To load only \wideparent, or:
\DeclareMathAccent{\wideparen}{\mathord}{yhlargesymbols}{"F3} % \usepackage{yhmath}
\usepackage{graphicx}
\usepackage{calc}
\makeatletter
\newlength{\temp@wip@width}
\newlength{\temp@wip@height}
\newcommand{\wideinvparen}[1]{%
\vfuzz=30pt% BAD: to remove overfull vbox warnings...
\setlength{\temp@wip@width}{\widthof{$#1$}}%
\setlength{\temp@wip@height}{\heightof{$#1$}}%
#1\hspace{-\temp@wip@width}%
\raisebox{\temp@wip@height+1pt}[\heightof{$\wideparen{#1}$}]%
{\rotatebox[origin=c]{180}{\vbox to 0pt{\hbox{$\wideparen{\hphantom{#1}}$}}}}%
}
\makeatother
\begin{document}
$\wideinvparen{A}$ \quad
$\wideinvparen{AB}$ \quad
$\wideinvparen{ABC}$ \quad
$\wideinvparen{ABCD}$ \quad
$\wideinvparen{ABCDE}$ \quad
\end{document}
\wideparen
around its center point, and choosing the size in the same way as done byyhmath
ormathabx
. if i can find time, i will experiment. another possible approach is to scale the\smile
symbol in one axis only, but that would almost certainly result in an unsatisfactory deformation of the shape.