LaTeX forum ⇒ Theses, Books, Title pagesFrontmatter, Mainmatter, etc in Legrand Orange Book Template

Classicthesis, Bachelor and Master thesis, PhD, Doctoral degree
jworkerbee2
Posts: 3
Joined: Tue Apr 21, 2015 5:33 pm

Frontmatter, Mainmatter, etc in Legrand Orange Book Template

Postby jworkerbee2 » Tue Apr 21, 2015 11:11 pm

Re: Frontmatter, Mainmatter, Headers, etc, and the Book Design in Legrand Orange Book Template

I have been having some problems adapting this intriguing template. I must not understand some of structure.tex logic, especially around fancyhdr. Most attempts do not do what I want and changes often seem "fragile." (The seemingly obvious and simple tweaks from documentation and web fail to do what I want or break something else.)

Rather than us spending time discussing how to debug and hack, *perhaps* it might be more efficient to start conversation with two possible requests. At least, these illustrate some underlying issues.

The FIRST suggestion/request might be to add the following standard book class features into a version of the template:
- \frontmatter,
- *perhaps* with a sample Preface and/or Acknowledgements "chapter"
- \mainmatter,
- (your current chapters)
- \appendix,
- *perhaps* with an sample appendix,
- (bibliography),
- \backmatter,
- (index)

Adding these book class features would, I think, help many users obtain the "expected" book typography from the beginning. These /*matter commands are supposed to do the typographically-right thing for most usages and users in re the page numbering, chapter numbering, and placement in the TOC of different content for "real-world" books. If someone disagrees, it is possible to find hacks and tweaks around these common commands.

Now as to a problem trying to get the behavior I expected with this template.... When I added a frontmatter "Preface" to this template and it overflowed on to a second page the header came up with a "Chapter 0." Worse, a test with another two page frontmatter also showed up with a second "Chapter 0." This lack of frontmatter chapter numbering is the *intended* typographical behavior for frontmatter, but the "Chapter 0" header display seems an unintended error of this template. Also the nice pictorial design for starting mainmatter chapters seems major overkill for these shorter frontmatter topics. All my attempts to tweak this to a plainer style failed in some way.

The SECOND request is to *EITHER* add four commands *OR* to give me pointers on how I might hack them myself.

I would like four commands defined in a structure.tex, each of which are "twinned" with the four \*matter commands in main.tex. (I suppose one could redefine the std *matter commands, but that seems to add more complexity and less flexibility for neophyte hackers than keeping them separate.)

These new functions are as follows:
1) \stylefrontmatter
EDITED--> I changed proposed command names--In case someone is interested in working together on this, I have placed four placeholder commands with these names in my files, but will not have time to tweak them for awhile. <--

This would initiate a very plain header with no chapter or section numbers but with page numbers (note, roman page numbering is expected). Probably best to also avoid the chapter/section names in running headers, as most frontmatter chapters should be pretty short. The design for each "chapter start" should be smaller and simpler (i.e. just orange chapter font, no chapterpicture and minitoc)

2) \stylemainmatter
This initiates the current design with the usual chapter numbering.

3) \styleappendix Perhaps similar to mainmatter, but in testing note that letters are used for appendix chapter numbers. (Users who want to simplify the chapter start or header might be able to tweak its definition to look more like \legrandfrontmatter?)

4) \stylebackmatter Perhaps similar to mainmatter, except that after invoking this command, headers should turn off the chapter/section numbers, as chapter numbering is turned off in backmatter.

Thanks for the current template and any suggestions you might make!
I apologize for the length!
Last edited by jworkerbee2 on Wed Apr 22, 2015 3:55 pm, edited 1 time in total.

Tags:

jworkerbee2
Posts: 3
Joined: Tue Apr 21, 2015 5:33 pm

Postby jworkerbee2 » Wed Apr 22, 2015 3:04 pm

BTW, for new users and in the absence of an improved template,
one could hack \frontmatter sections with something like
  1. \chapter*{Preface}
  2. \addcontentsline{toc}{chapter}{\textcolor{ocre}{Preface}}
(note asterisk in [cmd]chapter*{}[/cmd] -this is an alternative to skip chapter numbering found in frontmatter)

HOWEVER, two page or longer appendices may not be fixable this way (the header may simply repeat the name of last numbered chapter.)

MOREOVER, this little hack will not actually do the exact right thing for frontmatter. For example, the usual convention, AFAIK, is that frontmatter should be paged with roman numerals and page numbering should begin again with an arabic 1 when you start with a mainmatter chapter. It is this sort of thing that the missing book class /*matter commands handle implicitly.

I still believe the template could be useful for longer books, but only when it --or a hack of it--takes advantage of the standard features of the book class and extends the concept in the page styling.

jworkerbee2
Posts: 3
Joined: Tue Apr 21, 2015 5:33 pm

Postby jworkerbee2 » Thu Apr 23, 2015 2:17 am

I think I actually solved *part* of my own problem with this otherwise great template...

If anyone is interested in some alternative code that implements some mainmatter and other matter-aware book class features in this template here are code snippets.

The snippets may need adjusting for your taste or debugging! I have not used fancyhdr before!

Add the first four snippets in main.tex

Add before the table of contents

  1. %----------------------------------------------------------------------------------------
  2. \frontmatter% Sets up frontmatter. eg. TOC, Preface, Dedication, Acknowlegements, or similar
  3. \pagestyle{frontmatter}% frontmatter page style
  4. % \addtocontents{toc}{\protect\addvspace{20pt}\color{ocre}\hrule\protect\addvspace{10pt}}
  5. %----------------------------------------------------------------------------------------


Add before the main content chapters.
Note there are two possible pagestyles here. Just comment out the one the one you do not want.

  1. %----------------------------------------------------------------------------------------
  2. \mainmatter% Sets up main book content
  3. %\pagestyle{mainmatterprint}% mainmatter page style--assumes 2sided content for 2-sided printing
  4. \pagestyle{mainmatterebook}% alternate "ebook" mainmatter page style--assumes a recto/verso header layout is NOT desired
  5. % \addtocontents{toc}{\protect\addvspace{20pt}\color{ocre}\hrule\protect\addvspace{10pt}}
  6. %----------------------------------------------------------------------------------------


Add before appendices or the bibliography

  1. %----------------------------------------------------------------------------------------
  2. \appendix% Sets up appendix
  3. \pagestyle{appendix}% appendix page style
  4. %\addtocontents{toc}{\protect\addvspace{20pt}\color{ocre}\hrule\protect\addvspace{10pt}}
  5. \part{Supporting Materials}
  6. %----------------------------------------------------------------------------------------


Add before index

  1. %----------------------------------------------------------------------------------------
  2. \backmatter% Sets up backmatter
  3. \pagestyle{backmatter}% \backmatter page style
  4. % \addtocontents{toc}{\protect\addvspace{20pt}\color{ocre}\hrule\protect\addvspace{10pt}}
  5. %----------------------------------------------------------------------------------------


Lastly, replace some of the Page headers section in structure.tex file with this.
  1. %-----------------------------------------------------------------------------------
  2. % PAGE HEADERS
  3. %----------------------------------------------------------------------------------------
  4.  
  5. \usepackage{fancyhdr} % Required for header and footer configuration
  6.  
  7. \renewcommand{\chaptermark}[1]{\markboth{\sffamily\normalsize\bfseries\chaptername\ \thechapter.\ #1}{}} % Chapter text font settings
  8. \renewcommand{\sectionmark}[1]{\markright{\sffamily\normalsize\thesection\hspace{5pt}#1}{}} % Section text font settings
  9.  
  10. \fancyhf{} % clears prior
  11. \pagestyle{fancy}
  12.  
  13. \fancypagestyle{frontmatter}{%
  14. \fancyhf{}% Clear header/footer
  15. \renewcommand{\headrulewidth}{0pt}% No header rule
  16. \renewcommand{\footrulewidth}{0pt}% No footer rule
  17. \fancyfoot[C]{\sffamily\normalsize\thepage}% ?? Don't you want consistent page number appearance, even in first page of chapters ??
  18. }
  19.  
  20. \fancypagestyle{mainmatterprint}{%
  21. \fancyhf{}% Clear header/footer
  22. \renewcommand{\headrulewidth}{.4pt}% Header rule
  23. \renewcommand{\footrulewidth}{0pt}% Footer rule
  24. \fancyfoot[C]{\sffamily\normalsize\thepage}% ??Consistent page # appearance, even in first page of chapters
  25. %\fancyhead[C]{\leftmark}% Chapter in center
  26. %\fancyhead[LE,RO]{\sffamily\normalsize\thepage} % Font setting for the page number in the header
  27. \fancyhead[LO]{\rightmark} % Print the nearest section name on the left side of odd pages
  28. \fancyhead[RE]{\leftmark} % Print the current chapter name on the right side of even pages
  29. \addtolength{\headheight}{2.5pt} % Increase the spacing around the header slightly
  30. }
  31.  
  32. \fancypagestyle{mainmatterebook}{%
  33. \fancyhf{}% Clear header/footer
  34. \renewcommand{\headrulewidth}{.4pt}% Header rule
  35. \renewcommand{\footrulewidth}{0pt}% Footer rule
  36. \fancyfoot[C]{\sffamily\normalsize\thepage}% ?? Consistent page # appearance, even in first page of chapters
  37. % \fancyhead[R]{\rightmark} % Print the nearest section name
  38. \fancyhead[R]{\leftmark} % Print the current chapter name
  39. \addtolength{\headheight}{2.5pt} % Increase the spacing around the header slightly
  40. }
  41. \fancypagestyle{appendix}{%
  42. \fancyhf{}% Clear header/footer
  43. \renewcommand{\headrulewidth}{.4pt}% Header rule
  44. \renewcommand{\footrulewidth}{0pt}% Footer rule
  45. \fancyfoot[C]{\sffamily\normalsize\thepage}% ?? Consistent page # appearance, even in first page of chapters
  46. \renewcommand\chaptername{Appendix}
  47. \fancyhead[R]{\leftmark} % Print the current chapter name
  48. \addtolength{\headheight}{2.5pt} % Increase the spacing around the header slightly
  49. }
  50.  
  51. \fancypagestyle{backmatter}{%
  52. \fancyhf{}% Clear header/footer
  53. \renewcommand{\headrulewidth}{0pt}% header rule
  54. \renewcommand{\footrulewidth}{0pt}% footer rule
  55. \fancyfoot[C]{\sffamily\normalsize\thepage}% Consistent page # apperance, even in first page of chapters
  56. }
  57.  
  58. %%% Commented this out because, ?? don't you want consistent page number appearance, even in first page of chapters ??
  59. %\fancypagestyle{plain}{ %
  60. %\fancyhf{} % remove everything
  61. %\renewcommand{\headrulewidth}{0pt} % remove lines as well
  62. %\renewcommand{\footrulewidth}{0pt}
  63. %}
  64. %%%%%% DELETE TO THE FOLLOWING
  65. % Removes the header from odd empty pages at the end of chapters....

User avatar
Stefan Kottwitz
Site Admin
Posts: 8980
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Thu Apr 23, 2015 8:45 am

Thank you very much for your information!

I followed your question and your solution. I just had not time to try it myself yet. It may help many other people who would be using this nice template.

Stefan
Site admin

User avatar
Vel
Site Moderator
Posts: 454
Joined: Fri Jun 29, 2012 1:20 am

Postby Vel » Thu Apr 23, 2015 3:55 pm

Thanks for your feedback jworkerbee2!

I've sent you a private message about implementing your changes in the current version of the template and emailing me the update with some justification for the changes. I'm then happy to update the version on the website to include your changes.

The same goes for anyone else who would like to improve a template on LaTeX Templates.

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

khaaba
Posts: 2
Joined: Thu Sep 17, 2015 9:35 pm

Postby khaaba » Fri Feb 26, 2016 3:27 am

Can you please upload here the complete modified structure.tex file so that I can give a try and look on it myself? I have been trying to start table of content page, and the start of every chapter page on EVEN pages keeping in mind the binding margin but of no success till now.

In fact, I want to FORCE start tableofcontent, chapters on EVEN PAGES.

User avatar
Stefan Kottwitz
Site Admin
Posts: 8980
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Fri Feb 26, 2016 10:08 am

Hi khaaba,

welcome to the forum!

khaaba wrote:In fact, I want to FORCE start tableofcontent, chapters on EVEN PAGES.


So, just to be sure: chapters shall start at a left hand page? I ask, because this is very uncommon (even means left hand).

Stefan
Site admin

khaaba
Posts: 2
Joined: Thu Sep 17, 2015 9:35 pm

Postby khaaba » Sat Feb 27, 2016 3:32 am

Hi Stefan,
Thank you for the warm welcome. Actually I want to have the first of TOC and the Chapter One[this chapter only] to start at even page number [right hand side] in book class. First pages of other chapters may start as it may come.

So far, I could force start all first pages of TOC, Chapters at even page number as suggested by Tauhami in his code:

% Force TOC, Chapters to start at EVEN page numbers
\makeatletter
\renewcommand\chapter{\clearpage
\ifodd\c@page\null\thispagestyle{empty}% or plain
\newpage\fi
\thispagestyle{plain}%
\global\@topnum\z@
\@afterindentfalse
\secdef\@chapter\@schapter}
\makeatother

Can you please suggest me to start the page at even page number [right hand side] only for the first page of TOC and Chapter 1, and the rest as it may come?

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

Postby Johannes_B » Sat Feb 27, 2016 9:02 am

The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.


Return to “Theses, Books, Title pages”

Who is online

Users browsing this forum: No registered users and 2 guests