Page LayoutProblem with Index (packages conflicts ?)

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Problem with Index (packages conflicts ?)

Post by Cham »

I'm having some problems that I really don't understand with my index :( . It's systematically giving wrong pages numbers, offset by two pages (I'm using the makeidx package). There's an apparent conflict with the empheq package, since when I remove it from my preamble, the problem is solved (but I do need the empheq package !).

Also, the titlesec package behaves oddly when I use the raggedright option. It's adding two pages to the whole document, and I don't understand why.

Could a gentle soul check my preamble given below, to see where are the causes of the problems ? I know it's pretty big, but I'm writing a complex book of about 900 pages with tons of equations and figures... :shock:

Please help ! :cry:

Code: Select all

\documentclass[12pt,letterpaper,twoside]{book}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage{setspace}
\setstretch{1.1}
\usepackage{moreverb}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{mathrsfs}
\usepackage{upgreek}
\usepackage{tensor}
\usepackage{graphicx}
\usepackage{here}

\raggedbottom

\usepackage[bottom]{footmisc}
\usepackage{pdfpages}
\usepackage[font=small,format=plain,labelfont=bf,up,textfont=it,up]{caption}
\usepackage[nottoc]{tocbibind}
\usepackage{tocloft}
	\setlength{\cftchapnumwidth}{0pt}
	\setlength{\cftsecnumwidth}{35pt}
	\renewcommand{\cftchappresnum}{\chaptername\ }
	\setlength{\cftsubsecindent}{53pt}
	\renewcommand{\cftchapaftersnumb}{\newline}
	\renewcommand{\cftchapdotsep}{\cftdotsep}
	\renewcommand{\cftchapleader}{\cftdotfill{\cftchapdotsep}}
\usepackage[ ]{siunitx}
\definecolor{cliquable}{RGB}{40,40,150}
\usepackage[colorlinks, linkcolor=cliquable, urlcolor=red, citecolor=red]{hyperref}

\pagestyle{headings}

\usepackage{anysize}
\marginsize{1.5in}{1in}{0.5in}{0.5in}
\usepackage{tabto}
\usepackage{enumitem}
\usepackage[pagestyles]{titlesec}
\newpagestyle{toc}{
	\sethead[\thepage][][\itshape\small\MakeUppercase{Table des matières}]{\itshape\small\MakeUppercase{Table des matières}}{}{\thepage}
	\headrule
}
\newpagestyle{principal}{
	\sethead[\thepage][][\itshape\small\MakeUppercase{\chaptername\ \thechapter. \chaptertitle}]{\itshape\small\MakeUppercase{\thesection\ \sectiontitle}}{}{\thepage}
	\headrule
}
\newpagestyle{appendices}{
	\sethead[\thepage][][\itshape\small\MakeUppercase{\chaptertitle}]{\itshape\small\MakeUppercase{\thesection\ \sectiontitle}}{}{\thepage}
	\headrule
}
\newpagestyle{biblio}{
	\sethead[\thepage][][\itshape\small\MakeUppercase{\chaptertitle}]{\itshape\small\MakeUppercase{\chaptertitle}}{}{\thepage}
	\headrule
}
\newpagestyle{figures}{
	\sethead[\thepage][][\itshape\small\MakeUppercase{Table des figures}]{\itshape\small\MakeUppercase{Table des figures}}{}{\thepage}
	\headrule
}
\newpagestyle{index}{
	\sethead[\thepage][][\itshape\small\MakeUppercase{Index}]{\itshape\small\MakeUppercase{Index}}{}{\thepage}
	\headrule
}

\usepackage{empheq}
\definecolor{gris230}{RGB}{230,230,230}
\usepackage{makeidx}
\makeindex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\frontmatter
	\includepdf{PageTitre.pdf}

\thispagestyle{empty}
\cleardoublepage
\phantomsection
\addcontentsline{toc}{section}{\sl Avant-propos}
	\input{Avant-propos}

\newpage
\cleardoublepage
\phantomsection
\addcontentsline{toc}{section}{\sl Notations et conventions}
	\input{Conventions}

\newpage
\pagestyle{toc}
\tableofcontents

\mainmatter

\pagestyle{principal}
	\input{Chapitre1}
	\input{Chapitre2}

\backmatter

\appendix
	\pagestyle{appendices}
	\renewcommand\thesection{A.\arabic{section}}
	\input{Appendices}

\begin{thebibliography}{999}
	\pagestyle{biblio}
	\input{Bibliographie}
\end{thebibliography}

\newpage
\setlength{\cftfignumwidth}{1.25in}
\renewcommand{\cftfigpresnum}{\figurename\ }
\renewcommand{\cftfigaftersnum}{~:}

\pagestyle{figures}
\listoffigures

% The index :
\cleardoublepage
\phantomsection
\pagestyle{index}
\printindex

\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Problem with Index (packages conflicts ?)

Post by localghost »

Please provide a true minimal example that is reduced to minimal content (as its name implies) [1]. It mustn't depend on external files, thus has be compilable for everybody as provided. Otherwise I'm pessimistic about specific help.

[1] View topic: Avoidable mistakes


Thorsten
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Re: Problem with Index (packages conflicts ?)

Post by Cham »

I'm trying to reproduce the issues with a "basic" compilable version to be placed here, but it's really complicated. I'll try to post something later.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Problem with Index (packages conflicts ?)

Post by localghost »

Cham wrote:[…] Also, the titlesec package behaves oddly when I use the raggedright option. It's adding two pages to the whole document, and I don't understand why. […]
That's very unlikely, since this option only formats headings. Perhaps you know the \raggedright command to format paragraph units. The corresponding package option does nothing else for headings.
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Problem with Index (packages conflicts ?)

Post by Cham »

There's something fishy with my code (or is it ?). I need help to solve the index. Here's what I've found today :

The indexation works perfectly if I just remove the empheq package (what the ... ?). If I keep it, I can get the index to work correctly if I reduce considerably the book (by removing several chapters).

If I keep all the packages ON, and keep all the book's chapters, the indexation stop working properly around a simple word in the text, in the middle of chapter 3 (there are 15 chapters in the whole book). All indexed words before that specific word are correctly indexed while all the indexed words after that specific word aren't (there's a systematic offset of 1 or 2 pages in the index).

What the hell is going on ?

It strongly feel like a bug to me, and I don't think the bug is in my code (?)
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: Problem with Index (packages conflicts ?)

Post by localghost »

Aren't there any hints in the log file? I'm afraid that if you don't manage to cut down the problem, it will continue to be theoretic.
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Problem with Index (packages conflicts ?)

Post by Cham »

I see several lines like this one in the log file :
Underfull \hbox (badness 10000) in paragraph at lines 192--197
I don't know what it means. :oops:

EDIT : Now, this is really weird. Removing a small part of the code in chapter 3 appears to solve the problem. The removed code doesn't contain any cross-references, labels or indexed word. It's just three big equations and I don't see what's wrong with them.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Problem with Index (packages conflicts ?)

Post by localghost »

Cham wrote:I see several lines like this one in the log file :
Underfull \hbox (badness 10000) in paragraph at lines 192--197
I don't know what it means. […]
These are warnings caused by improperly filled lines due to difficulties in hyphenation. The fontenc and microtype package may help here. The latter one makes utilizes the micro-typographic capabilities of PDFLaTeX. A remote diagnosis for the rest of your problem is nearly impossible as long as you can't track down the probable cause.
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Problem with Index (packages conflicts ?)

Post by Cham »

Now this is yet weirder : adding the microtype package appears to solve the issue ! Now, I don't understand anything. How many "obscur" packages should I load ?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Problem with Index (packages conflicts ?)

Post by localghost »

Cham wrote:[…] How many "obscur" packages should I load ?
In general it is recommended to load only those packages that are really needed. Less is more. So, if you find some packages that you don't use in your document, drop them.
Post Reply