字母上方的弧线排版颠倒

字母上方的弧线排版颠倒

如何使用标准工具和包在字母上画一个“笑脸”?例如,我可以\wideparen{x}使用yhmath包进行排版,但我需要将弧线倒置。当然,我希望它像\wideparen之前一样可以延伸。我应该使用哪个标准命令?

答案1

大致基于数学模式中的大波浪符号(但本次更新避免了使用array环境):

\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

答案2

在法国论坛上(数学),他们建议使用包的命令定义一个新\wideinvparen{}命令,如下所示:\wideparen{}yhmath

\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

它也需要使用包graphicxcalc,并且论坛上写道它不能用作下标/上标。

最小工作示例

\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 of a extandable upside down arc

相关内容