我想做类似的事情关联,它在两个引文之间添加一个单词。当我有一系列引文(连续超过 2 个)时,它会将连字符更改为单词“to”。出于某种原因,更改 \compcitedelim 对我来说不起作用。感谢您的任何建议。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[backend=biber, sorting=none, style=numeric-comp]{biblatex}
\addbibresource{test.bib}
\title{Test}
\author{T. Est }
\date{November 2019}
\renewcommand*{\compcitedelim}{\bibstring{to}}
\renewcommand*{\multicitedelim}{\bibstring{to}
\begin{document}
\maketitle
\section{Introduction}
Test \cite{key1, key2, key3}.
\printbibliography
\end{document}
书目 test.bib 有三个条目
@misc{key1,
author = {Author, O.},
title = {The First Citation},
year = {2019},
howpublished = {Unpublished},
}
@misc{key2,
author = {Author, T.},
title = {The Second Citation},
year = {2019},
howpublished = {Unpublished},
}
@misc{key3,
author = {Author, T.},
title = {The Third Citation},
year = {2019},
howpublished = {Unpublished},
}
答案1
破折号 ( \bibrangedash
) 在 bibmacro 中是硬编码的cite:dump
(v3.13anumeric-comp.cbx
中的第 87-99 行biblatex
),但可以用可自定义的宏替换它,\comprangedelim
比如
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[backend=biber, sorting=none, style=numeric-comp]{biblatex}
\NewBibliographyString{to}
\DefineBibliographyStrings{english}{
to = {to},
}
\newcommand*{\comprangedelim}{\addspace\bibstring{to}\space}
\makeatletter
\renewbibmacro*{cite:dump}{%
\ifnumgreater{\value{cbx@tempcnta}}{0}
{\ifnumgreater{\value{cbx@tempcnta}}{1}
{\comprangedelim}
{\multicitedelim}%
\bibhyperref[\cbx@lastkey]{%
\ifdef\cbx@lastprefix
{\printtext[labelprefix]{\cbx@lastprefix}}
{}%
\printtext[labelnumber]{\cbx@lastnumber}}}
{}%
\setcounter{cbx@tempcnta}{0}%
\global\undef\cbx@lastprefix}
\makeatother
\addbibresource{biblatex-examples.bib}
\begin{document}
Test \cite{sigfridsson,worman,geer}.
\printbibliography
\end{document}
\compcitedelim
仅用于和系列-comp
的样式。它用于区分同一作者的引文(作者姓名被删除)。authortitle
authoryear
\documentclass{article}
\usepackage[backend=biber, style=authoryear-comp]{biblatex}
\usepackage{xcolor}
\addbibresource{biblatex-examples.bib}
\begin{document}
\cite{knuth:ct:a,knuth:ct:b}
\cite{sigfridsson,worman}
\renewcommand*{\compcitedelim}{\addspace \textcolor{red}{C}\space}
\renewcommand*{\multicitedelim}{\addspace \textcolor{blue}{M}\space}
\cite{knuth:ct:a,knuth:ct:b}
\cite{sigfridsson,worman}
\printbibliography
\end{document}