Skip to content

Conversation

lawcho
Copy link
Contributor

@lawcho lawcho commented Nov 20, 2023

Support beamer overlays

This PR allows scripting beamer animations in markdown (and other formats).

The input syntax uses the on attribute, e.g.

# What type? {.t}

`parseInt :: ???`{.haskell on=1}

. . .

`parseInt :: String -> Int`{.haskell on=2-3}

. . .

`parseInt "haha" == ???`{.haskell on=3}

![](https://openclipart.org/image/800px/190136){on=3}

. . .

`parseInt :: String -> Maybe Int`{.haskell}

`parseInt "haha" == Nothing`{.haskell}

This compiles to the following beamer-LaTeX:

\begin{frame}[fragile,t]{What type?}
\phantomsection\label{what-type}
\only<1>{\VERB|\OtherTok{parseInt ::} \OperatorTok{???}|}

\pause

\only<2-3>{\VERB|\OtherTok{parseInt ::} \DataTypeTok{String} \OtherTok{{-}\textgreater{}} \DataTypeTok{Int}|}

\pause

\only<3>{\VERB|\NormalTok{parseInt }\StringTok{"haha"} \OperatorTok{==} \OperatorTok{???}|}

\includegraphics<3>{https://openclipart.org/image/800px/190136}

\pause

\VERB|\OtherTok{parseInt ::} \DataTypeTok{String} \OtherTok{{-}\textgreater{}} \DataTypeTok{Maybe} \DataTypeTok{Int}|

\VERB|\NormalTok{parseInt }\StringTok{"haha"} \OperatorTok{==} \DataTypeTok{Nothing}|
\end{frame}

Related issues

Coverage

Tested:

  • Block images
  • Inline code

TODO:

  • Test tables
  • Test divs
  • Test spans
  • Test links
  • Test inline images
  • Debug fenced code blocks (currently broken)
  • Finalize syntax (currently on=OVERLAY attribute, but open for bike-shedding)
  • Write regression tests

Feedback welcome.

Pandoc now adds <OVERLAY> to LaTeX commands generated from
elements with the `on=OVERLAY` attribute

The <OVERLAY> s are only inserted into beamer-LaTeX output,
never into plain LaTeX output
@lawcho lawcho marked this pull request as draft November 20, 2023 11:48
@lawcho
Copy link
Contributor Author

lawcho commented Nov 24, 2023

Closing in favor of #9215, which is simpler and more robust.

@lawcho lawcho closed this Nov 24, 2023
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.

1 participant