Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I keep adding a class of sentences in different areas of my tex:

\section{...}
... 
sentence1
... 
\subsection{...}
... 
sentence2
... 
\section{...}
... 
sentence3
... 

I would like to make a add mechanisms, label all the sentences and later summarize them in a place by listallthesentences:

\section{...}
... 
\add{sentence1}
... 
\subsection{...}
... 
\add{sentence2}
... 
\section{...}
... 
\add{sentence3}
... 
\section{summary}
\listallthesentences

In the summary, it will be better, if all the sentences are repeated and have a reference pointed to their initial place.

Does anyone know how to realize this?

share|improve this question
    
This is too vague; what would you list in the "List of all sentences"? –  egreg Oct 17 '12 at 9:37
    
Just repeat the sentences which are labelled with add, and have a reference pointed to their initial place... –  SoftTimur Oct 17 '12 at 9:38
1  
Use the package tocloft, see also tex.stackexchange.com/questions/61086/…;. –  canaaerus Oct 17 '12 at 11:12
    
In my answer below I provided a solution for generating the list; it's not clear, however, what you mean with "labelled sentences". Could you please ellaborate a little more about this labelling? –  Gonzalo Medina Oct 17 '12 at 13:09

1 Answer 1

up vote 7 down vote accepted

You can use \@starttoc to generate a list similar to the ToC, Lof or LoT (it's not clear from the description, however, what "labelled sentence" means):

\documentclass{article}
\usepackage{hyperref}

\makeatletter
\newcommand\listofsentences{\@starttoc{los}}
\newcommand\addsentence[1]{%
\par\csname phantomsection\endcsname\addcontentsline{los}{section}{#1}#1\par}
\makeatother

\begin{document}

\section{Test Section One}
\addsentence{This is a test sentence.}
\section{Test Section Two}
\addsentence{This is another test sentence.}

\section{Summary}
\listofsentences

\end{document}

enter image description here

A variant (requested in a comment) without page numbers and with normal font for the entries in the new list:

\documentclass{article}
\usepackage{hyperref}

\makeatletter
\newcounter{sentence}
\newcommand\listofsentences{\@starttoc{los}}
\newcommand\addsentence[1]{%
\stepcounter{sentence}%
\par\csname phantomsection\endcsname\addcontentsline{los}{sentence}{#1}#1\par}
\newcommand\l@sentence[2]{\par\noindent#1}
\makeatother

\begin{document}

\section{Test Section One}
\addsentence{This is a test sentence.}
\section{Test Section Two}
\addsentence{This is another test sentence.}

\section{Summary}
\listofsentences

\end{document}

enter image description here

share|improve this answer
    
Thanks for your comment, it is quite what I need... By the way, in the summary, I don't want to show the page of the sentences, also I don't want to make them bold, could you adjust your response? –  SoftTimur Oct 17 '12 at 13:58
    
@SoftTimur sure! I've updated my answer. Is it something like that what you need? –  Gonzalo Medina Oct 17 '12 at 17:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.