-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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 writer: support beamer overlays (take 2) #9215
base: main
Are you sure you want to change the base?
Conversation
Pandoc elements with the `only=SPEC` attribute generate LaTeX code wrapped in `\begin{onlyenv}<SPEC>...\end{onlyenv} Unlike f0785a, this implementation is minimally invasive, and is compatible with a wide range of generated LaTeX code, including the `\Verb|` used by fenced code blocks. The wrapping only occurs for beamer-LaTeX output, never for plain LaTeX output
Now `visible`, `uncover`, and `visible` are supported, in addition to `only`. When multiple overlay-generating attributes are provided, nested environments are generated (instead of a warning).
I guess |
Yes, N.B. after writing this PR, I managed to get similar results with a lua filter: -- Convert ELEM{only=X} to \begin{onlyenv}<X>ELEM\end{onlyenv}
-- (and likewise for several other overlay types)
local overlays_supported = pandoc.List
{"only","uncover","visible","invisible","action","alert"}
local function tex_wrap(block_mode,pre,el,post)
return block_mode
and pandoc.Blocks
{pandoc.RawBlock("tex",pre), el, pandoc.RawBlock("tex",post)}
or pandoc.Inlines
{pandoc.RawInline("tex",pre), el, pandoc.RawInline("tex",post)}
end
local function wrap_in_overlays(block_mode,el)
for k,v in pairs(el.attributes) do
el = overlays_supported:includes(k)
and tex_wrap(block_mode,"\\begin{"..k.."env}<"..v..">",el,"\\end{"..k.."env}")
or el
end
return el
end
local function wrap_block(el) return wrap_in_overlays(true,el) end
local function wrap_inline(el) return wrap_in_overlays(false,el) end
return {{
-- These block elements have attributes
CodeBlock = wrap_block,
Div = wrap_block,
Figure = wrap_block,
Table = wrap_block,
-- These inline elements have attributes
Code = wrap_inline,
Image = wrap_inline,
Link = wrap_inline,
Span = wrap_inline,
}} So I'm no longer sure that this PR is worth merging. |
8 presentations later (half of these), a lua filter still covers my animation requirements. So I'm closing this PR as not-wanted. |
If you wouldn't mind keeping this open, it's still something I'd consider...it could be a useful feature in pandoc. |
This PR is a successor to #9203, with a different implementation.
This PR allows ergonomic beamer scripting, via attributes on pandoc elements.
only
,visible
,uncover
,invisible
] are interpreted specially by the beamer writerBlock
orInline
element\begin{XXXenv}<YYY>...\end{XXXenv}
,for each (special) attribute pair
(XXX,YYY)
Example
I can write a presentation in markdown:
Then
pandoc src.md -o slides.pdf --to beamer
generates a 12-page slideshow:slides.pdf