extension symbol

The approach here is a little complicated. Why?

  1. need to get the symbol centered between the two glyphs, even if the two glyphs are of different widths

  2. Need to make work across math styles.

  3. Need to make the accent glyph leave the spacing unchanged in the underlying glyphs.

  4. Need to auto-adjust vertical placement depending on height of underlying glyphs.

The MWE:

\documentclass{article}
\usepackage{amssymb,stackengine,scalerel}
\begin{document}
\newcommand\ext[2]{%
 \ThisStyle{
  \setbox0=\hbox{\ooalign{$\SavedStyle#1$\cr$\SavedStyle#2$}}
  \setbox2=\hbox{$\SavedStyle#1$}
  \setbox4=\hbox{$\SavedStyle#2$}
  \kern-\wd0\kern\wd2
  \ensurestackMath{
  \stackengine{-1.6\LMpt}{\makebox[\wd0][r]{$\SavedStyle#1$}
    \makebox[\wd0][l]{$\SavedStyle#2$}}
    {\kern1\LMpt\SavedStyle\scaleobj{.6}{\smallfrown}}{O}{c}{F}{F}{S}
  \kern-\wd0\kern\wd4}
 }
}

$ximaeijx$

$x\ext{i}{m}\ext{a}{e}\ext{i}{j}x$

$\scriptstyle x\ext{i}{m}\ext{a}{e}\ext{i}{j}x$

$\scriptscriptstyle x\ext{i}{m}\ext{a}{e}\ext{i}{j}x$
\end{document}

enter image description here


ADDENDUM:

A perhaps better and certainly shorter way to get an essentially similar result, achieved by merely vertical lapping the scaled \smallfrown between the two arguments:

\documentclass{article}
\usepackage{amssymb,stackengine,scalerel}
\newcommand\ext[2]{%
 \ThisStyle{\setbox0=\hbox{$\SavedStyle#1#2$}#1
  \tclap[\dimexpr\ht0-.5\LMpt]
  {$\kern1\LMpt\SavedStyle\scaleobj{.6}{\smallfrown}$}#2}
}
\begin{document}
$ximaeijx$

$x\ext{i}{m}\ext{a}{e}\ext{i}{j}x$

$\scriptstyle x\ext{i}{m}\ext{a}{e}\ext{i}{j}x$

$\scriptscriptstyle x\ext{i}{m}\ext{a}{e}\ext{i}{j}x$
\end{document}

One can just add a switch to the simpler-wick package. (These look like Wick contractions except that they are round.)

\documentclass[fleqn]{article}
\usepackage[sep=3pt,offset=0.5ex]{simpler-wick}
\newif\ifWickRound
\WickRoundfalse
\pgfkeys{
  /simplerwick/round/.code={\WickRoundtrue},
}

\makeatletter
\def\swick@end#1#2{
  \swick@setfalse@#1
  \tikzexternaldisable
  \begin{tikzpicture}[remember picture, baseline=(swick-close#1.base)]
    \node[use as bounding box, inner sep=0pt, outer sep=0pt] (swick-close#1) {$\displaystyle #2$};
  \end{tikzpicture}
  \tikz[remember picture, overlay]
{
\ifWickRound
    \draw[white,line width=2pt,postaction={draw,black,thin}] 
        let \p1=(swick-open#1.north),\p2=(swick-close#1.north),
        \n1={max(\y1,\y2)+1pt}
    in (\x1,\n1) to[out=60,in=120] (\x2,\n1);
\else
    \draw ($(swick-open#1.north) + (0, 3pt)$) 
          -- ($(swick-open#1.base) + (0, \swick@offset) + #1*(0, \swick@sep)$) 
          -- ($(swick-close#1.base) + (0, \swick@offset) + #1*(0, \swick@sep)$) 
          -- ($(swick-close#1.north) + (0, 3pt)$);
\fi}
\tikzexternalenable}
\makeatother

\begin{document}
\[\wick[round]{\c1x\c1y+3\c2x\c3y+2\c2 x+\c3z}\]
\end{document}

enter image description here

Please note that the appearance is very easy to modify. If you give feedback I'll be happy to adjust it to your needs.

ADDENDUM: This modifies the appearance according to your comment. (I am not sure if I interpret it correctly, though. Of course one can change the line width.)

\documentclass[fleqn]{article}
\usepackage[sep=3pt,offset=0.5ex]{simpler-wick}
\newif\ifWickRound
\WickRoundfalse
\pgfkeys{
  /simplerwick/round/.code={\WickRoundtrue},
}

\makeatletter
\def\swick@end#1#2{
  \swick@setfalse@#1
  \tikzexternaldisable
  \begin{tikzpicture}[remember picture, baseline=(swick-close#1.base)]
    \node[use as bounding box, inner sep=0pt, outer sep=0pt] (swick-close#1) {$\displaystyle #2$};
  \end{tikzpicture}
  \tikz[remember picture, overlay]
{
\ifWickRound
    \draw[white,line width=2pt,postaction={draw,black,thin,line cap=butt}] 
        let \p1=(swick-open#1.north west),\p2=(swick-close#1.north west),
        \p3=(swick-open#1.north east),\p4=(swick-close#1.north east),
        \n1={max(\y1,\y2)+1pt},\n2={0.2*\x1+0.8*\x3},\n3={0.8*\x2+0.2*\x4}
    in (\n2,\n1) to[out=60,in=120] (\n3,\n1);
\else
    \draw ($(swick-open#1.north) + (0, 3pt)$) 
          -- ($(swick-open#1.base) + (0, \swick@offset) + #1*(0, \swick@sep)$) 
          -- ($(swick-close#1.base) + (0, \swick@offset) + #1*(0, \swick@sep)$) 
          -- ($(swick-close#1.north) + (0, 3pt)$);
\fi}
\tikzexternalenable}
\makeatother

\begin{document}
\[\wick[round]{\c1x\c1y+3\c2x\c3y+2\c2 x+\c3z}\]
\end{document}

enter image description here

Tags:

Symbols