Thanks to Good way to make \textcircled numbers?, I found a way to circle numbers in the legend of a figure. Here is the command code :
\newcommand{\circled}[1]{\tikz[baseline=(char.base)]{\node[shape=circle,draw,inner sep=1.5pt](char){#1}}}
And here is my code :
\begin{figure}[t!]
\centering
\begin{minipage}[b]{.75\linewidth}
\centering
\centerline{\includegraphics[width=0.9\linewidth]{./Introduction/images/tirf}}
\centerline{\scriptsize{(a)}}\medskip
\end{minipage}
\caption{(Cis-)total internal reflection fluorescence microscope (TIRFM) diagram Specimen Evanescent wave range Cover slip Immersion oil Objective Emission beam (signal) Excitation beam.
\circled{1} Specimen.
\circled{2} Evanescent wave range.
\circled{3} Cover slip.
\circled{4} Immersion oil.
\circled{5} Objective.
\circled{6} Emission beam (signal).
\circled{7} Excitation beam.
Illustration created and released in public domain by Dawid Kulik.}
\label{fig:tirf}
\end{figure}
Problem is, I get these errors when compiling.
! Undefined control sequence.
<recently read> \tikz@origsemi
l.1123 ...leased in public domain by Dawid Kulik.}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., \hobx'), typeI' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Undefined control sequence.
<recently read> \tikz@origcolon
l.1123 ...leased in public domain by Dawid Kulik.}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., \hobx'), typeI' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Undefined control sequence.
\tikz@deactivatthings ...kz@nonactivecolon }\def |
{\tikz@nonactivebar }\def ...
l.1123 ...leased in public domain by Dawid Kulik.}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., \hobx'), typeI' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Argument of \tikz@style@parseA has an extra }.
<inserted text>
\par
l.1123 ...leased in public domain by Dawid Kulik.}
I've run across a }' that doesn't seem to match anything. For example,\def\a#1{...}' and \a}' would produce this error. If you simply proceed now, the\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your }' was spurious, just type2' and it will go away.
Runaway argument?
(char.base)]{\node shape=circle,draw,inner sep=2pt{1}} Specim\ETC.
! Paragraph ended before \tikz@style@parseA was complete.
<to be read again>
\par
l.1123 ...leased in public domain by Dawid Kulik.}
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
Strangely enough, everything looks fine in the PDF and the numbers are circled correctly. I have been investigating for hours and I still can't find out what is the problem. I tried removing and/or changing parameters in the \newcommand, searching for missing {}, moving the \circled commands outside the picture legend, explicitely adding the TikZ package in my main, etc. Nothing gave me a clue of what is happening, and I'm lost.
I thought of an package incompatibility but I have no idea which one could be causing a problem. FYI these are the ones I use :
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}
\usepackage{ntheorem}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
The TikZ package seems to be already included in the template I am using.

tikzin your preamble!) don't you prepare a minimal, compilable example that shows the problem? It'll help a lot! – Rmano Jun 23 '21 at 10:48