Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

When I insert \frontmatter into my LaTeX document, it causes all of the text to be centered and in the wrong font. I'm using a template called Legrand Orange Book http://www.latextemplates.com/template/the-legrand-orange-book with Scrivener and TeXShop.

I'm able to get the template to compile (albeit with some errors) as long as I leave out \frontmatter

The template compiles with no problems.

Working without \frontmatter

Not working because of \frontmatter

Partial code showing where I placed \frontmatter

\documentclass[11pt,fleqn]{book} % Default font size and left-justified equations

\usepackage[top=3cm,bottom=3cm,left=3.2cm,right=3.2cm,headsep=10pt,a4paper]{geometry} % Page margins

\usepackage{xcolor} % Required for specifying colors by name
\definecolor{ocre}{RGB}{243,102,25} % Define the orange color used for highlighting throughout the book

% Font Settings
\usepackage{avant} % Use the Avantgarde font for headings
%\usepackage{times} % Use the Times font for headings
\usepackage{mathptmx} % Use the Adobe Times Roman as the default text font together with math symbols from the Sym­bol, Chancery and Com­puter Modern fonts

\usepackage{microtype} % Slightly tweak font spacing for aesthetics
\usepackage[utf8]{inputenc} % Required for including letters with accents
\usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs

% Bibliography
\usepackage[style=alphabetic,sorting=nyt,sortcites=true,autopunct=true,babel=hyphen,hyperref=true,abbreviate=false,backref=true,backend=biber]{biblatex}
\addbibresource{bibliography.bib} % BibTeX bibliography file
\defbibheading{bibempty}{}

% Index
\usepackage{calc} % For simpler calculation - used for spacing the index letter headings correctly
\usepackage{makeidx} % Required to make an index
\makeindex % Tells LaTeX to create the files required for indexing

%----------------------------------------------------------------------------------------

\input{structure} % Insert the commands.tex file which contains the majority of the structure behind the template

\begin{document}
\frontmatter

%----------------------------------------------------------------------------------------
%   TITLE PAGE
%----------------------------------------------------------------------------------------

\begingroup
\thispagestyle{empty}
\AddToShipoutPicture*{\put(6,5){\includegraphics[scale=1]{background}}} % Image background
\centering
\vspace*{9cm}
\par\normalfont\fontsize{35}{35}\sffamily\selectfont
Commodore 64 Programming and Recollections\par % Book title
\vspace*{1cm}
{\Huge Kevin P. Kilburn}\par % Author name
\endgroup

%----------------------------------------------------------------------------------------
%   COPYRIGHT PAGE
%----------------------------------------------------------------------------------------

\newpage
~\vfill
\thispagestyle{empty}

\noindent Copyright \copyright\ 2013 Kevin P. Kilburn\\ % Copyright notice

\noindent \textsc{Published by Cold Stream Books}\\ % Publisher

\noindent \textsc{lorum ipsum}\\ % URL

\noindent Licensed under the Creative Commons Attribution-NonCommercial 3.0 Unported License (the ``License''). You may not use this file except in compliance with the License. You may obtain a copy of the License at \url{http://creativecommons.org/licenses/by-nc/3.0}. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \textsc{``AS IS'' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND}, either express or implied. See the License for the specific language governing permissions and limitations under the License.\\ % License information

\noindent \textit{First printing, March 2013} % Printing/edition date

%----------------------------------------------------------------------------------------
%   TABLE OF CONTENTS
%----------------------------------------------------------------------------------------

\chapterimage{chapter_head_1.pdf} % Table of contents heading image

\pagestyle{empty} % No headers

\tableofcontents % Print the table of contents itself

\cleardoublepage % Forces the first chapter to start on an odd page so it's on the right

\pagestyle{fancy} % Print headers again

\chapter{Preface}
\label{preface}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque tortor orci, ultricies ac adipiscing ac, mollis at dui. Vivamus placerat varius sapien. Integer malesuada porttitor nisi et lacinia. Pellentesque volutpat ornare nisi, vitae egestas odio suscipit non. In velit dui, pellentesque sed rhoncus vitae, bibendum et enim. Phasellus nulla sem, pharetra eu blandit sit amet, fringilla vulputate ante. Nullam porttitor convallis justo et ultricies. Sed diam dui, sodales id laoreet non, molestie non felis. Morbi mollis tortor ac lectus dapibus accumsan.

Praesent elit lectus, rutrum eget tempor eget, ullamcorper sed lectus. Nunc nibh orci, varius eu laoreet vitae, bibendum ac purus. Phasellus varius ultrices mi eget auctor. Proin justo sem, tempor sit amet malesuada quis, cursus feugiat magna. Phasellus diam leo, auctor pharetra eleifend vitae, tristique et mauris. Cras molestie iaculis dolor, et rhoncus mauris accumsan id. Quisque et est in nisi interdum tincidunt eu eget nulla. Vivamus posuere ligula in risus auctor nec feugiat magna posuere. Donec adipiscing, lorem non dictum aliquam, massa arcu pretium lorem, vel volutpat orci dolor quis urna. Phasellus vestibulum nunc non ante semper ullamcorper. Integer rutrum leo non neque euismod tincidunt. Donec ut eros non turpis feugiat dapibus a vitae velit.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque tortor orci, ultricies ac adipiscing ac, mollis at dui. Vivamus placerat varius sapien. Integer malesuada porttitor nisi et lacinia. Pellentesque volutpat ornare nisi, vitae egestas odio suscipit non. In velit dui, pellentesque sed rhoncus vitae, bibendum et enim. Phasellus nulla sem, pharetra eu blandit sit amet, fringilla vulputate ante. Nullam porttitor convallis justo et ultricies. Sed diam dui, sodales id laoreet non, molestie non felis. Morbi mollis tortor ac lectus dapibus accumsan.
share|improve this question
    
You can post links to uploaded images. Someone with the edit privilege will re-embed the image. –  Werner Jul 20 '13 at 5:30

1 Answer 1

up vote 4 down vote accepted

I don't think this template is done for using a \frontmatter.

To solve the problem, try to modify the file structure.tex that comes with the template in this way.

Substitute the following lines (they appear twice, substitute both)

\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\startcontents

with

\ifnum \c@secnumdepth >\m@ne
\startcontents

and the following (they, too, appear twice)

\end{tikzpicture}}\par\vspace*{230\p@}
\fi
\fi
}

with

\end{tikzpicture}}\par\vspace*{230\p@}
\fi
}

Obviously remember to put \mainmatter somewhere in your main file when you want to begin with numbered chapters.

share|improve this answer
    
Is it a problem with the template or was it just not designed to work with \frontmatter? Shouldn't \frontmatter override what's in the template? –  Kevin P. Kilburn Jul 20 '13 at 15:26
1  
@KevinP.Kilburn I think it is not designed to work with \frontmatter, because it seems to require all the stuff in the \mainmatter. –  karlkoeller Jul 20 '13 at 15:35
    
I'm trying it now and will let you know. I was away from my computer that has MacTeX on it. –  Kevin P. Kilburn Jul 20 '13 at 22:17
    
Seems to work. I still have some other errors, but I think I can work through them. They don't seem to affect the final product. Thanks for the help. If you don't mind, could you explain why this worked? –  Kevin P. Kilburn Jul 21 '13 at 0:29
1  
@KevinP.Kilburn In regards of XeLaTeX, it works fine for me. In regards of the first question, the explanation is: I've removed a statement \if@mainmatter...\fi that executes that code only if you are inside \mainmatter. Also \fi was used after the block starting with {\centering was closed, so the block was never closed and the text continued to be centered. Removing that, the code doesn't check if you are in the \mainmatter anymore. –  karlkoeller Jul 21 '13 at 6:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.