This repository showcases the use of Typst for formatting screenplays using a custom template drama.typ
. The primary purpose is to demonstrate how to format classic dramas, like Emilia Galotti by Gotthold Ephraim Lessing, in a well-structured way. The first act of Emilia Galotti is provided here as an example of how to use the drama.typ
template.
- drama.typ: A Typst template that provides functions and structures for formatting a drama, including acts, scenes, character lines, stage directions, and character lists.
- main.typ: The first act of Emilia Galotti formatted with
drama.typ
.
act(title, body)
: Formats each act with the title centered and includes the body of the act.scene(title, body)
: Formats each scene, centering the title and adding the scene body.scene-description(body)
: Formats the scene description in an inset block, used for stage directions at the beginning of a scene.regie(body)
andinline-regie(body)
: Italicizes stage directions, whereregie
is for full paragraphs andinline-regie
is for inline directions within dialogue.setupDrama(title, characters, numbering, paper)
: Initializes the drama document with a title, character list, and custom page settings.
-
Define Characters: Each character is defined with a full name and, optionally, a shortened name. For example:
let emilia = (full: "Emilia Galotti", short: "Emilia")
-
Initialize the Drama: The setupDrama function is used to set up the play’s metadata, such as title and character list. It returns dictionaries that maps the characters to functions. Example:
let (character-table, character-speaks, character-dict, character-print-dict, template) = setupDrama( title: "Emilia Galotti", paper: "a5", characters: ( (description: "", characters: (emilia)), (description: "Eltern der Emilia", characters: (odoardo, claudia)), ) )
the
character-table()
function produces a nicely formatted Table of all Characters in the drama.You can then use the template
#show template
-
Creating Acts and Scenes: Use
act
andscene
to define the structure. For example:#act("Erster Aufzug")[ #scene("Erster Auftritt")[ #scene-description[ //scene-characters is a custom function #scene-characters((prinz, kammerdiener)) #regie[Ein Kabinett des Prinzen.] ] #prinzsays(instructio: "(an einem Arbeitstische voller Briefschaften und Papiere, deren einige er durchläuft)")[ Klagen, nichts als Klagen! Bittschriften, nichts als Bittschriften! --- Die traurigen Geschäfte; und man beneidet uns noch! --- Das glaub ich; wenn wir allen helfen könnten: dann wären wir zu beneiden. --- Emilia? #inline-regie[Indem er noch eine von den Bittschriften aufschlägt und nach dem unterschriebenen Namen sieht.] Eine Emilia? --- //truncated ] #kammerdienersays[Nein.] ] ]
-
Retrieve character speech functions
Use the dictionary to retrieve the character speech functions like so:
#let prinzsays = character-speaks.der-prinz
Also if you want to print the character names you can use the character-print-dict
#let camillo = character-print-dict.camillo #regie[#camillo is going away]
The
character-dict
is simply to retrieve all character names as string.
For more information feel free to look at the example