pcafrica / focus-beamertheme

Focus: a minimalist presentation theme for LaTeX Beamer.
GNU General Public License v3.0
497 stars 43 forks source link

`noframenumbering` reduces the page number twice #29

Closed ishiihidemasa closed 8 months ago

ishiihidemasa commented 8 months ago

I recently started using focus theme. I like how it looks. My trouble is that, when I use section page and focus frame, the page numbering fails. To illustrate, I downloaded focus-demo.tex, focus-demo_bibliography.bib, and focus-logo.pdf and compiled the tex file on my PC. I attach the generated PDF (that was converted to images). I observe that the page number is reduced twice, though it should be reduced only once, every time a frame with noframenumbering option is created.

The version of beamertheme-focus is 3.3.0 (I believe it's the latest). I use lualatex with the following .latexmkrc file. Files are created in build directory.

$latex = 'lualatex -synctex=1 -interaction=nonstopmode -file-line-error -halt-on-error -outdir=build %O %S';
$out_dir = 'build';

# Biber, BibTeX
$biber = 'biber %O --bblencoding=utf8 -u -U --output_safechars %B';
$bibtex = 'upbibtex %O %B';
# makeindex
$makeindex = 'upmendex %O -o %D %S';

$pdf_mode = 4;  # lualatex

$max_repeat = 5;

I use Windows 11 and I usually work on VS Code with LaTeX Workshop extension. I don't think the use of VS Code is relevant though, because the result doesn't change even if I run latexmk focus-demo.tex on terminal.

I'm not sure if it helps, but I tried several things by myself. It seems that \addtocounter{framenumber}{-1} in beamerouterthemefocus.sty (line 210) is called twice. I added another counter mytest and overrode the definition of noframenumbering as follows, so that mytest increases by one when noframenumbering frame is created.

\newcounter{mytest}
\defbeamertemplate{footline}{mynoframenumbering}{  % new attribute mynoframenumbering
    \addtocounter{framenumber}{-1}
    \addtocounter{mytest}{1}  % NEW
}
% Enable noframenumbering option.
\define@key{beamerframe}{noframenumbering}[true]{%
    \setbeamertemplate{footline}[mynoframenumbering]%  use mynoframenumbering instead
    \setlength{\focus@pbar@height}{0cm}%
    \focus@calculatefootheight%
}

It turned out that, when mytest was 0 before the focus frame (i.e. mytest is 0 on page $N$ and page $N + 1$ is a focus frame), mytest became 2 after the focus frame (i.e. on page $N + 2$). I believe it should be 1 on page $N + 2$.

This is the first time I create an issue, and I apologize if I've done anything inappropriately. Thank you in advance.

Hidemasa

focus-demo_01 focus-demo_02 focus-demo_03 focus-demo_04 focus-demo_05 focus-demo_06 focus-demo_07 focus-demo_08 focus-demo_09 focus-demo_10 focus-demo_11 focus-demo_12 focus-demo_13 focus-demo_14 focus-demo_15 focus-demo_16 focus-demo_17 focus-demo_18

pcafrica commented 8 months ago

Hi @ishiihidemasa,

thanks for using Focus and for reporting the issue.

Unfortunately, I'm not able to reproduce the issue on any of my local machines. Even with your .latexmkrc file the generated PDF output looks correctly numbered.

Could you please provide a minimal working example? Also, which OS and LaTeX distribution are you using?

Best.

ishiihidemasa commented 8 months ago

Thank you very much for your prompt reply. OS: Microsoft Windows 11 Home (10.0.22621) LaTeX distribution: The output says This is LuaHBTeX, Version 1.17.0 (TeX Live 2023). (Does this answer your question?)

As for MWE, I came up with the following:

\documentclass{beamer}
\usetheme{focus}

\begin{document}
\begin{frame}[focus]
  This is focus frame!
\end{frame}

\begin{frame}{first slide}
  Page number should be one but it's zero.
\end{frame}
\end{document}

Compiling this tex file, I get the following PDF. Page number should be one after the focus frame, but it is zero instead.

Hope it helps. Thank you again for your response.

mwe_1 mwe_2

pcafrica commented 8 months ago

Unfortunately I'm still unable to reproduce the issue. Compiling your MWE with LuaLaTeX 1.14.0 outputs the following PDF, which is numbered correctly: texstudio_CqdbGz.pdf

There might be some incompatibility with the compiler version.

Have you tried to run the compiler more than once on the same file, or could you please try on some online platform like overleaf?

Best.

pcafrica commented 8 months ago

Update: it seems that this is caused by a different behaviour between TeXLive 2022 and TeXLive 2023...

pcafrica commented 8 months ago

I think I managed to fix it! Please find the fixed version in the latest release v3.4.0.

Thanks again for helping to improve Focus!

Best.