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 of each section appears below its chapter (wits 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 \section command we know what chapter we are in: it's showed in the headers of te 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 behavior 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}