chirun-ncl / chirun

A Python package providing the command line interface for building flexible and accessible content with Chirun.
https://chirun.org.uk/
Other
29 stars 4 forks source link

HTML output renders parameters fed to \usebeamerfont and \usebeamercolor #76

Open prowlett opened 3 years ago

prowlett commented 3 years ago

Not a huge issue, because it's easy to work around, but I noticed it so I'm reporting it.

I have a slide where I use \usebeamerfont and \usebeamercolor. Something like this:

\documentclass{beamer}

\begin{document}
\begin{frame}
    Small.

    \usebeamerfont{title}\usebeamercolor[fg]{title} Big.
\end{frame}

\end{document}

For the PDF, this produces 'Small' in normal font and on the next line 'Big' is bigger and blue.

For the HTML, this produces:

<div class="beamer-frame">
<p>
Small. 
</p>
<p>
title[fg]title Big. 
</p>
</div>

Better if it didn't include title[fg]title in the rendered HTML output.

As a more general point, it seems a little odd to me that if it doesn't understand \latexcommand{thing} that it would eat \latexcommand but then render {thing} anyway.

georgestagg commented 3 years ago

I've added stubs for \usebeamerfont and \usebeamercolor so that the arguments are absorbed and not rendered in the output. I've left the issue open because the best way to really handle the behaviour of these macros needs further thought. Beamer is one of those packages where we don't necessarily want to exactly reproduce the PDF, but we probably shouldn't just ignore them either.

The unknown macro behaviour is inherited from the plasTeX compiler we use. When the compiler hits a macro it doesn't understand it tries to continue rather than just erroring out. However, since it doesn't know how many arguments \latexcommand takes it can't know whether to render {thing} or not. Consider the pdflatex output of \LaTeX{123} as a counterexample where "123" should indeed be rendered.

prowlett commented 3 years ago

Ah crumbs, I had forgotten there are cases \latexcommand{thing} where \latexcommand and {thing} are not related - good point.

I suppose \usebeamerfont and \usebeamercolor are used to say "make this bit look like something from the Beamer theme" and since you aren't obeying the Beamer theme, you don't need to worry about it and can just swallow these commands and their arguments. If I were saying "make me some large blue text no matter what" I should be saying this in a direct way, rather than saying "make this look like a title in my Beamer theme".