summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/thalie
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-12-12 21:00:18 +0000
committerKarl Berry <karl@freefriends.org>2022-12-12 21:00:18 +0000
commit6774dec9cc8e9543ce571410865c56ee3e6a4595 (patch)
tree0df97dcffa9de0c63c446181f0258e546dd30bae /Master/texmf-dist/tex/latex/thalie
parent26c8f16e73a12e3d9ce0b7c5f081b18de04a5ecb (diff)
thalie (12dec22)
git-svn-id: svn://tug.org/texlive/trunk@65249 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/thalie')
-rw-r--r--Master/texmf-dist/tex/latex/thalie/thalie.sty206
1 files changed, 137 insertions, 69 deletions
diff --git a/Master/texmf-dist/tex/latex/thalie/thalie.sty b/Master/texmf-dist/tex/latex/thalie/thalie.sty
index fb29b37ca53..9007b0eedef 100644
--- a/Master/texmf-dist/tex/latex/thalie/thalie.sty
+++ b/Master/texmf-dist/tex/latex/thalie/thalie.sty
@@ -1,29 +1,22 @@
-%%
-%% This is file `thalie.sty',
-%% generated with the docstrip utility.
-%%
-%% The original source files were:
-%%
-%% thalie.dtx (with options: `package')
-%% Copyright 2010-2022 Louis Paternault
-%%
-%% This work may be distributed and/or modified under the
-%% conditions of the LaTeX Project Public License, either version 1.3
-%% of this license or (at your option) any later version.
-%% The latest version of this license is in
-%% http://www.latex-project.org/lppl.txt
-%% and version 1.3 or later is part of all distributions of LaTeX
-%% version 2005/12/01 or later.
-%%
-%% This work has the LPPL maintenance status `maintained'.
-%%
-%% The Current Maintainer of this work is Louis Paternault
-%%
-%% This work consists of the files thalie.dtx and thalie.ins
-%% and the derived file thalie.sty.
+% Copyright 2010-2022 Louis Paternault
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is Louis Paternault
+%
+% This work consists of the files thalie.tex and thalie.sty.
+
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{thalie}
- [2022/10/09 v0.12a A package to typeset drama plays]
+ [2022/12/11 v0.13a A package to typeset drama plays]
\RequirePackage{pgfkeys}
@@ -91,14 +84,14 @@
\end{minipage}}
\end{center}
\vspace{1em}
- }{}}}
+ }{}}}%
}
\newcommand\@clearpage[1]{%
% Clear page if necessary
\ifboolexpr{test{\ifdefstring{#1}{part}} or test{\ifdefstring{#1}{chapter}}}{
\cleardoublepage
\thispagestyle{empty}
- }{}
+ }{}%
}
\newcommand{\play}[2][]{%
@@ -322,24 +315,30 @@
}%
}{}%
}
+\providebool{@dramatis@hidden}
+\pgfkeys{
+ % Character definition
+ /THALIE/DRAMATIS/.is family,
+ /THALIE/DRAMATIS,
+ hidden/.default=true,
+ hidden/.is choice,
+ hidden/true/.code=\booltrue{@dramatis@hidden},
+ hidden/false/.code=\boolfalse{@dramatis@hidden},
+ defaultcast/.default={},
+ defaultcast/.value required,
+ defaultcast/.store in=\@defaultcast,
+}
\newcommand{\@dramatis@clear}{}
\newcommand{\@empty@}{}
-\providebool{@dramatis@hidden}
\newenvironment{dramatis}[1][]{
\@dramatis@clear{}
\undef{\@dramatis@clear}
- \ifstrequal{#1}{hidden}{
- \booltrue{@dramatis@hidden}
- }{\ifstrempty{#1}{
- \boolfalse{@dramatis@hidden}
- \dramatisenv
- }{
- \ClassError{thalie}{%
- Environment dramatis does not accept option #1.%
- }{
- }
- }
- }
+ \pgfkeys{/THALIE/DRAMATIS/.cd, #1}
+ \ifbool{@dramatis@hidden}{%
+ % Nothing
+ }{%
+ \dramatisenv%
+ }%
}{%
\notbool{@dramatis@hidden}{%
\enddramatisenv
@@ -355,13 +354,15 @@
\newcommand{\dramatischaracterdescription}[1]{#1}
+\newcommand{\dramatischaractercast}[1]{#1}
+
\newcommand{\characterspace}{ %
\notbool{@dramatis@hidden}{%
\smallskip\newline %
- }{} %
+ }{}%
}
-\newcommand{\dramatischaracter}[2]{ %
+\newcommand{\dramatischaracter}[3]{ %
\hspace*{-1cm} %
\ifboolexpr{(not test {\ifdefempty{#1}}) and test {\ifdefempty{#2}}}{%
\dramatischaractername{#1} %
@@ -372,20 +373,18 @@
\ifboolexpr{ (not test{\ifdefempty{#1}}) and (not test{\ifdefempty{#2}})}{%
\dramatischaractername{#1}, \dramatischaracterdescription{#2} %
}{}%
+ \ifdefempty{#3}{}{\dotfill\dramatischaractercast{#3}}%
\newline %
}
- \newlength{\@spaceaftergroup}
-\newenvironment{charactergroup}[2][5cm]{%
- \notbool{@dramatis@hidden}{%
+\newlength{\@spaceaftergroup}
+\newenvironment{dramatischaractergroup}[2]{
\gdef\@groupname{#2} %
\gdef\@grouplength{#1} %
- \hspace*{-1.3pt}\math\left. %
- \minipage[c]{#1} %
- \vspace*{2pt} %
- }{}%
+ \hspace*{-1.3pt}\math\left. %
+ \minipage[c]{#1} %
+ \vspace*{2pt} %
}{%
- \notbool{@dramatis@hidden}{%
\vspace*{-8pt} %
\endminipage %
\right\} \endmath %
@@ -396,9 +395,65 @@
\begin{minipage}[c]{\@spaceaftergroup}
\@groupname %
\end{minipage}
- \newline %
+ \newline %
+}
+\newenvironment{charactergroup}[2][5cm]{%
+ \notbool{@dramatis@hidden}{%
+ \dramatischaractergroup{#1}{#2}
+ }{}%
+}{%
+ \notbool{@dramatis@hidden}{%
+ \enddramatischaractergroup
}{}%
}
+
+\newenvironment{dramatischaractercastgroup}[3]{%
+ \ifdefempty{#3}{
+ \hspace*{-1cm} %
+ \ifboolexpr{(not test {\ifdefempty{#1}}) and test {\ifdefempty{#2}}}{%
+ \dramatischaractername{#1} %
+ }{}%
+ \ifboolexpr{ test{\ifdefempty{#1}} and not test{\ifdefempty{#2}}}{%
+ \dramatischaracterdescription{#2} %
+ }{}%
+ \ifboolexpr{ (not test{\ifdefempty{#1}}) and (not test{\ifdefempty{#2}})}{%
+ \dramatischaractername{#1}, \dramatischaracterdescription{#2} %
+ }{}%
+ \hfill%
+ }{
+ \ClassError{thalie}{%
+ Environment "castgroup" cannot have a non-empty "cast" argument.%
+ }{}%
+ }%
+}{}
+
+\newenvironment{castgroup}[2][]{%
+ \@thalie@parsecharacter{#1}{#2}{dramatischaractercastgroup}%
+ \notbool{@dramatis@hidden}{%
+ \math\left\{%
+ \array{r}%
+ }{}%
+}{%
+ \notbool{@dramatis@hidden}{%
+ \endarray%
+ \right.\endmath%
+ \newline%
+ }{}%
+ \enddramatischaractercastgroup
+}
+\newcommand{\dramatiscast}[1]{%
+ % Command used to display cast inside a castgroup.
+ % Can be redefined by user.
+ \notbool{@dramatis@hidden}{%
+ \hbox{\dramatischaractercast{#1}\hspace*{-6pt}}\tabularnewline%
+ }{}%
+}
+\newcommand{\cast}[1]{%
+ % "Public" command, used by author in the dramatis personae.
+ % Does nothing fancy right now, but how knows?
+ \dramatiscast{#1}%
+}
+
\newcommand{\setcharactername}[2]{%
\expandafter\gdef\csname#1name\endcsname{%
#2\@maybexspace%
@@ -446,44 +501,57 @@
/THALIE/CHARACTER,
cmd/.value required,
cmd/.store in=\@cmd,
+ cast/.value required,
+ cast/.store in=\@cast,
drama/.value required,
drama/.store in=\@drama,
desc/.value required,
desc/.store in=\@desc,
}
-\newcommand{\character}[2][]{
+\newcommand{\@thalie@parsecharacter}[3]{%
+ % Parse a character definition. Arguments are:
+ % #1: Optional arguments of \character: [drama={foo}, cast={bar}]
+ % #2: Mandatory argument of \character (character name)
+ % #3: Name of the command to call to display this character definition.
\undef{\@drama}
\undef{\@cmd}
+ \undef{\@cast}
\undef{\@desc}
\pgfkeys{/THALIE/CHARACTER, #1}%
- % Forbidden combinations
+ \ifcsundef{@cast}{%
+ \ifcsdef{@defaultcast}{%
+ \gdef\@cast{\@defaultcast}%
+ }{%
+ \gdef\@cast{}%
+ }%
+ }{}%
+ % Forbidden combinations
\ifboolexpr{
- ( test{\ifdef{\@cmd}} and test{\ifstrempty{#2}} ) or
- ( test{\ifstrempty{#2}} and test{\ifundef{\@cmd}} and test{\ifundef{\@desc}} and test{\ifundef{\@drama}} ) or
- ( test{\ifundef{\@cmd}} and (not test{\ifstrempty{#2}}) and test{\ifdef{\@drama}} )
+ ( ( test{\ifdef{\@cmd}} and not test{\ifdefempty{\@cmd}} ) and test{\ifstrempty{#2}} ) or
+ ( ( test{\ifundef{\@cmd}} or test{\ifdefempty{\@cmd}} ) and not test{\ifstrempty{#2}} ) or
+ ( test{\ifdefempty{\@drama}} and ( test{\ifdef{\@desc}} and not test{\ifdefempty{\@desc}} ) ) or
+ ( test{\ifundef{\@cmd}} and test{\ifundef{\@desc}} and test{\ifundef{\@drama}} and test{\ifstrempty{#2}} ) or
+ %( ( test{\ifundef{\@cmd}} or test{\ifdefempty{\@cmd}} ) and test{\ifstrempty{#2}} and ( test{\ifdefempty{\@drama}} or test{\ifundef{\@drama}} ))
+ ( ( test{\ifundef{\@desc}} or test{\ifdefempty{\@desc}} ) and test{\ifstrempty{#2}} and ( test{\ifdefempty{\@drama}} or test{\ifundef{\@drama}} ))
}{
\ClassError{thalie}{Invalid character definition.}{All combination of omitted arguments are not allowed. See the documentation for more information}
- }{}
+ }{}%
% Defining character command
\ifboolexpr{ test{\ifdef{\@cmd}} and (not test{\ifstrempty{#2}}) }{%
\@definecharactercommand{\@cmd}{#2}
}{}%
- \notbool{@dramatis@hidden}{%
- \ifboolexpr{ (not test{\ifstrempty{#2}}) and test{\ifdef{\@cmd}} and test{\ifdef{\@drama}} and test{\ifundef{\@desc}}}{%
- \ifdefempty{\@drama}{%
- % Hidden character. Nothing added to dramatis personae
- }{%
- % Populating dramatis personae
- \dramatischaracter{\@drama}{\@empty@}
- }%
- }{%
- % Populating dramatis personae
+ \ifboolexpr{ bool{@dramatis@hidden} or test{\ifdefempty{\@drama}} }{%
+ % Hidden character. Nothing added to dramatis personae
+ }{%
\ifcsundef{@desc}{\gdef\@desc{}}{}%
\ifcsundef{@drama}{\gdef\@drama{#2}}{}%
- \dramatischaracter{\@drama}{\@desc}
- }%
- }{}%
+ \csuse{#3}{\@drama}{\@desc}{\@cast}%
+ }%
+}
+\newcommand{\character}[2][]{%
+ \@thalie@parsecharacter{#1}{#2}{dramatischaracter}%
}
+
\newcommand{\disposablecharacter}[2][]{%
\@speaks[#1]{#2}%
}