使用外语的乳胶会导致引用错误

时间:2019-06-30 15:58:10

标签: latex

包括LaTeX外语软件包时:

\usepackage[utf8x]{inputenc}
\usepackage[english,hebrew]{babel}
\usepackage[top=2cm,bottom=2cm,left=2.5cm,right=2cm]{geometry}

我的引用有误:

示例:

Missing number, treated as zero.

<to be read again> 
                   \afterassignment 
l.19 ...{example1}}}{\@@number {27}}

A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

另一个例子:

Improper alphabetic constant.

<to be read again> 
                   \afterassignment 
l.86 ...15normalized}. \citet{example2}
                                                   further improved the resu...
A one-character control sequence belongs after a ` mark.
So I'm essentially inserting \0 here.

! Missing = inserted for \ifnum.
<to be read again> 
                   \afterassignment 
l.86 ...15normalized}. \citet{example2}
                                                   further improved the resu...
I was expecting to see `<', `=', or `>'. Didn't.

引文为空。 当我不包括外语软件包时,我不会收到错误,并且引文很好。

我引用的格式为\ usepackage {natbib}和文档\ documentclass [12pt,twoside] {mitthesis}。

我还尝试了其他格式,并得到相同的错误。

bibliography.bib是传统的:

@article{example1,
  title={Title1},
  author={Author},
  journal={arXiv preprint arXiv:1706.04902},
  year={2019}
}

@article{example2,
  title={Title2},
  author={Author},
  journal={arXiv preprint arXiv:1706.04902},
  year={2019}
}

“最小工作示例”非常基础(最小的“不工作示例”是当您取消注释希伯来语部分时):

\documentclass{report}
%\documentclass[12pt,twoside]{mitthesis}
\usepackage{natbib}

% Hebrew
% \usepackage[utf8x]{inputenc}
% \usepackage[english,hebrew]{babel}
% \usepackage[top=2cm,bottom=2cm,left=2.5cm,right=2cm]{geometry}

\begin{document}
%\selectlanguage{english}
\include{introduction} %some text with \cite{example1} and so on...


% bibliography
\bibliography{bibliography}
\bibliographystyle{plainnat}

\end{document}

1 个答案:

答案 0 :(得分:1)

为避免此问题,请在natbib之后加载babel

\documentclass{report}
%\documentclass[12pt,twoside]{mitthesis}


% Hebrew
\usepackage[utf8]{inputenc}
\usepackage[english,hebrew]{babel}
\usepackage[top=2cm,bottom=2cm,left=2.5cm,right=2cm]{geometry}
\usepackage{natbib}

\begin{filecontents}{bibliography.bib}
@article{example1,
  title={Title1},
  author={Author},
  journal={arXiv preprint arXiv:1706.04902},
  year={2019}
}

@article{example2,
  title={Title2},
  author={Author},
  journal={arXiv preprint arXiv:1706.04902},
  year={2019}
}
\end{filecontents}

\begin{document}
% \selectlanguage{english}
\cite{example1,example2}

{
\selectlanguage{english}
\cite{example1,example2}
}

% bibliography
% \selectlanguage{english}
\bibliography{bibliography}
\bibliographystyle{plainnat}

 \selectlanguage{english}
\bibliography{bibliography}
\bibliographystyle{plainnat}

\end{document}

https://www.overleaf.com/read/kgrzpznmzjcz