Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eurosym in Pandoc seems to be incompatible with hyperref #3801

Closed
harriott opened this issue Jul 14, 2017 · 6 comments
Closed

eurosym in Pandoc seems to be incompatible with hyperref #3801

harriott opened this issue Jul 14, 2017 · 6 comments

Comments

@harriott
Copy link

  • Windows 10 version 1703, MiKTeX 2.9.6300 64-bit, pandoc v1.19.2.1.
  • Arch linux 4.11.9-1, texlive-bin 2016.41290-12, pandoc 1.19.2.1-90.

eurosym.md contains just:

# 2€
2€

pandoc eurosym.md -o eurosym.pdf --latex-engine=xelatex returns variants of:

! Improper alphabetic constant.
<to be read again>
                   \euro
l.70 \section{2\euro{}}

pandoc.exe: Error producing PDF

Further details: pandoc convert to pdf fails when € is in a header.

@mb21
Copy link
Collaborator

mb21 commented Jul 14, 2017

could not reproduce on macOS with pandoc 1.19.2.1 and XeTeX 3.14159265-2.6-0.99996 (TeX Live 2016)

have you modified your default template?

@harriott
Copy link
Author

mb21, no (as elaborated on StackOverflow), I've used the latest jgm default.latex.

@jgm
Copy link
Owner

jgm commented Jul 14, 2017 via email

@jgm
Copy link
Owner

jgm commented Jul 14, 2017 via email

@jgm
Copy link
Owner

jgm commented Jul 14, 2017

Minimal case that fails for me using xelatex:

\documentclass[]{article}
\usepackage{unicode-math}
\newcommand{\euro}{€}

\usepackage[unicode=true]{hyperref}

\begin{document}

\hypertarget{section}{
\section{2\euro{}}\label{section}
}

\end{document}

Note that if you comment out the unicodemath part, OR if you remove hyperref and the hyperref specific commands, it compiles successfully. So it's the combination of the custom \euro macro with BOTH unicodemath and hyperref that seems to cause the problem.

@adunning
Copy link
Contributor

adunning commented Sep 7, 2017

This can be fixed by dropping the \euro command and the two associated lines from the template, and writing € directly. It's already handled through the textcomp package (part of the core LaTeX distribution), which is automatically loaded when using the Pandoc template under pdfLaTeX via the upquote package. (To prevent errors, either the conditional loading of the upquote package in the template should be removed, or textcomp should be called directly with pdfLaTeX.)

The following produces an identical PDF under any of the three LaTeX engines:

\documentclass{article}
\usepackage{lmodern}
\usepackage{ifxetex,ifluatex}
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
\else % if luatex or xelatex
  \usepackage{unicode-math}
  \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
\fi
\usepackage{upquote}
\usepackage{hyperref}

\begin{document}

\hypertarget{section}{
\section{2€}\label{section}
}

\end{document}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants