LaTEX newbie here... I am trying to quote portions of chat logs and get them to look like this:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed iaculis orci augue, id finibus nunc feugiat egestas. Ut at consectetur orci.
(...)
Bob: This is the first line of my message
and this the second one
and this the third
Alice: Hi Bob
(...)
Morbi laoreet gravida elit vitae posuere. Mauris vel urna nec elit cursus lacinia.
And this is the code that I am using now:
%!TEX program = xelatex
\documentclass[12pt,a4paper,oneside]{report}
\newenvironment{chat} {
\list{}{
\topsep 2em
\parsep -1em
\rightmargin \leftmargin
\advance\leftmargin 1.5em
\newcommand\who[1]{\item[{##1}:]}
}
\item[]
}{\endlist}
\begin{document}
\chapter{Chapter}
\section{title}
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Sed iaculis orci augue, id finibus nunc feugiat egestas.
Ut at consectetur orci.
\begin{chat}
(...)\\
\who{Bob} This is the first line of my message\\
and this the second one\\
and this the third\\
\who{Alice} Hi Bob\\
(...)
\end{chat}
Morbi laoreet gravida elit vitae posuere.
Mauris vel urna nec elit cursus lacinia.
\end{document}
Is this the right approach? And also, I tried to add the (...) before and after directly inside the \newenvironment
, so that I don't have to include them any time, but I couldn't get them to align properly. Any help?
Thanks
\item[]
in the environment definition but apart from that it looks Ok if it gives the layout you want, also I wouldn't use\\
but rather use\who{bob}
each time.\newcommand\who[1]{\item[{##1}:]}
? And also the issue with using\who{bob}
each time means that the name would repeat, while I want to group messages that are sent separately by the same person together using the indentation. Also in my code the (...) are not aligned with the rest of the items - any idea how to change this?\item[]
that you have in the enviornmemt definition. I would use\who{bob}
every time and if you want special formatting for repeat comments that can be done (liek bibliography formats that use a dash for second publication by same author rather than repeat the name