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

footnote and xcolor do not commute #4861

Closed
hseg opened this issue Aug 29, 2018 · 7 comments · Fixed by #5193
Closed

footnote and xcolor do not commute #4861

hseg opened this issue Aug 29, 2018 · 7 comments · Fixed by #5193

Comments

@hseg
Copy link
Contributor

hseg commented Aug 29, 2018

MWE:

---
header-includes: \usepackage{xcolor}
...
----
C^[F]
----

LaTeX complains of a forgotten \endgroup. A bit of digging shows that this is due to footnote defining \fn@endnote with a dependency on \color@endgroup, which is subsequently redefined by xcolor, breaking the macro.

This in turn breaks any document that uses footnotes and xcolor. Since tikz depends on xcolor, adding it to header-includes also triggers this problem.

A quick-and-dirty workaround until footnote fixes this is to include xcolor before footnote.
Subsequent inclusions will note it's already included and not run.
Note that xcolor is in texlive-latex-recommended, so this shouldn't be an issue.

P.S. I will note, however, that footnote was last updated in 1996, so I'm not holding my breath for it to be fixed. Haven't contacted upstream, but seeing as this is a well-known bug that's at least 7 years old, they're probably not responding.

@hseg hseg changed the title footnote and xcolor do not commute in the presence of longtable footnote and xcolor do not commute Aug 29, 2018
@jgm
Copy link
Owner

jgm commented Aug 29, 2018

Note: the default template loads xcolor if colorlinks is set to a true value.
This happens before footnote is loaded, so we should be okay unless you manually include xcolor. To avoid manually loading xcolor, you could always set colorlinks to true (you could set all the colors to black).

I don't see anything that needs to be changed in pandoc here, do you?

@hseg
Copy link
Contributor Author

hseg commented Aug 30, 2018 via email

@adunning
Copy link
Contributor

In theory there shouldn't be much harm in loading xcolor whether or not the colorlinks option is enabled; there are very few packages that don't take it into account.

@adunning
Copy link
Contributor

A cleaner solution might be to remove the footnote package, which we're only using to fix footnotes in tables. It appears from https://texfaq.org/FAQ-footintab that this is already fixed by using longtable, and I haven't been able to find any examples of footnotes in tables as generated by Pandoc that require it. Are there perhaps more complex examples that require it?

@adunning
Copy link
Contributor

Ah, the reason for the inclusion of footnote can be found in #2378.

@jgm
Copy link
Owner

jgm commented Nov 26, 2018

Well, I guess we could just load xcolor unconditionally. Do you want to submit a PR? The html templates (and slide show templates) would have to be changed, and the tests updated.

@adunning
Copy link
Contributor

Yes, I will research it more to make sure there aren't any obvious conflicts and send something in.

@jgm jgm closed this as completed in #5193 Jan 3, 2019
jgm added a commit that referenced this issue Jan 3, 2019
* Use Babel for LuaTeX.  There are a number of bugs in Polyglossia under LuaLaTeX with common languages, e.g. <reutenauer/polyglossia#182>.

* Load xcolor. The `xcolor` package must be loaded before the `footnote` package, which we load to fix foonotes in tables. Closes #4861.

* Load xurl if available. This breaks URLs in more locations. Only available with TeX Live 2018 and later.

* Remove obsolete fixltx2e package

* Reindent. Use two spaces to be consistent internally and with other templates.

* Use `bookmark` if available. The `bookmark` package can sometimes correct the levels of headings where `hyperref` cannot: see <https://komascript.de/release3.26>.

* Update LaTeX tests
jgm pushed a commit that referenced this issue Jan 23, 2019
Use the [`footnotehyper`](https://ctan.org/pkg/footnotehyper/) package if available.
This is a rewrite of `footnote` that is compatible with `hyperref` and `babel-frenchb`.

This patch also addresses the incompatibility with `xcolor` noted in #4861, but the
new package has only been available since 2016, so this template still loads `xcolor`
earlier for compatibility with older distributions. Note that the `footnote` package 
is part of `collection-latexrecommended` in TeX Live, so there shouldn't be any
problem loading it unconditionally as we now do if `footnotehyper` is not available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants