3

It seems like a bug, I want to fix it but fails. I will describe the problem by the following MME:

\documentclass{amsart}
\usepackage[colorlinks,citecolor=cyan]{hyperref}
\usepackage[author-year]{amsrefs}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article {MotazedifardDalafiNaderiRoknizadeh2018Controllable,
    AUTHOR = {Motazedifard, Ali and Dalafi, A. and Naderi, M. H. and
              Roknizadeh, R.},
     TITLE = {Controllable generation of photons and phonons in a coupled
              {B}ose--{E}instein condensate-optomechanical cavity via the
              parametric dynamical {C}asimir effect},
   JOURNAL = {Ann. Physics},
  FJOURNAL = {Annals of Physics},
    VOLUME = {396},
      YEAR = {2018},
     PAGES = {202--219},
      ISSN = {0003-4916},
   MRCLASS = {81},
  MRNUMBER = {3853390},
       DOI = {10.1016/j.aop.2018.07.013},
       URL = {https://doi.org/10.1016/j.aop.2018.07.013},
}
\end{filecontents}
\begin{document}
In \ocite{MotazedifardDalafiNaderiRoknizadeh2018Controllable}, \citeauthor{MotazedifardDalafiNaderiRoknizadeh2018Controllable} show that ...
\bibliography{\jobname}
\end{document}

The compile result looks like: The MME PDF It is wired that the color is only for "In Motazedifard et al. (2018", why the last ")" is out of color?

3

I think I have seen this wrong coloring in some textbooks and now I am convinced that this is a bug in the amsrefs package. However (I could be wrong though), it is worth pointing out that rather than “missing the last right parenthesis”, the intended behavior should be “using black/normal colored parentheses while the authors and year are colored”. You can check this by typing

\cite{MotazedifardDalafiNaderiRoknizadeh2018Controllable}

which will produce a pair of black parentheses.

I can offer a fix which forces the left parenthesis to be black.

\documentclass{amsart}
\usepackage[colorlinks,citecolor=cyan]{hyperref}
\usepackage[author-year]{amsrefs}

\makeatletter
\renewcommand*\citesel@object[5]{\PrintCiteNames{#3} \textcolor{black}{\citeleft}#4}
% The original definition is
% \def\citesel@object#1#2#3#4#5{\PrintCiteNames{#3} \citeleft#4}
% which misses the possible color change by hyperref
\makeatother

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article {MotazedifardDalafiNaderiRoknizadeh2018Controllable,
    AUTHOR = {Motazedifard, Ali and Dalafi, A. and Naderi, M. H. and
              Roknizadeh, R.},
     TITLE = {Controllable generation of photons and phonons in a coupled
              {B}ose--{E}instein condensate-optomechanical cavity via the
              parametric dynamical {C}asimir effect},
   JOURNAL = {Ann. Physics},
  FJOURNAL = {Annals of Physics},
    VOLUME = {396},
      YEAR = {2018},
     PAGES = {202--219},
      ISSN = {0003-4916},
   MRCLASS = {81},
  MRNUMBER = {3853390},
       DOI = {10.1016/j.aop.2018.07.013},
       URL = {https://doi.org/10.1016/j.aop.2018.07.013},
}
\end{filecontents}
\begin{document}
In \ocite{MotazedifardDalafiNaderiRoknizadeh2018Controllable}, \citeauthor{MotazedifardDalafiNaderiRoknizadeh2018Controllable} show that ...
\bibliography{\jobname}
\end{document}

color fixed


One could also force the right parenthesis to be cyan, like this:

\documentclass{amsart}
\usepackage[colorlinks,citecolor=cyan]{hyperref}
\usepackage[author-year]{amsrefs}

\usepackage{etoolbox}
\makeatletter
\patchcmd\cite@cj
  {\citeright}
  {\textcolor{cyan}\citeright}
  {}{}
\makeatother

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article {MotazedifardDalafiNaderiRoknizadeh2018Controllable,
    AUTHOR = {Motazedifard, Ali and Dalafi, A. and Naderi, M. H. and
              Roknizadeh, R.},
     TITLE = {Controllable generation of photons and phonons in a coupled
              {B}ose--{E}instein condensate-optomechanical cavity via the
              parametric dynamical {C}asimir effect},
   JOURNAL = {Ann. Physics},
  FJOURNAL = {Annals of Physics},
    VOLUME = {396},
      YEAR = {2018},
     PAGES = {202--219},
      ISSN = {0003-4916},
   MRCLASS = {81},
  MRNUMBER = {3853390},
       DOI = {10.1016/j.aop.2018.07.013},
       URL = {https://doi.org/10.1016/j.aop.2018.07.013},
}
\end{filecontents}
\begin{document}
In \ocite{MotazedifardDalafiNaderiRoknizadeh2018Controllable}, \citeauthor{MotazedifardDalafiNaderiRoknizadeh2018Controllable} show that ...
\bibliography{\jobname}
\end{document}

color fixed alternatively

  • This fix seems work for the colorlinks setting of hyperref, but fails when I use ocgcolorlinks. – user19832 Sep 18 '18 at 13:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.