I'm getting what appears to be a common error, but I can't figure out how to fix it. I have the following document, which I'm processing using xelatex.
\documentclass[12pt,english,oldfontcommands,openright]{memoir}
% For setting line height of individual blocks of text
\DisemulatePackage{setspace}
\usepackage{setspace}
% Select Font
%\usepackage{charter}
% Use GNU FreeSerif Font
\usepackage{fontspec}
% Great font for title page and chapter headings, but not the rest
\newfontfamily\headingfont{Quicksand-Regular.ttf}[
Path = fonts/,
BoldFont = Quicksand-Bold.ttf,
ItalicFont = Quicksand-Regular.ttf,
BoldItalicFont = Quicksand-Bold.ttf
]
\usepackage{titlesec}
\titleformat{\chapter}[display]
{\headingfont\centering}{\thechapter}{}{\Huge\textbf}
% Main text will be typeset in this font
\setmainfont{GaramondNo8-Reg.ttf}[
Path = fonts/,
BoldFont = GaramondNo8-Med.ttf,
ItalicFont = GaramondNo8-Ita.ttf,
BoldItalicFont = GaramondNo8-MedIta.ttf
]
\renewcommand{\familydefault}{\rmdefault}
%showframe option VERY USEFUL for debugging!
\usepackage[xetex,paperwidth=7in,paperheight=10in,includehead,includefoot]{geometry}
% lmargin = inner, rmargin = outer
\geometry{verbose,tmargin=0.5in,bmargin=0.5in,lmargin=0.5in,rmargin=0.5in,headheight=18pt,headsep=0.25in,footskip=0.5in}
% In addition to paperwidth and paperheight in the geometry package setting,
% I need to set the stock size, a command defined by the memoir class, to actually
% change the physical page size to something custom.
\setstocksize{10in}{7in}
\setcounter{chapter}{0}
\setcounter{tocdepth}{0}
\usepackage{textcomp}
\usepackage{graphicx}
\usepackage{sidecap}
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{microtype} % reduce amount of unnecessary and broken hyphenation
\usepackage{lettrine}
\renewcommand{\LettrineTextFont}{\rmfamily} % text following drop cap lowercase
\let\footruleskip\undefined % make memoir ignore fancyhead method
\usepackage{fancyhdr}
\fancypagestyle{fancyfacing}{
\fancyhead{} %clear head
\fancyfoot{} % clear foot
\fancyfoot[CO]{\headingfont\thepage}
\fancyfoot[CE]{\headingfont\thepage}
\fancyhead[CE]{\itshape Title}
\fancyhead[CO]{\itshape Athor}
\renewcommand{\headrulewidth}{0pt} %hide header rule
}
% Redefine the plain page style for chapters
\fancypagestyle{plain}{
\fancyhead{} %clear head
\fancyfoot{} % clear foot
\fancyfoot[CO]{\thepage}
\fancyfoot[CE]{\thepage}
\renewcommand{\headrulewidth}{0pt} %hide header rule
}
% \renewcommand*{\printchapternonum}{\centering} % alternative centre chapter
\renewcommand\chaptitlefont{\centering\normalfont\huge\bfseries\noindent} %center chapter titles
\setlength{\pfbreakskip}{\baselineskip} % make pfbreak one line space height
\setlength{\parskip}{0pt} %gap between paras same as line space
\setlength{\parsep}{0pt} %gap between paras same as line space
\makeatother
\usepackage{babel}
\begin{document}
\frontmatter
\pagestyle{empty}
\vspace*{\stretch{1}}
% Have an extra blank page at the beginning of the book.
\newpage{}
\vspace*{\stretch{1}}
\newpage{}
% Title page
\include{include/titlepage}
\newpage{}
% Copyright page
\include{include/copyright}
\newpage{}
% Insert extra blank page
\newpage{}
\vspace*{\stretch{1}}
\newpage{}
\clearpage{}
\mainmatter
\pagestyle{fancyfacing}
\chapter{Chapter name}
Some text for the chapter
\pagestyle{empty}
% Skip a page so that we start on the right again
\newpage{}
\vspace*{\stretch{1}}
\newpage{}
% Insert extra blank page (both sides)
\newpage{}
\vspace*{\stretch{1}}
\newpage{}
\end{document}
I'm getting the following error:
! Missing number, treated as zero.
<to be read again>
\relax
l.1 \chapter{Chapter Name}
If I use \chapter*{Chapter Name} instead of \chapter{Chapter Name}, I don't get that error, but unfortunately I need to generate a table of contents, so I need my chapters to be numbered.
Any help figuring out where this error is coming from would be greatly appreciated! :)
titlesec
is the culprit here). Also, eliminate everything not relevant to the problem, so the document compiles. Fonts, definitions for fancy headers etc. are not relevant here -- and I got lots of errors before getting to your error message because your document requires fonts I don't have installed. Anyway, I'll try to come up with a solution, might take some time, though. :-)titlesec
: "Unfortunately, it is not compatible with memoir, which provides its own tools with a limited subset of the features available intitlesec."