我使用以下程式碼為文字中引用的括號著色。這對於括號之間的逗號和連字號也適用。然而,後續標點符號的顏色也發生了變化。有沒有辦法讓這些標點符號以標準文字顏色顯示?
請注意,為了編譯下面的範例,您可能必須將預設參考書目工具變更為 Biber。
\documentclass[a4paper,twoside,openright,chapterprefix=true,11pt]{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[doi=false,url=true,isbn=false,sorting=none,style=numeric-comp,bibencoding=utf8,babel=other,backend=biber]{biblatex}
\usepackage[utf8]{inputenc}
\usepackage[ngerman,american]{babel}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\definecolor{CeruleanRef}{RGB}{12,127,172}
\usepackage[colorlinks=true, citecolor=CeruleanRef]{hyperref}
\begin{filecontents}{bibname.bib}
@book{Lehner2014,
author = {Lehner, Markus and Tichler, Robert and Koppe, Markus},
doi = {10.1007/978-3-319-03995-4},
file = {:Users/lima/ICP/Literatur/Power-to-Gas- Technology and Business Models.pdf:pdf},
isbn = {978-3-319-03994-7},
title = {{Power-to-Gas: Technology and Business Models}},
year = {2014}
}
@article{Garcia2014,
author = {Garcia-Fresnillo, L. and Shemet, V. and Chyrkin, A. and de Haart, L.G.J. and Quadakkers, W.J.},
doi = {10.1016/j.jpowsour.2014.07.189},
file = {:Users/lima/Library/Application Support/Mendeley Desktop/Downloaded/Garcia-Fresnillo et al. - 2014 - Long-term behaviour of solid oxide fuel cell interconnect materials in contact with Ni-mesh during e(2).pdf:pdf},
issn = {03787753},
journal = {J. Power Sources},
month = dec,
pages = {213--222},
publisher = {Elsevier B.V},
title = {{Long-term behaviour of solid oxide fuel cell interconnect materials in contact with Ni-mesh during exposure in simulated anode gas at 700 and 800}},
url = {http://linkinghub.elsevier.com/retrieve/pii/S0378775314012531},
volume = {271},
year = {2014}
}
\end{filecontents}
\bibliography{bibname.bib}
\DeclareCiteCommand{\cite}[\color{CeruleanRef}\mkbibbrackets]
{\usebibmacro{cite:init}%
\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{cite:comp}}
{}
{\usebibmacro{cite:dump}%
\usebibmacro{postnote}}
\begin{document}
test
\cite{Lehner2014} and \cite{Garcia2014} but \cite{Lehner2014}. Or \cite{Lehner2014,Garcia2014}, which has
\end{document}
答案1
您可以定義自己的括號指令(或重新定義 \mkbibbrackets):
\makeatletter
\newrobustcmd{\mkbibbracketscolor}[1]{%
\begingroup%
\blx@blxinit
\blx@setsfcodes
\color{CeruleanRef}\bibopenbracket#1\bibclosebracket%
\endgroup}
\makeatother
\DeclareCiteCommand{\cite}[\mkbibbracketscolor]
{\usebibmacro{cite:init}%
\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{cite:comp}}
{}
{\usebibmacro{cite:dump}%
\usebibmacro{postnote}}