Theses, Books, Title pagesLegrand Orange Book: Changing from A4 to Letter messes up TOC

Classicthesis, Bachelor and Master thesis, PhD, Doctoral degree
Post Reply
AntonVargas
Posts: 9
Joined: Wed Sep 13, 2017 10:31 am

Legrand Orange Book: Changing from A4 to Letter messes up TOC

Post by AntonVargas »

I changed the paper size in the Legrand Orange Book template from A4 to Letter, and as a result the table of contents part number (the big Roman numeral) was moved from the left of the part name to above it, as can be seen here:

Image
https://imgur.com/a/S24xx

The relevant section of structure.tex is as follows:

Code: Select all

% PAGE MARGINS
\usepackage[
	top=3cm,
	bottom=3cm,
	left=3cm,
	right=3cm,
	headsep=10pt,
	paper=letterpaper,
	layout=letterpaper,
]{geometry}
How do I fix this, so that the part number and part title are on the same line, as they should be?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Vel
Site Moderator
Posts: 463
Joined: Fri Jun 29, 2012 1:20 am

Legrand Orange Book: Changing from A4 to Letter messes up TOC

Post by Vel »

Hi Anton,

Starting with a fresh copy of the template, I've replaced the first coding line of structure.tex that specifies geometry with your command and I can't reproduce the problem. Perhaps you've modified something else that's causing it?

Cheers,
Vel
Founder and administrator of LaTeXTemplates.com and LaTeXTypesetting.com
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Legrand Orange Book: Changing from A4 to Letter messes up TOC

Post by Johannes_B »

Without knowing more, it is hard to give any advice.
Did you compile multiple times?
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
AntonVargas
Posts: 9
Joined: Wed Sep 13, 2017 10:31 am

Legrand Orange Book: Changing from A4 to Letter messes up TOC

Post by AntonVargas »

Vel wrote:Starting with a fresh copy of the template, I've replaced the first coding line of structure.tex that specifies geometry with your command and I can't reproduce the problem. Perhaps you've modified something else that's causing it?
Thanks for the response, Vel. I've modified structure.tex extensively at this point -- not only have I added packages and configurations and such, but I painstakingly reformatted the entire file because I simply can't make heads or tails of the original version. So that makes it hard to figure out where the problem is!

But assuming that something did happen to my structure.tex, I've started with the original again and am replacing it bit by bit with the contents of my customized version. At this point the TOC problem is fixed, apparently -- the numbers and titles appear on the same line. The hyperlink boxes only extend to the right of the part title, though, rather than to the extreme right of the colored boxes. Can you confirm that this is the right behavior?

Now I have to keep going in order to restore the formatting I had changed. For example, the Roman numerals VII and VIII on the top left of the part title pages run off past the left edge of the page.
AntonVargas
Posts: 9
Joined: Wed Sep 13, 2017 10:31 am

Legrand Orange Book: Changing from A4 to Letter messes up TOC

Post by AntonVargas »

Johannes_B wrote:Without knowing more, it is hard to give any advice.
Did you compile multiple times?
Oh yes!
AntonVargas
Posts: 9
Joined: Wed Sep 13, 2017 10:31 am

Legrand Orange Book: Changing from A4 to Letter messes up TOC

Post by AntonVargas »

As a note to anyone else dealing with these kinds of issues, I've been re-reformatting structure.tex and recompiling my document after every couple changes, and I've realized something that I've never seen mentioned elsewhere: LaTeX syntax is incredibly fragile, even compared to a language like Python, where white space is actually semantic.

For example, the following original code produces (part of) the TOC formatting in the Legrand template:

Code: Select all

{\addvspace{12pt}\large\sffamily\bfseries}
{\color{ocre!60}\contentslabel[\Large\thecontentslabel]{1.25cm}\color{ocre}} % Chapter number
{\color{ocre}}
And frankly, it almost looks like it's been obfuscated! It's very, very hard to browse such code in order to find out where various things are done and modify them.

But if you reformat the code in order to simply separate elements from each other...

Code: Select all

{
    \addvspace{12pt}
    \large
    \sffamily
    \bfseries
}
% Chapter number
{
    \color{ocre!60}
    \contentslabel[
        \Large
        \thecontentslabel
    ]{1.25cm}
    \color{ocre}
}
{
    \color{ocre}
}
...then by doing nothing more than inserting some line breaks and tabs, the code breaks in half a dozen ways -- justification, spacing and other things get all messed up!

In fact, LaTeX code is so fragile that I've completely borked files by doing nothing more than deleting a single % sign that was sitting alone on a line.

So let that be a warning to other LaTeX newbies -- this is not a robust langauge! Now that I know this, I can try and take the appropriate precautions, but there are undoubtedly tons of landmines that I've yet to stumble upon.
AntonVargas
Posts: 9
Joined: Wed Sep 13, 2017 10:31 am

Legrand Orange Book: Changing from A4 to Letter messes up TOC

Post by AntonVargas »

[OOPS! Double posted!]
User avatar
Vel
Site Moderator
Posts: 463
Joined: Fri Jun 29, 2012 1:20 am

Legrand Orange Book: Changing from A4 to Letter messes up TOC

Post by Vel »

Yeah, it's certainly not a modern language and the fragility arises due to you adding line breaks, which are interpreted. The typical solution is, when you are breaking up code into lines for readability, to put % at the end of each line (without a space before it). This will ensure no newline is interpreted before the next line so the code behaves as if it was on one line. This doesn't look very pretty though which annoys me but it's either that or putting everything on one line.

If you want to know a lot more about this, have a read here: https://tex.stackexchange.com/questions ... d-of-lines

By the way, if you think you're making improvements to the template that would benefit other users, send them my way and I'll have a look. If you could make it obvious what each change is and what it does rather than sending 100 at once that would be much more helpful :)
Founder and administrator of LaTeXTemplates.com and LaTeXTypesetting.com
Post Reply