Personally, I favour algpseudocode
from the algorithmicx
(note the trailing x
!) package. With a bit of setup, this can be harnessed to create beautiful pseudocode.
This was produced by the following code:
\begin{algorithm}
\caption{Counting mismatches between two packed \DNA{} strings
\label{alg:packed-dna-hamming}}
\begin{algorithmic}[1]
\Require{$x$ and $y$ are packed \DNA{} strings of equal length $n$}
\Statex
\Function{Distance}{$x, y$}
\Let{$z$}{$x \oplus y$} \Comment{$\oplus$: bitwise exclusive-or}
\Let{$\delta$}{$0$}
\For{$i \gets 1 \textrm{ to } n$}
\If{$z_i \neq 0$}
\Let{$\delta$}{$\delta + 1$}
\EndIf
\EndFor
\State \Return{$\delta$}
\EndFunction
\end{algorithmic}
\end{algorithm}
And used the following setup (this is just an example to replicate the above; you can of course use your own setup):
\usepackage{fontspec}
\setmainfont{Hoefler Text}
\newcommand*\DNA{\textsc{dna}}
\newcommand*\Let[2]{\State #1 $\gets$ #2}
\algrenewcommand\alglinenumber[1]{
{\sf\footnotesize\addfontfeatures{Colour=888888,Numbers=Monospaced}#1}}
\algrenewcommand\algorithmicrequire{\textbf{Precondition:}}
\algrenewcommand\algorithmicensure{\textbf{Postcondition:}}
To get the end
-less pseudocodes, I included the package as follows:
\usepackage[noend]{algpseudocode}
The above pseudo code is nested inside an algorithm
float environment. This environment isn’t part of algorithmicx
. Instead, you need to load the package algorithm
to get it. To produce a list of all algorithms, you can use
\listofalgorithms
For further information, see the section “The algorithm
Environment” in the documentation of the algorithms
package. But I want to stress again that (except for the float environment) the algorithmicx
package is superior to algorithms
.
I am not familiar with play-writing, so this is merely a technical note.
The TUGboat article you mention was written in 2004 by the dramatist
package author, while the most recent version of the package is dated 2005. As such, there seems to have been some modifications made to the code causing the example to not compile. For the example to compile properly, \Character
should be used as
\Character[MAXIMILIAN, COUNT VON MOOR.]{OLD MOOR}{moor}
\Character[FRANCIS, his Sons.]{FRANCIS}{fran}
with the first argument being optional rather than mandatory.
The optional argument is retrieved using \persona@<Roman>
where <Roman>
denotes a capitalized Roman numeral, sequentially numbered as they are defined. As such
\makeatletter
\persona@I \par
\persona@II
\makeatletter
prints
MAXIMILIAN, COUNT VON MOOR.
FRANCIS, his Sons.
The above mechanism is implemented to some extent when using \dodramperlist
, which prints the persona list of the play (should be used within the drama
environment).
Best Answer
The
bibleref
package could be an option.