1

I have this very good macro with 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}

But today, I don't use PStricks anymore.Can you do exactly the same but with TikZ?

1
  • 2
    You should really be more forthcoming... what does the output look like? Can you include that as an image in your post?
    – Werner
    Commented Apr 27, 2023 at 23:43

2 Answers 2

2

Something like this maybe (it is not exactly the same tough ...):

\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}

enter image description here

2

The PSTricks solution a bit shorter:

\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}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .