“\Ualgocf@original@chapter” undefined when using algorithm2e with natbib

本文解决了在使用LaTeX进行文档编辑时,natbib包与algorithm2e包之间的兼容性问题。通过调整加载顺序及对章节定义的修改,实现了正确引用文献格式的同时避免了错误发生。

Is it possible to just use plainnat without using the package natbib? When I do so, multiple author references don't work too well. I get

[author et al (year)auhtor1, author2 and author3]

when what I want is just

[author et al (year)]

Anyway to fix this?

If I add \usepackage{natbib} I just get an error:

Undefined control  sequence.

\chtapter ...ace {10\p@ }}\algocf@original@chapter

1.1 \begin{thebibliography}{28}

So using plainnat without natbib is the closest I got to get this working.

Example:

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{rotating}
\usepackage{listings}
\usepackage[ruled,vlined]{algorithm2e}
\usepackage[ngerman,english]{babel}
\usepackage{babelbib,url} 
\usepackage{breakcites}
%\usepackage{natbib}
%\usepackage[square, comma, sort&compress]{natbib}
\usepackage[latin1]{inputenc}
\usepackage{pslatex}
\usepackage{setspace}
\setstretch{2} 
\begin{document}
    \cite{DPS2000}
\newpage\pagebreak
\nocite{*}
\bibliographystyle{plainnat}
\bibliography{references}
\end{document}

It compiles fine but I get

[author et al (year)auhtor1, author2 and author3]

style referencing and if I uncomment natbib it won't compile.

share improve this question
 
Was this post useful to you?     

2 Answers

up vote 6 down vote accepted

The problem is that the algorithm2e expects \chapter to be defined. It makes some changes to how the bibliography is printed which do not make sense. One fix is to do

\let\chapter\section

before loading algorithm2e: the problem should be go away.

share improve this answer
 
feedback

Load algorithm2e after natbib.

share improve this answer
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值