pandoc icon indicating copy to clipboard operation
pandoc copied to clipboard

::: notes div on section slide shows up in beamer article

Open folofjc opened this issue 2 years ago • 15 comments

Explain the problem. This is a continuation of #7857.

Thanks for the fix there, adding a ::: note to a section slide adds a note on that slide. This note does not show up on the main slide or the handout, which is expected and desired.

However, it does show up when compiling into the beamerarticle option. All other notes do not show up in the beamerarticle that I can see, just this one. This one should also not show up.

It looks like the \note{ is missing write before the content of the note when in beamerarticle.

Pandoc version? 2.19.2 on Ubuntu 22.04 LTS.

folofjc avatar Feb 18 '23 21:02 folofjc

Could you add a short example that allows us to reproduce the issue?

tarleb avatar May 05 '23 15:05 tarleb

Sure/

# First Section 1

## First Subsection in First Section

::: notes

This should also not appear in handout or article

:::

### First slide (I think)

Here is what shows up in article:

Screenshot 2023-05-10 205118

folofjc avatar May 10 '23 18:05 folofjc

I haver exactly the same issue with Pandoc 3.2.

pagiraud avatar Sep 10 '24 14:09 pagiraud

Please give detailed instructions for reproducing the issue (I could not).

jgm avatar Sep 10 '24 15:09 jgm

No problem.

Take the following file content:

---
title: Test for articleBeamer
author: Me
date: 1/1/1
documentclass: beamer
beameroption: "show notes on second screen=right"
---

# First slide

Some slide content.

::: notes

Make some note!

:::

# Second slide

Another slide

It makes a valid Beamer presentation using, let’s say:

pandoc -t beamer beamerarticle.md -o beamerarticle.pdf

Now, if you change the YAML header to:

---
title: Test for articleBeamer
author: Me
date: 1/1/1
documentclass: article
header-includes:
  - \usepackage{beamerarticle}
---

And use: pandoc beamerarticle.md -o beamerarticle.pdf

You expect the notes not to show up, but they do…

pagiraud avatar Sep 10 '24 16:09 pagiraud

Try with

pandoc beamerarticle.md -o beamerarticle.pdf --to=beamer

tarleb avatar Sep 10 '24 17:09 tarleb

@tarleb Thanks for the idea. It fails:

Error producing PDF.
! Undefined control sequence.
<recently read> \setbeamertemplate 
                                   
l.9 \setbeamertemplate

I think you don’t get what beamerarticle is made for : it’s a package for the class article that produces an article from a beamer presentation. I think this is why your solution fails.

pagiraud avatar Sep 10 '24 17:09 pagiraud

Ah yes, that was indeed my mistake.

You could filter the notes out with a Lua filter:

function Div (div)
  if div.classes:includes 'notes' then
    return {}
  end
end

tarleb avatar Sep 10 '24 17:09 tarleb

I'm wondering, if the note div will be translated into a \note{...} command. If this is true, couldn't you just add an emtpy definition to the headers-include section?

cagix avatar Sep 10 '24 17:09 cagix

@cagix No, the notes div is not translated: it would be recognized by beamerarticle. To be completely sure, I exported to a .tex file : it becomes a simple paragraph.

@tarleb Thanks a lot, the filter does the job. Actually, that was the first solution I was heading to but I stumbled upon an apparently similar problem and thought (by misinterpreting what the writer was actually meaning) it was not a good idea. As far as I’m concerned, the issue is solved, since the only reason I wanted to use the beamerarticle package was to drop the notes div.

pagiraud avatar Sep 10 '24 20:09 pagiraud

I'm wondering, if the note div will be translated into a \note{...} command. If this is true, couldn't you just add an emtpy definition to the headers-include section?

This is actually what I was hoping for in my original request above. All the other note div in slides are translated into \note{...} for beamerarticle, but not when it is part of a section. If the \note{...} would be added by pandoc even in the beamerarticle class, just like it does for beamer then everything would work as expected.

folofjc avatar Sep 11 '24 05:09 folofjc

@folofjc @pagiraud Ah, so in the case of -t beamer a \note{<text>} is output, but with -t latex it is only the text within the div without the enclosing \note{}.

However, this only seems to affect the note div, I just tested it with other divs, there is no tex command emitted in any case, just the text. I find this quite ... inconsistent (even though note has a special meaning in the case of Beamer).

cagix avatar Sep 11 '24 06:09 cagix

@folofjc @pagiraud Ah, so in the case of -t beamer a \note{<text>} is output, but with -t latex it is only the text within the div without the enclosing \note{}.

However, this only seems to affect the note div, I just tested it with other divs, there is no tex command emitted in any case, just the text. I find this quite ... inconsistent (even though note has a special meaning in the case of Beamer).

Correct. And it is only in the section. When there is a note div in a slide, it is correctly output as \note{...} in beamerarticle.

folofjc avatar Sep 11 '24 06:09 folofjc

@jgm Is this something that should be handled the same way across all writers? With -t html, a div with the corresponding class is always produced, and the user must provide the appropriate definition. If this were handled in the same way for -t latex and -t beamer, it would be much more consistent and logical from a user's point of view. This would also solve the original question. However, it might also break some workflows where people use divs and translate to LaTeX.

cagix avatar Sep 11 '24 06:09 cagix

I note the following code in the LaTeX writer:

              [Div (_,"notes":_,_) _] ->  -- see #7857, don't create frame
                    -- just for speaker notes after section heading
                    Div (ident,"section":dclasses,dkvs) xs

This refers to #7857 which might shed some light on why it behaves the way it does...

jgm avatar Oct 03 '24 03:10 jgm

I think this might have been fixed by the recent template-restructuring. At least I now see the notes when running pandoc -Vbeamerarticle test.md --output=out.pdf.

tarleb avatar Jul 29 '25 09:07 tarleb