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

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

Frontmatter, Mainmatter, etc in Legrand Orange Book Template

Post by jworkerbee2 »

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.

Recommended reading 2024:

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

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

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

Frontmatter, Mainmatter, etc in Legrand Orange Book Template

Post by jworkerbee2 »

BTW, for new users and in the absence of an improved template,
one could hack \frontmatter sections with something like

Code: Select all

\chapter*{Preface}
 \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

Frontmatter, Mainmatter, etc in Legrand Orange Book Template

Post by jworkerbee2 »

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

Code: Select all

%----------------------------------------------------------------------------------------
\frontmatter% Sets up frontmatter. eg. TOC, Preface, Dedication, Acknowlegements, or similar 
\pagestyle{frontmatter}% frontmatter page style
% \addtocontents{toc}{\protect\addvspace{20pt}\color{ocre}\hrule\protect\addvspace{10pt}}
%----------------------------------------------------------------------------------------
Add before the main content chapters.
Note there are two possible pagestyles here. Just comment out the one the one you do not want.

Code: Select all

%----------------------------------------------------------------------------------------
\mainmatter% Sets up main book content 
%\pagestyle{mainmatterprint}% mainmatter page style--assumes 2sided content for 2-sided printing
\pagestyle{mainmatterebook}% alternate "ebook" mainmatter page style--assumes a recto/verso header layout is NOT desired 
% \addtocontents{toc}{\protect\addvspace{20pt}\color{ocre}\hrule\protect\addvspace{10pt}}
%----------------------------------------------------------------------------------------
Add before appendices or the bibliography

Code: Select all

%----------------------------------------------------------------------------------------
\appendix% Sets up appendix 
\pagestyle{appendix}% appendix page style
%\addtocontents{toc}{\protect\addvspace{20pt}\color{ocre}\hrule\protect\addvspace{10pt}}
\part{Supporting Materials}
%----------------------------------------------------------------------------------------
Add before index

Code: Select all

%----------------------------------------------------------------------------------------
\backmatter% Sets up backmatter 
\pagestyle{backmatter}% \backmatter page style
% \addtocontents{toc}{\protect\addvspace{20pt}\color{ocre}\hrule\protect\addvspace{10pt}}
%----------------------------------------------------------------------------------------
Lastly, replace some of the Page headers section in structure.tex file with this.

Code: Select all

%-----------------------------------------------------------------------------------
%	PAGE HEADERS
%----------------------------------------------------------------------------------------

\usepackage{fancyhdr} % Required for header and footer configuration

\renewcommand{\chaptermark}[1]{\markboth{\sffamily\normalsize\bfseries\chaptername\ \thechapter.\ #1}{}} % Chapter text font settings
\renewcommand{\sectionmark}[1]{\markright{\sffamily\normalsize\thesection\hspace{5pt}#1}{}} % Section text font settings

\fancyhf{} % clears prior 
\pagestyle{fancy}

\fancypagestyle{frontmatter}{%
  \fancyhf{}% Clear header/footer
  \renewcommand{\headrulewidth}{0pt}% No header rule
  \renewcommand{\footrulewidth}{0pt}% No footer rule
  \fancyfoot[C]{\sffamily\normalsize\thepage}%  ?? Don't you want consistent page number appearance, even in first page of chapters ??
}

\fancypagestyle{mainmatterprint}{%
  \fancyhf{}% Clear header/footer
	\renewcommand{\headrulewidth}{.4pt}% Header rule
  \renewcommand{\footrulewidth}{0pt}% Footer rule
  \fancyfoot[C]{\sffamily\normalsize\thepage}% ??Consistent page # appearance, even in first page of chapters
  %\fancyhead[C]{\leftmark}% Chapter in center
	%\fancyhead[LE,RO]{\sffamily\normalsize\thepage} % Font setting for the page number in the header
  \fancyhead[LO]{\rightmark} % Print the nearest section name on the left side of odd pages
  \fancyhead[RE]{\leftmark} % Print the current chapter name on the right side of even pages
  \addtolength{\headheight}{2.5pt} % Increase the spacing around the header slightly
}

\fancypagestyle{mainmatterebook}{%
  \fancyhf{}% Clear header/footer
	\renewcommand{\headrulewidth}{.4pt}% Header rule
  \renewcommand{\footrulewidth}{0pt}% Footer rule
  \fancyfoot[C]{\sffamily\normalsize\thepage}% ?? Consistent page # appearance, even in first page of chapters
%  \fancyhead[R]{\rightmark} % Print the nearest section name
  \fancyhead[R]{\leftmark} % Print the current chapter name
  \addtolength{\headheight}{2.5pt} % Increase the spacing around the header slightly
}
\fancypagestyle{appendix}{%
  \fancyhf{}% Clear header/footer
  \renewcommand{\headrulewidth}{.4pt}% Header rule
  \renewcommand{\footrulewidth}{0pt}% Footer rule
  \fancyfoot[C]{\sffamily\normalsize\thepage}% ?? Consistent page # appearance, even in first page of chapters
  \renewcommand\chaptername{Appendix}
	\fancyhead[R]{\leftmark} % Print the current chapter name
  \addtolength{\headheight}{2.5pt} % Increase the spacing around the header slightly
 }

\fancypagestyle{backmatter}{%
  \fancyhf{}% Clear header/footer
  \renewcommand{\headrulewidth}{0pt}% header rule
  \renewcommand{\footrulewidth}{0pt}% footer rule
  \fancyfoot[C]{\sffamily\normalsize\thepage}% Consistent page # apperance, even in first page of chapters
}

%%% Commented this out because, ?? don't you want consistent page number appearance, even in first page of chapters ??
%\fancypagestyle{plain}{ %
  %\fancyhf{} % remove everything
  %\renewcommand{\headrulewidth}{0pt} % remove lines as well
  %\renewcommand{\footrulewidth}{0pt}
%}
%%%%%% DELETE TO THE FOLLOWING
% Removes the header from odd empty pages at the end of chapters....
User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Re: Frontmatter, Mainmatter, etc in Legrand Orange Book Temp

Post by Stefan Kottwitz »

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
LaTeX.org admin
User avatar
Vel
Site Moderator
Posts: 463
Joined: Fri Jun 29, 2012 1:20 am

Re: Frontmatter, Mainmatter, etc in Legrand Orange Book Temp

Post by Vel »

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

Re: Frontmatter, Mainmatter, etc in Legrand Orange Book Temp

Post by khaaba »

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: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Frontmatter, Mainmatter, etc in Legrand Orange Book Template

Post by Stefan Kottwitz »

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
LaTeX.org admin
khaaba
Posts: 2
Joined: Thu Sep 17, 2015 9:35 pm

Re: Frontmatter, Mainmatter, etc in Legrand Orange Book Temp

Post by khaaba »

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

Frontmatter, Mainmatter, etc in Legrand Orange Book Template

Post by Johannes_B »

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