| 1 |
% \iffalse |
| 2 |
%<*internal> |
| 3 |
\iffalse |
| 4 |
%</internal> |
| 5 |
%<*readme> |
| 6 |
___________________ |
| 7 |
The beamertools package |
| 8 |
v0.1 |
| 9 |
|
| 10 |
This package provides a collection of programming tools for beamer. |
| 11 |
|
| 12 |
If you want to report any bugs or typos and corrections in the |
| 13 |
documentation, or ask for any new features, or suggest any |
| 14 |
improvements, or ask any questions about the package, then |
| 15 |
please use the issue tracker: |
| 16 |
|
| 17 |
<https://github.com/xepersian/beamertools/issues> |
| 18 |
|
| 19 |
In doing so, please always explain your issue well enough, |
| 20 |
and always include a minimal working example showing the |
| 21 |
issue. |
| 22 |
|
| 23 |
You may also have conversations, ask questions and post answers |
| 24 |
without opening issues using the Discussions space: |
| 25 |
|
| 26 |
<https://github.com/xepersian/beamertools/discussions> |
| 27 |
|
| 28 |
The announcements for the new releases of the package will |
| 29 |
also appear in the Discussions space under the Announcements |
| 30 |
category. |
| 31 |
|
| 32 |
Current version release date: 2025/01/09 |
| 33 |
|
| 34 |
___________________________________________ |
| 35 |
Vafa Khalighi |
| 36 |
|
| 37 |
Copyright (c) Vafa Khalighi 2025 |
| 38 |
|
| 39 |
It may be distributed and/or modified under the LaTeX Project Public License, |
| 40 |
version 1.3c or higher (your choice). The latest version of |
| 41 |
this license is at: http://www.latex-project.org/lppl.txt |
| 42 |
|
| 43 |
This work is “author-maintained” (as per LPPL maintenance status) |
| 44 |
by Vafa Khalighi. |
| 45 |
%</readme> |
| 46 |
%<*internal> |
| 47 |
\fi |
| 48 |
\begingroup |
| 49 |
%</internal> |
| 50 |
%<*batchfile> |
| 51 |
\input docstrip.tex |
| 52 |
\keepsilent |
| 53 |
\preamble |
| 54 |
|
| 55 |
__________________________________________________ |
| 56 |
Vafa Khalighi |
| 57 |
|
| 58 |
Copyright (c) 2025 Vafa Khalighi |
| 59 |
|
| 60 |
It may be distributed and/or modified under the LaTeX Project Public License, |
| 61 |
version 1.3c or higher (your choice). The latest version of |
| 62 |
this license is at: http://www.latex-project.org/lppl.txt |
| 63 |
|
| 64 |
This work is “author-maintained” (as per LPPL maintenance status) |
| 65 |
by Vafa Khalighi. |
| 66 |
|
| 67 |
|
| 68 |
\endpreamble |
| 69 |
\askforoverwritefalse |
| 70 |
\generate{\file{beamertools.sty}{\from{\jobname.dtx}{table,beamertools.sty}}} |
| 71 |
%</batchfile> |
| 72 |
%<batchfile>\endbatchfile |
| 73 |
%<*internal> |
| 74 |
\generate{\file{\jobname.ins}{\from{\jobname.dtx}{batchfile}}} |
| 75 |
\nopreamble\nopostamble |
| 76 |
\generate{\file{README.txt}{\from{\jobname.dtx}{readme}}} |
| 77 |
\endgroup |
| 78 |
\immediate\write18{mv README.txt README} |
| 79 |
\immediate\write18{makeindex -s gind.ist -o \jobname.ind \jobname.idx} |
| 80 |
\immediate\write18{makeindex -s gglo.ist -o \jobname.gls \jobname.glo} |
| 81 |
%</internal> |
| 82 |
% |
| 83 |
%<*driver> |
| 84 |
\documentclass{ltxdoc} |
| 85 |
\usepackage{bidicode} |
| 86 |
\usepackage{microtype} |
| 87 |
\definecolor{niceblue}{rgb}{0.2,0.4,0.8} |
| 88 |
\usepackage[numbered]{hypdoc} |
| 89 |
\hypersetup{% |
| 90 |
pdfauthor={Vafa Khalighi},% |
| 91 |
linkcolor=niceblue,% |
| 92 |
urlcolor=niceblue,% |
| 93 |
citecolor=niceblue% |
| 94 |
} |
| 95 |
\pdfstringdefDisableCommands{% |
| 96 |
\renewcommand\Lcs[1]{\textbackslash#1} |
| 97 |
} |
| 98 |
\EnableCrossrefs |
| 99 |
\CodelineIndex |
| 100 |
%\RecordChanges |
| 101 |
\begin{document} |
| 102 |
\DocInput{\jobname.dtx} |
| 103 |
\PrintIndex |
| 104 |
% \PrintChanges |
| 105 |
\end{document} |
| 106 |
%</driver> |
| 107 |
% |
| 108 |
% |
| 109 |
% \fi |
| 110 |
% |
| 111 |
% \GetFileInfo{\jobname.dtx} |
| 112 |
% \title{The \textsf{beamertools} Package} |
| 113 |
% \author{Vafa Khalighi} |
| 114 |
%\date{Version 0.1\quad\today} |
| 115 |
%\maketitle |
| 116 |
% |
| 117 |
%\begingroup |
| 118 |
%\parindent 0pt |
| 119 |
%\vskip 0pt plus 3fill |
| 120 |
%{\color{red!85!black}\fbox{\begin{minipage}{\dimexpr\textwidth-2\fboxsep-2\fboxrule} |
| 121 |
%If you want to report any bugs or typos and corrections in the documentation, |
| 122 |
%or ask for any new features, or suggest any improvements, or ask any questions about the package, then please use the issue tracker: |
| 123 |
% |
| 124 |
%\medskip |
| 125 |
% \centerline{\url{https://github.com/xepersian/beamertools/issues}} |
| 126 |
% |
| 127 |
%\medskip |
| 128 |
%In doing so, please always explain your issue well enough, and always include |
| 129 |
%a minimal working example showing the issue. |
| 130 |
% |
| 131 |
%\bigskip |
| 132 |
%You may also have conversations, ask questions and post answers |
| 133 |
%without opening issues using the Discussions space: |
| 134 |
% |
| 135 |
%\medskip |
| 136 |
% \centerline{\url{https://github.com/xepersian/beamertools/discussions}} |
| 137 |
% |
| 138 |
%\medskip |
| 139 |
%The announcements for the new releases of the package will |
| 140 |
%also appear in the Discussions space under the Announcements |
| 141 |
%category. |
| 142 |
%\end{minipage} |
| 143 |
%}} |
| 144 |
% |
| 145 |
%\vskip 0pt plus 3fill |
| 146 |
% |
| 147 |
%Copyright (c) 2025 Vafa Khalighi |
| 148 |
% |
| 149 |
%\medskip |
| 150 |
%Permission is granted to distribute and/or modify \emph{both the documentation and the code} under the conditions of the \LaTeX{} Project Public License, either version 1.3c of this license or (at your option) any later version. |
| 151 |
%\endgroup |
| 152 |
% |
| 153 |
%\clearpage |
| 154 |
% \tableofcontents |
| 155 |
% \section{Introduction} |
| 156 |
%If you want to redefine any predefined beamer template and try |
| 157 |
%something like |
| 158 |
%\begin{lstlisting}[gobble=1,numbers=none] |
| 159 |
%\defbeamertemplate{itemize item}{square}{\hbox{\vrule width 2ex height 2ex}} |
| 160 |
%\end{lstlisting} |
| 161 |
%then beamer will give the following unhelpful |
| 162 |
%error message |
| 163 |
%\begin{lstlisting}[gobble=1,numbers=none,backgroundcolor=\color{blue!30},frame=none,framexleftmargin=1mm] |
| 164 |
%./test.tex:4: LaTeX Error: Command \beamer@@tmpop@itemize item@square already d |
| 165 |
%efined. |
| 166 |
% Or name \end... illegal, see p.192 of the manual. |
| 167 |
% |
| 168 |
%See the LaTeX manual or LaTeX Companion for explanation. |
| 169 |
%Type H <return> for immediate help. |
| 170 |
% ... |
| 171 |
% |
| 172 |
%l.4 \begin |
| 173 |
% {document} |
| 174 |
%? |
| 175 |
%\end{lstlisting} |
| 176 |
%and one is puzzled as what to do. |
| 177 |
% |
| 178 |
%beamer does not provide a control sequence for redefining a |
| 179 |
%predefined beamer template. One way to get around this issue |
| 180 |
%is to undefine the control sequence shown above and then to redefine |
| 181 |
%the beamer template using the control sequence \Lcs{defbeamertemplate}. But this is |
| 182 |
%really ugly and unpleasant. |
| 183 |
% |
| 184 |
%Of course, this is just a silly example for illustrating the issue. I found |
| 185 |
%myself redefining a lot of predefined beamer templates in my |
| 186 |
%\textsf{bidi}\footnote{\url{https://ctan.org/pkg/bidi}} package and the |
| 187 |
%workaround above is just ugly and painful. |
| 188 |
% |
| 189 |
%The \textsf{beamertools} package solves this exact issue. It provides a |
| 190 |
%control sequence for redefining a predefined beamer template and |
| 191 |
%unlike beamer unhelpful error message, it provides an informative |
| 192 |
%error message if the beamer template you are trying to redefine is not |
| 193 |
%predefined. |
| 194 |
% |
| 195 |
% |
| 196 |
%\section{Using the package} |
| 197 |
%\subsection{Loading The Package} |
| 198 |
%You can load the package in the ordinary way: |
| 199 |
%\begin{BDef} |
| 200 |
%\Lcs{usepackage}\Largb{beamertools} |
| 201 |
%\end{BDef} |
| 202 |
%\subsection{The user interface} |
| 203 |
%The packages provides the control sequence \Lcs{redefbeamertemplate} for redefining a predefined beamer template and has exactly the same syntax as the control sequence |
| 204 |
%\Lcs{defbeamertemplate} that beamer provides. |
| 205 |
% \StopEventually{} |
| 206 |
% \section{Implementation} |
| 207 |
%\iffalse |
| 208 |
%<*table> |
| 209 |
%\fi |
| 210 |
%% \CheckSum{0} |
| 211 |
%% \CharacterTable |
| 212 |
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z |
| 213 |
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z |
| 214 |
%% Digits \0\1\2\3\4\5\6\7\8\9 |
| 215 |
%% Exclamation \! Double quote \" Hash (number) \# |
| 216 |
%% Dollar \$ Percent \% Ampersand \& |
| 217 |
%% Acute accent \' Left paren \( Right paren \) |
| 218 |
%% Asterisk \* Plus \+ Comma \, |
| 219 |
%% Minus \- Point \. Solidus \/ |
| 220 |
%% Colon \: Semicolon \; Less than \< |
| 221 |
%% Equals \= Greater than \> Question mark \? |
| 222 |
%% Commercial at \@ Left bracket \[ Backslash \\ |
| 223 |
%% Right bracket \] Circumflex \^ Underscore \_ |
| 224 |
%% Grave accent \` Left brace \{ Vertical bar \| |
| 225 |
%% Right brace \} Tilde \~} |
| 226 |
%% |
| 227 |
% \iffalse |
| 228 |
%</table> |
| 229 |
%<*beamertools.sty> |
| 230 |
%\fi |
| 231 |
% |
| 232 |
% |
| 233 |
% |
| 234 |
% \begin{macrocode} |
| 235 |
\NeedsTeXFormat{LaTeX2e} |
| 236 |
\ProvidesPackage{beamertools}[2025/01/09 v0.1 A collection of programming tools for beamer] |
| 237 |
\newcommand<>\redefbeamertemplate{ |
| 238 |
\ifblank{#1} |
| 239 |
{\def\beamer@@oar{<presentation>}} |
| 240 |
{\def\beamer@@oar{#1}}\beamer@redefbeamertemplate} |
| 241 |
|
| 242 |
\def\beamer@redefbeamertemplate{\@ifstar{\beamer@sbttrue\beamer@redef@sbtoo}{\beamer@sbtfalse\beamer@redef@sbtoo}} |
| 243 |
|
| 244 |
\def\beamer@redef@sbtoo#1#2{\@ifnextchar[{\beamer@redef@sbto{#1}{#2}}{\beamer@redef@sbto{#1}{#2}[0]}} |
| 245 |
|
| 246 |
\def\beamer@redef@sbto#1#2[#3]{\@ifnextchar[{\beamer@@redef@sbto{#1}{#2}[{#3}]}{\def\beamer@sbtotemp{}\beamer@@@redef@sbto{#1}{#2}[{#3}]}} |
| 247 |
|
| 248 |
\long\def\beamer@@redef@sbto#1#2[#3][#4]{\long\def\beamer@sbtotemp{[{#4}]}\beamer@@@redef@sbto{#1}{#2}[{#3}]} |
| 249 |
|
| 250 |
\long\def\beamer@@@redef@sbto#1#2[#3]#4{% |
| 251 |
\beamer@sbttoks={\beamer@@@@redef@sbto{#1}{#2}[{#3}]{#4}}% |
| 252 |
\@ifnextchar[{\the\beamer@sbttoks}{\the\beamer@sbttoks[action]{}}% |
| 253 |
} |
| 254 |
|
| 255 |
\long\def\beamer@@@@redef@sbto#1#2[#3]#4[#5]#6{% |
| 256 |
\edef\beamer@@sbtoarg{\expandafter\noexpand\csname beamer@@tmpop@#1@#2\endcsname[{#3}]}% |
| 257 |
\@ifundefined{beamer@@tmpop@#1@#2}{% |
| 258 |
\PackageError{beamertools}{beamer template with element name `#1' and predefined option `#2' undefined}\@ehc |
| 259 |
} |
| 260 |
\expandafter\expandafter\expandafter\renewcommand\expandafter\beamer@@sbtoarg\beamer@sbtotemp{% |
| 261 |
\expandafter\long\expandafter\def\csname beamer@@tmpl@#1\endcsname{#4}#6}% |
| 262 |
\let\beamer@@next=\beamer@resetsbtoarg% |
| 263 |
\expandafter\mode\beamer@@oar{\let\beamer@@next=\relax}% |
| 264 |
\beamer@@next% |
| 265 |
\ifbeamer@sbt\setbeamertemplate{#1}[{#2}]\relax\relax\relax\relax\relax\relax\relax\relax\relax\fi% |
| 266 |
} |
| 267 |
% \end{macrocode} |
| 268 |
% \iffalse |
| 269 |
%</beamertools.sty> |
| 270 |
%\fi |
| 271 |
% |
| 272 |
% |
| 273 |
% \Finale |
| 274 |
% |
| 275 |
% |
| 276 |
% \typeout{*************************************************************} |
| 277 |
% \typeout{*} |
| 278 |
% \typeout{* To finish the installation you have to move the file} |
| 279 |
% \typeout{* `beamertools.sty' into a directory searched by TeX.} |
| 280 |
% \typeout{*************************************************************} |
| 281 |
% |
| 282 |
\endinput |