Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am trying to compile an essay and it has references in it. I am using BibTeX and XeLaTeX. Here are the last few lines of the log

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}
                                                  .
? 

The commands entered are the following:

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

Here is a minimal working example:

\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}

Here is a sample of how I am citing in the Tex file.

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.

Here are two samples of BibTeX entries:

 @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,}
}

Can anyone explain what I need to do?

Note: The last BibTeX entry could be the issue.

share|improve this question
3  
Looks like if you have not escaped special characters (here the $) in your URLs. The LastPage warning is just a warning, not an error. –  Marco Nov 8 '11 at 18:38
    
Welcome to TeX Stack-Exchange! It would be helpful if you also posted the input lines that create the LaTeX Warnings. Do you have a bibtex entry with a key of "LastPage"? Which bibliography style and which citation management package (e.g., natbib, harvard, apacite, ...) are you using? And, are you using the lastpage package (and making references to the document's last page)? –  Mico Nov 8 '11 at 18:38
    
As @Marco says, TeX is complaining about l.43 .../files/1892_the_nordic_model_complete.pdf}: the LastPage warning is before the error, and is not relevant to the issue at hand. –  Joseph Wright Nov 8 '11 at 18:58
1  
it's not clear what command is used to introduce the url. it's possible that whatever command is used doesn't treat the underscore properly, and that could cause an error for a missing $. it doesn't look like this has anything at all to do with LastPage –  barbara beeton Nov 8 '11 at 19:48
    
Could you post a MWE? –  cmhughes Nov 8 '11 at 23:23

2 Answers 2

up vote 2 down vote accepted

You need to load a package to handle URLs, as the 'fall back' dimply does nothing, meaning that TeX tries to use _ in text mode then complains. The easiest way to do this is to load the url package

\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}

(Note: I've cut down to a minimal example, which has nothing to do with XeTeX. I've also used the filecontents environment to auto-generate a suitable .bib file as part of the LaTeX run. The later can be removed for a real document: it's just there to make the example work properly.)

share|improve this answer

Here is another solution, using biblatex and biber. As you are using bibtex+natdin maybe this is not what you want, but I think such a problem is a good occasion to switch to biblatex+biber for ever. If you use XeLaTeX maybe you are interested in UTF-8 and then biblatex+biber is the better choice.

I copied your two bibtex entries to References.bib. Please note that I also changed the names to the lastname, firstname format and that the names conatin characters like ö (copied from the linked 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,}
}

The document then looks like this:

\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}

This example works without problems for me using XeLaTeX, all special characters in the URL are displayed, the links work and they are nicely broken. No problems with umlauts in the authors names. Names with three parts are correctly displayed. pdfLaTeX users need to load the \usepackage[utf8]{inputenc}
This answer contains pieces from my answer to the question regarding special characters in URLs in the bibliography already linked above.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.