supercite 和 hyperref 颜色

supercite 和 hyperref 颜色

hyperref我有一个小问题:我已经使用包选项( )更改了超级数字的颜色citecolor=gray,但逗号和破折号仍然是黑色。

我们怎样才能改变破折号的颜色?

\documentclass[a4paper,11pt]{book}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=3cm]{geometry} 
\usepackage[T1]{fontenc}
\usepackage[french]{babel}     \setlength{\parindent}{10mm}      \usepackage{makeidx} 
\usepackage{imakeidx}
\makeindex[intoc] 
\setcounter{tocdepth}{5} 
\usepackage{enumitem} 
\usepackage{lmodern}         
\usepackage{graphicx}           
\usepackage{amssymb,amsthm, amsbsy,amsfonts}      
\usepackage{siunitx} 
\usepackage{mhchem}              
\usepackage{pgf-spectra}         
\usepackage[final]{pdfpages}
\usepackage{booktabs} 
\usepackage{array,multirow,multicol,graphicx, xcolor, colortbl, hhline} 
\usepackage[labelfont={sc}, textfont=it, labelsep=endash, justification=centering]{caption} 
\def\frenchtablename{Tableau}
\usepackage[  
   autopunct=true, giveninits=true, backend=bibtex, sorting=none, sortlocale=auto, notetype=foot+end, style=numeric-comp, maxnames=10, maxbibnames=100, doi=true, isbn=true, url=false, eprint=true]{biblatex}
\setlength\bibitemsep{0.3\baselineskip}
\addbibresource{library.bib} 
\AtBeginBibliography{\small}
\usepackage{csquotes} %pour biblatex


\usepackage[colorlinks=true, frenchlinks=true, linkcolor=black,filecolor=magenta,urlcolor=blue, citecolor=gray]{hyperref}
\urlstyle{same}
%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

bla bla bla \supercite{Toto1900,Toto1901,Toto1902}

\printbibliography  
\end{document}

破折号为黑色,数字 1 和 3 为灰色

答案1

hyperref'scitecolor只会对实际链接的引文部分进行着色。短划线没有链接,因此没有颜色。

您可以重新定义\supercite,以便无论引用输出的哪些位实际链接,它始终是完全彩色的。

\documentclass[a4paper,11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage{lmodern}
\usepackage{csquotes}
\usepackage[backend=bibtex,
  style=numeric-comp,
  sorting=none,
  maxcitenames=10, maxbibnames=100,
  giveninits=true,
  doi=true, isbn=true, url=false, eprint=true,
  notetype=foot+end,
]{biblatex}

\usepackage{xcolor}
\usepackage[
  colorlinks=true,
  frenchlinks=true,
  linkcolor=black,
  filecolor=magenta,
  urlcolor=blue,
  citecolor=gray,
]{hyperref}
\urlstyle{same}

\appto\bibfont{\small}

\newrobustcmd*{\mkbibsuperscriptcitecolour}[1]{%
  \mkbibsuperscript{%
    \ifhyperref
      {\textcolor{gray}{#1}}
      {#1}}}

\DeclareCiteCommand{\supercite}[\mkbibsuperscriptcitecolour]
  {\usebibmacro{cite:init}%
   \let\multicitedelim=\supercitedelim
   \let\multicitesubentrydelim=\supercitesubentrydelim
   \let\multiciterangedelim=\superciterangedelim
   \let\multicitesubentryrangedelim=\supercitesubentryrangedelim
   \iffieldundef{prenote}
     {}
     {\BibliographyWarning{Ignoring prenote argument}}%
   \iffieldundef{postnote}
     {}
     {\BibliographyWarning{Ignoring postnote argument}}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite:comp}}
  {}
  {\usebibmacro{cite:dump}}

\addbibresource{biblatex-examples.bib}

\begin{document}
bla bla bla \supercite{sigfridsson,worman,geer}

\printbibliography
\end{document}

全彩色引文。

相关内容