2

The following code works fine

% arara: pdflatex
\documentclass[12pt]{book}

\usepackage{accents}

\usepackage[
    cal = cm,
    bb = ams,
    frak = euler,
    scr = euler
]{mathalfa}

\begin{document}

$\accentset{\circ}{\mathfrak{D}}$ % newton

\end{document}

But when I put the newton line into another file where amsfonts is loaded, and I add all my work I get

! Use of \reserved@a doesn't match its definition.
\reserved@b ->\relax 
                     \ifmmode \else \non@alpherr \mathfrak  \fi \use@mathgro...
l.50 \end{align}

? 
! Emergency stop.
\reserved@b ->\relax 
                     \ifmmode \else \non@alpherr \mathfrak  \fi \use@mathgro...
l.50 \end{align}

I think the trouble is with the command \accentset.
How to solve this issue?

8
  • 3
    please make an example that shows the error, just start with a copy of your document and remove everything that doesn't stop the error appearing, it's hard to debug unseen code. Dec 30, 2014 at 22:43
  • 1
    What do you mean with another file? Do you mean within an included file?
    – Sigur
    Dec 30, 2014 at 22:44
  • 1
    By the way, LaTeX has \mathring. It's impossible to say something until seeing code that produces the error.
    – egreg
    Dec 30, 2014 at 22:48
  • 1
    align is defined by amsmath. \reserved@a is also defined by amsmath. so putting together amsmath and accents is likely to result in conflicts. Dec 30, 2014 at 22:49
  • 1
    @NicolasEssis-Breton -- and that is why a nonworking example is useful, showing what's in play when the error occurs. Dec 30, 2014 at 22:52

2 Answers 2

3

The package mathalfa, while perhaps handy for setting different math alphabets, conflicts with amsfonts that also defines \mathfrak and \mathbb.

However amsfonts does this definition conditionally:

103 \@ifundefined{mathfrak}{%
104     \DeclareMathAlphabet{\mathfrak}{U}{euf}{m}{n}
105     \SetMathAlphabet{\mathfrak}{bold}{U}{euf}{b}{n}
106 }{}
107 \@ifundefined{mathbb}{%
108     \DeclareSymbolFontAlphabet{\mathbb}{AMSb}%
109 }{}

so it's safe to load it after mathalfa. It does nothing, in this case, if you have declared fonts for \mathfrak and \mathbb with the other package, but it's important if you want to load amssymb (which depends on amsfonts).

So the correct order would be

\usepackage{amsmath}
\usepackage{accents}
\usepackage[
    cal = cm,
    bb = ams,
    frak = euler,
    scr = euler
]{mathalfa}
\usepackage{amssymb}

The error is triggered by \text{$...$} in an align environment, because this is quite a complex situation, with math nested in math at various levels, with the additional problem of double passing over the material.

Note that you don't need accents for a ring accent in math mode, because LaTeX already provides \mathring.

\documentclass[12pt]{book}
\usepackage{amsmath}
\usepackage{accents}
\usepackage[
    cal = cm,
    bb = ams,
    frak = euler,
    scr = euler
]{mathalfa}
\usepackage{amssymb}

\begin{document}

\begin{align}
\text{$S$}
\mathring{\mathfrak{D}}
\accentset{\circ}{\mathfrak{D}}
\end{align}

\end{document}

enter image description here

I find the rendering with \mathring much better.

0

When doing the mwe, I found the faulty line.
Thanks to all for your help.

% arara: pdflatex
\documentclass[12pt]{book}

\usepackage{amsmath}
\usepackage{amsfonts} % delete to remove error
\usepackage{accents}
\usepackage[
    cal = cm,
    bb = ams,
    frak = euler,
    scr = euler
]{mathalfa}

\begin{document}     

\begin{align}
     \text{  $S$ }
     \accentset{\circ}{ \mathfrak{D} }
\end{align}

\end{document}
1
  • 1
    i trust you'll hang in here, to be able to answer when the problem reappears. the other poor user suffers the same problem and can't find the solution by searching here. Dec 31, 2014 at 9:52

You must log in to answer this question.