4

I am using the lineno package to add line numbers to my document. Is there a way to restart the numbering after every chapter?

There is an option called pagewise which restarts line numbering on every page. But I'm looking for something like "chapterwise" numbering.

MWE

\documentclass[12pt,a4paper]{report}
\usepackage{blindtext}
\usepackage{lineno}
\linenumbers

\begin{document}

\chapter{First}
\blindtext[5]

\chapter{Second}
\blindtext[5]

\end{document}

enter image description here

enter image description here

7

You can add \resetlinenumber before \chapter.

Automating it is maybe better:

\documentclass[12pt,a4paper]{report}
\usepackage{lineno}
\usepackage{etoolbox}

\usepackage{blindtext}

\preto{\chapter}{\resetlinenumber}

\linenumbers

\begin{document}

\chapter{First}
\blindtext[5]

\chapter{Second}
\blindtext[5]

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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