LaTeX forum ⇒ Theses, Books, Title pages\mainmatter corrupts indexes in Legrand Orange Book template Topic is solved

Classicthesis, Bachelor and Master thesis, PhD, Doctoral degree
NormanDunbar
Posts: 5
Joined: Fri Jul 07, 2017 3:05 pm
Location: Leeds
Contact:

\mainmatter corrupts indexes in Legrand Orange Book template

Postby NormanDunbar » Fri Jul 07, 2017 3:36 pm

Good Afternoon (UTC Timezone) all.

I have used the Legrand Orange Template to produce a book or two and so far so good. I'm seriously impressed by the quality of the finished book layout etc.

I have just noticed a foible, and as my download of the template was some years ago, I've updated to the current one, but the foible remains.

Basically, if I use \mainmatter in the book contents, my indexes are incorrect, as follows:

  • The TOC displays the correct page numbers and links correctly to the page in question.
  • the index entries list the correct page number too, but link to the physical page rather than the actual one.

So the TOC will show page 3, and link to the page numbered 3 - which is actually the 15th physical page in the book.

The index will show page 3 also, but will link to the page numbered iii which is the 3rd physical page in the completed book - and is slap bang in the middle of the TOC.

I have tested with and without \frontmatter, \mainmatter and \backmatter and the problem only occurs when \mainmatter is present.

I'm hopelessly inadequate at LaTeX I'm afraid, and while I've made a couple of changes to structure.tex to \usepackage{listings} and to set up defaults for the listings package, nothing much else has changed.

Any assistance gratefully received as I'd like to have my book in a "proper" format with roman numeral page numbering in the frontmatter etc. In the meantime, I need my indexes to work, so I've had to make do without the three \*matter commands.

Many thanks.

Cheers,
Norm.
Why do they put lightning conductors on churches?
How come Tarzan never grew a beard?

Tags:

User avatar
thomasb
Posts: 76
Joined: Thu Aug 03, 2017 10:54 am
Location: france

Postby thomasb » Sun Aug 06, 2017 12:03 am

(Hey, I'm too junior to answer but it's just to say I read your post...)

User avatar
Stefan Kottwitz
Site Admin
Posts: 8451
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Sun Aug 06, 2017 10:48 am

Hi Norman,

if you are still interested in finding a solution, let us know. (Perhaps you already solved it). Perhaps there was no answer because there was no code, and downloading the template and simulating the issue was a bit too much to do yet. ;-)

Stefan
Site admin

NormanDunbar
Posts: 5
Joined: Fri Jul 07, 2017 3:05 pm
Location: Leeds
Contact:

Postby NormanDunbar » Thu Sep 21, 2017 11:25 pm

Good Evening Stefan,

Sorry about the tardy response, I've just finished a contract, lots of work to handover to my replacement.

I'm afraid that I have not yet found a solution, I have downloaded the most recent template and reproduced the problem. If is definitely only a problem when \mainmatter is used.

I'll see about sorting out some demo code that reproduces the problem. I need to check the forum guidelines for submitting code first. I also want to be sure that I can reproduce it on Windows as well as Linux. Just in case.

Cheers,
Norm.
Why do they put lightning conductors on churches?
How come Tarzan never grew a beard?

User avatar
Vel
Site Moderator
Posts: 451
Joined: Fri Jun 29, 2012 1:20 am
Location: Sydney, Australia
Contact:

Postby Vel » Mon Oct 02, 2017 4:04 am

Hi Norm,

Don't have time to look into this but thought I'd pop in and say I'll update the template as soon as someone finds the solution!

Cheers,
Vel
Founder and administrator of LaTeXTemplates.com and LaTeXTypesetting.com

User avatar
Johannes_B
Site Moderator
Posts: 3549
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Mon Oct 02, 2017 7:38 am

A minimal working example would be nice to reproduce the reported behaviour.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

NormanDunbar
Posts: 5
Joined: Fri Jul 07, 2017 3:05 pm
Location: Leeds
Contact:

Postby NormanDunbar » Mon Oct 02, 2017 10:21 am

Morning All,

I should get a minimal example in the next few days.

Cheers,
Norm.
Why do they put lightning conductors on churches?
How come Tarzan never grew a beard?

NormanDunbar
Posts: 5
Joined: Fri Jul 07, 2017 3:05 pm
Location: Leeds
Contact:

Postby NormanDunbar » Thu Oct 05, 2017 2:50 pm

Good Afternoon All.

Here is the procedure to create the problem of \mainmatter corrupting index entries.


To run a full, clean build, I have found that the current instructions on lines 21 to 24 of main.tex need to be changed to indicate that the last step must be three separate executions of pdflatex main as running only two, results in the message LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.

  • pdflatex main
  • makeindex main.idx -s StyleInd.ist
  • biber main
  • pdflatex main
  • pdflatex main
  • pdflatex main

Open the generated main.pdf in a pdf reader and go to the index. The following bugs can now be seen:

  • Click on the first entry - "Citation" on page number 4. This takes you to the TOC on physical page 4 of 19 and not the page numbered 4 in the main document.
  • Clicking "Paragraphs of Text" on page 3 also takes you to the TOC on physical page 3 of 19 and again, not to the page numbered 3 in the main document.
  • Clicking "Lists" or any sub-entry of "Lists" all on page 4, takes you to physical page 4 and not to page number 4. Again, this is in the TOC.

Other entries in the index, which point to other pages do appear to work correctly. Definitions on page 5, Corollaries on page 6 etc are fine. It appears that any page number prior to page 5 has the problem. That might be a clue? Page 5 (as numbered, not physical page 5) happens to be the Part Heading page for Part 1. Maybe relevant?

If the added \mainmatter line is deleted, or commented out, and a full, clean, build is done again, then the index entries work correctly.

Hope this helps.

The testing was all done with the latest versions of the template, and the latest versions on texlive as installed using apt-get on Linux Mint 18.2:

  • pdflatex is pdfTeX 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian)
  • makeindex is makeindex, version 2.15 [TeX Live 2015]
  • biber is Biber 2.4

However, I have also had the same problems with the full texlive download available from https://www.tug.org/texlive/acquire-netinstall.html installed, in full, on a Centos 7 box. (That was at work, where I no longer am!)


Cheers,
Norm.
Why do they put lightning conductors on churches?
How come Tarzan never grew a beard?

User avatar
Johannes_B
Site Moderator
Posts: 3549
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Sun Oct 08, 2017 9:59 am

This behaviour is expected and you get several error in the log file. You need \frontmatter right before the title page.

The pages before mainmatter are having arabic numbers, even though they are not shown, they are numbered. mainmatter resets the page numbers, meaning you have the same page existing twice. This bugs out hyperref.

By the way, this would be a minimal working example to reproduce the issue. I don't like long descriptions and walkthroughs to reproduce a simple issue.

  1. \documentclass{book}
  2. \usepackage{hyperref}
  3. \begin{document}
  4. %\frontmatter% <- fix
  5. Hi Wombat\pageref{capybara}
  6. \mainmatter
  7. \chapter{Hi Capybara}\label{capybara}
  8. \end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

NormanDunbar
Posts: 5
Joined: Fri Jul 07, 2017 3:05 pm
Location: Leeds
Contact:

Postby NormanDunbar » Sun Oct 08, 2017 12:26 pm

Morning Johannes_B,

many thanks for your reply. I apologise for the lack of a decent (to you anyway) minimal example, reading yours doesn't seem to use the template so I was a tad confused at first - until I realised that you were simply demonstrating the problem another way. As I said, I'm hopelessly inadequate at LaTeX! (I'm an Oracle DBA.)

I had used \frontmatter, \mainmatter and \backmatter in my original document which was showing the problem, but using \frontmatter and \mainmatter together just in the template itself does indeed fix the problem. When I uncommented these commands, and \backmatter, from my own document, I still had the problem.

However, it seems that was down to me having \frontmatter in the wrong place. Once I moved it, it worked fine, and, as a bonus, no longer produces the error that I need to run pdflatex a third time to get the cross references right.

Many thanks.

Cheers,
Norm.
Why do they put lightning conductors on churches?
How come Tarzan never grew a beard?


Return to “Theses, Books, Title pages”

Who is online

Users browsing this forum: No registered users and 3 guests