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.

A recently upgraded my computer and on my old PC, this code

\RequirePackage{fix-cm}
\documentclass{scrbook}
\usepackage[no-math]{fontspec}
\usepackage{xunicode,xltxtra} 
\usepackage{mathspec}
% Mathfont
\setmathfont{STIXGeneral}
\usepackage[german]{babel} % Neue Rechtschreibung
\usepackage{hyperref}
\usepackage[all]{hypcap}            % Link to start of figures, not captions

\newcommand{\interpolationOp}[1]{\ensuremath{L_{#1}}}
\begin{document}
    \tableofcontents
    \section{Der Interpolationsfehler
    \texorpdfstring{\( \|f-\interpolationOp{\mathbf{M}}f\| \)}{||f- IMf||} 
    }
\end{document}

Would produce both a correct PDF-Meta-TOC and a correct TOC using XeLaTeX.

However, now the TOC looks like this

Faulty TOC

Deleting either mathspec or the babel packes removes the faulty TOC, but I need both packages. Further, the .aux file states

\@writefile{toc}{\contentsline {section}{\numberline {0.1}Der Interpolationsfehler \( \delimiter "026B30D f-\ensuremath  {L_{\mathbf  {M}}}f\delimiter "026B30D  \)}{1}{section.0.1}}

Which looks like TeXis expanding (but somehow just since I changed my computer) the \|, though the hint from here, declaring a robust command would not work.

Any ideas, why this is introduced in my new setup (though i can't say what the difference is, the old PC is not available atm, maybe a difference between MacTex 2013 and 2012)?

share|improve this question
1  
Just a comment unrelated to your question, but regarding your code example: As mentioned in another question, you need to use ngerman instead of german for the new German orthography. –  canaaerus Sep 20 '13 at 10:45
    
And one further interesting point would be: Why did that work on my previous (MacTex 2012) system? –  Ronny Sep 20 '13 at 12:04

2 Answers 2

up vote 8 down vote accepted

The problem is that \| is expanded into

\delimiter "026B30D

in the .toc file and the quotes disturb XeLaTeX when mathspec is loaded.

Solution: add

\protected\def\|{\Vert}

to your preamble. However the problem would be the same if you use \Vert in a section title (don't do it!)

Don't load xunicode and xltxtra. Documentation saying they are needed is outdated.

I wouldn't use mathspec:

\documentclass{scrbook}

\usepackage{unicode-math}
\setmainfont{TeX Gyre Termes} % or any other Times-like font
\setmathfont{XITS Math}

\usepackage[german]{babel} % Neue Rechtschreibung
\usepackage{hyperref}
\usepackage[all]{hypcap}            % Link to start of figures, not captions

\newcommand{\interpolationOp}[1]{\ensuremath{L_{#1}}}
\begin{document}
    \tableofcontents
    \section{Der Interpolationsfehler
    \texorpdfstring{\( \|f-\interpolationOp{\mathbf{M}}f\| \)}{||f- IMf||}
    }
\end{document}

I wouldn't use \ensuremath in the definition of \interpolationOp either.

share|improve this answer
    
What should I then load in XeLaTeX to ensure utf8 despite those two packages? The point is, that the project is nearly finished and the first (faulty) PDF endet up being at the publisher, so i don't want to change too much (in order to not have to resubmit everything)... What should I use instead of mathspec - unicode-math? And finally: I always thought \ensuremath was to ensure, that the command is only used in math - so what would you use instead? –  Ronny Sep 20 '13 at 11:55
    
Oh, and - is XITS Math the same font as STIXGeneral? –  Ronny Sep 20 '13 at 12:09
1  
@Ronny Yes, but with the math tables added –  egreg Sep 20 '13 at 12:15
    
I'll use your very hopeful tips on my next project :) But for this one, I fear, If I now (at this late stage) change something (well I already hat to change my computer, you saw, what that did), that might be uncomfortable for me. –  Ronny Sep 20 '13 at 12:17

So one dirty and quite local way (because it just affects this and onyl this \section) would be to

\texorpdfstring{\( {\protect\|}f-\interpolationOp{\mat{M}}f{\protect\|}\)}{||f- LMf||}

in order to not get them expanded. Edit: But of course, that should either be used in a command or - even better - use @egreg s remarks in his answer.

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.