jolars / moloch

A LaTeX Beamer theme, forked from the metropolis theme
https://ctan.org/pkg/moloch
Creative Commons Attribution Share Alike 4.0 International
89 stars 5 forks source link

Disable memoization of progress bars when using the memoize package #16

Closed zhantyzgz closed 4 months ago

zhantyzgz commented 4 months ago

When writing a presentation, it is often helpful to externalize the figures so that they don't get recompiled each time. One modern way to do this is with the Memoize package (https://github.com/sasozivanovic/memoize). But some elements such as progress bars are not well-suited for memoization, since they depend on external factors to compute the lengths.

Currently, trying to use Moloch and Memoize together results in auto-memoization of the progress bars, which is undesirable. In practice, this means that each progress bar in the document is filled to the same amount.

Both Metropolis and Moloch already disable the TikZ externalization library, in the beamer templates for title separator, progress bar in section page, and progress bar in head/foot. It suffices to add \mmznext(disable} to their definition. Currently, one solution for the end-user is to input the following into the preamble of their document, after loading Moloch.

\addtobeamertemplate{progress bar in head/foot}{%
    \mmznext{disable}% pre-text
}{}
\addtobeamertemplate{progress bar in section page}{%
    \mmznext{disable}% pre-text
}{}
\addtobeamertemplate{title separator}{%
    \mmznext{disable}% pre-text
}{}

Of course, should it be implemented in this way, Moloch should also \providecommand{\mmznext}{}, like it already does for \tikzexternalenable and \tikzexternaldisable. According to Memoize's documentation, using \RequirePackage{memoizable} works, too.

But I think a theoretical better way would be to input \mmzUnmemoizable in the code of each relevant tikzpicture, since this should also prevent the use of any previously memoized progress bars. I have not tested this yet, though.

jolars commented 4 months ago

Thanks for raising the issue! Okay, I think I understand the problem. I don't understand completely how to use \mmzUnmemoizable, however. Should the command just go inside the tikzpicture environment?

zhantyzgz commented 4 months ago

Yes, that is right. I have done a quick test and it seems to work fine.