5

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

1 Answer 1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .