首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Latex使用外语导致引用错误

Latex使用外语导致引用错误
EN

Stack Overflow用户
提问于 2019-06-30 23:58:11
回答 1查看 645关注 0票数 0

当包含LaTeX外语包时:

代码语言:javascript
运行
复制
\usepackage[utf8x]{inputenc}
\usepackage[english,hebrew]{babel}
\usepackage[top=2cm,bottom=2cm,left=2.5cm,right=2cm]{geometry}

我得到了一个错误的引用:

示例:

代码语言:javascript
运行
复制
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.)

另一个例子:

代码语言:javascript
运行
复制
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},而文档\documentclass12pt,twoside{mitthesis}的格式是\usepackage{natbib}。

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

bibliography.bib是传统的:

代码语言:javascript
运行
复制
@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}
}

最小的工作示例是超级基本的(最小的不工作的示例是当你取消对希伯来语部分的注释时):

代码语言:javascript
运行
复制
\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}
EN

回答 1

Stack Overflow用户

发布于 2019-07-01 21:01:24

要避免在babel之后加载natbib时出现问题

代码语言:javascript
运行
复制
\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

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56826229

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档