jgm / pandoc

Universal markup converter
https://pandoc.org
Other
33.96k stars 3.35k forks source link

data/templates/default.latex uses legacy packages #7387

Open dimpase opened 3 years ago

dimpase commented 3 years ago

Explain the problem. LaTeX packages such as ifxetex and ifluatex are legacy packages that both just input iftex package. You can use \iftutex which is true in xetex and luatex rather than the nested \ifnum game. (copied from a comment David Carlisle in https://tex.stackexchange.com/questions/601579/unicode-maths-in-pdflatex?noredirect=1#comment1508737_601579)

That SE question was posted by me as I had a bit of an issue with pandoc-converted md file which used unicode maths.

So the template ought to be simplified.

Pandoc version? Gentoo current, as well as current master.

alerque commented 3 years ago

Do we have documented somewhere what the minimum expected XeTeX/LuaTeX versions are that Pandoc currently supports? Even if current versions have better syntax we need to make sure we don't over-simplify past what older versions need to keep functioning as expected.

jgm commented 3 years ago

No, we don't have this documented. But we do some informal checking to make sure that changes to the templates don't require very new versions that may not be available to everyone. (A good rule of thumb for me is that if something is in debian stable, we can feel good about relying on it.)

alerque commented 3 years ago

That sounds reasonable. The LaTeX ecosystem and Debian stable are both slow moving behemoths. I'll grant they were probably made for each-other.

Perhaps that should be codified such that for any given Pandoc release the max supported version is whatever the latest texlive release is at the time of Pandoc tagging and the min supported version is whatever happens to be in Debian stable at the time of tagging. That would make it easy to evaluate whether or not it was okay to update LaTeX usage.

If that's agreeable, the next question is when did ifxetex and ifluatex become legacy?

dimpase commented 3 years ago

https://packages.debian.org/buster/texlive says it's TeXLive 2018.20190227-2 (whatever this means - probably some kind of updated TeXLive 2018). It might be quicker to actually check on a piece of TeX code whether ifxetex and ifluatex may be skipped.

dimpase commented 3 years ago

I'm testing the example which used \iftutex from https://tex.stackexchange.com/questions/601579/unicode-maths-in-pdflatex

\documentclass{article}

\usepackage{iftex,amsmath}

\iftutex
\usepackage{unicode-math}
\else
\usepackage{amssymb}
\def\z"{}
\def\UnicodeMathSymbol#1#2#3#4{%
 \ifnum#1>"A0
   \DeclareUnicodeCharacter{\z#1}{#2}%
  \fi}
\input{unicode-math-table}
\let\muprho\rho
\def\BbbR{\mathbb{R}}
\fi
\begin{document}

$ρ ∈ ℝ$

\end{document}

So far I know it works on texlive 2020 and 2021, but does not work on texlive 2017.