我正在尝试在 bib 文件中(即作者字段)放置一个条件语句。我尝试了ifthenelse
和iftoggle
命令,但都无济于事。条件得到遵守,但作者姓名未正确展开,它认为这是唯一作者,并且没有用逗号替换“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}
}
结果:
提前致谢!