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

LaTeX Template: Improve package selections #5193

Merged
merged 9 commits into from
Jan 3, 2019
Merged

LaTeX Template: Improve package selections #5193

merged 9 commits into from
Jan 3, 2019

Conversation

adunning
Copy link
Contributor

@adunning adunning commented Jan 1, 2019

Changes:

  • Use Babel instead of Polyglossia for LuaLaTeX: there are a number of bugs in Polyglossia under this engine with common languages, e.g. polyglossia + lualatex: French punctuation spacing remains enabled after \textfrench{} reutenauer/polyglossia#182. (Most development appears to have moved from Polyglossia to Babel; it might make sense to make it the default for both LuaTeX and XeTeX before long.)
  • Use xurl if available. Introduced with TeX Live 2018, this greatly improves the appearance of URLs by allowing them to break at additional points. (Run tlmgr update --all if you are seeing problems with this, as there were some bugs in the initial release.)
  • Use bookmark if available, which can correct the levels of headings where hyperref cannot: see the KOMA-Script 3.26 release notes.
  • Load xcolor if available. The xcolor package must be loaded before the footnote package, which we load to fix foonotes in tables. Closes footnote and xcolor do not commute #4861.
  • Remove obsolete fixltx2e package (has no functionality with TeX Live 2015 or later).
  • Reindent file.

This test demonstrates the changes:

pandoc -o test.pdf --pdf-engine=lualatex << EOT

Some text <http://dsf.tqsdatmdtdls.ctm/cudfsdvqfqll-ocd/bdcbcfqlf-lcclldh/cbsntwgqke-esbptb-vvylhy/zkhqnqidf-obedbacpf-lzlal-pxaccqa-gwki.lfof/> and another url: <http://osb.ccdngagkkg.raa/qrkxzvi/dxfsiaa/xidf-lata-dgdqmhp-uoxdl-vst-vcsbhl-aisdsasih-skl-aezb-fhixvyy-qqlachd-achhfc-koe-xgfqp-iyplcu-1.696884>.

[Bonjour!]{lang=fr}

Test!

EOT

With pandoc 2.5 template:

screen shot 2019-01-01 at 18 02 21

With changes:

screen shot 2019-01-01 at 18 01 55

adunning and others added 8 commits January 1, 2019 14:37
There are a number of bugs in Polyglossia under LuaLaTeX with common languages, e.g. <reutenauer/polyglossia#182>.
The `xcolor` package must be loaded before the `footnote` package, which we load to fix foonotes in tables. Closes #4861.
This breaks URLs in more locations. Only available with TeX Live 2018 and later.
Use two spaces to be consistent internally and with other templates.
The `bookmark` package can sometimes correct the levels of headings where `hyperref` cannot: see <https://komascript.de/release3.26>.
@mb21
Copy link
Collaborator

mb21 commented Jan 2, 2019

Most development appears to have moved from Polyglossia to Babel; it might make sense to make it the default for both LuaTeX and XeTeX before long

I remember polyglossia being "marketed" as a newer replacement to babel. And when using XeTeX, the recommendation was to use polyglossia. You're saying babel has caught up with polyglossia and/or tackled whatever problems polyglossia was designed to solve?

@jgm
Copy link
Owner

jgm commented Jan 2, 2019

For one recent issue with polyglossia/xelatex, see
pandoc/lua-filters#36
Special typography for French colons is applied in code blocks, and there seems to be no way to disable this short of switching to English for code blocks. I don't know if babel is any better in this respect.

\usepackage{xcolor}
$endif$
\usepackage{hyperref}
\IfFileExists{xcolor.sty}{\usepackage{xcolor}}{}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if they specify colorlinks but xcolor doesn't exist?
Previously we would have gotten a latex compilation failure, pointing to the need for xcolor.
What do we get in this case now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point: if there are no visible links in the document, it will work even if colorlinks is specified.

It fails when the document tries to render a colour using the xcolor definitions: for example, in a document with a URL and colorlinks enabled:

! LaTeX Error: Undefined color `Blue'.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.69 \href{https://pandoc.org}{test url}

Is it worse, then, to require xcolor even in situations when it isn't needed, or to have an error message that doesn't explain the package is missing?

@adunning
Copy link
Contributor Author

adunning commented Jan 2, 2019

That verbatim issue does appear to be a bug specific to Polyglossia. I wonder if it would be worth making Polyglossia an option similar to how mathspec is handled right now. (Babel's support for RTL languages is even improving; here's a Hebrew example.) I've looked for a survey of which has broader language support at the moment, but haven't found anything.

For background, Babel is now part of the LaTeX core, supporting both XeTeX and LuaTeX, and has been improving steadily since it received a new maintainer in 2012. Meantime, the creator of Polyglossia is now inactive, and the current maintainer quite understandably has his hands full with managing the TeX hyphenation patterns. It would appear from all this that the eventual aim is make Babel a single interface for all languages and engines, though I'm not aware of a conscious effort to merge the two or any public statements on the matter.

@jgm
Copy link
Owner

jgm commented Jan 2, 2019 via email

@adunning
Copy link
Contributor Author

adunning commented Jan 3, 2019

That does seem best; I've simplified the line to require xcolor. There are few situations in which it will be missing in any case.

@jgm jgm merged commit 9746938 into jgm:master Jan 3, 2019
@adunning adunning deleted the patch-1 branch January 3, 2019 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

footnote and xcolor do not commute
3 participants