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

Markdown syntax for beamer "\alert" #4457

Closed
gjherbiet opened this issue Mar 16, 2018 · 3 comments
Closed

Markdown syntax for beamer "\alert" #4457

gjherbiet opened this issue Mar 16, 2018 · 3 comments

Comments

@gjherbiet
Copy link

Hello,

This issue can be thought as a reverse of #4091 : would it be possible to have a Markdown syntax element that translates to LaTeX Beamer \alert command.

For instance, using !! as delimiter, this would give:

$ echo "This text has an !!alert part with *emphasis*!!." | pandoc -f markdown -t beamer
\begin{frame}

This text has an \alert{alert part with \emph{emphasis}}.

\end{frame}

Ideally, this would support nested formatting, as in the example.

@mb21
Copy link
Collaborator

mb21 commented Mar 16, 2018

You can simply write raw TeX, e.g. \alert inside your markdown document. I think adding special markdown syntax for such a rarely-used command is out of scope for pandoc.

@mb21 mb21 closed this as completed Mar 16, 2018
@cagix
Copy link
Contributor

cagix commented Mar 26, 2018

You could also use (blabla){.alert} and translate the resulting span with a short lua-filter ...

@CLRafaelR
Copy link
Contributor

CLRafaelR commented Sep 12, 2021

@gjherbiet

You can use the following lua filter (say, alert.lua) when you produce a beamer presentation.

if FORMAT:match 'beamer' then
    function Span(el)
        if el.classes[1] == "alert" then
            table.insert(el.content, 1, pandoc.RawInline("latex", "\\alert{"))
            table.insert(el.content, pandoc.RawInline("latex", "}"))
        end
        return el
    end
    return { { Span = Span } }
end

In an md file, [what you want to highlight]{.alert} is the command to produce a text with an alert. Note that you need to enclose the text with square bracket [...], not (...).

## frame header

- This is important
- This is also important
- This is [the most important]{.alert} line

Then, your md is converted into a beamer presentation pdf with alerts.

pandoc --lua-filter=alert.lua -t beamer presentation.md -o presentation.pdf

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

No branches or pull requests

4 participants