This was the problem I posted: "I need to output "see section 2.3" where the referenced section is the third on the second chapter."
You all are right. I've to redefine the problem.
Sections are referenced in a lot of distinct places:
- In table of contents. Managed by
\tableofcontents
- In minitocs. Managed by
minitoc
package - In headers. Managed by
fancyhdr
package - Like a leader section. Managed by
\section
- In text. Managed by
\ref
In tocs and minitocs, because each section appears below its chapter (with some indentation) it's not necessary to prefix the section number with the chapter number. The label scope is local; so I need a local renderization. Example:
1. Chapter One ------------------1
1. First section -----------1
2. Second section ----------3
2. Chapter Two -----------------5
1. First section ...........5
This means that sections 1.1 and 2.1 must be rendered as section 1.
When we use the \section
command we know what chapter we are in: it's shown in the headers of the page. So I want also local scope:
1. First section
bla bla
2. Second section
bla bla
In headers I want global scope:
1. Chapter One 1.1. First section
In text we can make a crossreference to whatever point of text. So we need global scope:
See section 1.1 (first section in first chapter)
This is the problem:
The default behavoir give as global scope every where. But if I redefine \thesection
to local scope, then I redefine everywhere.
This is my code:
\documentclass[catalan]{book}
\usepackage{fancyhdr}
\usepackage{nameref}
\usepackage{minitoc}
\usepackage{hyperref}
\makeindex
\dominitoc
%\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\chaptermark}[1]{\markboth{\thechapter\ #1}{}}
\renewcommand{\sectionmark}[1]{\markboth{\thechapter.\thesection\ \ #1}}
\fancyhead{}
\fancyhead[LO]{\leftmark}
\fancyhead[RE]{\thechapter.\rightmark}
\pagestyle{fancy}
\begin{document}
\tableofcontents
\chapter{One}
\minitoc[e]
\section{First section}\label{sec:A}
aaaaaa \newpage bbbbbbbb \newpage ccccccccccc
\chapter{Two}
\minitoc[e]
\section{Second section}\label{sec:B}
See sections \ref{sec:A} and \ref{sec:B}
\end{document}
section 1.1.Introduction
seems unlikely to be desirable.