-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Conversation
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>.
Partially addresses #5179
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? |
For one recent issue with polyglossia/xelatex, see |
data/templates/default.latex
Outdated
\usepackage{xcolor} | ||
$endif$ | ||
\usepackage{hyperref} | ||
\IfFileExists{xcolor.sty}{\usepackage{xcolor}}{} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
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 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. |
Andrew Dunning <notifications@github.com> writes:
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?
I like the basic principle that, if the latex code we
generate *requires* a package, then the package should
be unconditionally loaded in the preamble. If the
package would merely improve output, but isn't
required, then it's okay to load it if if exists.
That will ensure that things fail in a way that gives
the user the best clue as to what is going on.
I'm not really concerned about documents with
`colorlinks: true` failing even if they contain no
links.
|
That does seem best; I've simplified the line to require |
Changes:
xurl
if available. Introduced with TeX Live 2018, this greatly improves the appearance of URLs by allowing them to break at additional points. (Runtlmgr update --all
if you are seeing problems with this, as there were some bugs in the initial release.)bookmark
if available, which can correct the levels of headings wherehyperref
cannot: see the KOMA-Script 3.26 release notes.xcolor
if available. Thexcolor
package must be loaded before thefootnote
package, which we load to fix foonotes in tables. Closes footnote and xcolor do not commute #4861.fixltx2e
package (has no functionality with TeX Live 2015 or later).This test demonstrates the changes:
With pandoc 2.5 template:
With changes: