4

So, I'm writing a study guide as a book class document, and at the end of each chapter I'd like to be able to print summaries/highlights. What I have in mind is to tag and then re-print tagged definitions, important theorems, examples and exercises in standalone sections of the document. If possible, I'd like to have the option of either collecting the entire environment (as in the case of definitions, where I'd like to include the framed format I currently have for them) or only the text (as would be the case for exercises that arise naturally from the content but would be included in an enumerated list).

After some searching I found the tagging and collect packages, and from reading the documentation it seems to me they could be tweaked to do what I have in mind but it's beyond my ability tom modify the example codes I've found. It's also possible that this functionality is included in a different package altogether, but I haven't hit the right keywords to find it yet, so I'm open to suggestions.

LFG
  • 41
  • Wouldn't it be far easier to just comment on the important parts, i.e. %Highlight, and when you are finished search for %Highlight and copy&paste it?

    I suggest this method, since you don't just want environments, but also sometimes only a sentence or formula, which would cause a lot of formating problems.

    – DonFangzahn May 27 '19 at 00:49
  • The approach I would first try is to save the desired elements as named token lists, defining these in the "logical" context and immediately calling them out, and having the name available later to repeat. This is similar to (although different in a significant way) to the endnote approach. – barbara beeton May 27 '19 at 11:17
  • 1
    You mention "definitions, theorems, examples, and exercises", all of which are probably defined using theorem-like format? Maybe you want to look into the "restatable theorems"? https://tex.stackexchange.com/questions/51286/recalling-a-theorem – Willie Wong Mar 18 '21 at 19:42

1 Answers1

1

Many years ago I asked a comparable question on mrunix.de and a helpful soul provided (more or less) this code:

\documentclass[english]{scrartcl}
\usepackage{babel,blindtext,framed}
\newcommand\lorname{Highlights}
\newcommand\lorext{lor} %Dateierweiterung
\newcommand\lortmp{}
\newcounter{Highlights}
\setcounter{Highlights}{0}
\newcommand{\HigH}[2][\empty]{%
  \textit{%
    Highlight \refstepcounter{Highlights}\theHighlights:}%
  \vspace{-0.75\baselineskip}
  \begin{framed}%
    #2
  \end{framed}%
  \ifx#1\empty
  \renewcommand\lortmp{#2}
  \else\renewcommand\lortmp{#1}
  \fi%
\addcontentsline{\lorext}{subsection}{\theHighlights\quad\lortmp}
}
\makeatletter
\newcommand\listofrecommendations{%
\section*{\lorname}
\markboth{\lorname}{}
\@starttoc{\lorext}
}
\makeatother
\begin{document}


\section{First section}
\label{CLA:first-section}


\HigH{First recommendation}
\HigH{Second highlight}
\HigH[Too long to print (not: to long to print)]{\blindtext}
\clearpage
\listofrecommendations
\end{document}

What you get is a list of recommendations whereever you write \listofrecommendations, but probably you have to adapt and customise it for sectionswise use.

Keks Dose
  • 30,892