bibtex 文件中的 iftoggle 或 ifthenelse,作者字段未展开

bibtex 文件中的 iftoggle 或 ifthenelse,作者字段未展开

我正在尝试在 bib 文件中(即作者字段)放置一个条件语句。我尝试了ifthenelseiftoggle命令,但都无济于事。条件得到遵守,但作者姓名未正确展开,它认为这是唯一作者,并且没有用逗号替换“and”,等等。

您知道解决这个问题的方法吗?

下面是一个最小的复制器。

\documentclass{article}
\bibliographystyle{vancouver}

\usepackage{etoolbox}%iftoggle
\providetoggle{blinded}
\settoggle{blinded}{false}

\usepackage{ifthen}
\newcommand{\amode}{\string notblinded}

\begin{document}

iftoggle: \cite{test_article}

ifthenelse: \cite{test_article2}

correct: \cite{test_article3}

\bibliography{References}
\end{document}

文件References.bib

@article{ test_article,
  title     = {a},
  author    = {\iftoggle{blinded}{b}{c c and d d and e e}},
  journal   = {j},
  volume    = {v},
  number    = {n},
  pages     = {ps},
  doi       = {doi},
  year      = {y}
}
@article{ test_article2,
  title     = {a},
  author    = {\ifthenelse{\equal{\amode}{\string blinded}}{b}{c c and d d and e e}},
  journal   = {j},
  volume    = {v},
  number    = {n},
  pages     = {ps},
  doi       = {doi},
  year      = {y}
}
@article{ test_article3,
  title     = {a},
  author    = {c c and d d and e e},
  journal   = {j},
  volume    = {v},
  number    = {n},
  pages     = {ps},
  doi       = {doi},
  year      = {y}
}

结果:

编译结果

提前致谢!

以某种方式相关:在 biblatex `printbibliography` 中使用切换

相关内容