1

I use longtable environment to make a dialog, like this below.

enter image description here

I prefer it than the dialogue environment because of:

  • the || lines at the left
  • the style of the speaker's name (separate from the text)

The problem is with the big texts! When I write the code below, the 2nd student's row can't split into pages. I know that it is not possible, so I 'm asking if someone knows an alternative to my solution, for example dialogue environment customizing.

\documentclass[a4paper,11pt,twoside]{book}

\usepackage{longtable} 
\usepackage{lipsum}

\begin{document}

\begin{longtable}{||lp{0.7\textwidth}}
Student1:& \lipsum[1] \\
Teacher: & \lipsum[1] \\
Student2:& \lipsum[1-3]
\end{longtable}

\end{document}

enter image description here

Thank's in advanced!!!

1

This would be a first guess for avoiding the use of tables. Page breaks still do not occur inside paragraphs, but, if you wrap each paragraph in a new \speaks{...}, page breaks can occur between paragraphs. The following code needs some correction for the beginning of a new page though.

\documentclass{scrartcl}
\usepackage{tikz}\usetikzlibrary{backgrounds}
\usepackage{enumitem}

\newlength\fntheight
\newlength\fntdepth
\newlength\parcorrection
\newif\iffirstitem
\newif\iffirstpar
\widowpenalties 1 10000
\raggedbottom
\newenvironment{dialogue}[1][25mm]{
    \newcommand{\speaks}[2][]{%
        \def\temp{##1}%
        \ifx\temp\empty%
            \vspace{-\itemsep}%
        \else%
            \firstpartrue%
        \fi%
        \setlength{\fntheight}{\fontcharht\font`B}%
        \setlength{\fntdepth}{\fontchardp\font`q}%
        \setlength{\parcorrection}{
            \dimexpr
                 \fntheight
                +\iffirstitem
                    0pt
                 \else
                     \parsep 
                    +\baselineskip
                    +\iffirstpar
                        \itemsep
                     \else
                        0pt
                     \fi
                \fi
            \relax
        }
        \item[##1]
        \begin{tikzpicture}[remember picture, overlay]
            \node[inner sep=0] (start) at (-1ex-#1, \parcorrection) {};
        \end{tikzpicture}%
        ##2
        \hfill
        \begin{tikzpicture}[remember picture, overlay]
            \node[inner sep=0] (end) at (-1ex-\textwidth, -\fntdepth) {};
            \draw[double] (start) -- (end);
        \end{tikzpicture}
        \firstitemfalse
        \firstparfalse
        \par
    }
    \firstitemtrue
    \begin{description}[
        labelwidth=#1,
        leftmargin=#1,
        labelsep=0pt,
        font={\normalfont\scshape}
    ]
}{
    \end{description}
}
\begin{document}
    \begin{dialogue}
        \speaks[Christian]{The square is a refuge for everyone.}
        \speaks[Visitor]{Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.}
    \end{dialogue}
\end{document}

enter image description here

  • thank's for your answer! I found 4 problems on your solution: (I) The text doesn't split to the next page, as I want. (II) The vertical line stops after a while without an obvious reason. (III) I prefer the vertical line to be double. (IV) The horizontal brake between the speakers is too big. – Kώστας Κούδας Feb 14 at 21:25
0

I played with this answer and I make one for me.

The code below works fine for me, but I don't know if it is the simplest one. If someone knows a better version, I 'll be happy to hear it!

\documentclass{article}

\usepackage[most]{tcolorbox}
\usepackage{dialogue}
\usepackage{environ}
\usepackage{lipsum}

\newtcolorbox{four}[1][]{%
    enhanced,
    breakable,
    frame hidden,
    colback=white,
    overlay unbroken={%
        \draw[thick,black,double] (interior.north west)--(interior.south west)--(interior.south west);
    },
    overlay first={
        \draw[thick,black,double] (interior.north west)--(interior.south west);
    },
    overlay middle={
        \draw[thick,black,double] (interior.north west)--(interior.south west);
    },
    overlay last={
        \draw[thick,black,double] (interior.north west)--(interior.south west)--(interior.south west);
    },
    #1,
}

\NewEnviron{dialogos}{
    \begin{four}
\begin{dialogue}
\BODY.
\end{dialogue}
    \end{four}
        }

\begin{document}

\begin{dialogos}
    \speak{Someone} \lipsum[1]

    \lipsum[3]
    \speak{someone else} \lipsum[2]
\speak{Someone} \lipsum[1]
\end{dialogos}

\end{document}

enter image description here

Thank's in advanced!

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.