Bibtex 参考文献由于 LastPage 包而无法编译?

Bibtex 参考文献由于 LastPage 包而无法编译?

我正在尝试编写一篇文章,其中有参考文献。我使用的是 BibTeX 和 XeLaTeX。以下是日志的最后几行

LaTeX Warning: Reference `LastPage' on page 4 undefined on input line 46.

[4] (./Essay.bbl (/usr/local/texlive/2011/texmf-dist/tex/latex/euenc/eu1lmtt.fd
)
Overfull \hbox (86.4996pt too wide) in paragraph at lines 9--13
\EU1/lmtt/m/n/12 http://goscandinavia.about.com/od/scandinaviatripplanning/p/sc
andnordic.htm\EU1/TimesNewRoman(0)/m/n/12 .

Overfull \hbox (66.03194pt too wide) in paragraph at lines 26--29
[]\EU1/TimesNewRoman(0)/m/n/12 Meltdown, October 2011.  URL \EU1/lmtt/m/n/12 ht
tp://english.aljazeera.net/programmes/meltdown/\EU1/TimesNewRoman(0)/m/n/12 .

LaTeX Warning: Reference `LastPage' on page 5 undefined on input line 29.

[5]
! Missing $ inserted.
<inserted text> 
                $
l.43 .../files/1892_the_nordic_model_complete.pdf}
                                                  .
? 

输入的命令如下:

xelatex Essay.tex
bibtex Essay.aux
xelatex Essay.Tex
then the error

这是一个最小的工作示例:

\documentclass[a4paper,12pt]{article}
\usepackage{fontspec}
\usepackage{natbib}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{setspace}
\pagestyle{fancy}
% clear any old style settings
\fancyhead{}
\fancyfoot{}
%new settings
\lhead{\footnotesize {Sebastian Stephenson}}
\rhead{\footnotesize{2812193}}
\rfoot{{\thepage} of \pageref{LastPage}}
%for hardvard style citation 
\citestyle{agms}
% addfont Times New Roman
\setmainfont{Times New Roman}
\begin{document}

\begin{doublespacing}
    \title{The Nordic Region and The Great Recession}
    %to remove the date that is added when it gets complied
    \date{}
    \maketitle
    %Because the maketitle command has been used, it automatically
    %issues \thispagestyle{plain} which overrides the fancy headings for
    %this page.  Must now tell Latex to override this
    \thispagestyle{fancy}
    With an understanding of what makes the Nordic region distinct from other regions. We will look at how the Nordic region is doing in the Great Recession. "The outlook for these countries is good" says Christian Ketal, economist at Harvard Business School and the Stockholm School of Economics "They are going to return...there own banking crises before the Great Recession,showing experience in managing a situation like today. It appears that the Nordic region is set for bright future.
\end{doublespacing}
    \bibliographystyle{plainnat}
    \bibliography{References} 
    \end{document}

这是我在 Tex 文件中引用的示例。

the Nordic embassy.\citep{monoembassy} There is even consideration for further integration with one historian proposing a Nordic federation.\citep{econorfed} They are not completely homogenous societies. For instance Finland is the only Nordic country in the euro,\citep{econorfed} Norway is a oil powered economy\citep{unischobooklet5} and the last 30 years of Iceland.

以下是两个 BibTeX 条目的示例:

 @article{nordicdecline,
author={Johan Carlstrom},
editor={Chris Kirkham},
title={Nordic Countries Plunge Into Recession as Export Markets Fail  - Bloomberg},
month={Febuary},
year={2008},
url={http://www.bloomberg.com/apps/news?pid=newsarchive&sid=at0pmFF3uEOY},
publisher={Bloomberg},
address={New York},
note={[14102011]}
}

@book{nordicpdfintro,
author={Torben M. Andersen and Bengt Holmström and Seppo Honkapohja and Sixten Korkman and Hans Tson Söderström and Juhana Vartiainen},
booktitle={The Nordic Model:Embracing globalization and sharing risks},
pages={13},
year={2007},
url={http://www.etla.fi/files/1892_the_nordic_model_complete.pdf},
publisher={Taloustieto Oy},
address={Helsinki,}
}

谁能解释一下我需要做什么?

注意:最后一个 BibTeX 条目可能是问题所在。

答案1

您需要加载一个包来处理 URL,因为“回退”实际上不执行任何操作,这意味着 TeX 尝试_在文本模式下使用,然后会报错。最简单的方法是加载url包裹

\documentclass{article}
\begin{filecontents}{References.bib}
 @article{nordicdecline,
author={Johan Carlstrom},
editor={Chris Kirkham},
title={Nordic Countries Plunge Into Recession as Export Markets Fail  - Bloomberg},
month={Febuary},
year={2008},
url={http://www.bloomberg.com/apps/news?pid=newsarchive&sid=at0pmFF3uEOY},
publisher={Bloomberg},
address={New York},
note={[14102011]}
}
\end{filecontents}
\usepackage{natbib}
\usepackage{url}
\begin{document}

the Nordic embassy.\citep{nordicpdfintro} 
\bibliographystyle{plainnat}
\bibliography{References} 
\end{document}

(注意:我已将其精简为一个最小示例,它与 XeTeX 无关。我还使用环境在 LaTeX 运行过程中filecontents自动生成合适的.bib文件。后者可以删除以用于真实文档:它只是为了使示例正常工作。)

答案2

这是另一种解决方案,使用biblatexbiber。由于您正在使用bibtex+,natdin这可能不是您想要的,但我认为这样的问题是永远切换到biblatex+ 的好时机biber。如果您使用 XeLaTeX,也许您对 UTF-8 感兴趣,那么 biblatex+biber 是更好的选择。

我将您的两个 bibtex 条目复制到了References.bib。请注意,我还将名称更改为了 格式lastname, firstname,并且名称包含像 ö 这样的字符(从链接的 pdf 中复制)。

 @article{nordicdecline,
    author={Carlstrom, Johan},
    editor={Kirkham, Chris},
    title={Nordic Countries Plunge Into Recession as Export Markets Fail  - Bloomberg},
    month={Febuary},
    year={2008},
    url={http://www.bloomberg.com/apps/news?pid=newsarchive&sid=at0pmFF3uEOY},
    publisher={Bloomberg},
    address={New York},
    note={[14102011]}
}

@book{nordicpdfintro,
    author={Andersen, Torben M. and Holmström, Bengt and Honkapohja, Seppo and Korkman, Sixten and Söderström, Hans Tson and Vartiainen, Juhana},
    booktitle={The Nordic Model: Embracing globalization and sharing risks},
    pages={13},
    year={2007},
    url={http://www.etla.fi/files/1892_the_nordic_model_complete.pdf},
    publisher={Taloustieto Oy},
    address={Helsinki,}
}

该文件如下所示:

\documentclass[]{article}

\usepackage[T1]{fontenc}
\usepackage{lmodern}
% \usepackage[utf8]{inputenc}
\usepackage[english,swedish,nynorsk]{babel}

\usepackage{lastpage}

\usepackage[autostyle]{csquotes}

\usepackage[
    backend=biber,
    style=authoryear-icomp,
maxnames=99,
sortlocale=sv_SE,
    natbib=true,
    url=true, 
    doi=false,
    eprint=false
]{biblatex}
\addbibresource{biblatex-examples.bib}
\addbibresource{References.bib}

\usepackage[]{hyperref}
\hypersetup{
        colorlinks=true,
}

%% ##############################
\begin{document}
    Lorem ipsum dolor sit amet~\citep{kastenholz}.
    At vero eos et accusam et justo duo dolores et ea rebum~\citet{sigfridsson}.
    Lorem ipsum again the Nordic embassy~\citet{nordicpdfintro}.
    And then again even more lorem ipsum.~\citep{nordicdecline}
    \printbibliography 
\end{document}

对于我使用 XeLaTeX 的我来说,此示例运行起来毫无问题,URL 中的所有特殊字符都显示出来,链接正常工作,并且断开得很完美。作者姓名中的变音符号没有问题。三部分名称可以正确显示。pdfLaTeX 用户需要加载\usepackage[utf8]{inputenc}
此答案包含我对关于参考书目 URL 中特殊字符的问题上面已经链接了。

相关内容