如何在乳胶中为引用和参考文献编号添加前缀?

如何在乳胶中为引用和参考文献编号添加前缀?

我想在参考列表中添加前缀 P,因此:

(1)列表将如下所示

参考

[第1页]...

[P2].​​.

(2)当我引用它们时,它们也显示为[P1]。

我在序言中添加了以下内容

\makeatletter

\def\@biblabel#1{[P#1]}

\makeatother

但这满足了第一个要求,而不是第二个要求。所以现在当我引用时,引用仍然显示为 [1]。

如何解决这个问题?

谢谢

答案1

此解决方案仅适用于旧版本(3.4)biblatex

我认为您正在寻找以下解决方案:

\documentclass{article}

\usepackage[backend=bibtex]{biblatex}


\addbibresource{\jobname.bib}

\usepackage{filecontents}

\begin{filecontents*}{\jobname.bib}
  @book{lamport1994latex,
    title={LATEX: a document preparation system: user's guide and reference manual},
    author={Lamport, Leslie},
    year={1994},
    publisher={Addison-wesley}
  }
  @book{mittelbach2004latex,
    title={The LATEX companion},
    author={Mittelbach, Frank and Goossens, Michel and Braams, Johannes and Carlisle, David and Rowley, Chris},
    year={2004},
    publisher={Addison-Wesley Professional}
  }
\end{filecontents*}

\pagenumbering{gobble}

\begin{document}

\cite{lamport1994latex} is the one we started our journey with. Then
we also got~\cite{mittelbach2004latex}.  Both
\cite{lamport1994latex,mittelbach2004latex} are good ones.

\printbibliography[prefixnumbers=P]

\end{document}

在此处输入图片描述


详情请参阅biblatex文档

答案2

对于当前版本的biblatex,您需要使用refcontexts 来labelprefix

\documentclass{article}

\usepackage[backend=biber,defernumbers=true]{biblatex}
\addbibresource{\jobname.bib}

\usepackage{filecontents}

\begin{filecontents*}{\jobname.bib}
  @book{lamport1994latex,
    title={LATEX: a document preparation system: user's guide and reference manual},
    author={Lamport, Leslie},
    year={1994},
    publisher={Addison-wesley}
  }
  @book{mittelbach2004latex,
    title={The LATEX companion},
    author={Mittelbach, Frank and Goossens, Michel and Braams, Johannes and Carlisle, David and Rowley, Chris},
    year={2004},
    publisher={Addison-Wesley Professional}
  }
\end{filecontents*}

\begin{document}
\newrefcontext[labelprefix=P]

\cite{lamport1994latex} is the one we started our journey with. Then
we also got~\cite{mittelbach2004latex}.  Both
\cite{lamport1994latex,mittelbach2004latex} are good ones.

\printbibliography
\end{document}

相关内容