jgm / pandoc

Universal markup converter
https://pandoc.org
Other
33.94k stars 3.34k forks source link

`linestretch` does not take effect for latex beamer slides #10035

Open jdgx opened 1 month ago

jdgx commented 1 month ago

Issue

Compile the following with pandoc -o output.pdf -V linestretch=2 -t beamer (tested with pandoc 3.1.2):

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.

and observe that the space between the lines is not enlarged (compared to linestretch=1 or without linestretch variable).

Positive counter example: when compiling to regular pdf document (via latex), without the -t beamer option, the line spacing is set according to the linestretch variable as expected.

Root cause

I think, I've also identified the root cause in the default.latex template:

Possible solutions

Personally, I tend to go for Option 1. Option 2 could be implemented in addition, but I cannot really judge if this makes sense. I'm not that familiar with beamer and beamerarticle and cannot assess possible side effects.

Any opinions on this? I'm happy to create a pull request for Option 1 and/or Option 2 if desired.

jgm commented 1 month ago

I assume that if we added \setstretch after \begin{document}, there was a reason for it. Perhaps something has chaged? Can you test it to make sure it works in the preamble?

jdgx commented 1 month ago

My minimal example, and also some of my private real world examples work like charm with \setstretch in the preamble.

However, digging through the search result for setstrech/linestretch in the issues revealed the history behind it. Let me try to summarize:

Regardless of the technical implementation, I would say

jgm commented 1 month ago

Thanks for doing all that research, it really helps.

Well, I suppose one obvious approach would be to move setstretch to the preamble and protect \maketitle in a singlespace environment. I agree, personally, that the linestretch should affect the TOC.

In any case the issue with Korean should be tested.