beamer-presentation 中的 Boolexpr 和 biblatex

beamer-presentation 中的 Boolexpr 和 biblatex

我编写了自己的 beamer-class-template,它使用了 -package boolexpr。但是当将它与biblatex-package 结合使用时,它会产生 6 MByte 的日志文件和大量错误。首先是

(c:/texlive/2016/texmf-dist/tex/latex/biblatex/blx-dm.def
! Undefined control sequence.
\do ...lx@dm@datatype }{#1}}\par \par \ifboolexpr 
                                                  {test {\ifcsstring {blx@dm...
l.447   volumes}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.


! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.447   volumes}

You're in trouble here.  Try typing  <return>  to proceed.
If that doesn't work, type  X <return>  to quit.

! Argument of \@secondoftwo has an extra }.
<inserted text> 
                \par 
l.447   volumes}

I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.

Runaway argument?
! Paragraph ended before \@secondoftwo was complete.
<to be read again> 
                   \par 
l.447   volumes}

I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.

我的文件是

\documentclass[screen, aspectratio=43]{beamer}
\usetheme{test}
\usepackage{biblatex}
\begin{document}
    Hello
\end{document}

作为主文件和

\ProvidesClass{beamerthemetest}

\mode
<presentation>
% Set some style dependent values
\usepackage{boolexpr}
\ifcsname ifboolexpr\endcsname
\makeatletter
\let\ifboolexpr\@undefined
\makeatother
\fi


\mode
<all>

作为样式文件。如何biblatex在主文件中使用 -package,同时仍在boolexpr主题文件中保留 -package?

如果我删除 undef-part(即\if...\fi,我会收到以下错误(第一部分):

(c:/texlive/2016/texmf-dist/tex/latex/biblatex/blx-dm.def
! Missing number, treated as zero.
<to be read again> 
                   \protect 
l.447   volumes}

A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

! Missing = inserted for \ifnum.
<to be read again> 
                   \begingroup 
l.447   volumes}

I was expecting to see `<', `=', or `>'. Didn't.

! Missing number, treated as zero.
<to be read again> 
                   \begingroup 
l.447   volumes}

A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

! Missing \endcsname inserted.
<to be read again> 
                   \begingroup 
l.447   volumes}

The control sequence marked <to be read again> should
not appear between \csname and \endcsname.


! LaTeX Error: Unknown relation found while scanning \boolexpr !.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.447   volumes}

You're in trouble here.  Try typing  <return>  to proceed.
If that doesn't work, type  X <return>  to quit.

我对这个包裹的申请boolexpr

\long\def\isequal#1#2{\pdf@strcmp{#1}{#2}}
\switch
\case{\isequal{\beamer@ntnu@style}{vertical}}
   \setbeamercolor{footline}{fg=white}
   \def\footlinealign{left}
   \def\titlex{50pt}
   \def\titley{70pt}
   \def\pgnumoffset{7pt}
   \setbeamersize{text margin left=2cm,text margin right=1em}
\case{\isequal{\beamer@ntnu@style}{horizontal}}
   \setbeamercolor{footline}{fg=white}
   \def\footlinealign{left}
   \def\titlex{30pt}
   \def\titley{70pt}
   \def\pgnumoffset{0pt}
   \setbeamersize{text margin left=1cm,text margin right=1em}
\otherwise
   \setbeamercolor{footline}{fg=black}
   \def\footlinealign{right}
   \def\titlex{16pt}
   \def\titley{110pt}
   \def\pgnumoffset{0pt}
   \setbeamersize{text margin left=1cm,text margin right=1em}
\endswitch

答案1

根据 beamer 通常处理主题选项的方式,以下可能是不使用软件包的解决方法boolexpr

\documentclass[screen, aspectratio=43]{beamer}

\setbeamertemplate{footline}{
    \begin{beamercolorbox}{footline}
        sdjk
    \end{beamercolorbox}
}

\usetheme[style=vertical]{ntnu}


\usepackage{biblatex}
\begin{document}
    Hello
\end{document}

\mode<presentation>

\DeclareOptionBeamer{style}{\def\beamer@ntnu@style{#1}}
\ExecuteOptionsBeamer{style=vertical}
\ProcessOptionsBeamer

\def\beamer@ntnu@verticaltext{vertical}%
\def\beamer@ntnu@horizontaltext{horizontal}%

\ifx\beamer@ntnu@style\beamer@ntnu@verticaltext%
   \setbeamercolor{footline}{fg=blue}
   \def\footlinealign{left}
   \def\titlex{50pt}
   \def\titley{70pt}
   \def\pgnumoffset{7pt}
   \setbeamersize{text margin left=2cm,text margin right=1em}
\else%
\ifx\beamer@ntnu@style\beamer@ntnu@horizontaltext%
   \setbeamercolor{footline}{fg=red}
   \def\footlinealign{left}
   \def\titlex{30pt}
   \def\titley{70pt}
   \def\pgnumoffset{0pt}
   \setbeamersize{text margin left=1cm,text margin right=1em}
\else%
   \setbeamercolor{footline}{fg=green}
   \def\footlinealign{right}
   \def\titlex{16pt}
   \def\titley{110pt}
   \def\pgnumoffset{0pt}
   \setbeamersize{text margin left=1cm,text margin right=1em}
\fi
\fi%

\mode
<all>

相关内容