Math & Scienceamsmath error: math mode in Natbib style

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
solanumlycopersicum
Posts: 4
Joined: Fri Sep 25, 2009 9:51 pm

amsmath error: math mode in Natbib style

Post by solanumlycopersicum »

Hey!

Maybe one of you can help me out on this one:

I just switched from using the regular BibTex style to Natbib style.
Before, whenever I wanted to put some accents like \dot{a} or \grave etc. I could just put it between dollar signs $\dot{a}$ to have it in math mode.
Now when I'm using Natbib style it gives me this kind of errors:
<<Package amsmath error: \grave allowed only in math mode>>

And what I personally think is strange is that in the references at the end of my document, the names with accents are printed out fine (ex:Bùùth). They just disappear in my text when I refer to them (ex:Bth et al., 2006).

So the next thing I did was just leave out my package amsmath in the preamble. Everything works fine then, but of course, now I can't use amsmath anymore.

I've already been looking on the internet for the same sort of error in natbib but can't find any...

Any help is welcome!
evelien

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

amsmath error: math mode in Natbib style

Post by localghost »

You better use text accents instead of math accents. But with the right input encoding you can insert the accented characters directly also in your BibTeX database file. See the example below.

Code: Select all

\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\begin{document}
  Bùùth       % direct insertion of accented characters

  B\`u\`uth   % control sequences to produce accents
\end{document}

Best regards
Thorsten
solanumlycopersicum
Posts: 4
Joined: Fri Sep 25, 2009 9:51 pm

Re: amsmath error: math mode in Natbib style

Post by solanumlycopersicum »

Hey Thorsten,

Thank you for the fast reply.
Unfortunately, If I use the text accents I get the error "undefined control sequence". This only happened in my Bibtex, not my regular "LaTeX-texts". I already noticed that so I switched to using math accents which gave no problem in Bibtex. Now, when I'm using Natbib, also the math accents don't work.

I also tried the inputenc once (couple of months ago) for that problem but I remember that some other symbols which I use quite often didn't get printed out correctly (in which correctly I mean the way I want it :D) anymore.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

amsmath error: math mode in Natbib style

Post by localghost »

I can't comprehend the problem. The code below compiles smoothly.

Code: Select all

\listfiles
\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{filecontents}
\usepackage{natbib}

\begin{filecontents*}{accents.bib}
@book{buuth01,
author={{A}dalbert {B}ùùth},
title={{D}irectly inserted accented characters},
publisher={{D}ummy publisher},
year={2009},
}

@book{buuth02,
author={{A}dalbert {B}\`u\`uth},
title={{A}ccents produced by control sequences},
publisher={{D}ummy publisher},
year={2010},
}
\end{filecontents*}

\begin{document}
  \nocite{*}
	\bibliographystyle{natdin}
	\bibliography{accents}
\end{document}
And I obtain the following list of used files in the log file.

Code: Select all

 *File List*
 article.cls    2007/10/19 v1.4h Standard LaTeX document class
  size11.clo    2007/10/19 v1.4h Standard LaTeX file (size option)
 fontenc.sty
   t1enc.def    2005/09/27 v1.99g Standard LaTeX file
inputenc.sty    2008/03/30 v1.1d Input encoding file
    utf8.def    2008/04/05 v1.1m UTF-8 support for inputenc
   t1enc.dfu    2008/04/05 v1.1m UTF-8 support for inputenc
  ot1enc.dfu    2008/04/05 v1.1m UTF-8 support for inputenc
  omsenc.dfu    2008/04/05 v1.1m UTF-8 support for inputenc
filecontents.sty    2009/03/17 v1.2 Create an external file from within a LaTeX document
  natbib.sty    2009/11/07 8.31a (PWD, AO)
 accents.bbl
 ***********
If it doesn't work for you, it requires a counterexample (keyword: minimal example) that clearly shows the misbehaviour.
Post Reply