3

In a work, I have to write a lot of dialogue.

This is my MWE:

\documentclass{article}

\newenvironment{dialogue}{%
\noindent%
\newcommand\one[1]{\textit{##1}\newline}%
\newcommand\two[1]{\textbf{##1}\newline}%
\newcommand\NormalText[1]{##1\newline}%
}{}

\begin{document}

\begin{dialogue}%
\one{bla-bla}
\two{bla-bla}
\one{bla-bla}
\one{bla-bla}
\NormalText{Normal text}
\two{bla-bla}
\end{dialogue}

\end{document}

This code does exactly what I want... but I ask if it is possible to mimic the enumerate environment like this :

\begin{dialogue}%
\one bla-bla
\two bla-bla
\one bla-bla
\one bla-bla
\NormalText Normal text
\two bla-bla
\end{dialogue}
Werner
  • 603,163
Amorok
  • 137

1 Answers1

3

Sure it is!

\documentclass{article}

\newenvironment{dialogue}{%
  \par\setlength{\parindent}{0pt}%
  \newcommand\one{\par\normalfont\itshape}%
  \newcommand\two{\par\normalfont\bfseries}%
  \newcommand\NormalText{\par\normalfont}%
}{\par}

\begin{document}

\begin{dialogue}
\one bla-bla
\two bla-bla
\one bla-bla
\one bla-bla
\NormalText Normal text
\two bla-bla
\end{dialogue}

\end{document}

enter image description here

egreg
  • 1,121,712