summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/thalie
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-04-23 22:08:37 +0000
committerKarl Berry <karl@freefriends.org>2017-04-23 22:08:37 +0000
commit53b8d70292c2a17a5807f9269c92d0806ca93e61 (patch)
tree3967d672201c7cbab5895a323b898b18b924321a /Master/texmf-dist/source/latex/thalie
parentf5a55f5fa1a9c9ce70847df822ac1b8210174653 (diff)
thalie (23apr17)
git-svn-id: svn://tug.org/texlive/trunk@43994 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/thalie')
-rw-r--r--Master/texmf-dist/source/latex/thalie/thalie.dtx1277
-rw-r--r--Master/texmf-dist/source/latex/thalie/thalie.ins8
2 files changed, 840 insertions, 445 deletions
diff --git a/Master/texmf-dist/source/latex/thalie/thalie.dtx b/Master/texmf-dist/source/latex/thalie/thalie.dtx
index 40a898daedd..87c5e6fcd63 100644
--- a/Master/texmf-dist/source/latex/thalie/thalie.dtx
+++ b/Master/texmf-dist/source/latex/thalie/thalie.dtx
@@ -1,5 +1,5 @@
% \iffalse meta-comment
-% Copyright 2010-2015 Louis Paternault
+% Copyright 2010-2017 Louis Paternault
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -25,7 +25,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{thalie}
%<*package>
- [2015/12/30 v0.8 A package to typeset drama plays]
+ [2017/04/22 v0.9a A package to typeset drama plays]
%</package>
%
%<*driver>
@@ -34,14 +34,13 @@
\CodelineIndex
\RecordChanges
\usepackage{array}
-\usepackage{attachfile}
\usepackage{enumerate}
\usepackage{multirow}
\usepackage{hyperref}
\usepackage{thalie}
\usepackage{showexpl}
\lstset{language=[LaTeX]TeX, numbers=left, numberstyle=\tiny}
-\usepackage[francais,english]{babel}
+\usepackage[english]{babel}
\begin{document}
\DocInput{thalie.dtx}
\end{document}
@@ -67,56 +66,65 @@
%
% \GetFileInfo{thalie.dtx}
%
-% \DoNotIndex{\@backslashchar, \@ifnextchar, \@ifundefined, \\, \protect\`, \(, \)}
-% \DoNotIndex{\addcontentsline, \addto, \ae, \AND, \arabic}
-% \DoNotIndex{\begin, \bfseries, \boolean}
+% \DoNotIndex{\@backslashchar, \@ifnextchar, \protect\`}
+% \DoNotIndex{\#,\$,\%,\&,\@,\\,\{,\},\^,\_,\~,\ ,\!,\(,\),\,}
+% \DoNotIndex{\addcontentsline, \addto, \ae, \AND, \arabic, \abovedisplayshortskip, \abovedisplayskip, \addtolength}
+% \DoNotIndex{\begin, \bfseries, \boolean, \baselineskip, \belowdisplayskip, \belowdisplayshortskip, \boolfalse, \booltrue}
% \DoNotIndex{\captionsenglish, \captionsfrench, \center, \centering, \ClassError, \cleardoublepage, \csname, \csundef}
-% \DoNotIndex{\def, \defcharcommand@with, \defcharcommand@without}
-% \DoNotIndex{\emph, \end, \endcsname, \equal, \expandafter}
-% \DoNotIndex{\framebox}
-% \DoNotIndex{\gappto, \gdef, \global}
+% \DoNotIndex{\def, \defcharcommand@with, \defcharcommand@without, \dimen, \dimexpr}
+% \DoNotIndex{\emph, \end, \endcsname, \equal, \expandafter, \endlist, \endmath, \endminipage}
+% \DoNotIndex{\framebox, \fi}
+% \DoNotIndex{\gappto, \gdef, \global, \GetTranslation}
% \DoNotIndex{\hspace}
-% \DoNotIndex{\ifthenelse, \@ifpackageloaded, \indent, \isundefined}
-% \DoNotIndex{\LARGE, \Large, \left, \leftskip}
-% \DoNotIndex{\medskip, \MakeUppercase, \markboth, \markright}
+% \DoNotIndex{\@ifpackageloaded, \indent, \if@xspace, \ifbool, \ifboolexpr, \ifcsundef, \ifcsdef, \ifdef, \ifdefempty, \ifdefstring, \ifstrempty, \ifstrequal, \ifundef, \ignorespacesafterend, \item}
+% \DoNotIndex{\LARGE, \Large, \left, \leftskip, \leftmargin, \list, \linewidth, \LoadDictionaryFor, \LoadDictionary}
+% \DoNotIndex{\medskip, \MakeUppercase, \markboth, \markright, \MakeLowercase, \math, \minipage}
% \DoNotIndex{
% \@actlevel,
% \@actstyle,
-% \@character,
-% \@characterstyle,
% \@clearpage,
+% \@cmd,
% \@definecharactercommand,
+% \@desc,
% \@displaytitle,
+% \@drama,
% \@dramatis@clear,
-% \@dramatis@hook,
+% \@empty@,
+% \@grouplength,
% \@groupname,
% \@interludelevel,
% \@label,
+% \@maybexspace,
+% \@ne,
% \@playlevel,
% \@playstyle,
% \@scenelevel,
% \@scenestyle,
% \@short,
+% \@spaceaftergroup,
% \@speaks,
+% \@verseadjust,
% }
-% \DoNotIndex{\newcommand, \newcounter, \newenvironment, \noindent, \noexpand, \NOT}
+% \DoNotIndex{\newcommand, \newcounter, \newenvironment, \noindent, \noexpand, \NOT, \newif, \newlength, \newline, \nopagebreak}
% \DoNotIndex{\OR}
-% \DoNotIndex{\par, \pgfkeys, \ProcessPgfPackageOptions, \protect, \provideboolean, \protected@xappto}
-% \DoNotIndex{\refstepcounter, \renewcommand, \RequirePackage, \right, \Roman}
-% \DoNotIndex{\section, \setboolean, \setlength, \sffamily}
-% \DoNotIndex{\tabularnewline, \textrm, \textsc, \textwidth, \thispagestyle}
+% \DoNotIndex{\par, \pgfkeys, \ProcessPgfPackageOptions, \protect, \protected@xappto, \parindent, \parskip, \predisplaysize, \prevgraf, \providebool}
+% \DoNotIndex{\quad},
+% \DoNotIndex{\refstepcounter, \renewcommand, \RequirePackage, \right, \Roman, \relax, \rightmargin}
+% \DoNotIndex{\section, \setboolean, \setlength, \sffamily, \smallskip}
+% \DoNotIndex{\tabularnewline, \textrm, \textsc, \textwidth, \thispagestyle, \textbf, \the, \tmp}
% \DoNotIndex{\undef}
-% \DoNotIndex{\vspace}
+% \DoNotIndex{\vspace, \vskip}
% \DoNotIndex{\WithSuffix}
-% \DoNotIndex{\xappto, \xspace}
+% \DoNotIndex{\xappto, \xspace, \xdef}
+% \DoNotIndex{\z@}
%
% \newcommand{\bbackslash}{\symbol{92}}
%
% \title{The \textsf{thalie} package\thanks{
% This document corresponds to \textsf{thalie}~\fileversion, dated \filedate.
-% Home page, bug requests, etc. at \url{http://git.framasoft.org/spalax/thalie}
+% Home page, bug requests, etc. at \url{http://framagit.org/spalax/thalie}
% }\\A package to typeset drama plays}
-% \author{Louis Paternault\\ \texttt{spalax(at)gresille(dot)org}}
+% \author{Louis Paternault\\ \texttt{spalax+thalie(at)gresille(dot)org}}
%
% \maketitle
%
@@ -170,9 +178,10 @@
%
% In short (but this paragraph has no legal value), you can use this package
% freely to render your drama plays, and modify it almost freely. Nevertheless,
-% if you like my work, you can send me smiles, cakes or poetry, or, better, the
-% text of the plays you write using my package\footnote{Seriously, it would
-% make me \emph{really} happy!}.
+% if you like my work, you can invite me to the performance of the play you
+% typeset using my package\footnote{You will not take a big risk, since there
+% is little chance I travel half the world to see a play. But if by chance I
+% can attend it, it would make me really happy.}.
%
% \subsection{Acknowledgements}
% I borrowed ideas and lines of code from the \LaTeX{} packages
@@ -184,76 +193,76 @@
%
% \subsection{Examples}
%
-% All the examples are taken from Edmond Rostand's \emph{Cyrano de Bergerac}
+% Most of the examples are taken from Edmond Rostand's \emph{Cyrano de Bergerac}
% \cite{cyrano} or from William Shakespeare's \emph{A Midsummer Night's Dream}
% \cite{midsummer}. The snippets of \emph{Cyrano de Bergerac} are from the
% original (French) version of this play, roughly translated by myself (which
% means that they must be of poor quality).
%
-% A part of this play (now in public domain), is
-% \textattachfile[mimetype=text/plain,color=0 0 1]{examples/cyrano.tex}{attached to this
-% file}, as a working example of this package.
-%
% \subsection{Overview}
+% Installation instruction are given in section \ref{sec:install}.
% Documentation about how to use this package is given in section
% \ref{sec:usage}. In particular, section \ref{sec:sectioning} explains how to
-% use acts and scenes, section \ref{sec:characters} explains how to define
+% use acts and scenes, sections \ref{sec:dramatis} and \ref{sec:characters} explains how to define
% characters, and use these definitions to introduce characters' lines, and
% section \ref{sec:directions} describes commands used to render stage
-% directions.
+% directions. At last, specific instruction about how to use this package with
+% a language other than English (or a non-latin alphabet) are given in section
+% \ref{sec:i18n}. Examples are given in section \ref{sec:examples}.
%
% Implementation is given in section \ref{sec:implementation}.
%
-% \section{Usage}
-% \label{sec:usage}
+% \section{Download and Install}
+% \label{sec:install}
%
-% \subsection{Localization}
-% \DescribeMacro{\playname}
-% \DescribeMacro{\actname}
-% \DescribeMacro{\scenename}
-% \DescribeMacro{\interludename}
-% \DescribeMacro{\pausename}
-% \DescribeMacro{\curtainname}
-% Language cannot be defined directly in this package. Instead, the language
-% currently used by the |babel| package (i.e. the language returned by
-% |babel|'s |\languagename| command) is used to display names.
%
-% Package |babel|, and its languages you want to use, must be loaded
-% \emph{before} this package, otherwise localization will not be available.
+% \subsection{\textsc{Gnu}/Linux Distribution}
%
-% The effect of choosing a language or another is to translate some words. The
-% corresponding commands, and the words they correspond to, are listed in table
-% \ref{table:l10n}.
+% If applicable, the easiest way to get |thalie| working is by installing it by your distribution package. With Debian (and Ubuntu, and surely other distributions that inherit from Debian), simply run:
%
-% \begin{table}
-% \centering
-% \begin{tabular}{ccc}
-% \hline
-% Command & Result (in English) & Result (in French) \\
-% \hline
-% |\playname| & Play & Pi\`ece \\
-% |\actname| & Act & Acte \\
-% |\scenename| & Scene & Sc\`ene \\
-% |\interludename| & Interlude & Interm\`ede \\
-% |\pausename| & Pause & Pause \\
-% |\curtainname| & Curtain & Rideau \\
-% \hline
-% \end{tabular}
-% \caption{Localization commands}
-% \label{table:l10n}
-% \end{table}
+% \begin{quote}
+% |sudo apt-get install texlive-humanities|
+% \end{quote}
%
-% If the option for your language does not exist\footnote{You can also send me
-% the translation for your language, to improve this package.}, or if you want
-% to change the default words used here, you can redefine the commands listed
-% in table \ref{table:l10n}. For instance use
-% |\renewcommand{\curtainname}{Tel\`on}| for Spanish (if I am not wrong).
+% \subsection{LaTeX distribution}
+%
+% This package is included both in \TeX{}Live and MiK\TeX{}. It can be installed by their respective package managers.
+%
+% \subsection{Manual installation}
+%
+% \begin{itemize}
+% \item Download the lastest archive :
+% \begin{description}
+% \item[Stable version] \url{http://mirrors.ctan.org/install/macros/latex/contrib/thalie.tds.zip}
+% \item[Development version] \url{https://framagit.org/spalax/thalie/repository/archive.zip?ref=master}
+% \end{description}
+% \item Unzip the archive.
+% \item If you got the archive from CTAN (stable version), move file \texttt{tex/latex/thalie/thalie.sty} in a \LaTeX{} path.
+% \item If you got the development version, |cd| to the main archive directory, and run |latex thalie.ins| to build |thalie.sty|. Move this file into a \LaTeX{} path.
+% \end{itemize}
+%
+% \section{Usage}
+% \label{sec:usage}
+%
+% \subsection{Localization}
+% \changes{v0.9a}{2017/04/22}{Add section \emph{Localization}.}
+%
+% By default, commands |\act|, |\scene|, etc. use English words, but they are
+% translated to the current language used by |babel| or
+% |polyglossia|\footnote{Given that someone provided the translation. Right
+% now, the only available languages are English and French.}. More information
+% is given in section \ref{sec:l10n}.
%
% \subsection{Package options}
% \label{sec:options}
%
% Package options are summed up in table \ref{table:packageoptions}.
%
+% Note that any package option can be redefined anywhere in the document. This
+% makes it possible to have several plays collected in a single document, while
+% applying different styles or options to each play. See section
+% \ref{sec:redefine} for more detail.
+%
% \begin{table}
% \centering
% \begin{tabular}{c|c|c}
@@ -326,6 +335,38 @@
% sectioning levels as the level, you may choose |play|, |act| or |scene|. It
% defines if an interlude is at the same level as a play, an act or a scene.
%
+% \subsubsection{Redefining options}
+% \label{sec:redefine}
+% \DescribeMacro{\setthalieoptions}
+%
+% Packages options can be reset in the document body using command
+% |\setthalieoptions|\marg{package options}. Its only argument has the same
+% syntax as the package options.
+%
+% For instance, if you are writing a collections of plays, some in prose, some in verses, you might want to write something like the following.
+%
+% \iffalse
+%<*example>
+% \fi
+% \begin{lstlisting}
+\documentclass{book}
+...
+\usepackage{thalie}
+...
+\begin{document}
+...
+\play{First play}
+\setthalieoptions{characterstyle=imprimerie-verse}
+...
+\play{Second play}
+\setthalieoptions{characterstyle=impriemie-prose}
+...
+\end{document}
+\end{lstlisting}
+% \iffalse
+%</example>
+% \fi
+%
% \subsection{Sectioning}
% \label{sec:sectioning}
% Here begin the parts explicitly relating to drama.
@@ -378,8 +419,8 @@
%
% \DescribeMacro{\curtain}
% At last, to mark the end of an act or of the play, you can use command
-% |\curtain|, which prints the word |\curtainname| in the middle of its own
-% line.
+% |\curtain|, which prints the word |\GetTranslation{Curtain}| in the middle of its
+% own line.
%
% \subsubsection{Title styles}
% \label{sec:sectionstyles}
@@ -401,13 +442,17 @@
% \begin{lstlisting}
\newcommand\customact[2]{
\begin{center}
- \textsc{#1}
+ \textsc{\GetTranslation{Act} #1}
#2
\end{center}
}
-\WithSuffix\newcommand\customact*[1]{\customact{}{#1}}
-% \end{lstlisting}
+\WithSuffix\newcommand\customact*[1]{
+ \begin{center}
+ #1
+ \end{center}
+}
+\end{lstlisting}
% \iffalse
%</example>
% \fi
@@ -453,12 +498,12 @@
% case if you did not choose the default option for |playlevel|, |actlevel| or
% |scenelevel|), you can redefine them.
%
-% \subsection{Characters}
-% \label{sec:characters}
-% This part explains how to define characters, introduce character's lines, and
-% build and display the dramatis person\ae{}.
+% Examples are given in section \ref{sec:examples:headers}.
+%
+% \subsection{Dramatis person\ae}
+% \label{sec:dramatis}
+% This part explains how to build and display the dramatis person\ae{}.
%
-% \subsubsection{Dramatis person\ae{}}
% Definition of characters is done in document body.
% As it is possible to have several plays in a single documents (for a
% collection of plays or sketches), it is possible to define several
@@ -542,15 +587,15 @@ Wait for the crowd to leave. \did{To \bellerosename} Can I stay?
% \multicolumn{2}{c||}{} & no \meta{cmd} & \meta{cmd} & no \meta{cmd} & \meta{cmd} \\
% \hline
% \hline
-% \multirow{4}{*}{no \meta{drama}} & \multirow{2}{*}{no \meta{desc}} & & & silent\up{\ref{character:silent}} & default\up{\ref{character:default}} \\
-% & & & & & hidden\up{\ref{character:hidden}}\\
+% \multirow{4}{*}{no \meta{drama}} & \multirow{2}{*}{no \meta{desc}} & & & silent\textsuperscript{\ref{character:silent}} & default\textsuperscript{\ref{character:default}} \\
+% & & & & & hidden\textsuperscript{\ref{character:hidden}}\\
% \cline{2-6}
-% & \multirow{2}{*}{ \meta{desc}} & description & & silent\up{\ref{character:silent}} & default\up{\ref{character:default}} \\
-% & & only\up{\ref{character:description}} & & & \\
+% & \multirow{2}{*}{ \meta{desc}} & description & & silent\textsuperscript{\ref{character:silent}} & default\textsuperscript{\ref{character:default}} \\
+% & & only\textsuperscript{\ref{character:description}} & & & \\
% \hline
-% \multirow{2}{*}{ \meta{drama}} & no \meta{desc} & silent\up{\ref{character:silent}} & & & default\up{\ref{character:default}} \\
+% \multirow{2}{*}{ \meta{drama}} & no \meta{desc} & silent\textsuperscript{\ref{character:silent}} & & & default\textsuperscript{\ref{character:default}} \\
% \cline{2-6}
-% & \meta{desc} & silent\up{\ref{character:silent}} & & & default\up{\ref{character:default}} \\
+% & \meta{desc} & silent\textsuperscript{\ref{character:silent}} & & & default\textsuperscript{\ref{character:default}} \\
% \hline
% \end{tabular}
%
@@ -576,40 +621,173 @@ Wait for the crowd to leave. \did{To \bellerosename} Can I stay?
% \DescribeEnv{charactergroup}
% It is possible to group several characters' definition if they have the same
% description. This is done with environment
-% |charactergroup|\marg{description}. For example, one can use code of figure
-% \ref{fig:charactergroup} to define the three sons of another character.
+% |charactergroup|\oarg{width}\marg{description}. The optional argument sets
+% the group width (on the left of the brace).
+% See an example on figure \ref{fig:charactergroup}.
%
% \begin{figure}[p]
% \centering
% \iffalse
%<*example>
% \fi
-% \begin{LTXexample}
+% \begin{LTXexample}[pos=b]
\begin{dramatis}
-\begin{charactergroup}{Two musicians}
- \character[desc={Gaston Henry}]{}
- \character[desc={Damon}]{}
+\begin{charactergroup}[2.5cm]{Officers}
+ \character[desc={a soldier}]{Marcellus}
+ \character[desc={a soldier}]{Bernardo}
\end{charactergroup}
\end{dramatis}
% \end{LTXexample}
% \iffalse
%</example>
% \fi
-% \caption[Defining a group of characters]{Defining a group of characters\footnotemark}
+% \caption[Defining a group of characters]{Defining a group of characters}
% \label{fig:charactergroup}
% \end{figure}
-% \footnotetext{
-% I admit I am cheating here. As it was difficult to find a single play that
-% illustrates every feature of this package, this snippet, in the original
-% \emph{Cyrano de Bergerac}, is used to give the names of the actors playing the
-% two musicians, which is a bit different from the purpose of the
-% |charactergroup| environment. Still, you can see how it is rendered,
-% which is the important part here.
-% }
%
% The effect of this code will be, in the dramatis person\ae{}, to have a
% nice brace mapping the three characters to their common description.
%
+% The behaviour of nested |charactergroup| environments is
+% undefined\footnote{It might work; it might not. It might work now, but stop
+% working in the future; it might not work now, but work by accident in the
+% future. Etc.}.
+%
+% \subsubsection{Customize style of dramatis person\ae}
+% \DescribeEnv{dramatisenv}
+% \DescribeMacro{\dramatischaracter}
+% \DescribeMacro{\dramatischaractername}
+% \DescribeMacro{\dramatischaracterdescription}
+%
+% A default style is used to display the dramatis person\ae, but is it made to
+% be customized.
+% The following commands can be redefined to make dramatis person\ae look
+% different. They do nothing apart from displaying text (no internal
+% definition, etc.).
+%
+% \begin{itemize}
+% \item |dramatisenv|: This environment wraps the dramatis person\ae.
+% \item |\dramatischaracter|\marg{name}\marg{description} Renders the character name and description. It should take care of cases where name or descsription (but not both) is missing.
+% \item |\dramatischaractername|\marg{name} Renders the character name.
+% \item |\dramatischaracterdescription|\marg{description} Renders the character description.
+% \item Environment |charactergroup|\oarg{width}\marg{description} Renders a group of characters.
+% \item |\characterspace| Adds a vertical character space.
+% \end{itemize}
+
+% Figure \ref{fig:dramatisconversion} illustrates how those commands are used.
+%
+% \begin{figure}[p]
+% \iffalse
+%<*example>
+% \fi
+\begin{lstlisting}
+\begin{dramatis}
+ \character{The queen}
+ \character[desc={the queen's husband.}]{The king}
+ \begin{charactergroup}{Lords and ladies}
+ \character{Lord Foo}
+ \character[desc={Lord Foo's sister.}]{Lady Bar}
+ \character[desc={Lord and Lady Baz.}]{}
+ \end{charactergroup}
+ \characterspace
+ \character[desc={Several servants}]{}
+\end{dramatis}
+\end{lstlisting}
+% \iffalse
+%</example>
+% \fi
+%
+% To display the dramatis person\ae{} above, the commands below are called.
+%
+% \iffalse
+%<*example>
+% \fi
+\begin{lstlisting}
+\begin{dramatisenv}
+ \dramatischaracter{The queen}{}
+ \dramatischaracter{The king}{the queen's husband.}
+ \begin{charactergroup}{Lords and ladies}
+ \dramatischaracter{Lord Foo}{}
+ \dramatischaracter{Lady Bar}{Lord Foo's sister.}
+ \dramatischaracter{}{Lord and Lady Baz.}
+ \end{charactergroup}
+ \characterspace
+ \dramatischaracter{}{Several servants}
+\end{dramatisenv}
+\end{lstlisting}
+% \iffalse
+%</example>
+% \fi
+%
+% And command |\dramatischaracter|\marg{Name}\marg{Description} is defined as something like the following code (excepted that parts taking care of cases where there is no character name or description is omitted here).
+% \iffalse
+%<*example>
+% \fi
+\begin{lstlisting}
+\newcommand{\dramatischaracter}[2]{ %
+ \dramatischaractername{#1}, \dramatischaracterdescription{#2}\\
+}
+\end{lstlisting}
+% \iffalse
+%</example>
+% \fi
+% \caption{Commands used to display the dramatis person\ae.}
+% \label{fig:dramatisconversion}
+% \end{figure}
+%
+% For example, to render character names in small caps, one would define :
+%
+% \iffalse
+%<*example>
+% \fi
+\begin{lstlisting}[numbers=none]
+\renewcommand{\dramatischaractername}[1]{\textsc{#1}}
+\end{lstlisting}
+% \iffalse
+%</example>
+% \fi
+%
+% Or to make dramatis
+% person\ae{} include a title, one can define :
+% \iffalse
+%<*example>
+% \fi
+\begin{lstlisting}[numbers=none]
+\renewenvironment{dramatisenv}{%
+ \list{}{\rightmargin1cm\leftmargin2cm}\item[]
+ \act*{Dramatis person\ae}%
+}{%
+ \endlist%
+}
+\end{lstlisting}
+% \iffalse
+%</example>
+% \fi
+%
+% \subsection{Characters}
+% \label{sec:characters}
+% This part explains how to define characters, and introduce character's lines.
+%
+% It has been explained that definition of a character in the dramatis
+% person\ae{} (previous subsection) also creates commands used to introduce
+% lines of characters. For instance, defining a character using
+% |\character[cmd=cyrano]{Cyrano}| means than Cyrano's lines can now be
+% introduced using the following code.
+% \iffalse
+%<*example>
+% \fi
+\begin{lstlisting}
+\cyrano
+No! It's a bit short, young man\ldots
+\end{lstlisting}
+% \iffalse
+%</example>
+% \fi
+% This would display the name \emph{Cyrano} using the current character style, then
+% his line.
+%
+% \subsubsection{Custom characters}
+%
% \paragraph{Disposable character}
% \DescribeMacro{\disposablecharacter}
% One can need to define characters that are used only once (or a few times).
@@ -620,6 +798,10 @@ Wait for the crowd to leave. \did{To \bellerosename} Can I stay?
% nothing is added to the dramatis person\ae{}. It is used in figure
% \ref{fig:setcharactername_example}.
%
+% This command is also useful to introduce lines of characters in non standard
+% ways, for instance if several characters speak at once. See examples in
+% section \ref{sec:examples:characterslines}.
+%
% \subsubsection{Changing character's name}
% \label{setcharactername}
% \DescribeMacro{\setcharactername}
@@ -679,12 +861,18 @@ Wait for the crowd to leave. \did{To \bellerosename} Can I stay?
% Several styles are available, to typeset character's name and lines in
% different ways. Change the style by loading package using option
% |characterstyle=|\marg{style} (available styles are |bold|, |center|,
-% |margin|, |simple|, |imprimerie-verse|, |imprimerie-prose|).
-% Note that |imprimerie-verse| and |imprimerie-prose| styles are French
+% |margin|, |simple|, |imprimerie-verse|, |imprimerie-prose|). A few notes:
+% \begin{itemize}
+% \item Default style is |simple|.
+% \item |imprimerie-verse| and |imprimerie-prose| styles are French
% \emph{de facto} standards for typesetting drama plays, respectively in verse
% and in prose, as defined by the \emph{Imprimerie nationale}
-% \cite{imprimerienationale}, and |arden| tries to mimick typesetting of the
-% Arden Shakespeare series. Default style is |simple|.
+% \cite{imprimerienationale}.
+% \item |arden| tries to mimick typesetting of the Arden Shakespeare series.
+% \item |bold| needs a sans serif font to be defined (it should be done by
+% default with latin alphabets, but must be done by hand with languages using
+% non latin characters (greek, hindi, etc.)).
+% \end{itemize}
%
% \paragraph{Customize style}
% \DescribeMacro{\speakswithoutdirection}
@@ -726,7 +914,7 @@ Wait for the crowd to leave. \did{To \bellerosename} Can I stay?
%
% \DescribeMacro{\pause}
% As we often need to mark pauses in theater, we created the command |\pause|,
-% which is a shortcut for |\did{\pausename}|.
+% which is a shortcut for |\did{\GetTranslation{Pause}}|.
%
% \subsection{Splitting verses}
% \DescribeMacro{\pauseverse}
@@ -788,159 +976,213 @@ So is Lysander.\pauseverse
% in \LaTeX, so, defining these commands by default might conflict with other
% packages, while most of |thalie| users will not use them.
%
+% \section{Localization and Internationalization}
+% \label{sec:i18n}
+%
+% \subsection{Localization}
+% \label{sec:l10n}
+%
+% \changes{v0.9a}{2017/04/22}{Use package |translations| for localization.}
+%
+% Language cannot be defined directly in this package. Instead, the language
+% currently used by |babel| or |polyglossia| is used to translate the following
+% words (with or without capital letter, singular or plural): \emph{play},
+% \emph{act}, \emph{scene}, \emph{interlude}, \emph{pause}, \emph{curtain}.
+%
+% If the option for your language does not exist\footnote{You can also send me
+% the translation for your language, to improve this package.}, or if you want
+% to change the default words used here, you can set your own translation
+% using command |\DeclareTranslation| (see the |translations| package for more
+% information). For instance use
+% |\DeclareTranslation{Spanish}{Curtain}{Tel\`on}| for Spanish\footnote{I may
+% be wrong: I cannot speak Spanish.}.
+%
+% \subsubsection{Common translations}
+% \DescribeMacro{\playname}
+% \DescribeMacro{\actname}
+% \DescribeMacro{\scenename}
+% \DescribeMacro{\interludename}
+% \DescribeMacro{\pausename}
+% \DescribeMacro{\curtainname}
+%
+% Commands defined here are shorter versions of strings commonly translated.
+%
+% For instance, |\playname| is a shortcut for |\GetTranslation{Play}|,
+% |\actname| is a shortcut for |\GetTranslation{Act}|, and so on.
+%
+% \subsection{Non-latin alphabets}
+%
+% This package should work with languages using non-latin alphabets (greek,
+% hindi, etc.). However, here are a few remarks.
+%
+% \begin{itemize}
+% \item The |bold| character style (see section \ref{sec:lines}) can only be used if a sans serif font has been defined. For instance, for hindi, you might write in the preamble: |\newfontfamily\hindifontsf{Noto Sans Devanagari}|
+% \end{itemize}
+%
+% \subsection{Language specific comments}
+%
+% \subsubsection{English}
+%
+% \begin{itemize}
+% \item The |arden| character style tries to mimick the typestting of the Arden Shakespeare series.
+% \end{itemize}
+%
+% \subsubsection{French}
+%
+% \begin{itemize}
+% \item The |imprimerie-verse| and |imprimerie-prose| character styles implements the French \emph{de facto} standards for typesetting drama plays, respectively in verse and in prose, as defined by the \emph{Imprimerie nationale} \cite{imprimerienationale}.
+% \item The same book (\cite{imprimerienationale}) states that act numbers should be typeset in capital roman numerals (which is done by default with |thalie|), and that scene numbers should be typeset in small capital roman numerals, which is \emph{not} the default, but can be achieved by adding the following line in the preamble: |\renewcommand{\thescene}{\textsc{\roman{scene}}}|
+% \end{itemize}
+%
+% \subsubsection{Other languages}
+%
+% I do not know anything related to other languages. If you have interesting advice for those languages that you would like to share (preferably with a reference to a reliable source), I would be happy to add them to this list!
+%
+% \section{Examples}
+% \label{sec:examples}
+% \changes{v0.9a}{2017/04/22}{Add section \emph{Examples}.}
+%
+% \subsection{Characters' lines}
+% \label{sec:examples:characterslines}
+%
+% \subsubsection{Introduce lines of several characters at the same time.}
+%
+% Since |\disposablecharacter| can display arbitrary text using the style of
+% character names, it can be used to render a custom text when two characters
+% are speaking together.
+%
+% \iffalse
+%<*example>
+% \fi
+% \begin{LTXexample}[pos=b, preset={
+\begin{dramatis}[hidden]
+ \character[cmd=alice]{Alice}
+ \character[cmd=bob]{Bob}
+ \character[cmd=eve]{Eve}
+\end{dramatis}
+}]
+\alice
+Let's open it.
+
+\disposablecharacter{\bobname and \evename}
+No!
+% \end{LTXexample}
+% \iffalse
+%</example>
+% \fi
+%
+% \subsubsection{Add a footnote on a character name}
+%
+% Adding a footnote on the character name introducing its line cannot be done on the character command defined by the dramatis person\ae. Instead, the |\disposablecharacter| command can be used instead.
+% \iffalse
+%<*example>
+% \fi
+% \begin{lstlisting}
+\disposablecharacter{\alicename\footnote{An interesting note.}}
+Hello, world!
+\end{lstlisting}
+% \iffalse
+%</example>
+% \fi
+%
+% \subsubsection{Add a footnote in a stage direction}
+%
+% Footnote must be protected to be included in stage directions.
+% \iffalse
+%<*example>
+% \fi
+% \begin{lstlisting}
+\cyrano[clapping his hands\protect\footnote{An interesting footnote.}]
+One!
+\end{lstlisting}
+% \iffalse
+%</example>
+% \fi
+%
+% \subsection{Headers and footers}
+% \label{sec:examples:headers}
+%
+% By default, with the |article| class, the header of the left page contains
+% the play name, and the header of the right page contains the act number.
+%
+% \subsubsection{Act number on left, scene number on right}
+%
+% \iffalse
+%<*example>
+% \fi
+% \begin{lstlisting}
+\renewcommand{\actmark}[1]{%
+ {\markboth{\MakeUppercase{\GetTranslation{Act}}\ \theact\ #1}{}}%
+}
+\renewcommand{\scenemark}[1]{%
+ {\markright{\MakeUppercase{\GetTranslation{Scene}}\ \thescene\ #1}}%
+}
+\end{lstlisting}
+% \iffalse
+%</example>
+% \fi
+%
+% \subsubsection{Play name of left, act and scene name on right}
+%
+% \iffalse
+%<*example>
+% \fi
+% \begin{lstlisting}
+\usepackage{fancyhdr}
+\pagestyle{fancy}
+\fancyhf{}
+\fancyhead[RO]{%
+ \textit{\MakeUppercase{%
+ \GetTranslation{Act} \theact{}, %
+ \GetTranslation{Scene} \thescene%
+ }}%
+}
+\fancyhead[LE]{\leftmark}
+\end{lstlisting}
+% \iffalse
+%</example>
+% \fi
+%
% \section{Implementation}
% \label{sec:implementation}
%
% \subsection{Required packages}
% Loading some packages.
% \begin{macrocode}
-\RequirePackage{ifthen}
% Chapters, sections, etc
\RequirePackage{etoolbox}
\RequirePackage{suffix}
-% Dramatis person\ae{} is written using a table. Package "longtable" is used to be
-% able to write it on several pages.
-\RequirePackage{longtable}
+% Dramatis person\ae{} is written using a table.
+\RequirePackage{tabularx}
% Handling spaces after having introduced characters' lines.
\RequirePackage{xspace}
% \end{macrocode}
%
-% \subsection{Package options}
-% Manage package options.
+% \subsection{Localization}
+%
+% Use |translations|. Translations are defined in the |dicts/thalie-<LANGUAGE>.trsl| files.
% \begin{macrocode}
-\RequirePackage{pgfopts}
-
-\pgfkeys{
- % Character style
- /THALIE/.cd,
- characterstyle/.value required,
- characterstyle/.default=simple,
- characterstyle/.is choice,
- characterstyle/bold/.code=\def\@characterstyle{bold},
- characterstyle/center/.code=\def\@characterstyle{center},
- characterstyle/margin/.code=\def\@characterstyle{margin},
- characterstyle/simple/.code=\def\@characterstyle{simple},
- characterstyle/arden/.code=\def\@characterstyle{arden},
- characterstyle/imprimerie-verse/.code=\def\@characterstyle{imprimerie-verse},
- characterstyle/imprimerie-prose/.code=\def\@characterstyle{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}
+\RequirePackage{translations}
+\LoadDictionary{thalie}
+\LoadDictionaryFor{fallback}{thalie}
% \end{macrocode}
%
-% \subsection{Localization}
+% \subsection{Obsolete localization commands}
+%
% \begin{macro}{\playname}
% \begin{macro}{\actname}
% \begin{macro}{\scenename}
% \begin{macro}{\interludename}
% \begin{macro}{\curtainname}
% \begin{macro}{\pausename}
-% Definition of the commands used for localization. The \emph{only} way to
-% choose the language to use is by loading the |babel| package before loading
-% this one.
+% Shorter versions of commonly translated strings.
% \begin{macrocode}
-\newcommand{\playname}{Play}
-\newcommand{\actname}{Act}
-\newcommand{\scenename}{Scene}
-\newcommand{\interludename}{Interlude}
-\newcommand{\curtainname}{Curtain}
-\newcommand{\pausename}{Pause}
-\@ifpackageloaded{babel}{
- \addto\captionsfrench{%
- \renewcommand{\playname}{Pi\`ece}
- \renewcommand{\actname}{Acte}
- \renewcommand{\scenename}{Sc\`ene}
- \renewcommand{\interludename}{Interm\`ede}
- \renewcommand{\curtainname}{Rideau}
- \renewcommand{\pausename}{Pause}
- }
- \addto\captionsenglish{%
- % Useless: these are the default...
- }
-}{}
+\newcommand{\playname}{\GetTranslation{Play}}
+\newcommand{\actname}{\GetTranslation{Act}}
+\newcommand{\scenename}{\GetTranslation{Scene}}
+\newcommand{\interludename}{\GetTranslation{Interlude}}
+\newcommand{\curtainname}{\GetTranslation{Curtain}}
+\newcommand{\pausename}{\GetTranslation{Pause}}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -961,7 +1203,10 @@ So is Lysander.\pauseverse
\markboth{\MakeUppercase{#1}}{}%
}
\newcommand{\actmark}[1]{%
- \markright{\MakeUppercase{#1}}%
+ \markright{\MakeUppercase{%
+ \GetTranslation{Act}\ \theact%
+ \ifdefempty{#1}{}{: #1}%
+ }}%
}
\newcommand{\scenemark}[1]{%
}
@@ -997,20 +1242,20 @@ So is Lysander.\pauseverse
% - Style
% - Label (none = not in toc)
% - Title
- \ifthenelse{\equal{#1}{center}}{
+ \ifdefstring{#1}{center}{
\begin{center}
\textsc{#2}
#3
\end{center}
- }{\ifthenelse{\equal{#1}{bigcenter}}{
+ }{\ifdefstring{#1}{bigcenter}{
\begin{center}
\Large
\textsc{#2}
#3
\end{center}
- }{\ifthenelse{\equal{#1}{box}}{
+ }{\ifdefstring{#1}{box}{
\begin{center}
\framebox{\begin{minipage}{0.7\textwidth}
\begin{center}
@@ -1018,7 +1263,7 @@ So is Lysander.\pauseverse
\vspace{0.5em}
#2
- \ifthenelse{\equal{#3}{} \OR \equal{#2}{}}{}{---}
+ \ifboolexpr{test{\ifstrempty{#3}} or test{\ifstrempty{#2}}}{}{---}
#3
\vspace{0.5em}
@@ -1036,7 +1281,7 @@ So is Lysander.\pauseverse
% \begin{macrocode}
\newcommand\@clearpage[1]{%
% Clear page if necessary
- \ifthenelse{\equal{#1}{part} \OR \equal{#1}{chapter}}{
+ \ifboolexpr{test{\ifdefstring{#1}{part}} or test{\ifdefstring{#1}{chapter}}}{
\cleardoublepage
\thispagestyle{empty}
}{}
@@ -1052,7 +1297,7 @@ So is Lysander.\pauseverse
% \begin{macrocode}
\newcommand{\play}[2][]{%
\refstepcounter{play}
- \ifthenelse{\equal{#1}{}}{
+ \ifstrempty{#1}{
\def\@short{#2}
}{
\def\@short{#1}
@@ -1060,7 +1305,7 @@ So is Lysander.\pauseverse
\@clearpage{\@playlevel}
\playmark{\@short}
\addcontentsline{toc}{\@playlevel}{\@short}
- \ifthenelse{\equal{\@playstyle}{custom}}{
+ \ifdefstring{\@playstyle}{custom}{
\customplay{\theplay}{#2}
}{
\@displaytitle{\@playstyle}{}{#2}
@@ -1068,7 +1313,7 @@ So is Lysander.\pauseverse
}
\WithSuffix\newcommand\play*[1]{%
\@clearpage{\@playlevel}
- \ifthenelse{\equal{\@playstyle}{custom}}{
+ \ifdefstring{\@playstyle}{custom}{
\customplay*{#1}
}{
\@displaytitle{\@playstyle}{}{#1}
@@ -1084,28 +1329,28 @@ So is Lysander.\pauseverse
% \begin{macrocode}
\newcommand{\act}[2][]{%
\refstepcounter{act}
- \ifthenelse{\equal{#1}{}}{
+ \ifstrempty{#1}{
\def\@short{#2}
}{
\def\@short{#1}
}
- \ifthenelse{\equal{\@short}{}}{
- \def\@label{\actname{} \theact{}}
+ \ifdefempty{\@short}{
+ \def\@label{\GetTranslation{Act} \theact{}}
}{
- \def\@label{\actname{} \theact{}\xspace: }
+ \def\@label{\GetTranslation{Act} \theact{}\xspace: }
}
\@clearpage{\@actlevel}
- \actmark{\@label\@short}
+ \actmark{\@short}
\addcontentsline{toc}{\@actlevel}{\@label\@short}
- \ifthenelse{\equal{\@actstyle}{custom}}{
+ \ifdefstring{\@actstyle}{custom}{
\customact{\theact}{#2}
}{
- \@displaytitle{\@actstyle}{\actname{} \theact}{#2}
+ \@displaytitle{\@actstyle}{\GetTranslation{Act} \theact}{#2}
}
}
\WithSuffix\newcommand\act*[1]{%
\@clearpage{\@actlevel}
- \ifthenelse{\equal{\@actstyle}{custom}}{
+ \ifdefstring{\@actstyle}{custom}{
\customact*{#1}
}{
\@displaytitle{\@actstyle}{}{#1}
@@ -1121,28 +1366,28 @@ So is Lysander.\pauseverse
% \begin{macrocode}
\newcommand{\scene}[2][]{%
\refstepcounter{scene}
- \ifthenelse{\equal{#1}{}}{
+ \ifstrempty{#1}{
\def\@short{#2}
}{
\def\@short{#1}
}
- \ifthenelse{\equal{\@short}{}}{
- \def\@label{\scenename{} \thescene{}}
+ \ifdefempty{\@short}{
+ \def\@label{\GetTranslation{Scene} \thescene{}}
}{
- \def\@label{\scenename{} \thescene{}\xspace: }
+ \def\@label{\GetTranslation{Scene} \thescene{}\xspace: }
}
\@clearpage{\@scenelevel}
- \scenemark{\@label\@short}
+ \scenemark{\@short}
\addcontentsline{toc}{\@scenelevel}{\@label\@short}
- \ifthenelse{\equal{\@scenestyle}{custom}}{
+ \ifdefstring{\@scenestyle}{custom}{
\customscene{\thescene}{#2}
}{
- \@displaytitle{\@scenestyle}{\scenename{} \thescene}{#2}
+ \@displaytitle{\@scenestyle}{\GetTranslation{Scene} \thescene}{#2}
}
}
\WithSuffix\newcommand\scene*[1]{%
\@clearpage{\@scenelevel}
- \ifthenelse{\equal{\@scenestyle}{custom}}{
+ \ifdefstring{\@scenestyle}{custom}{
\customscene*{#1}
}{
\@displaytitle{\@scenestyle}{}{#1}
@@ -1157,43 +1402,43 @@ So is Lysander.\pauseverse
% Define commands to introduce interludes.
% \begin{macrocode}
\newcommand{\interlude}[2][]{%
- \ifthenelse{\equal{#1}{}}{
+ \ifstrempty{#1}{
\def\@short{#2}
}{
\def\@short{#1}
}
- \ifthenelse{\equal{\@short}{}}{
- \def\@label{\interludename{}}
+ \ifdefempty{\@short}{
+ \def\@label{\GetTranslation{Interlude}}
}{
- \def\@label{\interludename{}\xspace: }
+ \def\@label{\GetTranslation{Interlude}\xspace: }
}
- \ifthenelse{\equal{\@interludelevel}{play}}{
+ \ifdefstring{\@interludelevel}{play}{
\@clearpage{\@playlevel}
- \playmark{\@label\@short}
+ \playmark{\@short}
\addcontentsline{toc}{\@playlevel}{\@label\@short}
- \@displaytitle{\@playstyle}{\interludename}{#2}
- }{\ifthenelse{\equal{\@interludelevel}{act}}{
+ \@displaytitle{\@playstyle}{\GetTranslation{Interlude}}{#2}
+ }{\ifdefstring{\@interludelevel}{act}{
\@clearpage{\@actlevel}
- \actmark{\@label\@short}
+ \actmark{\@short}
\addcontentsline{toc}{\@actlevel}{\@label\@short}
- \@displaytitle{\@actstyle}{\interludename}{#2}
+ \@displaytitle{\@actstyle}{\GetTranslation{Interlude}}{#2}
}{% \@interludelevel is scene
\@clearpage{\@scenelevel}
- \scenemark{\@label\@short}
+ \scenemark{\@short}
\addcontentsline{toc}{\@scenelevel}{\@label\@short}
- \@displaytitle{\@scenestyle}{\interludename}{#2}
+ \@displaytitle{\@scenestyle}{\GetTranslation{Interlude}}{#2}
}}
}
\WithSuffix\newcommand\interlude*[1]{%
- \ifthenelse{\equal{\@interludelevel}{play}}{
+ \ifdefstring{\@interludelevel}{play}{
\@clearpage{\@playlevel}
- \@displaytitle{\@playstyle}{\interludename}{#1}
- }{\ifthenelse{\equal{\@interludelevel}{act}}{
+ \@displaytitle{\@playstyle}{\GetTranslation{Interlude}}{#1}
+ }{\ifdefstring{\@interludelevel}{act}{
\@clearpage{\@actlevel}
- \@displaytitle{\@actstyle}{\interludename}{#1}
+ \@displaytitle{\@actstyle}{\GetTranslation{Interlude}}{#1}
}{% \@interludelevel is scene
\@clearpage{\@scenelevel}
- \@displaytitle{\@scenestyle}{\interludename}{#1}
+ \@displaytitle{\@scenestyle}{\GetTranslation{Interlude}}{#1}
}}
}
% \end{macrocode}
@@ -1208,7 +1453,7 @@ So is Lysander.\pauseverse
% Curtain
\newcommand\curtain{
\begin{center}
- \sffamily\LARGE\bfseries \textsc{\curtainname}
+ \Large\textsc{\GetTranslation{Curtain}}
\end{center}
}
% \end{macrocode}
@@ -1233,7 +1478,7 @@ So is Lysander.\pauseverse
% takes two arguments: the character's name, and optionally, a stage direction.
% \begin{macrocode}
\newcommand{\@speaks}[2][]{%
- \ifthenelse{\equal{#1}{}}{%
+ \ifstrempty{#1}{%
\speakswithoutdirection{#2}%
}{%
\speakswithdirection{#2}{#1}%
@@ -1246,79 +1491,88 @@ So is Lysander.\pauseverse
% Definition of styles for introducing characters' lines. These
% commands can be overloaded by user.
% \begin{macrocode}
-\ifthenelse{\equal{\@characterstyle}{bold}}{%
- % Bold style
- \newcommand\speakswithdirection[2]{%
- \noindent%
- {\bfseries\sffamily #1} \emph{(#2)}\xspace:%
- }
- \newcommand\speakswithoutdirection[1]{%
- \noindent%
- {\bfseries\sffamily #1\xspace:}%
- }%
-}{}%
-\ifthenelse{\equal{\@characterstyle}{center}}{%
- % Center style
- \newcommand\speakswithdirection[2]{%
- \begin{center}%
- \textsc{#1},\\\emph{#2}%
- \end{center}%
- }%
- \newcommand\speakswithoutdirection[1]{%
- \begin{center}%
- \textsc{#1}%
- \end{center}%
- }%
-}{}%
-\ifthenelse{\equal{\@characterstyle}{imprimerie-verse}}{%
- % Style for verse plays defined by the French Imprimerie nationale
- \newcommand\speakswithdirection[2]{%
- \begin{center}%
- \textsc{#1}, \emph{#2}%
- \end{center}%
- }%
- \newcommand\speakswithoutdirection[1]{%
- \begin{center}%
- \textsc{#1}%
- \end{center}%
- }%
-}{}%
-\ifthenelse{\equal{\@characterstyle}{imprimerie-prose}}{%
- % Style for prose plays defined by the French Imprimerie nationale
- \newcommand\speakswithdirection[2]{%
- \noindent\hspace*{-\parindent}\textsc{#1}, \emph{#2}\xspace:%
- }%
- \newcommand\speakswithoutdirection[1]{%
- \noindent\hspace*{-\parindent}\textsc{#1}\xspace:%
- }%
-}{}%
-\ifthenelse{\equal{\@characterstyle}{arden}}{%
- \newcommand\speakswithdirection[2]{%
- \noindent\hspace*{-\parindent}\textsc{\MakeLowercase{#1}} [\emph{#2}]\quad%
- }%
- \newcommand\speakswithoutdirection[1]{%
- \noindent\hspace*{-\parindent}\textsc{\MakeLowercase{#1}}\quad%
- }%
-}{}%
-\ifthenelse{\equal{\@characterstyle}{simple}}{%
- % Simple style
- \newcommand\speakswithdirection[2]{%
- \indent\textsc{#1}, \emph{#2}\xspace:%
- }%
- \newcommand\speakswithoutdirection[1]{%
- \indent\textsc{#1}\xspace:%
- }%
-}{}%
-\ifthenelse{\equal{\@characterstyle}{margin}}{%
- % Margin style
- \setlength{\leftskip}{3cm}
- \newcommand\speakswithdirection[2]{%
- \hspace{-3cm} #1 #2
- }
- \newcommand\speakswithoutdirection[1]{%
- \hspace{-3cm} #1
- }%
-}{}%
+\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
+ }%
+ }{}%
+}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -1328,17 +1582,16 @@ So is Lysander.\pauseverse
% In this environment are defined characters.
% \begin{macrocode}
\newcommand{\@dramatis@clear}{}
-\provideboolean{@dramatis@hidden}
+\newcommand{\@empty@}{}
+\providebool{@dramatis@hidden}
\newenvironment{dramatis}[1][]{
\@dramatis@clear{}
\undef{\@dramatis@clear}
- \undef{\@dramatis@hook}
- \newcommand{\@dramatis@hook}{}
- \ifthenelse{\equal{#1}{hidden}}{
- \setboolean{@dramatis@hidden}{true}
- }{\ifthenelse{\equal{#1}{}}{
- \setboolean{@dramatis@hidden}{false}
- \gappto{\@dramatis@hook}{\begin{longtable}{l}}
+ \ifstrequal{#1}{hidden}{
+ \booltrue{@dramatis@hidden}
+ }{\ifstrempty{#1}{
+ \boolfalse{@dramatis@hidden}
+ \dramatisenv
}{
\ClassError{thalie}{%
Environment dramatis does not accept option #1.%
@@ -1347,63 +1600,90 @@ So is Lysander.\pauseverse
}
}
}{%
- \ifthenelse{\boolean{@dramatis@hidden}}{%
- }{%
- \gappto{\@dramatis@hook}{\end{longtable}}
- \@dramatis@hook{}%
- }
+ \notbool{@dramatis@hidden}{%
+ \enddramatisenv
+ }{}%
}
% \end{macrocode}
% \end{environment}
%
-% Generic character output
+% \begin{environment}{dramatisenv}
+% \changes{v0.9a}{2017/04/22}{It is now possible to customize style of dramatis person\ae.}
+% \begin{macro}{\dramatischaracter}
+% \begin{macro}{\dramatischaractername}
+% \begin{macro}{\dramatischaracterdescription}
+% \begin{macro}{\characterspace}
+% \begin{environment}{charactergroup}
+% \changes{v0.6}{2013/11/02}{Groups of characters are now aligned with other caracters.}
+% Customizable commands to build dramatis person\ae.
% \begin{macrocode}
-\newcommand{\@character}[2]{%
- \ifthenelse{\( \equal{#1}{} \) \AND \( \equal{#2}{} \)}{%
- ~%
- }{}%
- \ifthenelse{\( \NOT \equal{#1}{} \) \AND \( \equal{#2}{} \)}{%
- #1%
+% Environment used to *display* dramatis personae.
+\newenvironment{dramatisenv}{%
+ \list{}{\rightmargin1cm\leftmargin2cm}\item[]
+}{%
+ \endlist%
+}
+
+% Display character name
+\newcommand{\dramatischaractername}[1]{\textbf{#1}}
+
+% Display character description
+\newcommand{\dramatischaracterdescription}[1]{#1}
+
+% Adds a vertical space
+\newcommand{\characterspace}{ %
+ \notbool{@dramatis@hidden}{%
+ \smallskip\newline %
+ }{} %
+}
+
+% Display dramatis personae name and description
+\newcommand{\dramatischaracter}[2]{ %
+ \hspace*{-1cm} %
+ \ifboolexpr{(not test {\ifdefempty{#1}}) and test {\ifdefempty{#2}}}{%
+ \dramatischaractername{#1} %
}{}%
- \ifthenelse{\( \equal{#1}{} \) \AND \( \NOT \equal{#2}{} \)}{%
- #2%
+ \ifboolexpr{ test{\ifdefempty{#1}} and not test{\ifdefempty{#2}}}{%
+ \dramatischaracterdescription{#2} %
}{}%
- \ifthenelse{\( \NOT \equal{#1}{} \) \AND \( \NOT \equal{#2}{} \)}{%
- #1, #2%
+ \ifboolexpr{ (not test{\ifdefempty{#1}}) and (not test{\ifdefempty{#2}})}{%
+ \dramatischaractername{#1}, \dramatischaracterdescription{#2} %
}{}%
- \tabularnewline
+ \newline %
}
-% \end{macrocode}
-%
-% \begin{macro}{\characterspace}
-% Add space in the dramatis person\ae{}.
-% \begin{macrocode}
-\newcommand{\characterspace}{%
- \gappto{\@dramatis@hook}{\@character{}{~}}
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{environment}{charactergroup}
-% \changes{v0.6}{2013/11/02}{Groups of characters are now aligned with other caracters.}
-% Gathers definition of characters that share the same description.
-% \begin{macrocode}
-\newenvironment{charactergroup}[1]{%
- \gdef\@groupname{#1}
- \gappto{\@dramatis@hook}{
- \hspace{-7.2pt}\begin{math}\left.
- \begin{tabular}{ll}
- }
+
+% Environment to manage groups of characters
+ \newlength{\@spaceaftergroup}
+\newenvironment{charactergroup}[2][5cm]{%
+ \notbool{@dramatis@hidden}{%
+ \gdef\@groupname{#2} %
+ \gdef\@grouplength{#1} %
+ \hspace*{-1.3pt}\math\left. %
+ \minipage[c]{#1} %
+ \vspace*{2pt} %
+ }{}%
}{%
- \gappto{\@dramatis@hook}{
- \end{tabular}
- \right\} \end{math}
- }
- \protected@xappto{\@dramatis@hook}{\@groupname}
- \gappto{\@dramatis@hook}{\tabularnewline}
+ \notbool{@dramatis@hidden}{%
+ \vspace*{-8pt} %
+ \endminipage %
+ \right\} \endmath %
+ %
+ \setlength{\@spaceaftergroup}{\linewidth}
+ \addtolength\@spaceaftergroup{-\@grouplength}
+ \addtolength\@spaceaftergroup{-20pt}
+ \begin{minipage}[c]{\@spaceaftergroup}
+ \@groupname %
+ \end{minipage}
+ \newline %
+ }{}%
}
% \end{macrocode}
% \end{environment}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{environment}
%
% \subsubsection{Character definitions}
% \begin{macro}{\setcharactername}
@@ -1434,17 +1714,16 @@ So is Lysander.\pauseverse
% one is the name of the character corresponding to this command.
% \begin{macrocode}
\newcommand{\@definecharactercommand}[2]{%
- \@ifundefined{#1}{%
- }{%
+ \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.%
}%
- }%
- \@ifundefined{#1name}{%
}{%
+ }%
+ \ifcsdef{#1name}{%
\ClassError{thalie}{%
A command named \@backslashchar#1name already exists. We cannot define a
new one.%
@@ -1453,6 +1732,7 @@ So is Lysander.\pauseverse
when a new command is defined by adding "name" to it, it does not
conflict with an existing one.
}%
+ }{%
}%
\setcharactername{#1}{#2}%
}
@@ -1466,7 +1746,8 @@ So is Lysander.\pauseverse
% \begin{macrocode}
\pgfkeys{
% Character definition
- /CHARACTER/.is family, /CHARACTER,
+ /THALIE/CHARACTER/.is family,
+ /THALIE/CHARACTER,
cmd/.value required,
cmd/.store in=\@cmd,
drama/.value required,
@@ -1478,36 +1759,34 @@ So is Lysander.\pauseverse
\undef{\@drama}
\undef{\@cmd}
\undef{\@desc}
- \pgfkeys{/CHARACTER, #1}%
+ \pgfkeys{/THALIE/CHARACTER, #1}%
% Forbidden combinations
- \ifthenelse{
- \( \( \NOT \isundefined{\@cmd} \) \AND \equal{#2}{} \) \OR
- \( \equal{#2}{} \AND \isundefined{\@cmd} \AND \isundefined{\@desc} \AND \isundefined{\@drama} \) \OR
- \( \isundefined{\@cmd} \AND \( \NOT \equal{#2}{} \) \AND \( \NOT \isundefined{\@drama} \) \)
+ \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}} )
}{
\ClassError{thalie}{Invalid character definition.}{All combination of omitted arguments are not allowed. See the documentation for more information}
- }{
- % Defining character command
- \ifthenelse{\( \NOT \isundefined{\@cmd} \) \AND \( \NOT \equal{#2}{} \)}{
- \@definecharactercommand{\@cmd}{#2}
- }{
- }
- \ifthenelse{
- \( \NOT \equal{#2}{} \) \AND \( \NOT \isundefined{\@cmd} \) \AND \( \NOT \isundefined{\@drama} \) \AND \isundefined{\@desc}
- }{
- \ifthenelse{\equal{\@drama}{}}{
+ }{}
+ % 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
- \protected@xappto{\@dramatis@hook}{\noexpand\@character{\@drama}{}}
- }
- }{
+ \dramatischaracter{\@drama}{\@empty@}
+ }%
+ }{%
% Populating dramatis personae
- \@ifundefined{@desc}{\def\@desc{}}{}
- \@ifundefined{@drama}{\def\@drama{#2}}{}
- \protected@xappto{\@dramatis@hook}{\noexpand\@character{\@drama}{\@desc}}
- }
- }
+ \ifcsundef{@desc}{\gdef\@desc{}}{}%
+ \ifcsundef{@drama}{\gdef\@drama{#2}}{}%
+ \dramatischaracter{\@drama}{\@desc}
+ }%
+ }{}%
}
% \end{macrocode}
% \end{macro}
@@ -1551,9 +1830,9 @@ So is Lysander.\pauseverse
% \end{environment}
%
% \begin{macro}{\pause}
-% Shortcut for |\did{\pausename}|.
+% Shortcut for |\did{\GetTranslation{Pause}}|.
% \begin{macrocode}
-\newcommand\pause{\did{\pausename}}
+\newcommand\pause{\did{\GetTranslation{Pause}}}
% \end{macrocode}
% \end{macro}
@@ -1589,6 +1868,122 @@ So is Lysander.\pauseverse
% \end{macro}
% \end{macro}
%
+% \subsection{Package options}
+% Manage package options.
+% \begin{macrocode}
+\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}
+% \end{macrocode}
+%
+% \begin{macro}{\setthalieoptions}
+% \changes{v0.9a}{2017/04/22}{Add command \texttt{\bbackslash{}setthalieoptions}.}
+% Redefine package options.
+% \begin{macrocode}
+\newcommand{\setthalieoptions}[1]{%
+ \pgfkeys{/THALIE/.cd, #1}%
+}
+% \end{macrocode}
+% \end{macro}
+%
% \changes{v0.5}{2013/06/08}{First published version.}
%
% \addcontentsline{toc}{section}{Change History}
diff --git a/Master/texmf-dist/source/latex/thalie/thalie.ins b/Master/texmf-dist/source/latex/thalie/thalie.ins
index b803c8e6e70..458be6afbaf 100644
--- a/Master/texmf-dist/source/latex/thalie/thalie.ins
+++ b/Master/texmf-dist/source/latex/thalie/thalie.ins
@@ -1,4 +1,4 @@
-%% Copyright 2015 Louis Paternault
+%% Copyright 2010-2017 Louis Paternault
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
@@ -21,7 +21,7 @@
\usedir{tex/latex/thalie}
\preamble
-Copyright 2010-2015 Louis Paternault
+Copyright 2010-2017 Louis Paternault
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either version 1.3
@@ -47,10 +47,10 @@ and the derived file thalie.sty.
\Msg{* To finish the installation you have to move the *}
\Msg{* following file into a directory searched by TeX: *}
\Msg{* *}
-\Msg{* thalie.sty *}
+\Msg{* thalie.sty *}
\Msg{* *}
\Msg{* To produce the documentation run the file *}
-\Msg{* thalie.dtx through LaTeX. *}
+\Msg{* thalie.dtx through LaTeX. *}
\Msg{* *}
\Msg{* Happy TeXing! *}
\Msg{* *}