书目条目字段中的 \textbackslash

书目条目字段中的 \textbackslash

有没有办法在书目条目的标题字段中包含反斜杠?下面的 MWE 一直出错

! Undefined control sequence.
<argument> Faster \unfolding 
                         of communities 

几乎就像它首先将 \textbackslash 变成反斜杠,然后将 \unfolding 重新解释为命令。

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}

@article{Traag2015,
  eprinttype = {arxiv},
  eprint = {1503.01322},
  title = {Faster \textbackslash unfolding of communities: speeding up the Louvain algorithm},
  url = {http://arxiv.org/abs/1503.01322},
  shorttitle = {Faster unfolding of communities},
  abstract = {textbackslash},
  timestamp = {2015-05-27 22:09:43},
  author = {Traag, V. A.},
  urldate = {2015-05-27},
  date = {2015-03-04},
  keywords = {Computer Science - Data Structures and Algorithms,Computer Science - Social and Information Networks,Physics - Physics and Society}
}


\end{filecontents*}

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[backend=biber, bibencoding=utf8]{biblatex}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}
\printbibliography
\end{document}

答案1

的扩展\textbackslash(注意空格)确实被解释为\,最终导致\unfolding。您可以声明一个强大的替代方案

\DeclareRobustCommand{\tbs}{\textbackslash}

它不会扩展,然后正常使用它:

在此处输入图片描述

\RequirePackage{filecontents}
\DeclareRobustCommand{\tbs}{\textbackslash}
\begin{filecontents*}{\jobname.bib}

@article{Traag2015,
  eprinttype = {arxiv},
  eprint = {1503.01322},
  title = {Faster \tbs{} unfolding of communities: speeding up the Louvain algorithm},
  url = {http://arxiv.org/abs/1503.01322},
  shorttitle = {Faster unfolding of communities},
  abstract = {textbackslash},
  timestamp = {2015-05-27 22:09:43},
  author = {Traag, V. A.},
  urldate = {2015-05-27},
  date = {2015-03-04},
  keywords = {Computer Science - Data Structures and Algorithms,Computer Science - Social and Information Networks,Physics - Physics and Society}
}


\end{filecontents*}

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[backend=biber, bibencoding=utf8]{biblatex}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}
\printbibliography
\end{document}

答案2

\textbackslash由于 Biber使用单个反斜杠进行翻译,因此欺骗 TeX 认为它必须将控制序列打印为字符串({}用于获取空格)。

title = {Faster \string\textbackslash unfolding{} of communities: 
         speeding up the Louvain algorithm},

在此处输入图片描述

或者更简单地说,

title = {Faster \string\unfolding{} of communities: 
         speeding up the Louvain algorithm},

因为 Biber 不会解释它不知道的宏。

相关内容