Dear John,

Thank you again for your super prompt response - very much appreciated, amazing.
Last thing I want is to waste your time and kindness and support.
Therefore, I allowed myself to create a MWE, as I think we are on different wavelengths.
https://github.com/tchevri/BookdownExample 

Opened as a project in RStudio, it compiles with a single click  (build book radio button, bookdown::pdf_book).
with Pandoc 2.6 - i get precisely what i look for - new title slides for every lecture set, works perfect.
with pandoc >2.7, because of the reveal.js request that impacted beamer, I am getting a spurious slide, which I cannot get rid of, containing the current section header.

I am using XieYiHui's bookdown, so i think yes, I can make my bookdown use a custom template by adding 'template:' to my YAML metadata.
As i said, I even see it in the command line when I build the book: "C:/PROGRA~1/Pandoc/pandoc"  +RTS -K512m -RTS ./index.split.md --template my-template.tex etc etc....
I tried so many things - setting the variable in the YAML metadata or with -V is one of the many things I tried.

Please do allow me to think you have a different issue in mind - you do handle so many (and I am so impressed you can, i would not be able to).
pre 2.7, non slide level content was just ignored.
Post 2.7 *anything* above a slide level gets slapped automatically onto a slide.
That's the new behavior that's been causing me havoc.

hence my suggestion that if I have level 3 slides, then content below level 1 be not slapped onto a slide, only content below level 2, if that makes sense?
Of course, I'd be happy with any other resolution.

Many thanks
thomas

 
On Wednesday, August 26, 2020 at 2:14:14 AM UTC+8 John MacFarlane wrote:

You can't make it use the template by adding 'template:'
to your YAML metadata. Use a defaults file or just specify
--template mytemplate.tex on the command line.

Also, you don't put $dayone$ in the body of your document.
You can set this variable in YAML metadata or with -V
on the command line.

---
dayone: true
...

or

-Vdayone



Thomas Chevrier  writes:

> Thank you again John for taking the time again and again to respond -
> totally appreciated, it's amazing.
>
> As a consequence, I took the entire day to try your solution, google
> frantically, but I failed miserably.
> I will spare you the details of everything I tried, but here is what i
> think is my best attempt:
>
> .1.
> Read carefully: https://bookdown.org/yihui/rmarkdown/template-pandoc.html
>
> .2.
> Download default.latex from your website:
> https://github.com/jgm/pandoc-templates
>
> .3.
> Rename the file to my-template.tex and, as per your email, line 460 just
> before $body$, add:
> $if(dayone)$
> \mode<presentation>
> {
> \title[\CourseName{} Lecture $lecture-number$]{\CourseName{} \newline
> \, Lecture $lecture-number$}
> \date{\DayOne{}\Yr{}}
> }
> ###
> \titlepage
> $endif$
>
> .4.
> In my bookdown, add the $dayone$ custom Pandoc variable
> # Notations {#notations}
> ## Mathematics
> $dayone$
> ```{r Lecture1Outline, eval = (out_type=="beamer"), echo=FALSE,
> results='asis'}
> ```
> ```{r Lecture1Slide1, eval = (out_type=="beamer"), echo=FALSE,
> results='asis'}
> ```
> `r if (out_type=="beamer") "- "` $h = \left(h_{1}, h_{2}, \ldots,
> h_{n}\right)$ denotes a vector (lowercase)
>
> etc. etc...
>
> .5.
> add "template: my-template.tex" to my YAML so that "--template
> my-template.tex" is being correctly added as an option to Pandoc.
>
> OUTCOME:
>
> I still get the undesired slide...
> "...
> Mathematics
> 𝑑𝑎𝑦𝑜𝑛𝑒
> ..."
>
> I check the .rmd file.
> It has
> <!--chapter:end:index.Rmd-->
> # Notations {#notations}
> ## Mathematics
> $dayone$
> etc. etc...
>
> the .tex file has:
>
> \hypertarget{mathematics}{%
> \subsection{Mathematics}\label{mathematics}}
> \begin{frame}{Mathematics}
> \(dayone\)
> \end{frame}
>
> I am so sorry - I feel crummy I could not figure this one out after so many
> hours and I Thank you in advance for any further help on this issue that
> has drawn me for nearly 18 months.
> Many thanks
> thomas
>
> PS: note that I have
> before_body: beamer_prefix.tex
> and that works well for setting the initial cover page (syllabus) - the
> issue is really after, as I used this mode<presentation> to redefine the
> elements of the title slide on the fly (day 1, 2, etc of the course)
>
> On Tuesday, August 25, 2020 at 12:22:26 PM UTC+8 John MacFarlane wrote:
>
>>
>> If that's what you need, then a custom template could provide it.
>> Just add this stuff to a custom template, with variables in the
>> varying parts:
>>
>> \mode<presentation>
>> {
>> \title[\CourseName{} Lecture $lecture-number$]{\CourseName{} \newline \,
>> Lecture $lecture-number$}
>> \date{\DayOne{}\Yr{}}
>> }
>> ###
>> \titlepage
>>
>> $body$
>>
>> "Chevrier, Thomas" writes:
>>
>> > First of all, thank you so much for taking the time to reply - really
>> much
>> > appreciated, all the more given how busy I see you are, with so many
>> > awesome improvements.
>> > I love this "raw beamer" attribute, might make my document a lot more
>> > readable, yet to try it for other purposes.
>> > Unfortunately, this suggested solution does not help the issue at stake.
>> >
>> > The issue is for the content not to get forced slapped onto a slide.
>> > To create a new title page, I need the following piece of code:
>> > \mode<presentation>
>> > {
>> > \title[\CourseName{} Lecture 1]{\CourseName{} \newline \, Lecture 1}
>> > \date{\DayOne{}\Yr{}}
>> > }
>> > ###
>> > \titlepage
>> >
>> > And this {...} code cannot sit inside a frame or a latex error is thrown
>> (!
>> > Illegal parameter number in definition of \iterate.).
>> > After 2.7 - there is no more option for me to write content outside a
>> frame
>> > - everything is forced into a frame.
>> > "raw beamer" attribute does not escape this behavior unfortunately.
>> >
>> > Hence my suggestion last night - i don't know if that would be acceptable
>> > or even useful?
>> > But i have been thinking that I am perfectly fine with level -2 content
>> not
>> > being forced onto slides.
>> > From what I read, it looks like reveal.js users only need level -1
>> content
>> > slapped onto slides?
>> > Of course, I'd be happy with any other solution you think is best.
>> >
>> > Many thank
>> > thomas
>> >
>> >
>> > On Tue, Aug 25, 2020 at 4:00 AM John MacFarlane 
>> wrote:
>> >
>> >>
>> >> If you use the raw attribute to mark up content as "raw beamer,"
>> >> as suggested earlier in this thread, it will not appear in
>> >> reveal.js output. Demo here:
>> >>
>> >>
>> >>
>> https://pandoc.org/try/?text=%23+Introduction%0A%0A%60%60%60%7B%3Dbeamer%7D%0AHey+this+is+raw+beamer!%0A%60%60%60%0A%0A%23%23+Slide+one%0A%0Acontent%0A%0A%23%23%23+Vertical+slide%0A%0Acontent+vertical%0A&from=markdown&to=revealjs&standalone=0
>> >>
>> >>
>> >> Thomas Chevrier  writes:
>> >>
>> >> > Hi folks,
>> >> >
>> >> > it's been exactly a year now and I am still not able to upgrade my
>> >> version
>> >> > of Pandoc - stuck pre 2.7, because of the adverse change.
>> >> > Indeed, the "upgrade" for reveal.js users caused my latex beamer code
>> to
>> >> > break down.
>> >> > I have tried multiple things without luck - I also tried a lua filter,
>> >> but
>> >> > that did not work - no matter what, the content gets "slapped" onto a
>> >> slide.
>> >> > As JGM suggests (was great watching him talk about Pandoc at TUG 2020
>> >> > keynote address), I'd love to be able to simply be able to have
>> content
>> >> > escape being slapped onto a slide - I believe that's precisely the
>> >> spirit
>> >> > of Beamer, which uses <mode> heavily for that purpose.
>> >> > I also thought that was the spirit of pandoc - as you were setting in
>> >> the
>> >> > yaml header your level for displaying on slides, but i have been
>> clearly
>> >> > proven wrong. :-(
>> >> > One option would be to recompile pandoc without that change, but
>> because
>> >> of
>> >> > the bloomberg API, I am forced to be on windows, which would make this
>> >> > solution cumbersome at best (would be straightforward on linux
>> though).
>> >> >
>> >> > FYI, I posted back then on SO, got only 2 upvotes and 2 bookmarks, but
>> >> no
>> >> > answer, not even a comment :-(
>> >> >
>> >>
>> https://stackoverflow.com/questions/57614387/pandoc-4317-forces-content-under-title-slides-to-be-included-in-a-frame-in-pand
>> >> >
>> >> >
>> >> > Could anyone *please* help me?
>> >> > many thanks in advance
>> >> > thomas
>> >> >
>> >> >
>> >> > On Wednesday, August 28, 2019 at 12:23:15 AM UTC+8 John MacFarlane
>> wrote:
>> >> >
>> >> >>
>> >> >> To summarize the issue here, which concerns a change to slide
>> >> >> show formats:
>> >> >>
>> >> >> Prior to 2.7, versions of pandoc only put material under the "slide
>> >> >> level" headings on slides. If you set slide level to 2, then
>> >> >> only material under level-2 headings would appear on slides,
>> >> >> and text under level-1 headings would not appear at all
>> >> >> (though level-1 headings would create "title slides" with
>> >> >> just the section title).
>> >> >>
>> >> >> Reveal.js users consistently complained (#4317, #5237) that
>> >> >> this made it hard to structure reveal.js 2D slide shows, in
>> >> >> which it is common to have the "top" slide on each column
>> >> >> contain both a title and some text.
>> >> >>
>> >> >> In response, I changed pandoc in 2.7 -- as the changelog says,
>> >> >>
>> >> >> > Slide show formats behavior change: content under headers less
>> >> >> > than slide level is no longer ignored, but included in the title
>> >> >> > slide (for HTML slide shows) or in a slide after the title slide
>> >> >> > (for beamer). This change makes possible 2D reveal.js slideshows
>> >> >> > with content in the top slide on each stack (#4317, #5237).
>> >> >>
>> >> >> The change to reveal.js has been welcomed by reveal.js users,
>> >> >> but the change to beamer is apparently not welcome by everyone.
>> >> >> The reason I made the change to both formats is because I want
>> >> >> slide shows to work the same no matter what output format you
>> >> >> use. (So you can switch from beamer to reveal.js, for example,
>> >> >> and the slides will look more or less the same.)
>> >> >>
>> >> >> I had thought the beamer change was innocuous, since it could
>> >> >> be worked around by people who wanted to include content under
>> >> >> top-level section headings but not in the slides, e.g. by using
>> >> >> a filter to strip out this content.
>> >> >>
>> >> >> Unfortunately, Thomas Chevrier's use case can't be handled that
>> >> >> way. He wants to insert raw tex commands that (a) can't be
>> >> >> stripped out but (b) only work if they're outside the
>> >> >> 'frame' environment created for a slide. I can't think of any
>> >> >> workaround for this.
>> >> >>
>> >> >> One possible course of action would be to revert the beamer
>> >> >> change while keeping the reveal.js change. This would potentially
>> >> >> have two bad consequences:
>> >> >>
>> >> >> 1) slide shows would render differently (in content, not just
>> >> >> form) in reveal.js and beamer.
>> >> >>
>> >> >> 2) this may break slide shows that were constructed using the
>> >> >> new behavior since 2.7 was released.
>> >> >>
>> >> >> A less radical change might be to introduce special Div whose
>> >> >> contents get moved outside the slide itself. Anyway, comments
>> >> >> welcome.
>> >> >>
>> >> >>
>> >> >>
>> >> >
>> >> > --
>> >> > You received this message because you are subscribed to the Google
>> >> Groups "pandoc-discuss" group.
>> >> > To unsubscribe from this group and stop receiving emails from it, send
>> >> an email to .
>> >> > To view this discussion on the web visit
>> >>
>> https://groups.google.com/d/msgid/pandoc-discuss/c4db2ddc-b3b0-4c62-a8bb-8a601e37dc48n%40googlegroups.com
>> >> .
>> >>
>>
>
> --
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to .
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/73f0ad6f-f17d-424a-abe6-e8e29e9c7f2en%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/d70cf350-f53a-4b7b-80ef-1bb1526e849fn%40googlegroups.com.