# \circlearound: Misalign of the circle center

I am using the following code, which I found here at StackExchange to draw a circle around some letters:

\newcommand\circlearound[1]{%
\setbox0=\hbox{#1}%
\dimen0\wd0%
\divide\dimen0 by 2%
\begin{tikzpicture}[baseline=(a.base)]%
\useasboundingbox (-\the\dimen2,0pt) rectangle (\the\dimen0,1pt);
\node[circle,draw,minimum size=1.4em,outer sep=0pt,inner sep=0.2ex] (a) {#1};
\end{tikzpicture}
}


This works fine for normal letter but there is a misalignment for cursive fonts (italic type). Therefore, I want to define a second command \circlearoundItalic in which I misalign the center of the circle by 0.2em. Does anybody know the TikZ code to move the center of the circle by 0.2em to the right?

Thank you!

In general such things can be adjusted using execute at begin node and execute at end node. More specifically, you could add

execute at begin node=\hspace*{-0.02em},execute at end node=\hspace*{0.02em}


to the node options, where you can change 0.02em to whatever looks good to you. Note that there is the rather new command \tikzmarknode which comes with the newest version of the tikzmark library and allows us to simplify things even more.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\tikzset{normcirc/.style={circle,draw,inner sep=0.25em},
itcirc/.style={normcirc,font=\itshape,execute at begin
node=\hspace*{-0.02em},execute at end node=\hspace*{0.02em}}
}
\begin{document}
\tikzmarknode[normcirc]{a1}{a}
\tikzmarknode[itcirc]{a2}{a}
\end{document}


• Thanks a lot that works great! But I have two additional questions: Is there a way to avoid the manual mark ({a1}, {a2})? It is quite annoying to take care of it in hundred cases.... Can I combine this with the enumerate environment? Until now I was using the command \begin{enumerate}[label=\protect\circlearound{\arabic*}] - how does this work with the tikzmarknode? Thanks again! – Candu Apr 27 at 19:33
• Sorry I clicked the check mark right now... I still have the problem that it doesn't work with enumerate environments.... – Candu Apr 27 at 21:57