Skip to content

Commit

Permalink
feat: new options bg and fg
Browse files Browse the repository at this point in the history
  • Loading branch information
LogCreative committed Jan 16, 2024
1 parent 3e90b13 commit 81c21d1
Show file tree
Hide file tree
Showing 11 changed files with 151 additions and 31 deletions.
3 changes: 1 addition & 2 deletions testfiles/block.lvt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
\input{regression-test}
\AtBeginDocument{\START}
\documentclass{presenter}
\LoadPresenterBackground{block}
\documentclass[bg=block]{presenter}
\EditPresenterBackground{headline}{stroke=true}
\begin{document}

Expand Down
3 changes: 1 addition & 2 deletions testfiles/cascade.lvt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
\input{regression-test}
\AtBeginDocument{\START}
\documentclass{presenter}
\LoadPresenterForeground{cascade}
\documentclass[fg=cascade]{presenter}
\EditPresenterForeground{headline}{parent-separator={\quad $\rightarrow$\quad}}
\title{Cascade Style}
\author{Your Name}
Expand Down
3 changes: 1 addition & 2 deletions testfiles/dual.lvt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
\input{regression-test}
\AtBeginDocument{\START}
\documentclass{presenter}
\LoadPresenterForeground{dual}
\documentclass[fg=dual]{presenter}
\title{Dual Style}
\geometry{headheight=1.8cm,top=2.3cm}
\begin{document}
Expand Down
3 changes: 1 addition & 2 deletions testfiles/iiiblock.lvt
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
\input{regression-test}
\AtBeginDocument{\START}
\documentclass{presenter}
\documentclass[bg=iiiblock]{presenter}
\usepackage{xcolor}
\LoadPresenterBackground{iiiblock}
\EditPresenterBackground{headline}{fill-color=blue!70!green}
\EditPresenterForeground{headline}{style={\Large\color{white}}}
\begin{document}
Expand Down
4 changes: 1 addition & 3 deletions testfiles/img.lvt
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
\input{regression-test}
\AtBeginDocument{\START}
\documentclass{presenter}
\documentclass[bg=img, fg=img]{presenter}
\usepackage{mwe}
\LoadPresenterBackground{img}
\LoadPresenterForeground{img}
\begin{document}
\paragraph{center image}
\EditPresenterBackground{canvas}{
Expand Down
3 changes: 1 addition & 2 deletions testfiles/progressbar.lvt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
\input{regression-test}
\AtBeginDocument{\START}
\documentclass{presenter}
\LoadPresenterBackground{progressbar}
\documentclass[bg=progressbar]{presenter}
\makeatletter
\gdef\@abspage@last{6} % assume it is the second run
\makeatother
Expand Down
3 changes: 1 addition & 2 deletions testfiles/secblock.lvt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
\input{regression-test}
\AtBeginDocument{\START}
\documentclass[base=report]{presenter}
\LoadPresenterBackground{secblock}
\documentclass[base=report, bg=secblock]{presenter}
\begin{document}

Testing the first empty sectioning page.
Expand Down
54 changes: 39 additions & 15 deletions texmf/doc/latex/presenter/presenter-code.tex
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@
\renewcommand*\l@subsubsection{\@dottedtocline{3}{4.3em}{3.7em}}
\makeatother

\newrobustcmd\rexptarget{%
\AddLineBeginMainAux{\csgdef{Codedoc@rexpstar}{}}%
\csname Hy@raisedlink\endcsname{\hypertarget{rexpstar}{}}}
\newrobustcmd\rexpstar{\hyperlink{rexpstar}{\ding{73}}}

\begin{document}

\maketitle
Expand Down Expand Up @@ -107,7 +112,7 @@
\section{Introduction}

\presenter{} is a document class (or a package) to create presentations from
regular \LaTeX{} documents without many modifications, \textit{i.e.} present
regular \LaTeX{} documents without many modifications, \textit{i.e.}, present
your \LaTeX{} document in a screen-friendly way.

\presenter{} won't need any additional \env{frame} or \env{slide} environments
Expand Down Expand Up @@ -240,21 +245,9 @@ \section{Basics}

\section{Options}

\begin{function}[added=2024-01-14]{base, base-options}
Set the \meta{base} document class to be used with \meta{base-options} comma
list. The default is \cls{article} base document class with empty options.

You should always set \meta{base} first if you want to use a different base
document class other than \cls{article}. And always surround your
\meta{base-options} comma list with braces (\verb"{}") especially if you want
to pass multiple options to the \meta{base} document class.

If you want to use \tn{chapter} level, you could use \cls{report} document
class as the base like \verb"\documentclass[base=report,base-options={}]{presenter}".
\end{function}

\begin{texnote}
If you want to customize the loading of the \presenter{} code,
Other than loading the document class \cls{presenter} shown previously,
if you want to customize the loading of the \presenter{} code,
you could use the package \pkg{presenter} instead.

\begin{center}
Expand All @@ -272,8 +265,38 @@ \section{Options}
\previewtest{package}
\end{minipage}
\end{center}

In the following section, the option with \rexptarget\rexpstar{} represents that
it is only available as a document class option,
\emph{i.e.}, not available as a package option.

\end{texnote}

\begin{function}[rEXP,added=2024-01-14]{base, base-options}
Set the \meta{base} document class to be used with \meta{base-options} comma
list. The default is \cls{article} base document class with empty options.

You should always set \meta{base} first if you want to use a different base
document class other than \cls{article}. And always surround your
\meta{base-options} comma list with braces (\verb"{}") especially if you want
to pass multiple options to the \meta{base} document class.

If you want to use \tn{chapter} level, you could use \cls{report} document
class as the base like \verb"\documentclass[base=report,base-options={}]{presenter}".
\end{function}

\begin{function}[added=2024-01-16]{bg, fg}
Set the initial background (\verb"bg") and foreground (\verb"fg") templates to
be loaded. \pkg{default} background and \pkg{default} foreground templates are
loaded by default and before the assigned templates are loaded.

The name choices can be viewed in Section \ref{sec:pretbg} and Section
\ref{sec:pretfg} respectively.
For advanced template loading, you could ignore these options and see the
commands \cs{LoadPresenterBackground} and \cs{LoadPresenterForeground} in
page \pageref{sec:loadtpl}.
\end{function}

\section{Templates}

\subsection{Decomposition}
Expand Down Expand Up @@ -335,6 +358,7 @@ \subsection{Decomposition}
{\texttt{testfiles/}} folder for the code example of using these templates.

\subsection{Load Templates}
\label{sec:loadtpl}

\begin{function}[added=2023-03-17,updated=2023-07-14]{\LoadPresenterBackground}
\begin{syntax}
Expand Down
83 changes: 82 additions & 1 deletion texmf/source/latex/presenter/presenter.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@
% to avoid the unwanted space token in the options.
% \end{variable}
%
% \begin{variable}{\l_@@_bg_tl, \l_@@_fg_tl}
% Background and foreground template selections.
% \begin{macrocode}
\tl_new:N \l_@@_bg_tl
\tl_new:N \l_@@_fg_tl
% \end{macrocode}
% \end{variable}
%
% Declare keys for the class with family name \verb"pretcls" to avoid the
% default family name \verb"presenter" which may conflict the package with the
% same name.
Expand Down Expand Up @@ -85,6 +93,22 @@
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{bg}
% The background template to be initially loaded.
% \begin{macrocode}
bg.tl_gset:N = \l_@@_bg_tl,
bg.initial:n = default,
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{fg}
% The foreground template to be initially loaded.
% \begin{macrocode}
fg.tl_gset:N = \l_@@_fg_tl,
fg.initial:n = default,
% \end{macrocode}
% \end{macro}
%
% \begin{macrocode}
}
% \end{macrocode}
Expand Down Expand Up @@ -130,6 +154,14 @@
% options raised by the latter one.
% \end{texnote}
%
% Pass the initial background and foreground template to the package.
% \begin{macrocode}
\PassOptionsToPackage {
bg = \l_@@_bg_tl,
fg = \l_@@_fg_tl
} { presenter }
% \end{macrocode}
%
% Load \cls{presenter} main package.
% \begin{macrocode}
\RequirePackage { presenter }
Expand All @@ -152,6 +184,43 @@
%<@@=pret>
% \end{macrocode}
%
% \begin{variable}{\l_@@_bg_tl, \l_@@_fg_tl}
% Background and foreground template selections.
% \begin{macrocode}
\tl_new:N \l_@@_bg_tl
\tl_new:N \l_@@_fg_tl
% \end{macrocode}
% \end{variable}
%
% \begin{macrocode}
\DeclareKeys [ pret ] {
% \end{macrocode}
%
% \begin{macro}{bg}
% The background template to be initially loaded.
% \begin{macrocode}
bg.tl_gset:N = \l_@@_bg_tl,
bg.initial:n = default,
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{fg}
% The foreground template to be initially loaded.
% \begin{macrocode}
fg.tl_gset:N = \l_@@_fg_tl,
fg.initial:n = default,
% \end{macrocode}
% \end{macro}
%
% \begin{macrocode}
}
% \end{macrocode}
%
% Process the package options.
% \begin{macrocode}
\ProcessKeyOptions [ pret ]
% \end{macrocode}
%
% When using \pkg{hyperref} package, the internal link will jump to the whole
% page (fits the page to the window), which confirms the behavior as a slide.
% TODO: It seems that \cs{AtEndOfPackage} is not available for \pkg{hyperref}.
Expand Down Expand Up @@ -202,12 +271,24 @@
% \end{macrocode}
%
% One could only load the template in the preamble.
% It is too heavy to load all the templates. Load \pkg{default} template as base.
% It is too heavy to load all the templates.
% Load \pkg{default} template as base
% which is required to declare all components used by \presenter{}.
% \begin{macrocode}
\LoadPresenterBackground { default }
\LoadPresenterForeground { default }
% \end{macrocode}
%
% Then load the initial templates set by the user.
% They will override some default components.
% \presenter{} will not load the \pkg{default} template twice.
% \begin{macrocode}
\tl_if_eq:NnF \l_@@_bg_tl { default }
{ \LoadPresenterBackground { \l_@@_bg_tl } }
\tl_if_eq:NnF \l_@@_fg_tl { default }
{ \LoadPresenterForeground { \l_@@_fg_tl } }
% \end{macrocode}
%
% Introduce \pkg{xpatch} for patching command by searching the query.
% \begin{macrocode}
\RequirePackage { xpatch }
Expand Down
10 changes: 10 additions & 0 deletions texmf/tex/latex/presenter/presenter.cls

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions texmf/tex/latex/presenter/presenter.sty

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 81c21d1

Please sign in to comment.