当我插入\frontmatter
文档时LaTeX
,它会导致所有文本居中且字体错误。我使用的是 Legrand Orange Book 模板http://www.latextemplates.com/template/the-legrand-orange-book与 Scrivener 和TeXShop
。
我能够编译模板(尽管有一些错误),只要我省略\frontmatter
模板编译没有问题。
部分代码显示了我放置的位置\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.
答案1
我认为这个模板不适合使用\frontmatter
。
structure.tex
为了解决这个问题,请尝试用这种方式修改模板自带的文件。
替换以下行(出现两次,均替换)
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\startcontents
和
\ifnum \c@secnumdepth >\m@ne
\startcontents
以及以下内容(它们也出现了两次)
\end{tikzpicture}}\par\vspace*{230\p@}
\fi
\fi
}
和
\end{tikzpicture}}\par\vspace*{230\p@}
\fi
}
\mainmatter
显然,当您想要以编号章节开始时,请记住将其放在主文件中的某个位置。