Tufte-book 中压缩引文时出错

Tufte-book 中压缩引文时出错

我正在使用 Tufte 书籍课程撰写论文。我在添加参考文献时遇到了一些问题。首先,我希望引用看起来像[1-4]而不是[1,2,3,4]。我正在使用

\setcitestyle{square,numbers,sort&compress}

并且

\bibliographystyle{unsrtnat}
\bibliography{sample-handout}

但我仍然收到格式为 的引用。此外,由于选项显示为红色,因此[1;2;3;4]似乎没有重新组织选项。请注意,我在引用参考文献时使用了 。sort&compress\citep{}


我还遇到了以下错误

包 inputenc 错误:Unicode 字符 (U+2009)(inputenc) 未设置为用于 LaTeX。C.~Monroe,W.

即使我把

\usepackage[utf8]{inputenc} % Ensure UTF-8 encoding is used

缺少插入的 $。...block \doi{10.1364/CLEO_QELS.2016.FTh4C.1}

引文如下

@article{White:16,
author = {Andrew G. White},
booktitle = {Conference on Lasers and Electro-Optics},
journal = {Conference on Lasers and Electro-Optics},
keywords = {Biology; Chemistry; Detectors},
pages = {FTh4C.1},
publisher = {Optica Publishing Group},
title = {Photonic Quantum Simulation},
year = {2016},
url = {https://opg.optica.org/abstract.cfm?URI=CLEO_QELS-2016-FTh4C.1},
doi = {10.1364/CLEO_QELS.2016.FTh4C.1},
abstract = {We review photonic quantum simulation, its use in biology, chemistry, computer science and physics, and its prospects for scaling given the latest advances in quantum photonics, notably in sources, detectors, and nonlinear interactions.},
}

答案1

虽然我无法立即从 的来源确认tufte-book,但我怀疑 cite 命令的重新定义阻止了sort&compress其生效。但是,如果您在natbib加载时设置此选项(在本例中是\PassOptionsToPackage在加载类之前使用),则排序和压缩行为将保留。

是由字段中的Missing $ inserted未转义字符引起的。字段也包含此字符,但该字段按逐字解析,而解析为普通文本,因此被视为需要数学模式(即)的下标。因此,对此问题的修复是_doiurldoi_$

doi = {10.1364/CLEO\_QELS.2016.FTh4C.1},

完整代码:

\begin{filecontents}[overwrite]{\jobname.bib}
@article{White:16,
author = {Andrew G. White},
booktitle = {Conference on Lasers and Electro-Optics},
journal = {Conference on Lasers and Electro-Optics},
keywords = {Biology; Chemistry; Detectors},
pages = {FTh4C.1},
publisher = {Optica Publishing Group},
title = {Photonic Quantum Simulation},
year = {2016},
url = {https://opg.optica.org/abstract.cfm?URI=CLEO_QELS-2016-FTh4C.1},
doi = {10.1364/CLEO\_QELS.2016.FTh4C.1},
abstract = {We review photonic quantum simulation, its use in biology, chemistry, computer science and physics, and its prospects for scaling given the latest advances in quantum photonics, notably in sources, detectors, and nonlinear interactions.},
}
@misc{White:17,
author = {John White},
title = {Number 17},
year = {2017}
}
@misc{White:18,
author = {Mary White},
title = {Number 18},
year = {2018}
}
\end{filecontents}
\PassOptionsToPackage{square,numbers,sort&compress}{natbib}
\documentclass{tufte-book}
%\setcitestyle{square,numbers,sort&compress}
\title{Sort \& Compress}
\author{with Tufte Book}
\begin{document}
\maketitle
\chapter{Some cite commands}
\citep{White:16,White:17,White:18}
\bibliographystyle{unsrtnat}
\bibliography{\jobname}
\end{document}

结果:

在此处输入图片描述

对于 utf8 字符,您无需提供有问题的 bib 条目的来源。但是,一般来说,错误是众所周知的,指的是 pdfLaTeX 只能处理有限数量的 utf8 字符(基本上是扩展的 ascii,即带变音符号的拉丁字母),如果您有其他 utf8 字符,则需要使用\DeclareUnicodeCharacter(或使用设置包,例如 CJK)单独设置它们。

但是对于这个特定的字符 U+2009,这是不需要的,这是一个“细小的空格”,可能是错误地插入到条目中的。例如,您可以尝试使用目视检查或十六进制编辑器来查找字符,或者只是重新输入条目(因此不要复制和粘贴,而是从头开始重新输入)。

相关内容