# Local and global cross-references

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}}


\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}
-
I might be able to help, but I don't really understand what you want. What part of the document is incorrect if you uncomment \renewcommand{\thesection}{\arabic{section}} in your example? –  Ian Thompson Dec 13 '10 at 17:09
If I uncomment \renewcommand{\thesection}{\arabic{section}} I obtain always local scope. But I want global scope in headers and in-text cross-references. I only want local scope in minitocs and in the begining of a section or chapter –  meren Dec 13 '10 at 17:22
@meren. I suspect that the reason you are struggling here is that most people would regard what you want to do as being rather confusing. Referencing 'Section 1' makes sense in a document with no chapters, but I've never seen this done in a larger document. –  Joseph Wright Dec 25 '10 at 9:24

Use \renewcommand{\thesection}{\arabic{section}} to get the numbers beside the section titles right. Changing this otherwise is difficult.

Use \renewcommand{\sectionmark}[1]{\markright{\thechapter.\thesection\ #1}} for the headers.

For the references you can use e.g. zref to set up a "fullsec" reference. But I would find it confusing. And what if you have a subsection 2.1? I would put a \label behind the chapter too and then write something like see section 1 in chapter 2.

-
Well. But what about minitoc? –  meren Dec 14 '10 at 15:15
And to have "see section 1 in chapter 2" how can I obtain the chapter number? –  meren Dec 14 '10 at 15:17
Like you optain the section number: With \label after the \chapter and \ref. –  Ulrike Fischer Dec 14 '10 at 15:27
But then I've to know the chapter of each reference! But I only want to know the label. –  meren Dec 14 '10 at 20:28