Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Makefile for compiling beamer with and without notes

202 views
Skip to first unread message

Sivaram Neelakantan

unread,
Oct 15, 2021, 1:12:32 PM10/15/21
to
As the subject says, is there one that can do the equivalent of what I
have currently within the latex file below?

%\setbeameroption{hide notes} % Only slides
\setbeameroption{show notes on second screen=right} % Both
%\setbeameroption{show only notes} % Only notes


sivaram
--

Denis Bitouzé

unread,
Oct 15, 2021, 2:37:16 PM10/15/21
to
Le 15/10/21 à 22h42, Sivaram Neelakantan a écrit :
1. Create a `main.tex` containing all your current file, except:
- `\documentclass[...]{beamer}`,
- the `\setbeameroption{...}` above.
2. Create 3 files:
1. `only-slides.tex` containing only:
--8<---------------cut here---------------start------------->8---
\documentclass[...]{beamer}
\setbeameroption{hide notes}
\input{main}
--8<---------------cut here---------------end--------------->8---
2. `both.tex` containing only:
--8<---------------cut here---------------start------------->8---
\documentclass[...]{beamer}
\setbeameroption{show notes on second screen=right}
\input{main}
--8<---------------cut here---------------end--------------->8---
┌────
│ \documentclass[...]{beamer}
│ \setbeameroption{show only notes}
│ \input{main}
└────
3. `only-notes.tex` containing only:
--8<---------------cut here---------------start------------->8---
\documentclass[...]{beamer}
\setbeameroption{hide notes}
\input{main}
--8<---------------cut here---------------end--------------->8---
3. Create a `makefile` containing:
--8<---------------cut here---------------start------------->8---
only-slides:
latexmk only-slides
both:
latexmk both
only-notes:
latexmk only-notes
--8<---------------cut here---------------end--------------->8---
--
Denis

Sivaram Neelakantan

unread,
Oct 16, 2021, 11:37:57 AM10/16/21
to
On Fri, Oct 15 2021,Denis Bitouzé wrote:

[snipped 12 lines]
> only-slides:
> latexmk only-slides
> both:
> latexmk both
> only-notes:
> latexmk only-notes

Thank you. This is what I modified it to, which seems to work.

--8<---------------cut here---------------start------------->8---
DOC=ML_CNF
only_slides: clean
latexmk -pdf only_slides
mv only_slides.pdf ${DOC}_only_slides.pdf 2>/dev/null
both: clean
latexmk -pdf both
mv both.pdf ${DOC}_both_slides_notes.pdf 2>/dev/null
only_notes: clean
latexmk -pdf only_notes
mv only_notes.pdf ${DOC}_only_notes.pdf 2>/dev/null

all: clean only_slides both only_notes

clean:
rm -f *.log *.aux *.snm *.nav *.out *.toc *.fls *.fdb_latexmk *.dvi
--8<---------------cut here---------------end--------------->8---

though now I have a new issue that I don't know where to look

The only_notes deck has numbering which is going 2 of 1, 3 of 1 etc
instead of 1 of 4, 2 of 4, 3 of 4. The makefile output is below and I
have no idea where the error is. I have no idea why .nav is not
generated.

--8<---------------cut here---------------start------------->8---
Output written on only_notes.pdf (4 pages, 39489 bytes).
Transcript written on only_notes.log.
Latexmk: Examining 'only_notes.log'
=== TeX engine is 'pdfTeX'
Latexmk: Missing input file: 'only_notes.nav' from line
'No file only_notes.nav.'
Latexmk: Log file says output to 'only_notes.pdf'
Latexmk: All targets (only_notes.pdf) are up-to-date
mv only_notes.pdf ML_CNF_only_notes.pdf 2>/dev/null
--8<---------------cut here---------------end--------------->8---

sivaram
--

Dr Eberhard Lisse

unread,
Oct 18, 2021, 8:02:15 AM10/18/21
to
I would do something like this:

In the preable ot the tex file put

\usepackage{etoolbox}
\newbool{both}
\boolfalse{both}
\newbool{notes}
\boolfalse{notes}
\newbool{slides}
\booltrue{slides}

and

\ifbool{slides}{\setbeameroption{hide notes}}{}
\ifbool{both}{\setbeameroption{show notes on second screen=right}}{}
\ifbool{slides}{\setbeameroption{show only notes}}{}

and the in the makefile something like

notes: beamerfile.tex
perl -i -p \
-e 's/\\booltrue\{both\}/\\boolfalse\{both\}/g;' \
-e 's/\\booltrue\{slides\}/\\boolfalse\{slides\}/g;' \
-e 's/\\boolfalse\{notes\}/\\booltrue\{notes\}/g;' \
beamerfile.tex
latexmk beamerfile.tex

plus the other two possibilites...

then a

make notes

should do the trick

el
To email me replace 'nospam' with 'el'

Denis Bitouzé

unread,
Oct 18, 2021, 8:55:47 AM10/18/21
to
Le 16/10/21 à 21h07, Sivaram Neelakantan a écrit :

> I have no idea why .nav is not generated.

What happens if you don't clean the `*.nav` files?
--
Denis

Sivaram Neelakantan

unread,
Oct 19, 2021, 3:14:33 AM10/19/21
to
Same issue

--8<---------------cut here---------------start------------->8---
Latexmk: Examining 'only_notes.log'
=== TeX engine is 'pdfTeX'
Latexmk: Missing input file: 'only_notes.nav' from line
'No file only_notes.nav.'
Latexmk: Log file says output to 'only_notes.pdf'
Latexmk: All targets (only_notes.pdf) are up-to-date
mv only_notes.pdf ML_CNF_only_notes.pdf 2>/dev/null

$ ll *.nav
only_slides.nav

$ cat only_slides.nav # as it says above there's no only_notes.nav
\headcommand {\slideentry {0}{0}{1}{1/1}{}{0}}
\headcommand {\beamer@framepages {1}{1}}
\headcommand {\slideentry {0}{0}{2}{2/2}{}{0}}
\headcommand {\beamer@framepages {2}{2}}
\headcommand {\slideentry {0}{0}{3}{3/3}{}{0}}
\headcommand {\beamer@framepages {3}{3}}
\headcommand {\slideentry {0}{0}{4}{4/4}{}{0}}
\headcommand {\beamer@framepages {4}{4}}
\headcommand {\slideentry {0}{0}{5}{5/5}{}{0}}
\headcommand {\beamer@framepages {5}{5}}
\headcommand {\slideentry {0}{0}{6}{6/6}{}{0}}
\headcommand {\beamer@framepages {6}{6}}
\headcommand {\slideentry {0}{0}{7}{7/7}{}{0}}
\headcommand {\beamer@framepages {7}{7}}
\headcommand {\slideentry {0}{0}{8}{8/8}{}{0}}
\headcommand {\beamer@framepages {8}{8}}
\headcommand {\beamer@partpages {1}{8}}
\headcommand {\beamer@subsectionpages {1}{8}}
\headcommand {\beamer@sectionpages {1}{8}}
\headcommand {\beamer@documentpages {8}}
\headcommand {\gdef \inserttotalframenumber {8}}

$ cat only_notes.tex
\documentclass[usenames,dvipsnames]{beamer}
\setbeameroption{show only notes} % Only notes
\input{main}
--8<---------------cut here---------------end--------------->8---


sivaram
--

Sivaram Neelakantan

unread,
Oct 19, 2021, 3:17:46 AM10/19/21
to
[snipped 12 lines]

Thank you. This too looks like a good way to generate docs.

sivaram
--

samcarter8

unread,
Oct 20, 2021, 10:50:57 AM10/20/21
to
It is not necessary to actually change the .tex with perl, you can pass
the options via the `pretex` option of latexmk, see e.g. the example in

https://topanswers.xyz/tex?q=583#a632

samcarter8

unread,
Oct 20, 2021, 10:52:35 AM10/20/21
to
P.S. if you then also choose different jobnames for the different
options you might avoid some unnecessary recompilations

On 20.10.21 16:50, samcarter8 wrote:
> It is not necessary to actually change the .tex with perl, you can pass
> the options via the `pretex` option of latexmk, see e.g. the example in
>
> https://topanswers.xyz/tex?q=583#a632
>
> On 18.10.21 14:02, Dr Eberhard Lisse wrote:

Dr Eberhard W Lisse

unread,
Oct 22, 2021, 3:08:09 AM10/22/21
to

Sam,

That will also work, but then you need to compile it with pretex every
time, which I sometimes don't.

greetings, el
On 2021-10-20 16:52 , samcarter8 wrote:
> P.S. if you then also choose different jobnames for the different
> options you might avoid some unnecessary recompilations
>
> On 20.10.21 16:50, samcarter8 wrote:
>> It is not necessary to actually change the .tex with perl, you can
>> pass the options via the `pretex` option of latexmk, see e.g. the
>> example in
[...]
0 new messages