Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm trying to typset a play using the dramatist package. I'm having difficulty figuring out how I change some settings. I want to ensure that the text that the characters say, is justified, rather than their names being justified.

enter image description here

I would like the words Well, Start and I to be left-justified, and the characters names to be right-justified. Here is an example of the tex that I used to make this demo:

\documentclass[a5paper,11pt]{memoir}    
\usepackage{dramatist}  

\begin{document}

\Character[Wilheim - a person]{Wilheim}{will} % define characters
\Character[Frederico - a person]{Frederico}{fred}

\scene[]

\StageDir{
    \begin{center} Darkness
     \end{center}
}

\begin{drama}

\willspeaks Well, will we - I\dots
\fredspeaks  Start.
\willspeaks I will go on.
\willspeaks Vivamus varius tellus et mi pretium elementum iaculis tellus semper. Donec semper iaculis ante, convallis convallis arcu laoreet vitae. Aliquam id leo ac eros ultrices rhoncus porta sed ipsum. 

\end{drama}

\end{document}

I would like my document to look like the following (which I prepared using the verbatim package) and for this to work for sentences that run over multiple lines:

enter image description here

I received some helpful advice from TeX.SE on starting to use the dramatist package here.

share|improve this question
add comment

2 Answers 2

up vote 6 down vote accepted

You need to make some surgery on the internal commands of dramatist; the easiest way is to use etoolbox and enumitem:

\documentclass[a5paper,11pt]{memoir}    
\usepackage{dramatist,etoolbox,enumitem}
\usepackage[latin]{babel}
\pagestyle{empty}
\makeatletter
\renewenvironment{drama}
  {\if@lnpa
   \PackageWarning{dramatist}{\lnpwarning{a}}
   \fi
   \if@lnps
   \PackageWarning{dramatist}{\lnpwarning{s}}
   \fi
   \begin{itemize}[labelwidth=\speakswidth,leftmargin=!]} 
  {\end{itemize}}
\patchcmd{\speaker}{\item[#1\speaksdel]}{\item[\speaksfont#1]}{}{}
\patchcmd{\@character}{\item[#1\speaksdel]}{\item[\speaksfont#1]}{}{}
\makeatother
\begin{document}

\Character[Wilheim - a person]{Wilheim}{will} % define characters
\Character[Frederico - a person]{Frederico}{fred}
\settowidth{\speakswidth}{\speaksfont{Frederico}\speaksdel\hspace{\speechskip}}


\scene[]

\StageDir{
    \begin{center} Darkness
     \end{center}
}

\begin{drama}

\willspeaks Vivamus varius tellus et mi pretium elementum iaculis tellus semper. Donec semper iaculis ante, 
convallis convallis arcu laoreet vitae. Aliquam id leo ac eros ultrices rhoncus porta sed ipsum.

\fredspeaks Vivamus varius tellus et mi pretium elementum iaculis tellus semper. Donec semper iaculis ante, 
convallis convallis arcu laoreet vitae. Aliquam id leo ac eros ultrices rhoncus porta sed ipsum.
\willspeaks Vivamus varius tellus et mi pretium elementum iaculis tellus semper. Donec semper iaculis ante, 
convallis convallis arcu laoreet vitae. Aliquam id leo ac eros ultrices rhoncus porta sed ipsum.

\end{drama}

\end{document}

The setting of \speakswidth is best done after all characters are introduced, so that one can choose the widest one. enter image description here

share|improve this answer
    
perfect! Thank you. I chose to edit the line \begin{itemize}[labelwidth=25pt,leftmargin=20pt]} and manually inserted the values which I found easier. –  celenius Dec 26 '11 at 19:09
    
I have a problem with this answer. It causes the stage directions in the drama environment to be centered with the dialogue (right column) and not the page. Is there a way to modify this answer to make the stage directions center on the page? –  Darling Feb 21 '12 at 0:02
    
@Darling Do you mean "Darkness"? Its position is independent of the patch. –  egreg Feb 21 '12 at 0:20
    
@egreg I mean if you use \StageDir{\begin{center}Some text.\end{center}} within a drama environment it is no longer centreed on the page. I have some stage directions in a drama environment and some outside and it is looking messy. –  Darling Feb 21 '12 at 12:50
    
@Darling It would be better to make a follow-up question –  egreg Feb 21 '12 at 13:01
show 1 more comment

EDIT: I missed the detail about right-justification. But aside from that


\speakswidth and \speaksindent are the critical parts here (section 2.2 of the dramatist documentation).

Easy version, adding an arbitrary amount of space that allows the speaker labels to fit:

\setlength{\speakswidth}{1in}
\setlength{\speaksindent}{0.5in}

More complicated version which uses the calc package to automatically calculate the required space, and keeps the other margins and lengths consistent. Use the longest character name in your script on \setlength line below:

\setlength{\speakswidth}{\widthof{\speaksfont Frederico}}
\addtolength{\speakswidth}{\Dlabelsep}
\addtolength{\speaksindent}{\speakswidth}

Full version:

\documentclass[a5paper,11pt]{memoir}    
\usepackage{dramatist}  
\usepackage{calc}
\begin{document}
\Character[Wilheim - a person]{Wilheim}{will}
\Character[Frederico - a person]{Frederico}{fred}
\setlength{\speakswidth}{\widthof{\speaksfont Frederico}}
\addtolength{\speakswidth}{\Dlabelsep}
\addtolength{\speaksindent}{\speakswidth}
\scene[]
\StageDir{
    \begin{center} Darkness
     \end{center}
}
\begin{drama}
\willspeaks Well, will we - I\dots
\fredspeaks  Start.
\willspeaks I will go on.
\end{drama}
\end{document}

enter image description here

share|improve this answer
    
Thanks @Mike. Do you know how I would deal with a sentence that runs over multiple lines? For example \willspeaks Vivamus varius tellus et mi pretium elementum iaculis tellus semper. Donec semper iaculis ante, convallis convallis arcu laoreet vitae. Aliquam id leo ac eros ultrices rhoncus porta sed ipsum. does not follow the same margin. –  celenius Dec 26 '11 at 15:53
    
Sorry! My mistake... it works fine when I choose appropriate values. –  celenius Dec 26 '11 at 15:57
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.