I am trying to automatically create a summary section/subsection at the end of a chapter/section, by marking text within the main text as part of the summary. Is there a package that does that?
I am trying to do this manually. The text in the summary section/subsection is copied from marked text within the main text. I used the collect
package to do that (inspired from Gonzalo's answer).
I'm having a few issues so far:
- Text within the
collect*
environment is placed within its own paragraph in the main text. - The
beforecol
andaftercol
parameters of thecollect
package are separated from the text entry with a\par
token, even when I do not provide it explicitly. I do not want that. I want them to be part of the same paragraph, unless explicitly stated. - If I do not provide
\par
at the end ofaftercol
, theaftercol
content andbegincol
content of the subsequent collection are merged into one. - I am not sure how to use
\includecollection
in anenumerate
environment such that each\begin{collect*} ... \end{collect*}
becomes an\item
inenumerate
. Right now, the whole collection is treated as one big\item
. - Automation. I guess what I am really looking for is the ability to use something like
\summary[Before text.][After text.]{Text within main text}
which will typeset and collect the text within main text normally, collect the before after parts, and produce a summary section/subsection at the end of every chapter/section, where every\summary
is an\item
in anenumerate
environment. This is the least of my concerns though.:-)
Below is what I have so far. The second summary subsection is what I would like to get.
MWE:
\documentclass{article}
\usepackage{collect}
\usepackage{multicol}
%% Gonzalo's answer: https://tex.stackexchange.com/a/166978/32206
\makeatletter
\newenvironment{summary}[2]
{\@nameuse{collect*}{thesummary}{}{}{{#1}}{{#2}}}
{\@nameuse{endcollect*}}
\makeatother
\definecollection{thesummary} % Collect summary content here.
\begin{document}
\section{El Section}
% This part should be in the summary, with some text before.
\begin{summary}{Some text before.}{}
Far quitting dwelling graceful the likewise received building. An fact so to that show am shed sold cold.
\end{summary}
Unaffected remarkably get yet introduced excellence terminated led. Result either design saw she esteem and. On ashamed no inhabit ferrars it ye besides resolve. Own judgment directly few trifling.
% This part should be in the summary, with some text after.
\begin{summary}{}{Some text after.}
Elderly as pursuit at regular do parlors. Rank what has into fond she.
\end{summary}
%% End of paragraph 1.
% This part should be in the summary, with some text before and after.
\begin{summary}{Some text before.}{Some text after.}
Lose away off why half led have near bed. At engage simple father of period others except.
\end{summary}
My giving do summer of though narrow marked at. Spring formal no county ye waited.
%% End of paragraph 2.
% Generate summary subsection. Split into two columns and enumerate.
\subsection*{Summary}
\begin{multicols}{2}
\begin{enumerate}
\item \includecollection{thesummary}
\end{enumerate}
\end{multicols}
% Ideal outcome.
\subsection*{Summary}
\begin{multicols}{2}
\begin{enumerate}
\item Some text before. Far quitting dwelling graceful the likewise received building. An fact so to that show am shed sold cold.
\item Elderly as pursuit at regular do parlors. Rank what has into fond she. Some text after.
\item Some text before. Lose away off why half led have near bed. At engage simple father of period others except. Some text after.
\end{enumerate}
\end{multicols}
\end{document}