4

Using libertinus as fontfamily within a yaml-header of a .md-file and trying to convert with pandoc (2.9.2) and the pdf-engine lualatex (TL 2020, LuaLaTeX 1.12.0) I get the following error-message:

! LaTeX Error: Command `\eth' already defined.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.240 ...mbol{\eth}            {\mathord}{AMSb}{"67}

Steps to reproduce Take this mwe for the .md-file

---
title: Test
author: Author
date: \today
fontfamily: libertinus
---
This is a test-file. 

ÄÜÖß

1234567890

the command for the conversion is

pandoc -s libertinus-test.md --pdf-engine=lualatex -o libertinus-test.pdf

I figured out that the problem is the line with the math-packages:

https://github.com/jgm/pandoc/blob/9d0506e4047f797a0672d7767830b59f1710d191/data/templates/default.latex#L100

Note: As soon as I change the fontfamily to libertine it is no problem. But same problem also occurs with libertinus-otf (by HV).


There is also an issue for this topic: https://github.com/alif-type/libertinus/issues/327

3
  • You have to convince pandoc not to load amssymb.
    – egreg
    Jun 18 '20 at 8:59
  • and how can I do that without changing the default template?
    – LukasCB
    Jun 18 '20 at 9:00
  • 1
    Notify the pandoc people that loading amssymb along with unicode-math is nonsensical. As far as I can see, there is no conditional around \usepackage{amssymb,amsmath} in the default template, so you're doomed.
    – egreg
    Jun 18 '20 at 9:12
8

The default pandoc template has

100 \usepackage{amssymb,amsmath}
101 \usepackage{ifxetex,ifluatex}
102 \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
103   \usepackage[$if(fontenc)$$fontenc$$else$T1$endif$]{fontenc}
104   \usepackage[utf8]{inputenc}
105   \usepackage{textcomp} % provide euro and other symbols
106 \else % if luatex or xetex
107 $if(mathspec)$
108   \ifxetex
109     \usepackage{mathspec}
110   \else
111     \usepackage{unicode-math}
112   \fi
113 $else$
114   \usepackage{unicode-math}
115 $endif$

which unconditionally loads amssymb. This is the cause of your issues.

Note that loading amssymb along with unicode-math makes very little sense (if at all).

A more sensible template would have

\usepackage{amsmath}
\usepackage{ifxetex,ifluatex}
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  \usepackage[$if(fontenc)$$fontenc$$else$T1$endif$]{fontenc}
  \usepackage[utf8]{inputenc}
  \usepackage{textcomp} % provide euro and other symbols
  \usepackage{amssymb}
\else % if luatex or xetex
$if(mathspec)$
  \ifxetex
    \usepackage{amssymb}
    \usepackage{mathspec}
  \else
    \usepackage{unicode-math}
  \fi
$else$
  \usepackage{unicode-math}
$endif$
5
  • please have a look at github.com/jgm/pandoc/issues/6469 and comment!
    – lemzwerg
    Jul 4 '20 at 4:11
  • @lemzwerg Yes, there was an oversight, fixed my proposal.
    – egreg
    Jul 4 '20 at 7:12
  • "Note that loading amssymb along with unicode-math makes very little sense (if at all)" -- this seems to be wrong. See github.com/jgm/pandoc/issues/6825 -- when we removed amssymb, it seems we lost \square which we need for todo lists. Nov 11 '20 at 17:24
  • @JohnMacFarlane Abusing a math symbol font for text parts is not the best strategy.
    – egreg
    Nov 11 '20 at 17:45
  • I'm not sure we can rely on the existence of appropriate glyphs in the main font -- since users can specify their own, and we don't know what fonts are available. Do you have another suggestion? Nov 12 '20 at 3:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.