This was a very good starting point for the solution below, which is still not perfect for my usecase.
I've tried to adapt it to show 3 circled letters with zero or more intervening letter between the circled ones and zero or more letters right out of the first and third circle. In other words, the desired scheme is that I want to type xOxOxOx
, where each O
represents a single circled possibly different letter, and each x
represents a sequence of zero or more letters. The desired result is something like this (the code is below):
What I don't like of this solution is that I had to hardcode a 1.3
multiplicative factor for \f@size
. Indeed, if I remove *1.3
, the size of the circle around m will be bigger than that of the circles around i and j. The 1.6 in the linked answer seemed a bit too much.
Here's the MWE verified on David Carlisle's TeXlive.net:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\makeatletter
\newcommand\stencil[7]{%
\tikz[outer sep=0, inner sep=0, baseline=(A.base), anchor=west]{
\node (A) {\vphantom{Wpm}#1};
\node[shape=circle, draw, minimum height={\f@size*1.3}] (B) at (A.east) {\vphantom{Wpm}#2};
\node (C) at (B.east) {\vphantom{Wpm}#3};
\node[shape=circle, draw, minimum height={\f@size*1.3}] (D) at (C.east) {\vphantom{Wpm}#4};
\node (E) at (D.east) {\vphantom{Wpm}#5};
\node[shape=circle, draw, minimum height={\f@size*1.3}] (F) at (E.east) {\vphantom{Wpm}#6};
\node (G) at (F.east) {\vphantom{Wpm}#7};
}%
}
\makeatother
before\stencil{h}{i}{j}{k}{}{m}{}after
beforeh
before \stencil{h}{i}{j}{k}{}{m}{} after
before h
\end{document}