I have trouble combining several features. In an environment like "numberedpars" below, I would like to
- … automatically number paragraphs exclusively on the left side in a two-sided book and reset the counter for each new environment. The numbers should be flushed right. Preferably, the numbers should be part of the text and not in the margin.
- … have the text in two columns.
- … have the first line of a paragraph not indented and the following lines hanging.
Is this even possible?
What I got so far: Automatically numbered paragraphs (even though it's not exclusively on the left side, the numbers are not flushed right, and the numbers are in the margin). Borrowed from the reply by T.H. here: Automatically assign a number to every paragraph
% !TeX TXS-program:compile = txs:///lualatex/[-synctex=1 -interaction=nonstopmode]
\documentclass[11pt]{scrbook}
\usepackage[ngerman]{babel}
\usepackage[excludeor]{everyhook}
\setlength{\marginparwidth}{8pt}
\newcounter{parcount}
\newif\ifnumberedpars
\newenvironment{numberedpars}{%
\PushPreHook{par}{%
\ifnumberedpars
\stepcounter{parcount}%
\numberedparsfalse
\marginpar{\arabic{parcount}}%
\numberedparstrue
\fi
}%
\numberedparstrue
}{%
\PopPreHook{par}%
}
\reversemarginpar
\begin{document}
\setlength{\parindent}{0pt}
\section*{Section Headline}
\subsection*{Subsection Headline}
Some info
\subsubsection*{Subsubsection Headline 1}
\begin{numberedpars}
AA: This is a short paragaph.
BB: This is a rather long paragraph spanning more than one line if we extend this really really long.
AA: Again another rather long long paragraph spanning more than one line if we extend this really really long.
BB: And here we stop this conversation.
\end{numberedpars}
\subsubsection*{Subsubsection Headline 2}
\setcounter{parcount}{0}
\begin{numberedpars}
AA: This is a short paragaph.
BB: This is a rather long paragraph spanning more than one line if we extend this really really long.
AA: Again another rather long long paragraph spanning more than one line if we extend this really really long.
BB: And here we stop this conversation.
\end{numberedpars}
\subsubsection*{Subsubsection Headline 3}
\setcounter{parcount}{0}
\begin{numberedpars}
AA: This is a short paragaph.
BB: This is a rather long paragraph spanning more than one line if we extend this really really long.
AA: Again another rather long long paragraph spanning more than one line if we extend this really really long.
BB: And here we stop this conversation.
\end{numberedpars}
\subsubsection*{Subsubsection Headline 4}
\setcounter{parcount}{0}
\begin{numberedpars}
AA: This is a short paragaph.
BB: This is a rather long paragraph spanning more than one line if we extend this really really long.
AA: Again another rather long long paragraph spanning more than one line if we extend this really really long.
BB: And here we stop this conversation.
\end{numberedpars}
\subsubsection*{Subsubsection Headline 5}
\setcounter{parcount}{0}
\begin{numberedpars}
AA: This is a short paragaph.
BB: This is a rather long paragraph spanning more than one line if we extend this really really long.
AA: Again another rather long long paragraph spanning more than one line if we extend this really really long.
BB: And here we stop this conversation.
\end{numberedpars}
\end{document}
All my attempts to add more of the mentioned features has broken things for me. I greatly appreciate any working ideas.
Edit: Because it is rather difficult to explain, here is a screenshot of what I'm trying to do, created with LibreOffice Writer (though it's still missing the numbers being flushed right):
Edit 2: Ah sorry, the first screenshot was still missing the hanging indentation, it should look like this (even though not everything is perfectly aligned yet):
Edit 3: Celdor, your EDIT3 almost does it. It is still missing a genuine hanging indent. Let me explain. In case I use short initials (like "II") and long initials (like "WvW") spacing is not so nice anymore. There is either too much white space around "II" or not enough around "WvW" because the size of the initials label is fixed. It also becomes apparent that the initials are centered:
I think a genuine hanging indent needs the initials and the text to be connected. What I manage to do is have the initials flush left/justify (justification is what I'm looking for) by changing c
to l
in the line \hspace{#3}\makebox[#4][l]{\textbf{#6:}}%
and raise the space after the initials (changing 1em to 2em in \NewDocumentCommand{\numpar}{s O{0.5cm} O{2em} O{#2} O{#3} m}{%
). Now the paragraph numbers are flush right, and the initials are flush left and there is enough space for both "II" and "WvW":
Now justification is all good and there is some space between paragraph numbers and initials. Perfect. – But initials and text are still disconnected. What I'm looking for is this:
Initials and text are connected, still a hanging indent with a certain size is used throughout. To summarize: I don't want the space around the initials to be fixed, but initials and text to be connected and the size of the hanging indent to be fixed. I hope this clarifies what I'm missing.
Best Answer
If I have got the description right, I'd propose using a mix of hangindent, hspace, and makebox
EDIT. Example with multi-columns. The solution is based on
tabular
.EDIT2.
Added an option for a single column, which is executed by
*
; this can be broken between pages. The two columns solution has a flow from one column to the other as requested but can't be spread between pages. It seems each solution I came up with required usage of boxes. Perhaps it would require some internal coding which I am still learning, hence no solution on that particular feature, I am afraid.EDIT3
A solution with the two-column sections.
EDIT4
Initials are no longer tabulated.