# Sections \label and \nameref [closed]

\documentclass[fleqn,12pt,a4paper]{article}
\usepackage{fontspec,xltxtra,xunicode}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{color}
\usepackage{setspace}
\usepackage{hyperref}
\usepackage{cmll}
\usepackage{tabularx}
\usepackage{pifont}
\usepackage{amstext, amsmath}
\usepackage{enumerate}

%========================================================
\begin{document}
.
.
.
.
.a document of 100 pages
.
.a document of various tables and other sections
.
.
.recalled lables at various places through out the document,
\nameref{} entire section header appeared nicely.

\end{document}
%========================================================


Above code worked like a charm, I can use \nameref{} anywhere in the document and it created a hyperlink. I went crazy and created as many as 3900 subsections and now the PDF prints only two pages and I get stack over flow error. Hyperlinks appear as ??. I tried using enumerate and it does not hyperlink to specific line as it does in case of \section{}, also tried putting lines with labels and still it did not work.

-

## closed as not a real question by Joseph Wright♦May 12 '12 at 7:12

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

I don't understand what you mean by “now the PDF prints only two pages and I get stack over flow error”. Have you gotten a PDF from TeX that your PDF viewer cannot handle? What exactly is the error you are seeing? –  Harald Hanche-Olsen Nov 22 '10 at 20:23
My crystal ball guesses: you have no text at all between those 3k subsections, hence there is no possibility for pagebreaks, on a TeX level, your second page becomes immensely long and breaks the ~400cm limit. –  Ulrich Schwarz Jan 23 '11 at 8:36
Your title does not reflect your question especially well. –  N.N. Aug 30 '11 at 11:04

Yea, I agree that a little more information might be needed for that error but just a side note after glancing at your code: it's recommended that \usepackage{hyperref} comes last in the order of packages that you load. occasionally a package requires placement after hyperref but i don't think there are many. hyperref might get overwritten otherwise, so maybe you can see if that changes your hyperlink behavior any.

The hyperref manual should have more info if you care to look into it.

-

In case Ulrich's guess is right, you can give special permission to Latex to start new pages at sections, so:

\let\ursection=\section
\def\section{\pagebreak[0]\ursection}


(untested, since there is no MWE).

-
Another old unanswered qn. –  Charles Stewart Apr 20 '11 at 8:08