我正在使用 Tufte 圖書課程來寫我的論文。我在引用參考文獻時遇到了一些問題。首先,我希望引文看起來像[1-4]
而不是[1,2,3,4]
.我在用著
\setcitestyle{square,numbers,sort&compress}
並且
\bibliographystyle{unsrtnat}
\bibliography{sample-handout}
但我仍然收到 format 的引用[1;2;3;4]
。此外,它似乎沒有重新組織該選項,sort&compress
因為它以紅色顯示。請注意,我\citep{}
在引用參考文獻時使用了。
我也遇到錯誤,例如
套件 inputenc 錯誤:Unicode 字元 (U+2009)(inputenc) 未設定為與 LaTeX 一起使用。 C.~門羅,W.
即使當我把
\usepackage[utf8]{inputenc} % Ensure UTF-8 encoding is used
和
缺少 $ 插入。 ...塊\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
未轉義的字元引起的。該字段也有這個字符,但該字段在解析為普通文本時逐字解析,因此被視為需要數學模式(即 )的下標。因此,解決這個問題的方法是_
doi
url
doi
_
$
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 字符,您不會給出有問題的圍兜條目的來源。然而,一般來說,這個錯誤是眾所周知的,它指的是pdfLaTeX 只能原生處理有限數量的utf8 字元(基本上是擴展的ascii,所以帶有變音符號的拉丁字母),如果你有其他utf8字符,那麼你需要使用\DeclareUnicodeCharacter
(或使用設定包,例如 CJK)。
然而,對於這個特定字元 U+2009 來說,這是不需要的,這是一個“薄空格”,可能被錯誤地插入到條目中。例如,您可以嘗試使用目視檢查或十六進位編輯器來尋找字符,或者只是重新輸入條目(所以不要複製和貼上,實際上是從頭開始重新輸入)。