0

This thread evolves from my discussion here. Minimal example

\documentclass{article}

\usepackage{mathtools}
\usepackage{polyglossia} % also loads package fontspec
\usepackage{unicode-math} % if you also need maths

\setmainlanguage{english} % loads language hyphenation rules and such

% TODO problem with finding good fonts with good support
% https://tex.stackexchange.com/a/218102/13173
%\setmainfont{Minion Pro} % or whatever OTF you have on your system
%\setmathfont{Cambria Math} % or whatever math OTF you have on your 

% Problem with these declarations which I like to use
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}

% This is causing the bug!
\usepackage{doi}  

\begin{document}

% this test case does not work
\section{Complex pathogenesis $\to$ complicated classification}

% This test case works because of disabling above fonts and loading amssymb
\begin{equation}
\norm{x} + \abs{y} = 1 \mdlgwhtsquare
\end{equation}


\end{document}

Hacking approach which works

\usepackage{amsmath, amsfonts, textcomp, mathtools, xparse}
\usepackage[T4, OT1]{fontenc}

but I cannot understand why.

Error messages

Auto-detecting the appropriate typesetting chain...


*************************************************
* unicode-math warning: "mathtools-colon"
* 
* I'm going to overwrite the following commands from the `mathtools' package:
* 
*     \dblcolon, \coloneqq, \Coloneqq, \eqqcolon.
* 
* Note that since I won't overwrite the other colon-like commands, using them
* will lead to inconsistencies.
*************************************************
---
*************************************************
* unicode-math warning: "mathtools-overbracket"
* 
* Using \overbracket and \underbracket from `mathtools' package.
* 
* Use \Uoverbracket and \Uunderbracket for original `unicode-math' definition.
*************************************************
---
Package hyperref Warning: Rerun to get /PageLabels entry.

(/usr/local/texlive/2014/texmf-dist/tex/latex/amsfonts/umsa.fd)
(/usr/local/texlive/2014/texmf-dist/tex/latex/amsfonts/umsb.fd)

Package hyperref Warning: Token not allowed in a PDF string (Unicode):
(hyperref)                removing `math shift' on input line 24.


Package hyperref Warning: Token not allowed in a PDF string (Unicode):
(hyperref)                removing `math shift' on input line 24.

./poistettuja.tex:24: Improper alphabetic constant.
<to be read again> 
                   \rightarrow 
l.24 ...ogenesis $\to$ complicated classification}

./poistettuja.tex:24: Missing = inserted for \ifnum.
<to be read again> 
                   \rightarrow 
l.24 ...ogenesis $\to$ complicated classification}

./poistettuja.tex:24: Extra \fi.
<recently read> \fi 

l.24 ...ogenesis $\to$ complicated classification}

./poistettuja.tex:24: Extra \fi.
<argument> ...er \the \numexpr 1024\fi \relax \fi 
                                                  \fi  -(64-1)/2)/64*64\rela...
l.24 ...ogenesis $\to$ complicated classification}

./poistettuja.tex:24: Extra \fi.
<argument> ...the \numexpr 1024\fi \relax \fi \fi 
                                                   -(64-1)/2)/64*64\relax \f...
l.24 ...ogenesis $\to$ complicated classification}

(That makes 100 errors; please try again.)
No pages of output.
Transcript written on /Users/masi/Dropbox/paper/.texp
adtmp/poistettuja.log.



/usr/texbin/xelatex -file-line-error -interaction=nonstopmode -synctex=1 -output-directory=/Users/masi/Dropbox/paper/.texpadtmp poistettuja.tex
This is XeTeX, Version 3.14159265-2.6-0.99991 (TeX Live 2014) (preloaded format=xelatex)
 restricted \write18 enabled.
entering extended mode
(./poistettuja.tex
LaTeX2e <2014/05/01>
Babel <3.9l> and hyphenation patterns for 79 languages loaded.
(/usr/local/texlive/2014/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2014/texmf-dist/tex/latex/base/size10.clo))
---
*************************************************
* unicode-math warning: "mathtools-colon"
* 
* I'm going to overwrite the following commands from the `mathtools' package:
* 
*     \dblcolon, \coloneqq, \Coloneqq, \eqqcolon.
* 
* Note that since I won't overwrite the other colon-like commands, using them
* will lead to inconsistencies.
*************************************************
)) (/usr/local/texlive/2014/texmf-dist/tex/latex/polyglossia/gloss-english.ldf)
---
(/usr/local/texlive/2014/texmf-dist/tex/latex/url/url.sty))

Package hyperref Message: Driver (autodetected): hxetex.

(/usr/local/texlive/2014/texmf-dist/tex/latex/hyperref/hxetex.def
---
) (/usr/local/texlive/2014/texmf-dist/tex/latex/tipa/t3cmr.fd)
*************************************************
* unicode-math warning: "mathtools-overbracket"
* 
* Using \overbracket and \underbracket from `mathtools' package.
* 
* Use \Uoverbracket and \Uunderbracket for original `unicode-math' definition.
*************************************************
(/usr/local/texlive/2014/texmf-dist/tex/latex/hyperref/nameref.sty
---

Package hyperref Warning: Rerun to get /PageLabels entry.

(/usr/local/texlive/2014/texmf-dist/tex/latex/amsfonts/umsa.fd)
(/usr/local/texlive/2014/texmf-dist/tex/latex/amsfonts/umsb.fd)

Package hyperref Warning: Token not allowed in a PDF string (Unicode):
(hyperref)                removing `math shift' on input line 24.


Package hyperref Warning: Token not allowed in a PDF string (Unicode):
(hyperref)                removing `math shift' on input line 24.

./poistettuja.tex:24: Improper alphabetic constant.
<to be read again> 
                   \rightarrow 
l.24 ...ogenesis $\to$ complicated classification}

---

l.24 ...ogenesis $\to$ complicated classification}

./poistettuja.tex:24: Extra \fi.
<argument> ...er \the \numexpr 1024\fi \relax \fi 
                                                  \fi   0\else \the \numexpr...
l.24 ...ogenesis $\to$ complicated classification}

./poistettuja.tex:24: Extra \fi.
<argument> ...the \numexpr 1024\fi \relax \fi \fi 
                                                    0\else \the \numexpr 0<\...
l.24 ...ogenesis $\to$ complicated classification}

./poistettuja.tex:24: Extra \else.
<argument> ...xpr 1024\fi \relax \fi \fi   0\else 
                                                  \the \numexpr 0<\z@ \expan...
l.24 ...ogenesis $\to$ complicated classification}

./poistettuja.tex:24: Extra \fi.
<argument> ...62144-1)/2)/262144*262144\relax \fi 
                                                  \fi  \expandafter \else \e...
l.24 ...ogenesis $\to$ complicated classification}

./poistettuja.tex:24: Extra \fi.
<argument> ...4-1)/2)/262144*262144\relax \fi \fi 
                                                   \expandafter \else \expan...
l.24 ...ogenesis $\to$ complicated classification}

./poistettuja.tex:24: Extra \else.
<recently read> \else 

l.24 ...ogenesis $\to$ complicated classification}

./poistettuja.tex:24: Extra \fi.
<argument> ...62144-1)/2)/262144*262144\relax \fi 
                                                  \fi  \expandafter \fi \exp...
l.24 ...ogenesis $\to$ complicated classification}

./poistettuja.tex:24: Extra \fi.
<argument> ...4-1)/2)/262144*262144\relax \fi \fi 
                                                   \expandafter \fi \expanda...
l.24 ...ogenesis $\to$ complicated classification}

./poistettuja.tex:24: Extra \fi.
<recently read> \fi 

l.24 ...ogenesis $\to$ complicated classification}

./poistettuja.tex:24: Extra \fi.
<argument> ...er \the \numexpr 1024\fi \relax \fi 
                                                  \fi  -(0<\z@ \expandafter ...
l.24 ...ogenesis $\to$ complicated classification}

./poistettuja.tex:24: Extra \fi.
<argument> ...the \numexpr 1024\fi \relax \fi \fi 
                                                   -(0<\z@ \expandafter -\nu...
l.24 ...ogenesis $\to$ complicated classification}

./poistettuja.tex:24: Extra \fi.
<argument> ...62144-1)/2)/262144*262144\relax \fi 
                                                  \fi  \expandafter \else \e...
l.24 ...ogenesis $\to$ complicated classification}

./poistettuja.tex:24: Extra \fi.
<argument> ...4-1)/2)/262144*262144\relax \fi \fi 
                                                   \expandafter \else \expan...
l.24 ...ogenesis $\to$ complicated classification}

./poistettuja.tex:24: Extra \else.
<recently read> \else 

---                      

./poistettuja.tex:24: Extra \fi.
<argument> ...er \the \numexpr 1024\fi \relax \fi 
                                                  \fi  -(64-1)/2)/64*64\rela...
l.24 ...ogenesis $\to$ complicated classification}

./poistettuja.tex:24: Extra \fi.
<argument> ...the \numexpr 1024\fi \relax \fi \fi 
                                                   -(64-1)/2)/64*64\relax \f...
l.24 ...ogenesis $\to$ complicated classification}

(That makes 100 errors; please try again.)
No pages of output.
Transcript written on /Users/masi/Dropbox/paper/.texp
adtmp/poistettuja.log.

How can you make the minimal example work?

DOI

With DOI which loads Hyperref, no output and errors as in above log message

enter image description here

Without DOI that is without Hyperref, correct output

enter image description here

Any possible changes to the package hyperref itself? Why has this behaviour been designed so?

  • 1
    It works fine for me without the additional lines – karlkoeller Dec 15 '14 at 19:40
  • the MWE works for me (texlive 2014) – David Carlisle Dec 15 '14 at 19:41
  • as stated in the comments in the referenced question you should show any error messages in full. Just saying it doesn't work isn't useful. do you get error or wrong fonts or no output or .... – David Carlisle Dec 15 '14 at 19:43
  • Posted error messages there. – Léo Léopold Hertz 준영 Dec 15 '14 at 19:44
  • No. That log does not match the posted code so it is not useful It shows an error on line 71 but the code you posted does not have that many lines. – David Carlisle Dec 15 '14 at 19:46
  • For the posted .log you need to use something like \texorpdfstring. See (duplicate): hyperref warning - Token not allowed in a PDF string – Werner Dec 15 '14 at 19:48
  • And the MWE does not load hyperref (unless that is hidden in other packages). You really should post the entire .log – daleif Dec 15 '14 at 19:49
  • Yes! You are all right. The problem is in some doi -package. – Léo Léopold Hertz 준영 Dec 15 '14 at 19:55
  • Use \texorpdfstring{$\to$}{->}... – Werner Dec 15 '14 at 19:59
  • 2
    So please next time check that your "MWE" really is an example of the problem in the question. – David Carlisle Dec 15 '14 at 20:05
  • I will do it. Thank you for the feedback! Got too excited by the test cases. – Léo Léopold Hertz 준영 Dec 15 '14 at 20:06
  • Someone started to vote to reopen this. I started to think why some packages accept the test code as above, but some require Werner's approach. I am not sure if Werner's approach is the best one here - it may only solve the complication! For instance, only Doi package here requires Werner's approach. @egreg says in one of his comments that do not use amssymb with mathtools. I really want to understand the internals why some packages allow the above test code, while some not. I think here a solution may be to disable amssymb. There is something in DOI which I do not understand. – Léo Léopold Hertz 준영 Dec 17 '14 at 00:13
  • The doi package has nothing to do with this; if you load instead hyperref you get the same behavior. It has nothing to do with amssymb either, which, as I said, should not be loaded along with unicode-math. The question is indeed a duplicate. – egreg Dec 17 '14 at 00:48
  • @egreg Did you even run the code? With doi, errors. Without doi, correct output. Can you please, explain, me what is going there inside the machine. Some packages allows math in section names, while some not. Doi should not be altering this but it does. These are some of my test cases which I use to test different packages. Please, see updated body of question where the difference shown. – Léo Léopold Hertz 준영 Dec 17 '14 at 07:57
  • @Masi Without doi but *with* hyperref, of course: I said that the problem is with hyperref, didn't I? – egreg Dec 17 '14 at 08:00
  • @egreg Yes, you are right! It seems that Doi -package loads hyperref -package behind. Any possible fixes in the hyperref -package itself? – Léo Léopold Hertz 준영 Dec 17 '14 at 08:10
  • @Masi This is the minimal example: \documentclass{article} \usepackage{unicode-math} \usepackage{hyperref} \begin{document} \section{$\to$} \end{document} – egreg Dec 17 '14 at 08:14
  • 1
    @Masi Using Complex pathogenesis → complicated classification (or spelling out the title) would avoid the problem. If you don't know how to input , type \textrightarrow{}. – egreg Dec 17 '14 at 08:15
  • @egreg WOOT! Which symbols are these which you do not need to into Math environment? \lambda, \Omega, \varphi do not work so, for instance. From which package does this textrightarrow{} come? – Léo Léopold Hertz 준영 Dec 17 '14 at 17:04
  • 1
    @Masi It's defined in the EU1 and EU2 encodings used by fontspec. – egreg Dec 17 '14 at 17:11

0 Answers0