Skip to content

Instantly share code, notes, and snippets.

@Harry-Chen
Last active Nov 23, 2018
Embed
What would you like to do?
XeLaTeX template for short novel (as book)
\documentclass[zihao=-4,oneside,UTF8]{ctexbook}
\usepackage{titlesec,fancyhdr,xltxtra,hyperxmp}
\usepackage[xetex,a4paper,centering,scale=0.8]{geometry}
\input{config.tex}
\xeCJKsetup{CheckSingle}
\pagestyle{fancy}
\setmainfont{\bookmainfont}
\setCJKmainfont[BoldFont=\bookboldfont,ItalicFont=\bookitalicfont]{\bookmainCJKfont}
\usepackage[bookmarksnumbered,
colorlinks=false,
linkcolor=blue]{hyperref}
\hypersetup{pdfauthor=\bookauthor,
pdftitle=\booktitle,
pdfsubject=\booksubject,
pdfkeywords=\bookkeywords,
pdfcopyright=\bookcopyright,
pdflicenseurl=\booklicenseurl,
pdfdate=\date
pdfdisplaydoctitle=true,
pdflang=\booklang,
pdfstartview=FitH}
\begin{document}
\titlespacing{\chapter}{0cm}{0cm}{1em}
\titleformat{\chapter}{\itshape\centering\Huge}{\chinese{chapter}}{1em} {}
\title{\fontsize{50pt}{50pt}\selectfont{\CJKfontspec{\booktitlefont} \booktitle}}
\author{
\fontsize{20pt}{50pt} \selectfont
\booksubject \\[0.5em]
\fontsize{20pt}{50pt} \selectfont
\bookauthor
\thanks{\bookthanks}
}
\date{\bookdate}
\maketitle
\frontmatter
\tableofcontents
%\thispagestyle{empty}
\mainmatter
\input{content.tex}
\backmatter
\end{document}
\newcommand{\booksubject}{}%Subject
\newcommand{\booktitle}{}%Title
\newcommand{\bookauthor}{}%Author
\newcommand{\bookthanks}{}%Thanks
\newcommand{\bookkeywords}{}%Keywords in metadata
\newcommand{\bookdate}{}%Date in title page
\newcommand{\booklang}{}%PDF language in metadata
\newcommand{\bookcopyright}{}%Copyright in metadata
\newcommand{\booklicenseurl}{}%License URL in metadata
\newcommand{\bookmainfont}{}%Main font for non-CJK characters
\newcommand{\bookmainCJKfont}{}%Main font for CJK characters
\newcommand{\bookboldfont}{}%Font for bold characters
\newcommand{\bookitalicfont}{}%Font for italic characters
\newcommand{\booktitlefont}{}%Font for title
%Add your content here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment