9

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?

Norbert
  • 273
  • as far as i know, there is no "extensible upside-down arc". i think one could be concocted by rotating the \wideparen around its center point, and choosing the size in the same way as done by yhmath or mathabx. 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. – barbara beeton Jan 05 '14 at 18:17
  • 1
    there is sufficient justification for extensible wide "decorations" of various sorts to consider them for inclusion in unicode; at present, all the "wide" combining diacritics are specifically intended to cover exactly two characters. i will pursue this possibility. – barbara beeton Jan 05 '14 at 18:19

2 Answers2

5

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}

enter image description here

  • (+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. – Norbert Jan 06 '14 at 14:44
1

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}

Output

Output of a extandable upside down arc

remjg
  • 2,486