This question follows the question 282721 (\command without {} ending at the end of the line?). My new environment does three things:
- Creates a paragraph of its kind \quote
- Hangout the first characters of paragraph
- Starts the rest of the paragraph at the margin.
The code of my environnment seems a little heavy (cargo cult!). Is it possible to get any easier?
My MWE :
\documentclass[]{memoir}%The class i need to use is derived from memoir
\def\changemargin#1#2{\list{}{\rightmargin#2\leftmargin#1\setlength{\parindent}{-1.0cm}}\item[]}
\let\endchangemargin=\endlist
% question 588, Vivi answer : https://tex.stackexchange.com/questions/588/how-can-i-change-the-margins-for-only-part-of-the-text/600#600
\usepackage{tabto}%« "Tab" to a measured position in the line »
\newenvironment{dialogue}{%
\begin{changemargin}{2.0cm}{2.0cm}%environment like \quote
\par\setlength{\parindent}{-1.0cm}%for hangout par
\leavevmode%if not, the first line is not hang
\TabPositions{0.0cm}%to begin the text at margin
\newcommand\one{\par\normalfont M : \tab}%
\newcommand\two{\par\normalfont P : \tab\normalfont\itshape}%
\newcommand\NormalText{\par\normalfont\tab}%
}{\par\end{changemargin}}
\usepackage{lipsum}
\begin{document}
\lipsum[4]%
\begin{dialogue}%
\two \lipsum[4]
\two \lipsum[4]
\one \lipsum[4]
\one \lipsum[4]
\NormalText \lipsum[4]
\two \lipsum[4]
\end{dialogue}
\lipsum[4]%
\end{document}

\lipsum[3]or\lipsum[2]– touhami Jan 31 '16 at 21:48