7

I'm writing and typesetting a novel using XeLaTeX and the memoir package. I'm just starting out with TeX and still trying to understand the best practices for things.

Specifically right now, I'm wondering how I should write dialogue that has multiple indented lines immediately following each other. Example from a book (I hope this falls under fair use):

Book Example

Should I use paragraphs? For example:

\documentclass[statementpaper]{memoir} % 8.5 x 5.5in
\begin{document}
\chapter{test}
Some flow text before the whole dialogue.

``You need a fast-burning....."

``Just as well;......"

``That did occur to me as well."\\*
Some text after the dialogue that's not indented because of the double-slash-star in the line above and the lack of an empty line.
\end{document}

This works, but I'm wondering if it works because I'm doing it right or because by coincidence the current styling of the class doesn't break my layout. Since it is a novel, paragraphs don't have extra spacing between lines, they are simply indented - so yeah, this seems to work, but I don't want to pick up bad habits in case there is a proper way to do this.

Resulting PDF

(PS: I've seen Q#3520, but this seems rather different - the formatting is very unlike what I'm trying to replicate, and I'm using the memoir package which supposedly has a whole lot of things pre-setup)

  • 2
    It's probably better to just have breaks as empty lines (making each a paragraph) and then use \noindent before a paragraph if you don't want it indented. – Werner Jun 3 '14 at 4:56
  • 1
    The example you have is simply using paragraphs. – Paul Stanley Jun 3 '14 at 6:44
  • 2
    You should avoid \\ , it's a last resort for last touches on the final revision. Same for \noindent. Look at the last paragraph of your snapshot: the text following a line of dialogue is indented, as every new paragraph. If you need special spacing or you think you may change your mind about the layout it's best to create a dialog environment that you can redefine later... – Bordaigorl Jun 3 '14 at 7:07
6

First, it seems you are not yet sure about how you want to style your dialogues and may change your mind afterwards. In these situations it is always a good idea to use the "markup" capabilities of LaTeX to mark the portions of your text with "semantic" commands so that you have control on what is what. This means you can create a custom environment dialogue to mark the beginning and end of a dialogue and use a command like \item inside to mark each "change of speaking character". The result would be a little bit more verbose but also self-explanatory and, most importantly will

  1. Avoid explicit hard-coded layout commands (error-prone: what if you forget a \\*?)
  2. Allow you to change the appearance of all dialogues by just changing the definition of your environment

Second, to alter the spacing, in a uniform way, LaTeX offers you the \parskip, \parindent and many other lengths that you can modify to get the effect. You can always limit the modifications to a piece of code by wrapping it in a group. Since environments wrap their contents in groups already you are all set.

Here's an example:

\documentclass[statementpaper]{memoir} % 8.5 x 5.5in

\newenvironment{dialogue}{\let\item\par}{\par\aftergroup\noindent\aftergroup\ignorespaces}

\begin{document}
\chapter{test}
Some flow text before the whole dialogue.
\begin{dialogue}
\item ``You need a fast-burning....."
\item ``Just as well;......"
\item ``That did occur to me as well."
\end{dialogue}
Some text after the dialogue that's not indented because of the double-slash-star in the line above and the lack of an empty line.
\end{document}

This definition of dialogue is not doing much and is not very general; the important bit is how the main text changes. Now you can change the definition of dialogue to obtain all sort of trickery: change spacing before and after, in between, linespread wathever.

A good idea is to define it using LaTeX's list see here for a nice discussion. A simple example:

\newenvironment{dialogue}{\list{}{\itemsep=\parskip \topsep=\parskip \parsep=\parskip}}{\endlist}

now want a dash before each item?

\newenvironment{dialogue}{\list{-}{\itemsep=\parskip \topsep=\parskip \parsep=\parskip}}{\endlist}

some more space between items?

\newenvironment{dialogue}{\list{}{\itemsep=\parskip \topsep=\parskip \parsep=2ex}}{\endlist}

want them all italics?

\newenvironment{dialogue}{\list{}{\itemsep=\parskip \topsep=\parskip \parsep=\parskip \itshape}}{\endlist}

The possibilities are endless!

  • Is there a way to omit the \item command and use the new line as an implicit \item? – Willem Van Onsem Dec 28 '14 at 17:59
  • 1
    it's more difficult with just newlines but you can use empty lines: they get interpreted as calls to \par so by redefining \par in the def of dialogue you can have something similar to what you are asking. One important thing to note: while \item goes before the content, \par typically follows it which means it cannot further parse/process it as \item can – Bordaigorl Dec 29 '14 at 0:51
1

Here's an extension of the answer provided by @Bordaigorl that I adapted for my own needs. I adapted the code so that when the dialogue moves onto a new line in the page that it starts at the beginning of the margin and isn't spaced to directly below the \item. This also allows for other lines without \item to be used inside the dialogue function:

\newenvironment{dialogue}{\list{}{\itemsep=\parskip \topsep=\parskip \parsep=\parskip \leftmargin=0em \itemindent=3em}}{\endlist}

Here's an example of it in use:

\begin{dialogue}

\item `Here is a line of dialogue that may move onto the next line of text (depending on your page settings). In this instance the new line should be aligned with the edge of the margin.`

This text should also be aligned with the beginning of the margin as it is not preceded by backslash item. This may come in useful if you wish to put all text inside this function.

\end{dialogue}

The same can be achieved while retaining indents for the beginning of a new paragraph as follows:

\newenvironment{dialogue}{\list{}{\itemsep=\parskip \topsep=\parskip \parsep=\parskip \leftmargin=0em \itemindent=3em}\parindent1.5em}{\endlist}

If you wish the new line that is not dialogue to avoid the paragraphs indentation add \\ as shown below:

\begin{dialogue}

    \item `Here is my dialogue` \\
but I want this line at the beginning of the margin ignoring the paragraph indentation.

\end{dialogue}
  • 1
    Is the dialogue environment a XeTeX thing, related to item? I see no reason why dialogue should not be treated the same as any other paragraph, with usual indent. Be sure that there is no added inter-paragraph skip. But then I only use LuaLaTeX. And, shameless plug for a new document class, specific to writing novels. Its package name is "novel" of course. – user103221 Mar 7 '17 at 20:58
  • @RobtA I'll check out that new class. Cheers for the heads up. – Docconcoct Mar 7 '17 at 21:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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