[latex3-commits] [git/LaTeX3-latex3-pdfresources] testbeamercolor: test new beamerbasecolor (e223232)

Ulrike Fischer fischer at troubleshooting-tex.de
Thu Jan 20 10:57:42 CET 2022


Repository : https://github.com/latex3/pdfresources
On branch  : testbeamercolor
Link       : https://github.com/latex3/pdfresources/commit/e22323268582825754f678f789c3524bb83aefc1

>---------------------------------------------------------------

commit e22323268582825754f678f789c3524bb83aefc1
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Thu Jan 20 10:57:42 2022 +0100

    test new beamerbasecolor


>---------------------------------------------------------------

e22323268582825754f678f789c3524bb83aefc1
 firstaid/beamerbasecolor-ltx.sty | 419 +++++++++++++++++++++++++++++++++++++++
 pdfmanagement-firstaid.dtx       |   1 +
 2 files changed, 420 insertions(+)

diff --git a/firstaid/beamerbasecolor-ltx.sty b/firstaid/beamerbasecolor-ltx.sty
new file mode 100644
index 0000000..ab88c93
--- /dev/null
+++ b/firstaid/beamerbasecolor-ltx.sty
@@ -0,0 +1,419 @@
+% Copyright 2003--2007 by Till Tantau
+% Copyright 2010 by Vedran Mileti\'c
+% Copyright 2015 by Vedran Mileti\'c, Joseph Wright
+% Copyright 2017,2018 by Louis Stuart, Joseph Wright
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the file doc/licenses/LICENSE for more details.
+
+% (patched for l3color, part of pdfmanagement-testphase, original version part of beamer 2021/10/18 v3.64)
+\mode
+<presentation>
+
+%
+% Color theme stuff
+%
+
+\define at key{beamerthc}{fg}
+  {\expandafter\def\csname beamer at thcfg@\beamer at temp\endcsname{\def\beamer at thc@fg{#1}}}
+\define at key{beamerthc}{bg}
+  {\expandafter\def\csname beamer at thcbg@\beamer at temp\endcsname{\def\beamer at thc@bg{#1}}}
+\define at key{beamerthc}{parent}
+  {\expandafter\def\csname beamer at thcinherits@\beamer at temp\endcsname{%
+    \@for\@temp:={#1}\do{\expandafter\beamer at thc@docolor\expandafter{\@temp}}}}
+\define at key{beamerthc}{use}
+  {\expandafter\def\csname beamer at thcuse@\beamer at temp\endcsname{%
+    \@for\@temp:={#1}\do{\expandafter\beamer at thc@usecolor\expandafter{\@temp}}}}
+
+\def\beamer at thc@prepcolor{%
+  \let\beamer at thc@fg=\@empty%
+  \let\beamer at thc@bg=\@empty%
+}
+
+\def\beamer at thc@docolor#1{%
+  \csname beamer at thcuse@#1\endcsname%
+  \csname beamer at thcinherits@#1\endcsname%
+  \csname beamer at thcfg@#1\endcsname%
+  \csname beamer at thcbg@#1\endcsname%
+}
+
+\def\beamer at thc@usecolor#1{%
+  \begingroup%
+    \beamer at thc@prepcolor%
+    \beamer at thc@docolor{#1}%
+    \ifx\beamer at thc@fg\@empty\def\beamer at thc@fg{fg}\fi%
+    \ifx\beamer at thc@bg\@empty\def\beamer at thc@bg{bg}\fi%
+    \global\let\beamer at thc@gfg\beamer at thc@fg%
+    \global\let\beamer at thc@gbg\beamer at thc@bg%
+    %\globalcolorstrue%
+  \endgroup%
+   \colorlet{#1.fg}{\beamer at thc@gfg}%
+   \colorlet{#1.bg}{\beamer at thc@gbg}%
+}
+
+\def\setbeamercolor{\@ifstar{\beamer at clearbeamercolor}{\beamer at setbeamercolor}}
+
+\newcommand\beamer at clearbeamercolor[2]{%
+  \def\beamer at temp{#1}%
+  \expandafter\let\csname beamer at thcfg@#1\endcsname=\relax%
+  \expandafter\let\csname beamer at thcbg@#1\endcsname=\relax%
+  \setkeys{beamerthc}{use={},parent={}}%
+  \setkeys{beamerthc}{#2}%
+}
+\newcommand\beamer at setbeamercolor[2]{%
+  \def\beamer at temp{#1}%
+  \setkeys{beamerthc}{#2}%
+}
+
+\newcommand\ifbeamercolorempty[2][]{%
+  \beamer at thc@prepcolor%
+  \beamer at thc@docolor{#2}%
+  \expandafter\ifx\csname beamer at thc@#1\endcsname\@empty%
+    \expandafter\@firstoftwo%
+  \else%
+    \expandafter\@secondoftwo%
+  \fi%
+}
+
+
+\def\usebeamercolor{\@ifstar{\beamer at usebeamercolor[fg]{normal text}\beamer at usebeamercolor}{\beamer at usebeamercolor}}
+\newcommand\beamer at usebeamercolor[2][]{%
+  \beamer at thc@prepcolor%
+  \beamer at thc@docolor{#2}%
+  \ifx\beamer at thc@fg\@empty%
+     \colorlet{temp at fg}{fg}
+     %\@namelet{\string\color@ temp at fg}{\string\color@ fg}%
+  \else%
+     \colorlet{temp at fg}{\csname beamer at thc@fg\endcsname}%
+  \fi%
+  \ifx\beamer at thc@bg\@empty%
+    \colorlet{temp at bg}{bg}
+    %\@namelet{\string\color@ temp at bg}{\string\color@ bg}%
+  \else%
+    \colorlet{temp at bg}{\csname beamer at thc@bg\endcsname}%
+  \fi%
+  %\@namelet{\string\color@ parent.fg}{\string\color@ fg}%
+    \colorlet{parent.fg}{fg}
+  %\@namelet{\string\color@ parent.bg}{\string\color@ bg}%
+    \colorlet{parent.bg}{bg}
+  %\@namelet{\string\color@ fg}{\string\color@ temp at fg}%
+    \colorlet{fg}{temp at fg}
+  %\@namelet{\string\color@ bg}{\string\color@ temp at bg}%
+    \colorlet{bg}{temp at bg}
+  \begingroup%
+    %\global\@namelet{\string\color@ #2.fg}{\string\color@ temp at fg}%
+    %\global\@namelet{\string\color@ #2.bg}{\string\color@ temp at bg}%
+  \endgroup%
+    \colorlet{#2.fg}{temp at fg}
+    \colorlet{#2.bg}{temp at bg}
+  \def\beamer at temp{#1}%
+  \ifx\beamer at temp\@empty%
+  \else%
+    \color{#1}%
+  \fi%
+}
+
+\colorlet{fg}{black}
+\colorlet{bg}{white}
+
+\mode
+<article>
+{
+  \newcommand\setbeamercolor{\@ifstar{\@gobbletwo}{\@gobbletwo}}
+  \newcommand\usebeamercolor{\@ifstar{\beamer at optgog}{\beamer at optgog}}
+  \newcommand\beamer at optgog[2][]{}
+}
+
+
+
+%
+% Colored boxes
+%
+
+\define at key{beamercolbox}{wd}{\def\beamer at colbox@wd{#1}}
+\define at key{beamercolbox}{ht}{\def\beamer at colbox@ht{#1}}
+\define at key{beamercolbox}{dp}{\def\beamer at colbox@dp{#1}}
+\define at key{beamercolbox}{leftskip}{\def\beamer at colbox@ls{#1}}
+\define at key{beamercolbox}{rightskip}{\def\beamer at colbox@rs{#1}}
+\define at key{beamercolbox}{left}[0pt]{\def\beamer at colbox@ls{0pt}\def\beamer at colbox@rs{#1 plus1fill}}
+\define at key{beamercolbox}{center}[0pt]{\def\beamer at colbox@ls{#1 plus1fill}\def\beamer at colbox@rs{#1 plus1fill}}
+\define at key{beamercolbox}{right}[0pt]{\def\beamer at colbox@ls{#1 plus1fill}\def\beamer at colbox@rs{0pt}}
+\define at key{beamercolbox}{sep}{\def\beamer at colbox@sep{#1}}
+\define at key{beamercolbox}{colsep}{\def\beamer at colbox@colsep{#1}}
+\define at key{beamercolbox}{colsep*}{\def\beamer at colbox@colseps{#1}}
+\define at key{beamercolbox}{shadow}[true]{\def\beamer at colbox@shadow{#1}}
+\define at key{beamercolbox}{rounded}{\csname beamer at colbox@rounded#1\endcsname}
+\define at key{beamercolbox}{ignorebg}[true]{\csname beamer at colbox@ignorebg#1\endcsname}
+\define at key{beamercolbox}{vmode}[]{\def\beamer at vmode{}}
+
+\newif\ifbeamer at colbox@rounded
+\newif\ifbeamer at colbox@ignorebg
+
+\newenvironment{beamercolorbox}[2][]{%
+  \def\beamer at vmode{\leavevmode}%
+  \setkeys{beamercolbox}{wd=\textwidth,ht={},dp={},%
+    leftskip=0pt,rightskip=0pt plus1fil,%
+    sep=0pt,colsep=0pt,colsep*=0pt,%
+    shadow=false,rounded=false,ignorebg=false}%
+  \setkeys{beamercolbox}{#1}%
+  \ifbeamercolorempty[bg]{#2}{\@tempswafalse}{\@tempswatrue}%
+  \ifbeamer at colbox@ignorebg\@tempswafalse\fi%
+  \def\beamer at colbox@color{#2}%
+  \setbox\beamer at tempbox=\hbox\bgroup\color at begingroup
+    \ifbeamer at colbox@ignorebg%
+      \colorlet{beamer at temp@color}{bg}%
+      \usebeamercolor[fg]{#2}%
+      \colorlet{bg}{beamer at temp@color}%
+    \else%
+      \usebeamercolor[fg]{#2}%
+    \fi%
+    \vbox\bgroup%
+    \hsize=\beamer at colbox@wd%
+    \@arrayparboxrestore%
+    \leftskip=\beamer at colbox@ls%
+    \ifdim\beamer at colbox@sep>\z@\advance\leftskip\beamer at colbox@sep\fi%
+    \rightskip=\beamer at colbox@rs%
+    \ifdim\beamer at colbox@sep>\z@\advance\rightskip\beamer at colbox@sep\fi%
+    \if at tempswa\ifdim\beamer at colbox@colsep>\z@%
+      \advance\leftskip by\beamer at colbox@colsep%
+      \advance\rightskip by\beamer at colbox@colsep%
+      \vskip\beamer at colbox@colsep%
+    \fi%
+      \ifdim\beamer at colbox@colseps>\z@\vskip\beamer at colbox@colseps\fi%
+    \fi%
+    \ifdim\beamer at colbox@sep>\z@\vskip\beamer at colbox@sep\fi%
+    \beamer at vmode\ignorespaces}{%
+    \ifdim\beamer at colbox@sep>\z@\vskip\beamer at colbox@sep\fi%
+    \if at tempswa
+      \ifdim\beamer at colbox@colsep>\z@\vskip\beamer at colbox@colsep\fi%
+      \ifdim\beamer at colbox@colseps>\z@\vskip\beamer at colbox@colseps\fi%
+    \fi%
+  \egroup\color at endgroup\egroup%
+  \wd\beamer at tempbox=\beamer at colbox@wd%
+  \ifx\beamer at colbox@ht\@empty\else\ht\beamer at tempbox=\beamer at colbox@ht\fi%
+  \ifx\beamer at colbox@dp\@empty\else\dp\beamer at tempbox=\beamer at colbox@dp\fi%
+  \ifbeamer at colbox@rounded%
+    \if at tempswa%
+      \begin{beamerboxesrounded}[%
+        shadow=\beamer at colbox@shadow,%
+        lower=\beamer at colbox@color,%
+        upper=normal text,%
+        width=\beamer at colbox@wd]{}%
+        \box\beamer at tempbox%
+      \end{beamerboxesrounded}%
+    \else%
+      \ifdim\wd\beamer at tempbox>\textwidth%
+        \setbox\beamer at tempbox=\hbox to\textwidth{\hss\box\beamer at tempbox\hss}%
+      \fi%
+      \box\beamer at tempbox%
+    \fi%
+  \else%
+    \if at tempswa\setbox\beamer at tempbox=\hbox{%
+      \usebeamercolor{\beamer at colbox@color}%
+      \hskip-\beamer at colbox@colseps%
+      \fboxsep=\z@\colorbox{bg}{%
+        \hskip\beamer at colbox@colseps%
+        \box\beamer at tempbox%
+        \hskip\beamer at colbox@colseps%
+      }%
+      \hskip-\beamer at colbox@colseps%
+      }\fi%
+    \ifdim\wd\beamer at tempbox>\textwidth%
+      \setbox\beamer at tempbox=\hbox to\textwidth{\hskip0pt minus\beamer at leftmargin\relax\box\beamer at tempbox\hskip0pt minus\beamer at rightmargin\relax}%
+    \fi%
+    \box\beamer at tempbox%
+  \fi%
+}
+
+\mode
+<article>
+{
+  \newenvironment{beamercolorbox}[2][]{}{}
+}
+
+
+%
+% Install these colors at the start of the document
+%
+
+\AtBeginDocument{
+  \usebeamercolor*{alerted text} % Define these colors
+  \usebeamercolor*{example text} % Define these colors
+  \usebeamercolor*{structure}    % Define these colors
+  \usebeamercolor{normal text}
+  \color{fg}
+  \def\normalcolor{\color{normal text.fg}}
+}
+
+
+
+
+%
+% Math mode color hackery
+%
+
+\newcommand\beamer at setmathcolor{%
+  \usebeamercolor{math text inlined}%
+  \ifbeamercolorempty[fg]{math text inlined}{}{\color{fg}}}
+
+\newcommand\donotcoloroutermaths{%
+  \everymath\expandafter\expandafter\expandafter{%
+    \expandafter\donotcoloroutermaths at aux\the\everymath
+      \beamer at setmathcolor\beamer at setmathcolor\beamer at stop
+    \everymath\expandafter{\the\everymath\beamer at setmathcolor}%
+  }%
+}
+\newcommand\donotcoloroutermaths at aux{}
+\long\def\donotcoloroutermaths at aux
+  #1\beamer at setmathcolor#2\beamer at setmathcolor#3\beamer at stop{%
+    #1#2%
+  }
+
+\newcommand\beamer at setdisplaymathcolor{%
+  \usebeamercolor{math text displayed}%
+  \ifbeamercolorempty[fg]{math text displayed}{}{\color{fg}\aftergroup\ignorespaces}}%
+
+\newcommand\donotcolorouterdisplaymaths{%
+  \everydisplay\expandafter\expandafter\expandafter{%
+    \expandafter\donotcolorouterdisplaymaths at aux\the\everydisplay
+      \beamer at setdisplaymathcolor\beamer at setdisplaymathcolor\beamer at stop
+    \everydisplay\expandafter{\the\everydisplay\beamer at setdisplaymathcolor}%
+  }%
+}
+\newcommand\donotcolorouterdisplaymaths at aux{}
+\long\def\donotcolorouterdisplaymaths at aux
+  #1\beamer at setdisplaymathcolor#2\beamer at setdisplaymathcolor#3\beamer at stop{%
+    #1#2%
+  }
+
+\AtBeginDocument
+{
+  \everymath\expandafter{\the\everymath\beamer at setmathcolor}
+  \everydisplay\expandafter{\the\everydisplay\beamer at setdisplaymathcolor}
+}
+
+\AtBeginDocument{
+  % Fix $ usage in tabular:
+  \let\beamer at orig@tabular=\@tabular
+  \def\@tabular{\donotcoloroutermaths\beamer at orig@tabular}
+
+  % Fix $ usage in underline:
+  \let\beamer at orig@underline=\underline
+  \def\underline#1{{\donotcoloroutermaths\beamer at orig@underline{#1}}}
+
+  % Fix $ usage in underline:
+  \let\beamer at orig@@textsubscript=\@textsubscript
+  \def\@textsubscript#1{{\donotcoloroutermaths\beamer at orig@@textsubscript{#1}}}
+  \let\beamer at orig@@textsuperscript=\@textsuperscript
+  \def\@textsuperscript#1{{\donotcoloroutermaths\beamer at orig@@textsuperscript{#1}}}
+
+  % Fix $ usage in parbox:
+  \let\beamer at orig@pboxswture=\@pboxswtrue
+  \def\@pboxswtrue{\donotcoloroutermaths\beamer at orig@pboxswture}
+
+  % Fix $$ usage in align:
+  \let\beamer at orig@start at align=\start at align
+  \def\start at align{\donotcolorouterdisplaymaths\donotcoloroutermaths\beamer at setdisplaymathcolor\beamer at orig@start at align}
+
+  % Fix $$ usage in gather:
+  \let\beamer at orig@start at gather=\start at gather
+  \def\start at gather{\donotcolorouterdisplaymaths\donotcoloroutermaths\beamer at setdisplaymathcolor\beamer at orig@start at gather}
+
+  % Fix $$ usage in multicolumn:
+  \let\beamer at orig@start at multline=\start at multline
+  \def\start at multline{\donotcolorouterdisplaymaths\donotcoloroutermaths\beamer at setdisplaymathcolor\beamer at orig@start at multline}
+
+  % Fix $$ usage in eqnarray:
+  \let\beamer at orig@eqnarray=\eqnarray
+  \def\eqnarray{\donotcolorouterdisplaymaths\donotcoloroutermaths\beamer at setdisplaymathcolor\beamer at orig@eqnarray}
+
+  % Fix \text:
+  \let\beamer at orig@text@=\text@
+  \def\text@#1{{\ifbeamercolorempty[fg]{normal text in math text}{}{\usebeamercolor[fg]{normal text in math text}}\beamer at orig@text@{#1}}}
+}
+
+%
+% Allow mixins to survive groups:
+%
+
+\let\beamerorig at set@color=\set at color
+\let\beamerorig at reset@color=\reset at color
+
+\edef\beamer at zeropt{\the\z@}
+
+\def\beamer at current@colorhook{}
+
+\def\set at color{%
+  \edef\beamer at current@colorhook{\beamer at colorhook}%
+  \beamerorig at set@color}
+\def\reset at color{%
+  \beamer at lastskip=\lastskip%
+  \edef\beamer at lastskiptexta{\the\lastskip}%
+  \ifx\beamer at lastskiptexta\beamer at zeropt\else%
+    \ifvmode\unskip\fi%
+    \ifhmode\unskip\fi%
+  \fi%
+  \ifx\beamer at current@colorhook\beamer at colorhook%
+    \beamerorig at reset@color%
+  \else% mixin changed -> recalculate
+    \colorlet{beamer at tempcolor}{.}%
+    \applycolormixins{beamer at tempcolor}%
+    \@namelet{current at color}{\string\color at beamer@tempcolor}%
+    \beamerorig at reset@color%
+    \pgfsys at color@unstacked{beamer at tempcolor}%
+  \fi%
+  \ifx\beamer at lastskiptexta\beamer at zeropt%
+  \else%
+    \ifvmode\vskip\beamer at lastskip\fi%
+    \ifhmode\hskip\beamer at lastskip\fi%
+  \fi%
+}
+
+
+
+% compatibility:
+
+\AtBeginDocument{
+  \colorlet{structure}{structure.fg}
+  \colorlet{beamerstructure}{structure.fg}
+  \colorlet{averagebackgroundcolor}{normal text.bg}
+}
+
+\mode
+<article>
+{
+  \def\beamersetaveragebackground#1{}
+
+  \ifbeamer at articlexcolor
+    \colorlet{averagebackgroundcolor}{white}
+  \fi
+}
+
+\colorlet{alert}{red!95!black}
+\definecolor{structure}{rgb}{0.2,0.2,0.7} % dummy -- not used
+
+\colorlet{beameralert}{alert}
+\colorlet{beamerexample}{green!50!black}
+\colorlet{beamerstructure}{structure} % dummy
+
+\mode
+<article>
+{
+  \ifbeamer at articlexcolor
+    \definecolor{alert}{rgb}{1,0,0}
+
+    \colorlet{beameralert}{alert}
+    \colorlet{beamerexample}{green!50!black}
+    \colorlet{beamerstructure}{black}
+    \colorlet{structure}{beamerstructure}
+  \fi
+
+}
+
+
+\mode
+<all>
diff --git a/pdfmanagement-firstaid.dtx b/pdfmanagement-firstaid.dtx
index 79453ee..a07feab 100644
--- a/pdfmanagement-firstaid.dtx
+++ b/pdfmanagement-firstaid.dtx
@@ -100,6 +100,7 @@
 \bool_if:NT \g_@@_firstaid_beamer_bool
   {
     \color_set:nnn{.5~.5~.5}{rgb}{0.5,0.5,0.5}
+    \declare at file@substitution{beamerbasecolor.sty}{beamerbasecolor-ltx.sty}
   }
 %    \end{macrocode}
 % \subsection{\pkg{color}}





More information about the latex3-commits mailing list.