2

I'm typesetting a drama script using the dramatist package, which defines the drama environment, which is basically a list environment, and each speech entry is a list item. Since I need to print the script several times, I want to reduce the space between the speech items.

The drama environment declares as follows:

\newenvironment{drama}{%
    \if@lnpa
    \PackageWarning{dramatist}{\lnpwarning{a}}
    \fi
    \if@lnps
    \PackageWarning{dramatist}{\lnpwarning{s}}
    \fi
    \list{}{%
        \labelwidth\speakswidth
        \itemindent\speaksindent
        \itemsep\speechskip
        \parsep\Dparsep
        \labelsep\Dlabelsep
        \let\makelabel\speakslabel}
    } {\endlist}

The dimensions are also declared in the dramatist.sty as follows:

\newdimen\speakswidth
\speakswidth\z@
\newdimen\speaksindent
\speaksindent=-\leftmargin
\newdimen\speechskip
\speechskip\itemsep
\newdimen\Dparsep
\Dparsep\z@
\newdimen\Dlabelsep
\Dlabelsep\labelsep

It even supports reading a config file:

\InputIfFileExists{dramatist.cfg}{\foundfile}{\inputfilewarning}

I figured out that the spacing between the items is probably set by the \speechskip-dimension, so I tried to create a config file with the following content:

\speechskip=0em
\speaksindent=0em

The package reads that config file, as stated in the log:

Package dramatist Warning: Using Configuration file dramatist.cfg. .

But neither the indents nor the skip between the items changes. I don't know why the config file isn't read correctly, since I think that the declarations of the dimensions I done are correct.

A MWE could look like:

\documentclass[oneside,12pt]{scrreprt}
\usepackage[ngerman]{babel}
\usepackage{scrpage2}
\usepackage[utf8]{inputenc}
\usepackage{dramatist}
\usepackage[x11names]{xcolor}
\usepackage{tcolorbox}
\usepackage[bookmarks]{hyperref}
\begin{document}
  \newcommand{\role}[1]{\textcolor{blue}{(\textit{#1})}}
  \begin{CharacterGroup}{Andere alte Leute}
  \GCharacter{Marta \role{Elisa}}{Marta}{marta}
  \end{CharacterGroup}
  \newcommand{\martax}[1]{\item\leavevmode\begin{tcolorbox}[title=\marta,colframe=red]#1\end{tcolorbox}}
  This is the regular document inset.
  \begin{drama}
    \martax{I can talk}
    This is the list inset.
    \martax{I can talk}
    \martax{I can talk}
    \martax{I can talk}
  \end{drama}
\end{document}

This produces the following output for me: Example Output MWE

Any ideas on how to tighten the distance between the items are greatly appreciated! Thanks in advance ;)

Edit: Christian Hupfer's answer fixed the spacing between the speech boxes, which I very appreciate ;) What about the spacing to the left? Any ideas are welcome ;)

Edit 2: I also tried changing the source of dramatist.sty directly in order to fix the bad left indentation, but to no avail: (of course for testing purposes only)

\newenvironment{drama}{%
    ...
    \list{}{%
        ...
        \itemindent0em
        ...
    } {\endlist}

and:

\newenvironment{drama}{%
    ...
    \list{}{%
        ...
        \itemindent=0em
        ...
    } {\endlist}

Edit 3: Using Christian Hupfer's new solution, I was able to reduce the left indentation to a minimum. But there's still a tiny bit of spacing towards the left, and a bit more to right, not much, but it gets visible, when a speechbox is next to some other, unindented content like a colored parbox or some normal text (outside the drama environment). Is there a way to fix this last bit of unwanted spacing?

  • You're looking at the wrong position: The spacing is due to tcolorbox, which adds a certain amount above and below each box, unless the option nobeforeafter is used. – user31729 Feb 10 '16 at 1:15
  • Sorry, I had no time to look after this all recently – user31729 Feb 27 '16 at 19:04
3

The tcolorbox package puts the tcolorbox environments in a paragraph, unless the option nobeforeafter is used. A better way to preserve the indents is to apply before={\hskip\dimexpr\leftmargin-\speechskip} and an empty after={}

The remaining spacing is \itemsep and the natural \interlineskip. Compare the difference between \martax and \martay

\documentclass[oneside,12pt]{scrreprt}
\usepackage[ngerman]{babel}
\usepackage{scrpage2}
\usepackage[utf8]{inputenc}
\usepackage{dramatist}
\usepackage[x11names]{xcolor}
\usepackage{tcolorbox}
\usepackage[bookmarks]{hyperref}
\begin{document}
  \newcommand{\role}[1]{\textcolor{blue}{(\textit{#1})}}
  \begin{CharacterGroup}{Andere alte Leute}
  \GCharacter{Marta \role{Elisa}}{Marta}{marta}
  \end{CharacterGroup}
  \newcommand{\martax}[1]{\item\mbox{}\begin{tcolorbox}[before={\hskip\dimexpr\leftmargin-\speechskip},after={},title=\marta,colframe=red]#1\end{tcolorbox}}
  \newcommand{\martay}[1]{\item\mbox{}\begin{tcolorbox}[title=\marta,colframe=blue]#1\end{tcolorbox}}

  This is the regular document inset.
  \begin{drama}
    \martax{I can talk}
    This is the list inset.
    \martax{I can talk}
    \martax{I can talk}
    \martax{I can talk}
  \end{drama}

  \begin{drama}
    \martay{I can talk}
    This is the list inset.
    \martay{I can talk}
    \martay{I can talk}
    \martay{I can talk}
  \end{drama}

\end{document}

enter image description here

Update

I changed the text inset and removed the \mbox{} commands which lead to the false horizontal spacings.

\documentclass[oneside,12pt]{scrreprt}
\usepackage[ngerman]{babel}
\usepackage{scrpage2}
\usepackage[utf8]{inputenc}
\usepackage{dramatist}
\usepackage[x11names]{xcolor}
\usepackage{tcolorbox}
\usepackage{xpatch}

\usepackage[bookmarks]{hyperref}

\newlength{\dramatextinset}
\setlength{\dramatextinset}{\dimexpr-\leftmargin+\labelsep}

\xapptocmd{\drama}{%
  \setlength{\parindent}{\dramatextinset}%
}{\typeout{Success}}{\typeout{Failure}}

\usepackage{showframe}

\newcommand{\role}[1]{\textcolor{blue}{(\textit{#1})}}
\begin{CharacterGroup}{Andere alte Leute}
  \GCharacter{Marta \role{Elisa}}{Marta}{marta}
\end{CharacterGroup}

\newcommand{\martax}[1]{\item\begin{tcolorbox}[before={},after={},title=\marta,colframe=red]#1\end{tcolorbox}}
\newcommand{\martay}[1]{\item\begin{tcolorbox}[title=\marta,colframe=blue]#1\end{tcolorbox}}

\begin{document}
This is the regular document inset.
\begin{drama}
  \martax{I can talk}

  This is the list inset.
  \martax{I can talk}
  \martax{I can talk}
  \martax{I can talk}
\end{drama}


\begin{drama}
  \martay{I can talk}
  This is the list inset.
  \martay{I can talk}
  \martay{I can talk}
  \martay{I can talk}
\end{drama}

\end{document}

enter image description here

  • Thank you! That way I was able to fix the huge spacing between the speech boxes. I didn't think about that the space could be caused by the tcolorboxes. But have you any idea how I can remove the huge inset to the left of the speech boxes? Compare the "regular document inset" with the "list inset" statement. Setting \speaksindent didn't do the trick, any other ideas? Or is this again caused by the tcolorbox? – LukeLR Feb 10 '16 at 2:19
  • @LukeLR: No, I am pretty sure that dramatist is the villain here. The tcolorbox can be moved nicely left or right. If you say nobeforeafter instead of before={...} (as I have shown in the code above), the boxes are all aligned left – user31729 Feb 10 '16 at 2:21
  • Okay. But why doesn't setting \speaksindent=0em fix that? Am I missing something? – LukeLR Feb 10 '16 at 2:23
  • @LukeLR: I'll try to figure out – user31729 Feb 10 '16 at 2:25
  • That's really Nice! I also tried modifying the Source of dramatist.sty by directly typing in the definition of the drama-environment: \itemindent0em or \itemindent=0em, which also didn't fix it… :/ – LukeLR Feb 10 '16 at 2:27

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.