4

I am writing a novel using TeX. I need to indent lines of dialogue by 0.25in from the left margin and by 1in from the right margin. I have thought of using a minipage to accomplish this as the dialogue would need to extend over a number of lines of text. The alternative is to use the command \quotation. However, I need to use this command frequently and, I am looking for an easy way to accomplish this. Could the minipage command be placed inside a global command? Or \quotation for that matter?

It would be nice to be able to write something like \d in the code instead of having to write out a lengthy command structure each time I need to include dialogue.

I would appreciate any help/advice! Mike

5
  • 1
    Welcome! Did you start from CTAN? For example, verse
    – percusse
    Jul 5 '14 at 19:00
  • 1
    you want an environment defined via the list environment not minipage, so quote or quotation or verse or one of the custom environments from ctan hard tp say without a more specific example of what you need. Jul 5 '14 at 19:11
  • 1
    A minipage will not break across pages.
    – Bernard
    Jul 5 '14 at 19:18
  • Yes, and it is a good idea to do this for maintainability; e.g., \newcommand{\mike}[1]{\begin{quote}#1\end{quote}}, then \mike{<text goes here>}. (Obviously needs customization, but the principle is there.)
    – jon
    Jul 5 '14 at 19:33
  • Thanks for the advice - I'll give it a try later tonight. Hope to come back later with some good news!
    – Mike
    Jul 5 '14 at 20:36
1

I propose another solution, that uses the enumitem package. More precisely two variants, not knowing if you dialogs begin with a dash or simply use quotes. I'm against commands in such cases because the argument of such a command can be rather lengthy, and it's so easy to forget a closing brace. Instead I propose shortcuts for entering and leaving the environment. Note that the different "parts" of a dialog are introduced by \item (or an alias).

Here is a ‘real’ example (from Edward Lear):

\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage{ebgaramond}
\usepackage{enumitem}
\newlist{dialogdash}{description}{1}
\setlist[dialogdash]{labelindent = 0.25in, leftmargin = \labelindent, labelsep = 0.2em, rightmargin = 1in, nosep,topsep = 0.5ex, itemsep = 0.5ex, align = left}
\newenvironment{dlgdash}{\begin{dialogdash}\item[---]}{\end{dialogdash}}

\newlist{dialognodash}{itemize}{1}
\setlist[dialognodash]{label = ,labelindent = 0.25in, leftmargin = \labelindent, rightmargin = 1in, nosep, topsep = 0.5ex, itemsep = 0.5ex, align = left}
\newenvironment{dlgnodash}{\begin{dialognodash}\item }{\end{dialognodash}}

\def\bdlg{\begin{dlgnodash}}
\def\edlg{\end{dlgnodash}}

\parindent=0pt

\begin{document}

The Four Children then entered into conversation with the Blue Bottle-Flies, who discoursed in a placid and genteel manner, though with a slightly buzzing accent, chiefly owing to the fact that they each held a small clothes-brush between their teeth which naturally occasioned a fizzy extraneous utterance.

\begin{dlgdash}
Why, said Violet, would you kindly inform us, do you reside in bottles? and if in bottles at all, why not rather in green or purple, or indeed in yellow bottles?
\end{dlgdash}

 To which questions a very aged Blue-Bottle-Fly answered, 

  \bdlg
‘We found the bottles here all ready to live in, that is to say, our great-great-great-great-great-grandfathers did, so we occupied them at once. And when the winter comes on, we turn the bottles upside down, and consequently rarely feel the cold at all, and you know very well that this could not be the case with bottles of any other colour than blue.’

\item ‘Of course it could not;’ said Slingsby, ‘but if we may take the liberty of inquiring, on what do you chiefly subsist?’

\item ‘Mainly on Oyster-patties,’ said the Blue-Bottle-Fly, ‘and, when these are scarce, on Raspberry vinegar and Russian leather boiled down to a jelly.’

\item ‘How delicious!’ said Guy.
\edlg

\end{document} 

enter image description here

4
  • Bernard's suggestion (thanks): %KOMA-script class: book \begin{dialogue} This is a try at dialogue. New line dialogue - empty line above %Indented \end{dialogue} Is it possible to remove the indent of lines following the first line e.g. tex seems to be treating the second line as a continuation of a paragraph? The aim is to line up the dialogue text so that every line starts at the defined left margin. Any suggestions much appreciated. Mike
    – Mike
    Jul 6 '14 at 11:21
  • @Mike: I'm not sure I understand what you mean. For instance, after the line that begins with ‘We found the bottles…, next line that begins with great-great-great… (and the following) should be aligned with the main text?
    – Bernard
    Jul 6 '14 at 11:34
  • Seems I've solved it myself: silly me - forgot about \usepackage{parskip}! Sorry to waste your time. Mike
    – Mike
    Jul 6 '14 at 11:34
  • @ Mike, You're welcome — but I still am unsure of what you mean. On the image I give, all lines of the dialog begin at the prescribed left margin.
    – Bernard
    Jul 6 '14 at 11:36
3

I need to indent lines of dialogue by 0.25in from the left margin and by 1in from the right margin

This sounds like a job for KOMA-Script's addmargin environment (which is available in other classes through the scrextend package). The environment is a list internally similar to the quotation environment. It allows setting a custom indentation from both sides with it's mandatory argument. With an optional argument a different value can be chosen for the indentation from the left:

\begin{addmargin}[<left indent>]{<indent>}

This can easily be wrapped in a custom command

\newcommand\dialogue[1]{%
  \begin{addmargin}[.25in]{1in}
  #1%
  \end{addmargin}%
}

or a custom environment:

\newenvironment{dialogue}
  {\addmargin[.25in]{1in}}
  {\endaddmargin}

An example:

\documentclass{article}

\usepackage{scrextend}% not needed with a KOMA-Script class
\newenvironment{dialogue}
  {\addmargin[.25in]{1in}}
  {\endaddmargin}

\usepackage{lipsum}% dummy text

\begin{document}

\lipsum[1]

\begin{dialogue}
  \lipsum[2]
\end{dialogue}

\lipsum[3]

\begin{dialogue}
  \lipsum[4]
\end{dialogue}

\lipsum[5]

\end{document}

enter image description here

0

Like the KOMA-related answer, there's a memoir-related answer:

\documentclass[12]{article}
\usepackage[showframe]{geometry}% to visualize output
\usepackage[T1]{fontenc}
\usepackage{lipsum}
\usepackage[strict]{changepage}% <-- or use the memoir class
\newenvironment{dial}
  {\begin{adjustwidth}{0.25in}{1in}
   % other commands?
   \small
   \parindent 0pt%
   \parskip   3pt%
    }
  {\end{adjustwidth}}

\begin{document}

\lipsum[1]

\begin{dial}
\lipsum[2-4]
\end{dial}

\lipsum[5]

\end{document}
1
  • Thank you all for your help - up and running successfully now!
    – Mike
    Jul 7 '14 at 12:13

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.