1

I can generate a list of sentences from labels with this. How do I enumerate the list?

Edit 1: Almost.

The following suffers from GIGANTIC TAB. I'd rather not have this problem.

\documentclass{article}
\usepackage{hyperref}
\usepackage[english]{babel} % English language/hyphenation

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

\begin{document}
\addsentence{This is a test sentence.}
\addsentence{This is another test sentence.}
\listofsentences
\end{document}

enter image description here

1 Answers1

3

Like this? You make a new counter for the sentences, step its value in the \addsentence macro, and use \thesentence to print the counter value in the list.

enter image description here

\documentclass{article}
\usepackage{hyperref}
\usepackage[english]{babel} % English language/hyphenation

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

\begin{document}
\addsentence{This is a test sentence.}
\addsentence{This is another test sentence.}
\listofsentences
\end{document}
Torbjørn T.
  • 206,688