将尾注的样式更改为带圆圈的数字

将尾注的样式更改为带圆圈的数字

我读了我想在这些阿拉伯数字后面加上圆圈,作为尾注。
顺便说一句,我想保留阿拉伯数字作为脚注。

\renewcommand\theendnote{\textcircled{\@arabic\c@endnote}}

上面的代码出错了。
提前谢谢您!

答案1

我解决了这个问题。
不过它并不像我之前想象的那么简单。

\documentclass[UTF8]{ctexbook}
\usepackage{endnotes}
\usepackage{xpatch}
\usepackage{xunicode-addon}
%
% common settings
%

% use specific font inside \textcircled
% ref: https://stone-zeng.github.io/2019-02-09-circled-numbers
\AtBeginUTFCommand[\textcircled]{\begingroup\EnclosedNumbers}
\AtEndUTFCommand[\textcircled]{\endgroup}

% set char class and font for circled numbers
\xeCJKDeclareCharClass{Default}{"24EA, "2460->"2473, "3251->"32BF}
\newfontfamily\EnclosedNumbers{Source Han Serif SC}

% for use on overleaf, you can try
% \AtBeginUTFCommand[\textcircled]{\begingroup\normalsize\EnclosedNumbers}
% \newfontfamily\EnclosedNumbers{Garamond-Math.otf}
\renewcommand\theendnote{\textcircled@protected{\@arabic\c@endnote}}

% a protected variant for use in \theendnote, which will be fully-expanded
\protected\def\textcircled@protected{\textcircled}

% overleaf doesn't like this approach
% \let\textcircled@old\textcircled
% \protected\def\textcircled#1{%
%  \expandafter\textcircled@old\expandafter{\expanded{#1}}}

% adjust position of circled number
\xpatchcmd\enoteformat
  {\makeenmark}
  {\makeenmark@nosuperscript}
  {}{\fail}
% before
% \def\@makeenmark{\hbox{\@textsuperscript{\normalfont\@theenmark}}}
\def\makeenmark@nosuperscript{%
  \lower .3ex \hbox{\normalfont\@theenmark\space}}
\makeatother

\begin{document}
\section{Footnotes}
xxx\footnote{text}

\addtocounter{footnote}{20}
xxx\footnote{text}

\addtocounter{footnote}{20}
xxx\footnote{text}

\section{Endnotes}
xxx\endnote{text}
    
\addtocounter{endnote}{20}
xxx\endnote{text}

\addtocounter{endnote}{20}
xxx\endnote{text}

\theendnotes
\end{document}

谢谢

相关内容