我怎样才能获得由
\documentclass{tufte-book}
\author{An author}
\title{A title}
\publisher{A publisher}
\begin{document}
\maketitle
\end{document}
在使用标准book
类时?我尝试复制粘贴 tufte-book 标题页的代码,它是
\newcommand{\maketitlepage}[0]{%
\cleardoublepage%
{%
\sffamily%
\begin{fullwidth}%
\fontsize{18}{20}\selectfont\par\noindent\textcolor{darkgray}{\allcaps{\thanklessauthor}}%
\vspace{11.5pc}%
\fontsize{36}{40}\selectfont\par\noindent\textcolor{darkgray}{\allcaps{\thanklesstitle}}%
\vfill%
\fontsize{14}{16}\selectfont\par\noindent\allcaps{\thanklesspublisher}%
\end{fullwidth}%
}
\thispagestyle{empty}%
\clearpage%
}
但该命令\allcaps
未在书籍类中定义。此外,字体似乎与标准 Computer Modern 不同。
有任何想法吗?
答案1
那里有由tufte-book
类定义的命令。\sfffamily
字体在您的文档中定义,如果您不执行任何操作,它将是book
类中的默认 Computer Modern Sans。
\documentclass{book}
\usepackage{xcolor}
\usepackage{fontspec}
\setmainfont{TeX Gyre Termes}
\setsansfont{TeX Gyre Heros}
\newcommand{\allcaps}[1]{\addfontfeature{LetterSpace=8}\MakeUppercase{#1}}
\makeatletter
\newcommand{\@publisher}{}
\newcommand*{\publisher}[1]{\gdef\@publisher{#1}}
\renewcommand{\maketitle}{%
\begin{titlepage}
\setlength{\parindent}{\z@}
\raggedright
\sffamily
\fontsize{18}{20}\selectfont\par\noindent\textcolor{darkgray}{\allcaps{\@author}}%
\vspace{11.5pc}%
\fontsize{36}{40}\selectfont\par\noindent\textcolor{darkgray}{\allcaps{\@title}}%
\vfill%
\fontsize{14}{16}\selectfont\par\noindent\allcaps{\@publisher}%
\end{titlepage}
}
\makeatother
\title{A great, informative title to call attention}
\author{The author} \publisher{The Publisher}
\begin{document}
\maketitle
\end{document}