我有这个非常好的 PStricks 宏。
\documentclass{article}
\usepackage{pst-node}
\newcommand*\Tsemb[2]{%
\quitvmode$\vcenter{\vbox{\setbox0\hbox{#1}\setbox1\hbox{#2}\hsize\wd\ifdim\wd0>\wd1 0 \else1 \fi
\offinterlineskip\psset{unit=1ex}%
\hbox to\hsize{\pnode(0,0.2){tl}\hss\pnode(0,1.3){tc}\hss\pnode(0.3,0.5){tr}\pnode(0.35,0.45){tr1}}
\hbox to\hsize{\pnode(-0.2,0){al}\hss#1\hss}\vskip2ex
\hbox to\hsize{\hss#2\hss\pnode(0,2){c}}
\hbox to\hsize{\pnode(-0.35,-0.45){bl1}\pnode(-0.3,-0.5){bl}\hss\pnode(0,-1.3){bc}\hss\pnode(0.2,-0.2){br}}
}}$%
\psecurve[linewidth=0.8pt](tr1)(tr)(tc)(tl)(al)(c)(br)(bc)(bl)(bl1)\hskip1ex
}
\begin{document}
\Tsemb{ABC}{XYZ} and \Tsemb{A'B'C'}{ABC} are similar.
\end{document}
但是今天,我不再使用 PStricks 了。您可以用 做同样的事情吗TikZ
?
答案1
可能是这样的(不是确切地一样的坚韧......):
\documentclass{article}
\usepackage{tikz}
\newcommand*\Tsemb[2]{%
\begin{tikzpicture}[baseline=0pt]
\pgfmathsetmacro{\mwidth}{max(width"#1",width"#2")}
\node[inner sep=0pt, minimum width=\mwidth] (A) at (0,0.75em) {\strut #1};
\node[inner sep=0pt, minimum width=\mwidth] (B) at (0,-0.75em) {\strut #2};
\draw[thick] (A.north east)
to[out=150, in=30, distance=5pt] (A.north west)
to[out=210, in=150, distance=5pt] (A.south west)
to[out=330, in=150, distance=5pt] (B.north east)
to[out=330, in=30, distance=5pt] (B.south east)
to[out=210, in=330, distance=5pt] (B.south west);
\end{tikzpicture}%
}
\begin{document}
\Tsemb{ABC}{XYZ} and \Tsemb{A'B'C'}{ABC} are similar.
\end{document}
答案2
PSTricks 解决方案稍微简短一些:
\documentclass{article}
\usepackage{pst-node}
\newcommand*\Tsemb[2]{%
\tabular{c}
\psDefBoxNodes{A}{#1}\\\psDefBoxNodes{B}{#2}
\endtabular%
\psecurve[linewidth=0.8pt](A:br)(A:tr)(A:tl)(A:bl)(B:tr)(B:br)(B:bl)(B:tl)%
}
\begin{document}
\Tsemb{ABC}{XYZ} and \Tsemb{A'B'C'}{ABC} are similar.
\end{document}