For my AP Stats notes this year, I've been citing everything with line numbers instead of page numbers, as most sections wind up being less than a page and I want to be able to find things quickly. I've been using the lineno
package for this. But when I generate a table of contents, everything's still cited in page numbers. Obviously, this has something to do with how sections and soforth are entered into the table of contents because they naturally use page numbers. I tried redefining \thepage
to be the line number, but that just resulted in each section being cited as the first line on the next page. So for instance on this page:
All three subsections that start here are listed in the table of contents as starting on line 265, even though they very much don't. Does anyone know how to make this work? I was thinking about basically making a new .toc
file that would work with line numbers, but I have absolutely no idea how that would work. I've included an MWE of what I have right now below; please let me know if anything's off.
%Using XeLaTeX for font reasons
\documentclass{article}
\usepackage{lineno}
\renewcommand{\thepage}{\thelinenumber}
\begin{document}
\tableofcontents %lists ``a section" and ``another section" as starting on line 37
\section{a section}
A bunch of text that would get rendered starting on line one
\section{another section}
A bunch more text that would get rendered starting on line ten
\newpage
Even more text that would get rendered starting on line thirty-seven
\end{document}