diff --git a/.gitignore b/.gitignore index e8e719f..fef0fe4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,9 @@ auto/* daisho.epub daisho.html -daisho.pdf \ No newline at end of file +daisho.pdf +script/auto/* +script/script.aux +script/script.log +script/script.pdf + diff --git a/script/script.tex b/script/script.tex new file mode 100644 index 0000000..7327f71 --- /dev/null +++ b/script/script.tex @@ -0,0 +1,411 @@ +\documentclass[twoside]{article} +\usepackage{geometry} +\geometry{a5paper} +\usepackage{mathspec} +\setmainfont{TeX Gyre Pagella} +\setmathfont(Digits){TeX Gyre Pagella Math} +\setmathfont(Latin,Greek){TeX Gyre Pagella} +\usepackage{microtype} +\usepackage[characterstyle=arden]{thalie} +\usepackage[modulo,right]{lineno} +\usepackage{fancyhdr} +\pagestyle{fancy} +\fancyhf{} +\fancyhead[RO]{% +\textit{\MakeUppercase{% +Act \thesection{}, % +Scene \thesubsection% +}}% +} +\fancyhead[LE]{\leftmark} +\fancyfoot[LE,RO]{\thepage} +\usepackage{polyglossia} +\setdefaultlanguage{english} + + + +\begin{document} + +\nolinenumbers + +\play{Final Fantasy X} + +\section*{Cast} + +\begin{dramatis} + \character[cmd={tidus},desc={star of the Zanarkand Abes}]{Tidus} + \characterspace + \character[cmd={yuna},desc={a summoner}]{Yuna} + \begin{charactergroup}{her guardians} + \character[cmd={lulu},desc={a black mage}]{Lulu} + \character[cmd={wakka},desc={captain of the Besaid Aurochs}]{Wakka} + \character[cmd={kimahri},drama={Kimahri Ronso}]{Kimahri} +\end{charactergroup} +\characterspace +\character[cmd={braska},desc={Yuna's father}]{Braska} +\begin{charactergroup}{his guardians} + \character[cmd={auron}]{Auron} + \character[cmd={jecht},desc={Tidus' father}]{Jecht} +\end{charactergroup} +\characterspace +\character[cmd={rikku},desc={an Al Bhed}]{Rikku} +\character[cmd={cid},desc={her father}]{Cid} +\character[cmd={brother},desc={Rikku's brother}]{Brother} +\characterspace +\begin{charactergroup}{maesters of Yevon} + \character[cmd={mika},drama={Yo Mika},desc={Grand Maester}]{Mika} + \character[cmd={seymour},drama={Seymour Guado}]{Seymour} + \character[cmd={kelk},drama={Kelk Ronso}]{Kelk} + \character[cmd={kinoc},drama={Wen Kinoc},desc={Auron's friend}]{Kinoc} +\end{charactergroup} +\characterspace +\begin{charactergroup}{Crusaders} + \character[cmd={luzzu}]{Luzzu} + \character[cmd={gatta}]{Gatta} +\end{charactergroup} +\characterspace +\begin{charactergroup}{chocobo knights} + \character[cmd={lucil},desc={captain}]{Lucil} + \character[cmd={elma}]{Elma} + \character[cmd={clasko}]{Clasko} +\end{charactergroup} +\characterspace +\character[cmd={dona},desc={a summoner}]{Dona} +\character[cmd={barthello},desc={her guardian}]{Barthello} +\characterspace +\character[cmd={isaaru},desc={a summoner}]{Isaaru} +\begin{charactergroup}{his brothers and guardians} + \character[cmd={maroda}]{Maroda} + \character[cmd={pacce}]{Pacce} +\end{charactergroup} +\characterspace +\character[cmd={belgemine},desc={a summoner}]{Belgemine} +\characterspace +\begin{charactergroup}{the Besaid Aurochs} + \character[cmd={botta}]{Botta} + \character[cmd={datto}]{Datto} + \character[cmd={jassu}]{Jassu} +\character[cmd={keepa}]{Keepa} +\character[cmd={letty}]{Letty} +\end{charactergroup} +\characterspace +\begin{charactergroup}{the Luca Goers} + \character[cmd={bickson}]{Bickson} + \character[cmd={graav}]{Graav} +\end{charactergroup} +\characterspace +\begin{charactergroup}{blitzball commentators} +\character[cmd={bobba}]{Bobba} +\character[cmd={jimma}]{Jimma} +\end{charactergroup} +\characterspace +\begin{charactergroup}{Kimahri's rivals} +\character[cmd={biran},drama={Biran Ronso}]{Biran} +\character[cmd={yenke},drama={Yenke Ronso}]{Yenke} +\end{charactergroup} +\characterspace +\character[cmd={oaka},drama={O’aka XXIII},desc={a salesman}]{O’aka} +\character[cmd={wantz},desc={his brother}]{Wantz} +\characterspace +\character[cmd={anima}]{Seymour’s mother} +\character[cmd={jyscal},drama={Jyscal Guado},desc={Seymour's + father}]{Jyscal} +\character[cmd={tromell},drama={Tromell Guado},desc={their + retainer}]{Tromell} +\characterspace +\character[cmd={borra},desc={a musician}]{Borra} +\characterspace +\character[cmd={calli},desc={a young girl}]{Calli} +\characterspace +\character[cmd={maechen},desc={a historian}]{Maechen} +\characterspace +\character[cmd={rin},desc={an Al Bhed merchant}]{Rin} +\characterspace +\character[cmd={shelinda},desc={an acolyte}]{Shelinda} +\characterspace +\character[cmd={mom}]{Tidus’ mother} +\characterspace +\character[cmd={yunalesca},desc={an unsent}]{Yunalesca} +\characterspace +\character[cmd={zuke},desc={a priest}]{Zuke} +\characterspace +\begin{charactergroup}{the fayth} + \character[cmd={bahamut},drama={Bahamut}]{Bahamut’s fayth} + \character[cmd={ifrit},drama={Ifrit}]{Ifrit’s fayth} + \character[cmd={ixion},drama={Ixion}]{Ixion’s fayth} + \character[cmd={shiva},drama={Shiva}]{Shiva’s fayth} + \character[cmd={magus},drama={The Magus Sisters}]{Fayth} + \character[cmd={valefor},drama={Valefor}]{Valefor’s fayth} +\character[cmd={yojimbo},drama={Yojimbo}]{Yojimbo’s fayth} +\end{charactergroup} +\end{dramatis} + +\makeatletter % https://tex.stackexchange.com/a/144329 +\patchcmd{\@startsection}{\@ifstar}{\nolinenumbers\@ifstar}{}{} +\patchcmd{\@xsect}{\ignorespaces}{\linenumbers\ignorespaces}{}{} +\makeatother + +\linenumbers + +\section{Jecht sphere} + +\subsection{Bevelle, ten years ago} + +\auron +What are you taking? + +\jecht +Well, you said it was gonna be a long trip.\\ +We'll be seeing a lot of neat things, right?\\ +So I thought I'd record it all in this.\\ +To show to my wife and kid, you know. + +\auron +This is no pleasure cruise! + +\jecht +Hey, Braska.\\ +Ain't this supposed to be a grand occasion?\\ +Where're the cheering fans? The crying women? + +\braska +This is it.\\ +Too many goodbyes~-- people think twice about leaving. + +\jecht +Hmm~… If you say so.\\ +Well, it better be a lot more colorful when we come back.\\ +A parade for Braska, vanquisher of Sin! + +\braska +We should go. Day will break soon. + +\subsection{Macalania, ten years ago} + +\braska +Auron, could you stand closer to him?\\ +Good. That should do it. + +\jecht +What's the matter? Afraid I might bite? + +\auron +Jecht~… + +\jecht +Braska! You should take one, too. It'd make a great gift for little +Yuna! + +\braska +I suppose. + +\auron +Lord Braska~… +We shouldn't be wasting our time like this! + +\jecht +What's the hurry, man? + +\auron +Let me tell you what the hurry is! + +\braska +Auron! + +\subsection{Macalania, present day} + +\tidus +What's the point? He wasn't on some pleasure cruise. + +\rikku +I think there's more. + +\subsection{Macalania, ten years ago} + +\jecht +Hey.\\ +If you're sitting there, watching this~…\\ +it means you're stuck in Spira, like me.\\ +You might not know when you'll get back home, but you better not be +crying!\\ +Although, I guess I'd understand. But you know what?\\ +There's a time when you have to stop crying and move on.\\ +You'll be fine. Remember, you're my son.\\ +And~… Well, uh~…\\ +Never mind. I'm no good at these things. + +\subsection{Macalania, ten years ago} + +\jecht +Anyways~…\\ +I believe in you. Be good.\\ +Goodbye. + +\subsection{Macalania, present day} + +\tidus +He sounded almost serious, but it was too late. + +\auron +He was serious.\\ +Jecht had already accepted his fate. + +\tidus +His fate? + +\auron +Jecht~… He~…\\ +He was always talking about going home, to Zanarkand.\\ +That's why he took all those pictures~– to show them to you when he +returned.\\ +But as he journeyed with us and came to understand Spira, and Braska's +resolve~…\\ +It happened gradually, but Jecht changed.\\ +He decided he would join Braska in his fight against Sin. + +\tidus +So then, he gave up going home? + +\auron +That was his decision. + +\begin{dida} + I guess I understood.\\ + My old man~…\\ + He knew there was no way back home, back to Zanarkand.\\ + He wanted to go home, but he knew he couldn't.\\ + He couldn't go on until he accepted it.\\ + Besides~…\\ + even if he had found a way back~…\\ + I don't think he would've left his friends behind before their + journey was complete. +\end{dida} + +\tidus +All right! Let's go, guys! + +\begin{dida} + Maybe I had to start accepting my own fate. +\end{dida} + +\section{Jecht sphere} + +\subsection{Besaid, ten years ago} + +\jecht +Smallest heap of huts I ever seen! + +\braska +Now, that looks like a fine place to live.\\ +Hmm~…\\ +Auron. + +\auron +My lord? + +\braska +When this is over, could you bring Yuna here?\\ +I want her to lead a life far away from this conflict. + +\auron +You have my word. I will bring her here. + +\braska +Thank you, Auron. You are a good friend. + +\jecht +What are you guys doin'? Let's go!\\ +I'm so hungry I could eat a shoopuf whole! + +\braska +Sorry. Well, let's go then. + +\section{Jecht sphere} + +\subsection{On board ship, ten years ago} + +\jecht +After you get that aeon from Besaid~…\\ +Where're we going? + +\auron +Back the way we came.\\ +Then we go north from Bevelle and climb Mt.\ Gagazet. + +\braska +Beyond it lies~… Zanarkand. + +\jecht +Zanarkand, huh?\\ +It's been in ruins for a thousand years, right? + +\auron +So the legends say. No one knows for sure.\\ +It still could be your Zanarkand. + +\jecht +Thanks for trying, Auron. + +\subsection{Upstairs} + +\jecht +I thought if I went with you guys I might find a way to go back.\\ +But it's not that easy. + +\braska +I'm sorry. + +\jecht +No need to apologize, Braska. It's not your fault.\\ +I should be thinking about fighting Sin now, anyway.\\ +Zanarkand can wait.\\ +But I will find my way back! + +\braska +Be careful, Jecht. + +\jecht +Hey, I'll be all right.\\ +You're the one that should be careful. Wouldn't want your little girl +to cry. + +\braska +She'll be all right. She's strong, like her mother was. + +\section{Jecht sphere} + +\subsection{Luca, ten years ago} + +\jecht +Hey, Auron!\\ +Did you get that last match? + +\auron +Yeah.\\ +But I don't understand why you wanted me to.\\ +Didn't you say you have blitzball in your Zanarkand? + +\jecht +Not a sportsman, are ya? + +\braska +Working on your form? + +\jecht +My form don't need no work. I'm the great Jecht. It's for my kid. + +\braska +Your son plays blitzball? + +\jecht +Yeah, and he wants to beat his old man bad.\\ +Once, I told him to give it up. He didn't speak to me for a week.\\ +Wonder what he's doing now.\\ +I hope he got bigger and put on some muscle.\\ +Hey, what's the big idea! Stop shooting! + +\end{document} +%%% Local Variables: +%%% mode: latex +%%% TeX-master: t +%%% End: diff --git a/script/thalie.sty b/script/thalie.sty new file mode 100644 index 0000000..9007b0e --- /dev/null +++ b/script/thalie.sty @@ -0,0 +1,693 @@ +% 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/12/11 v0.13a A package to typeset drama plays] + + +\RequirePackage{pgfkeys} +\RequirePackage{etoolbox} +\RequirePackage{suffix} +\RequirePackage{tabularx} +\RequirePackage{xspace} +\RequirePackage{translations} +\LoadDictionary{thalie} +\LoadDictionaryFor{fallback}{thalie} +\newcommand{\playname}{\GetTranslation{Play}} +\newcommand{\actname}{\GetTranslation{Act}} +\newcommand{\scenename}{\GetTranslation{Scene}} +\newcommand{\interludename}{\GetTranslation{Interlude}} +\newcommand{\curtainname}{\GetTranslation{Curtain}} +\newcommand{\pausename}{\GetTranslation{Pause}} +\newcommand{\playmark}[1]{% + \markboth{\MakeUppercase{#1}}{}% +} +\newcommand{\actmark}[1]{% + \markright{\MakeUppercase{% + \GetTranslation{Act}\ \theact% + \ifdefempty{#1}{}{: #1}% + }}% +} +\newcommand{\scenemark}[1]{% +} +\newcounter{play} +\renewcommand{\theplay}{\arabic{play}} +\newcounter{act}[play] +\renewcommand{\theact}{\Roman{act}} +\newcounter{scene}[act] +\renewcommand{\thescene}{\arabic{scene}} +\newcommand{\@displaytitle}[3]{ + % Arguments: + % - Style + % - Label (none = not in toc) + % - Title + \ifdefstring{#1}{center}{ + \begin{center} + \textsc{#2} + + #3 + \end{center} + }{\ifdefstring{#1}{bigcenter}{ + \begin{center} + \Large + \textsc{#2} + + #3 + \end{center} + }{\ifdefstring{#1}{box}{ + \begin{center} + \framebox{\begin{minipage}{0.7\textwidth} + \begin{center} + \Large \bfseries + \vspace{0.5em} + + #2 + \ifboolexpr{test{\ifstrempty{#3}} or test{\ifstrempty{#2}}}{}{---} + #3 + + \vspace{0.5em} + \end{center} + \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][]{% + \refstepcounter{play} + \ifstrempty{#1}{ + \def\@short{#2} + }{ + \def\@short{#1} + } + \@clearpage{\@playlevel} + \playmark{\@short} + \addcontentsline{toc}{\@playlevel}{\@short} + \ifdefstring{\@playstyle}{custom}{ + \customplay{\theplay}{#2} + }{ + \@displaytitle{\@playstyle}{}{#2} + } +} +\WithSuffix\newcommand\play*[1]{% + \@clearpage{\@playlevel} + \ifdefstring{\@playstyle}{custom}{ + \customplay*{#1} + }{ + \@displaytitle{\@playstyle}{}{#1} + } +} +\newcommand{\act}[2][]{% + \refstepcounter{act} + \ifstrempty{#1}{ + \def\@short{#2} + }{ + \def\@short{#1} + } + \ifdefempty{\@short}{ + \def\@label{\GetTranslation{Act} \theact{}} + }{ + \def\@label{\GetTranslation{Act} \theact{}\xspace: } + } + \@clearpage{\@actlevel} + \actmark{\@short} + \addcontentsline{toc}{\@actlevel}{\@label\@short} + \ifdefstring{\@actstyle}{custom}{ + \customact{\theact}{#2} + }{ + \@displaytitle{\@actstyle}{\GetTranslation{Act} \theact}{#2} + } +} +\WithSuffix\newcommand\act*[1]{% + \@clearpage{\@actlevel} + \ifdefstring{\@actstyle}{custom}{ + \customact*{#1} + }{ + \@displaytitle{\@actstyle}{}{#1} + } +} +\newcommand{\scene}[2][]{% + \refstepcounter{scene} + \ifstrempty{#1}{ + \def\@short{#2} + }{ + \def\@short{#1} + } + \ifdefempty{\@short}{ + \def\@label{\GetTranslation{Scene} \thescene{}} + }{ + \def\@label{\GetTranslation{Scene} \thescene{}\xspace: } + } + \@clearpage{\@scenelevel} + \scenemark{\@short} + \addcontentsline{toc}{\@scenelevel}{\@label\@short} + \ifdefstring{\@scenestyle}{custom}{ + \customscene{\thescene}{#2} + }{ + \@displaytitle{\@scenestyle}{\GetTranslation{Scene} \thescene}{#2} + } +} +\WithSuffix\newcommand\scene*[1]{% + \@clearpage{\@scenelevel} + \ifdefstring{\@scenestyle}{custom}{ + \customscene*{#1} + }{ + \@displaytitle{\@scenestyle}{}{#1} + } +} +\newcommand{\interlude}[2][]{% + \ifstrempty{#1}{ + \def\@short{#2} + }{ + \def\@short{#1} + } + \ifdefempty{\@short}{ + \def\@label{\GetTranslation{Interlude}} + }{ + \def\@label{\GetTranslation{Interlude}\xspace: } + } + \ifdefstring{\@interludelevel}{play}{ + \@clearpage{\@playlevel} + \playmark{\@short} + \addcontentsline{toc}{\@playlevel}{\@label\@short} + \@displaytitle{\@playstyle}{\GetTranslation{Interlude}}{#2} + }{\ifdefstring{\@interludelevel}{act}{ + \@clearpage{\@actlevel} + \actmark{\@short} + \addcontentsline{toc}{\@actlevel}{\@label\@short} + \@displaytitle{\@actstyle}{\GetTranslation{Interlude}}{#2} + }{% \@interludelevel is scene + \@clearpage{\@scenelevel} + \scenemark{\@short} + \addcontentsline{toc}{\@scenelevel}{\@label\@short} + \@displaytitle{\@scenestyle}{\GetTranslation{Interlude}}{#2} + }} +} +\WithSuffix\newcommand\interlude*[1]{% + \ifdefstring{\@interludelevel}{play}{ + \@clearpage{\@playlevel} + \@displaytitle{\@playstyle}{\GetTranslation{Interlude}}{#1} + }{\ifdefstring{\@interludelevel}{act}{ + \@clearpage{\@actlevel} + \@displaytitle{\@actstyle}{\GetTranslation{Interlude}}{#1} + }{% \@interludelevel is scene + \@clearpage{\@scenelevel} + \@displaytitle{\@scenestyle}{\GetTranslation{Interlude}}{#1} + }} +} +\newcommand\curtain{ + \begin{center} + \Large\textsc{\GetTranslation{Curtain}} + \end{center} +} +\newcommand{\@maybexspace}{% + \if@xspace% + \xspace% + \fi% +} +\newcommand{\@speaks}[2][]{% + \ifstrempty{#1}{% + \speakswithoutdirection{#2}% + }{% + \speakswithdirection{#2}{#1}% + }\@maybexspace% +} +\newenvironment{@smallcenter} + {\par\smallskip\centering} + {\par\nopagebreak\ignorespacesafterend} +\providecommand{\speakswithdirection}{} +\providecommand{\speakswithoutdirection}{} +\newcommand{\@setcharacterstyle}[1]{ + \ifstrequal{#1}{bold}{% + % Bold style + \renewcommand\speakswithdirection[2]{% + \noindent% + {\bfseries\sffamily ##1} \emph{(##2)}\xspace:% + } + \renewcommand\speakswithoutdirection[1]{% + \noindent% + {\bfseries\sffamily ##1\xspace:}% + }% + }{}% + \ifstrequal{#1}{center}{% + % Center style + \renewcommand\speakswithdirection[2]{% + \begin{center}% + \textsc{##1},\\\emph{##2}% + \end{center}% + \par\ignorespacesafterend% + }% + \renewcommand\speakswithoutdirection[1]{% + \begin{center}% + \textsc{##1}% + \end{center}% + \par\ignorespacesafterend% + }% + }{}% + \ifstrequal{#1}{imprimerie-verse}{% + % Style for verse plays defined by the French Imprimerie nationale + \renewcommand\speakswithdirection[2]{% + \begin{@smallcenter}% + \textsc{##1}, \emph{##2}% + \end{@smallcenter}% + }% + \renewcommand\speakswithoutdirection[1]{% + \begin{@smallcenter}% + \textsc{##1}% + \end{@smallcenter}% + }% + }{}% + \ifstrequal{#1}{imprimerie-prose}{% + % Style for prose plays defined by the French Imprimerie nationale + \renewcommand\speakswithdirection[2]{% + \noindent\hspace*{-\parindent}\textsc{##1}, \emph{##2}\xspace:% + }% + \renewcommand\speakswithoutdirection[1]{% + \noindent\hspace*{-\parindent}\textsc{##1}\xspace:% + }% + }{}% + \ifstrequal{#1}{arden}{% + \renewcommand\speakswithdirection[2]{% + \noindent\hspace*{-\parindent}\textsc{\MakeLowercase{##1}} [\emph{##2}]\quad% + }% + \renewcommand\speakswithoutdirection[1]{% + \noindent\hspace*{-\parindent}\textsc{\MakeLowercase{##1}}\quad% + }% + }{}% + \ifstrequal{#1}{simple}{% + % Simple style + \renewcommand\speakswithdirection[2]{% + \indent\textsc{##1}, \emph{##2}\xspace:% + }% + \renewcommand\speakswithoutdirection[1]{% + \indent\textsc{##1}\xspace:% + }% + }{}% + \ifstrequal{#1}{margin}{% + % Margin style + \setlength{\leftskip}{3cm} + \renewcommand\speakswithdirection[2]{% + \hspace{-3cm} ##1 ##2 + } + \renewcommand\speakswithoutdirection[1]{% + \hspace{-3cm} ##1 + }% + }{}% +} +\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@}{} +\newenvironment{dramatis}[1][]{ + \@dramatis@clear{} + \undef{\@dramatis@clear} + \pgfkeys{/THALIE/DRAMATIS/.cd, #1} + \ifbool{@dramatis@hidden}{% + % Nothing + }{% + \dramatisenv% + }% +}{% + \notbool{@dramatis@hidden}{% + \enddramatisenv + }{}% +} +\newenvironment{dramatisenv}{% + \list{}{\rightmargin1cm\leftmargin2cm}\item[] +}{% + \endlist% +} + +\newcommand{\dramatischaractername}[1]{\textbf{#1}} + +\newcommand{\dramatischaracterdescription}[1]{#1} + +\newcommand{\dramatischaractercast}[1]{#1} + +\newcommand{\characterspace}{ % + \notbool{@dramatis@hidden}{% + \smallskip\newline % + }{}% +} + +\newcommand{\dramatischaracter}[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} % + }{}% + \ifdefempty{#3}{}{\dotfill\dramatischaractercast{#3}}% + \newline % +} + +\newlength{\@spaceaftergroup} +\newenvironment{dramatischaractergroup}[2]{ + \gdef\@groupname{#2} % + \gdef\@grouplength{#1} % + \hspace*{-1.3pt}\math\left. % + \minipage[c]{#1} % + \vspace*{2pt} % +}{% + \vspace*{-8pt} % + \endminipage % + \right\} \endmath % + % + \setlength{\@spaceaftergroup}{\linewidth} + \addtolength\@spaceaftergroup{-\@grouplength} + \addtolength\@spaceaftergroup{-20pt} + \begin{minipage}[c]{\@spaceaftergroup} + \@groupname % + \end{minipage} + \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% + }% + \expandafter\gdef\csname#1\endcsname{% + \@ifnextchar[{% + \defcharcommand@with{#2}% + }{% + \defcharcommand@without{#2}% + }% + }% + \xappto{\@dramatis@clear}{% + \global\noexpand\csundef{#1}% + \global\noexpand\csundef{#1name}% + }% +} +\newcommand{\@definecharactercommand}[2]{% + \ifcsdef{#1}{% + \ClassError{thalie}{% + A command named \@backslashchar#1 already exists. We cannot define a new + one.% + }{% + Choose another command name to introduce character #2's lines.% + }% + }{% + }% + \ifcsdef{#1name}{% + \ClassError{thalie}{% + A command named \@backslashchar#1name already exists. We cannot define a + new one.% + }{% + Choose another command name to introduce character #2's lines, such that + when a new command is defined by adding "name" to it, it does not + conflict with an existing one. + }% + }{% + }% + \setcharactername{#1}{#2}% +} +\def\defcharcommand@with#1[#2]{\@speaks[#2]{#1}} +\def\defcharcommand@without#1{\@speaks{#1}} +\pgfkeys{ + % Character definition + /THALIE/CHARACTER/.is family, + /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{\@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}% + \ifcsundef{@cast}{% + \ifcsdef{@defaultcast}{% + \gdef\@cast{\@defaultcast}% + }{% + \gdef\@cast{}% + }% + }{}% + % Forbidden combinations + \ifboolexpr{ + ( ( 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} + }{}% + \ifboolexpr{ bool{@dramatis@hidden} or test{\ifdefempty{\@drama}} }{% + % Hidden character. Nothing added to dramatis personae + }{% + \ifcsundef{@desc}{\gdef\@desc{}}{}% + \ifcsundef{@drama}{\gdef\@drama{#2}}{}% + \csuse{#3}{\@drama}{\@desc}{\@cast}% + }% +} +\newcommand{\character}[2][]{% + \@thalie@parsecharacter{#1}{#2}{dramatischaracter}% +} + +\newcommand{\disposablecharacter}[2][]{% + \@speaks[#1]{#2}% +} +\newcommand{\onstage}[1]{{\centering \emph{#1}\par\medskip}} +\newcommand{\did}[1]{\emph{(#1)}\@maybexspace} +\newenvironment{dida}{% + \begin{quote} + \begin{em} + }{% + \end{em} + \end{quote} +} +\newcommand\pause{\did{\GetTranslation{Pause}}} + + +\newlength{\@verseadjust} +\setlength{\@verseadjust}{0pt} + +\newcommand{\adjustverse}[1]{\setlength{\@verseadjust}{#1}} + +\newcommand{\pauseverse}{{\abovedisplayshortskip\z@\abovedisplayskip\z@ + \belowdisplayshortskip\z@\belowdisplayskip\z@ + $$\global\dimen\@ne\predisplaysize + \xdef\tmp{% + \predisplaysize\the\predisplaysize + \prevgraf\the\prevgraf\relax}% + $$\vskip\dimexpr-\parskip-\baselineskip\relax}\tmp +} + +\newcommand{\resumeverse}{% + \hspace{\@verseadjust}\hspace{\the\dimen\@ne} +} +\RequirePackage{pgfopts} + +\pgfkeys{ + % Character style + /THALIE/.cd, + characterstyle/.value required, + characterstyle/.default=simple, + characterstyle/.is choice, + characterstyle/bold/.code=\@setcharacterstyle{bold}, + characterstyle/center/.code=\@setcharacterstyle{center}, + characterstyle/margin/.code=\@setcharacterstyle{margin}, + characterstyle/simple/.code=\@setcharacterstyle{simple}, + characterstyle/arden/.code=\@setcharacterstyle{arden}, + characterstyle/imprimerie-verse/.code=\@setcharacterstyle{imprimerie-verse}, + characterstyle/imprimerie-prose/.code=\@setcharacterstyle{imprimerie-prose}, + characterstyle, +} + +\pgfkeys{ + % play style + /THALIE/.cd, + playstyle/.value required, + playstyle/.default=box, + playstyle/.is choice, + playstyle/center/.code=\def\@playstyle{center}, + playstyle/bigcenter/.code=\def\@playstyle{bigcenter}, + playstyle/box/.code=\def\@playstyle{box}, + playstyle/custom/.code=\def\@playstyle{custom}, + playstyle, +} +\pgfkeys{ + % act style + /THALIE/.cd, + actstyle/.value required, + actstyle/.default=bigcenter, + actstyle/.is choice, + actstyle/center/.code=\def\@actstyle{center}, + actstyle/bigcenter/.code=\def\@actstyle{bigcenter}, + actstyle/box/.code=\def\@actstyle{box}, + actstyle/custom/.code=\def\@actstyle{custom}, + actstyle, +} +\pgfkeys{ + % scene style + /THALIE/.cd, + scenestyle/.value required, + scenestyle/.default=center, + scenestyle/.is choice, + scenestyle/center/.code=\def\@scenestyle{center}, + scenestyle/bigcenter/.code=\def\@scenestyle{bigcenter}, + scenestyle/box/.code=\def\@scenestyle{box}, + scenestyle/custom/.code=\def\@scenestyle{custom}, + scenestyle, +} + +\pgfkeys{ + % play level + /THALIE/.cd, + playlevel/.value required, + playlevel/.default=chapter, + playlevel/.store in=\@playlevel, + playlevel, +} +\pgfkeys{ + % act level + /THALIE/.cd, + actlevel/.value required, + actlevel/.default=section, + actlevel/.store in=\@actlevel, + actlevel, +} +\pgfkeys{ + % scene level + /THALIE/.cd, + scenelevel/.value required, + scenelevel/.default=subsection, + scenelevel/.store in=\@scenelevel, + scenelevel, +} +\pgfkeys{ + % interlude level + /THALIE/.cd, + interludelevel/.value required, + interludelevel/.default=act, + interludelevel/.is choice, + interludelevel/play/.code=\def\@interludelevel{play}, + interludelevel/act/.code=\def\@interludelevel{act}, + interludelevel/scene/.code=\def\@interludelevel{scene}, + interludelevel, +} +\newif\if@xspace +\pgfkeys{ + % xspace option + /THALIE/.cd, + xspace/.value required, + xspace/.is if=@xspace, + xspace/.default=true, + xspace, +} + +\ProcessPgfPackageOptions{/THALIE} +\newcommand{\setthalieoptions}[1]{% + \pgfkeys{/THALIE/.cd, #1}% +} +\endinput +%% +%% End of file `thalie.sty'.