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

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

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

Postby AntonVargas » Sun Sep 17, 2017 3:10 pm

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:

  1. % PAGE MARGINS
  2. \usepackage[
  3. top=3cm,
  4. bottom=3cm,
  5. left=3cm,
  6. right=3cm,
  7. headsep=10pt,
  8. paper=letterpaper,
  9. layout=letterpaper,
  10. ]{geometry}


How do I fix this, so that the part number and part title are on the same line, as they should be?

Tags:

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

Postby Vel » Sun Sep 17, 2017 4:04 pm

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: 3587
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Sun Sep 17, 2017 5:03 pm

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: 8
Joined: Wed Sep 13, 2017 10:31 am

Postby AntonVargas » Sun Sep 17, 2017 7:10 pm

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: 8
Joined: Wed Sep 13, 2017 10:31 am

Postby AntonVargas » Sun Sep 17, 2017 7:10 pm

Johannes_B wrote:Without knowing more, it is hard to give any advice.
Did you compile multiple times?


Oh yes!

AntonVargas
Posts: 8
Joined: Wed Sep 13, 2017 10:31 am

Postby AntonVargas » Sun Sep 17, 2017 8:56 pm

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:

  1. {\addvspace{12pt}\large\sffamily\bfseries}
  2. {\color{ocre!60}\contentslabel[\Large\thecontentslabel]{1.25cm}\color{ocre}} % Chapter number
  3. {\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...

  1. {
  2. \addvspace{12pt}
  3. \large
  4. \sffamily
  5. \bfseries
  6. }
  7. % Chapter number
  8. {
  9. \color{ocre!60}
  10. \contentslabel[
  11. \Large
  12. \thecontentslabel
  13. ]{1.25cm}
  14. \color{ocre}
  15. }
  16. {
  17. \color{ocre}
  18. }


...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: 8
Joined: Wed Sep 13, 2017 10:31 am

Postby AntonVargas » Sun Sep 17, 2017 9:05 pm

[OOPS! Double posted!]

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

Postby Vel » Mon Sep 18, 2017 4:42 pm

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


Return to “Theses, Books, Title pages”

Who is online

Users browsing this forum: No registered users and 1 guest