Document Classes ⇒ Section Numbering
Section Numbering
\def\thesection {\Alph{section}}
\def\labelsection {\thesection.}
The section headings are automatically numbered A, B, C.
When I make reference to a section using \ref{sec:Ex}, I want to see 3.B for the 2nd section in Chapter 3. However, only the section number shows up, i.e., B without the chapter number. I tried to amend the above 2 lines with
\def\thesection {\thechapter.\Alph{section}}
\def\labelsection {\thechapter.\thesection.}
The reference with \ref{sec:Ex} works now, but the section headings also include the chapter number. How do I remove the chapter number?
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
-
- Posts: 14
- Joined: Wed Sep 01, 2010 4:47 pm
Section Numbering
Code: Select all
\def\thesection {\Alph{section}}
\def\labelsection {\thechapter.\thesection.}
Section Numbering
Code: Select all
\usepackage{varioref}
\labelformat{section}{\thechapter.#1}
And here's a full example:
Code: Select all
\documentclass{report}
\renewcommand{\thesection}{\Alph{section}}
%\def\labelsection{\thechapter.\thesection}
\usepackage{varioref}
\labelformat{section}{\thechapter.#1}
\begin{document}
\tableofcontents
\chapter{A chapter}\label{ch:one}
Some text\ldots{}
\section{A section}\label{sec:one}
A reference:~\ref{sec:one}.
\section{Another section}
Some text\ldots{}
\section{And another one}\label{sec:two}
More references:~\ref{sec:two} and \ref{sec:one}.
\chapter{Another chapter}\label{ch:two}
Some text\ldots{} and references:~\ref{ch:one}, \ref{ch:two}, \ref{sec:one}, \ref{sec:two}.
\section{One more section}\label{sec:three}
\ldots{}and one more reference:~\ref{sec:three}.
\end{document}
Re: Section Numbering
I tried what ChemistKatie suggested as well, the problem with that is my section headings also include the chapter number, which I do not want.
Thanks all for your hints.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Section Numbering
Best regards and welcome to the board
Thorsten
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10