I mean how to add the red words in the figure.
\documentclass{article}
\begin{document}
\tableofcontents
\section{section 1}
% This is an example.
\section{section 2}
% This is an example.
\end{document}
I mean how to add the red words in the figure.
\documentclass{article}
\begin{document}
\tableofcontents
\section{section 1}
% This is an example.
\section{section 2}
% This is an example.
\end{document}
memoirclass has features to do this. You can of course steal the code frommemoirif you're using a different class. – daleif Jan 12 '23 at 09:43\documentclass{...}and ending with\end{document}. – dexteritas Jan 12 '23 at 10:03