Modernize latex greek math handling (partially fixes #1673) #1687
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
The current latex base template uses the ucs package with mathletters,
but as it does not also set utf8x on inputenc, the ucs package does
not work as intended, and Greek letters do not appear in math.
As utf8x and ucs are somewhat outdated and problematic, this PR uses
a few conditions to try to enable Greek letters in both math and text.
For pdflatex, if the alphabeta package (part of greek-inputenc, and
not necessarily installed) is present, this is used, as it better
supports Greek math and text, including diacritics. It it is not,
ucs with mathletters is used, which will allow math, and some text,
though diacritics will cause an error.
For xelatex and lualatex, this instead uses unicode-math, which
handles math well but does not support pdflatex. While this
arrangement does support text, note that by default, the fonts used
are unlikely to include support for Greek text, and the glyphs will be
omitted (both for text and for monospace text), particularly since
Latin Modern does not support Greek text. I have an additional change
which uses Computer Modern Unicode if available, but I'd like to keep
these separate, as it's unclear to me that setting the font in this
template would be a good idea.
Mathpazo for pdflatex is removed for consistency with xelatex/lualatex
output, and the position of the conditional is moved to avoid an order
conflict with the ams packages; this more closely matches the position
of unicode-math in pandoc's template.