In the first version of the answer to my question Gödel codes with rounded Cornes?, Sandy G offered the following solution:
\newcommand{\godel}[1]{{}\mathbin{\vcenter{\hbox{\tikz{
\node[inner ysep=-1pt, inner xsep=3pt](M){$#1\strut$};
\draw[rounded corners=.5mm]([xshift=-1mm]M.north east)--(M.north east)--++(0,-.1);
\draw[rounded corners=.5mm]([xshift=1mm]M.north west)--(M.north west)--++(0,-.1);
}}}}{}}
The solution is quite satisfactory for my document, except that many errors are produced, so that the document does not compile, if I put $\godel{A}$ in the title of a section. I tried two ways to protect it, via. $\protect\godel{A}\protect$ and $\protect\godel[thick]{A}$.
Are there other ways to protect $\godel{A}$ in section titles which may help me out?


\DeclareRobustCommandinstead of\newcommand– egreg Feb 09 '23 at 21:30\subsection{.$\godel{a}$.}or\subsection{.$\godel[thick]{a}$.}(with the macro\godelhaving been copied from the answer you reference) produces no errors on my system -- MacOS 13.2 "Ventura"; MacTeX2022; pdfTeX Version 3.141592653-2.6-1.40.24; LaTeX2e <2022-11-01> patch level 1; and L3 programming layer <2023-02-07>. Note that I don't find there's a need for\protect. – Mico Feb 09 '23 at 21:33\jobname.log). In my log file, the first line -- which is quite long -- saysThis is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022) (preloaded format=pdflatex 2023.2.9) 9 FEB 2023 23:10. MacTeX is TeX Live with some graphical tools. The log file is produced by TeX, not by Finder. – Mico Feb 09 '23 at 22:13