General ⇒ pages range of a section
pages range of a section
I have a document containing several sections and I need to print at the beginning of each section it's pages rage. I know that I can get current page number with \thepage command but how can I know what is a number of the last page of a section when I'm at beginning of the section?
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
pages range of a section
Follow howtoTeX on twitter
Re: pages range of a section

- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
pages range of a section
Code: Select all
\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{blindtext}
\begin{document}
\section{Section Title}\label{sec:first}
This Section goes from Page \pageref{sec:first} to Page \pageref{sec:first-end}
\medskip
\blindtext[6]\label{sec:first-end}
\end{document}
Thorsten
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10