stone-zeng / fduthesis

LaTeX thesis template for Fudan University
LaTeX Project Public License v1.3c
811 stars 205 forks source link

引用环境中添加定义/定理等 #303

Open Ericcc0921 opened 1 year ago

Ericcc0921 commented 1 year ago

目前\cite命令 \cite[Definition 1]{label 1}的编译结果是 上标{[label 1],Definiton 1}的格式,请问该如何修改可以使定义 Definition 1和label 1一起括进方括号,[label 1, Definition 1 ].

atxy-blip commented 1 year ago

一种 biblatex 方案:

\documentclass{fduthesis}
\fdusetup{style={auto-make-cover=false, bib-backend=biblatex}}
\begin{filecontents}{test.bib}
@article{a,title={A}}
\end{filecontents}
\addbibresource{test.bib}

% 定义自行使用的引用命令
\usepackage{etoolbox}
\AtEndPreamble{
  \DeclareCiteCommand{\mycite}[\mkbibsuperscript]
    {\mkbibleftborder\usebibmacro{cite:init}\usebibmacro{prenote}}
    {\usebibmacro{citeindex}\usebibmacro{cite:comp}}
    {}
    {\multicitedelim\usebibmacro{cite:dump}%
    ~\usebibmacro{postpages}\mkbibrightborder}
}

\begin{document}
特别的引用命令\mycite[definition 1]{a}
\printbibliography
\end{document}
image