我正在使用tufte-handout
。我已经居中parts
并sections
使用sectsty
。我怎样才能将标题、作者和日期居中?
%%%%%%%%%%%%%%%%%%%%
\documentclass[]{tufte-handout}
\usepackage{sectsty}
\allsectionsfont{\centering}
\usepackage{lipsum}
%%%%%%%%%%%%%%%%%%%%
% How to center them?
\title{Homework}
\author{hengxin}
\date{\today}
%%%%%%%%%%%%%%%%%%%%
\begin{document}
\maketitle
%%%%%%%%%%%%%%%%%%%%
\begin{abstract}
Abstract here~\footnote{footnote}.
\lipsum[10]
\end{abstract}
%%%%%%%%%%%%%%%%%%%%
\begin{center}
\fbox{\begin{tabular}{@{}c@{}}
Note 1: 123456789\\
Note 2: 123456789
\end{tabular}}
\end{center}
%%%%%%%%%%%%%%%%%%%%
\part{Part I}
\lipsum[2]~\footnote{problems}
$a + b = c$
\section{Section 1}
%%%%%%%%%%%%%%%%%%%%
\end{document}
答案1
我从中复制了源代码tufte-common.def
并进行了修改以满足居中对齐,以下是修改后的标签:
%%%%%%%%%%%%%%%%%%%%
\documentclass[]{tufte-handout}
\usepackage{sectsty}
\allsectionsfont{\centering}
\usepackage{lipsum}
%%%%%%%%%%%%%%%%%%%%
% How to center them?
\makeatletter
\renewcommand{\maketitle}{%
\newpage
\global\@topnum\z@% prevent floats from being placed at the top of the page
\begingroup
\setlength{\parindent}{0pt}%
\setlength{\parskip}{4pt}%
\let\@@title\@empty
\let\@@author\@empty
\let\@@date\@empty
\ifthenelse{\boolean{@tufte@sfsidenotes}}{%
\gdef\@@title{\sffamily\LARGE\allcaps{\@title}\par}%
\gdef\@@author{\sffamily\Large\allcaps{\@author}\par}%
\gdef\@@date{\sffamily\Large\allcaps{\@date}\par}%
}{%
\gdef\@@title{\LARGE\itshape\centering\@title\par}%
\gdef\@@author{\Large\itshape\centering\@author\par}%
\gdef\@@date{\Large\itshape\centering\@date\par}%
}%
\@@title
\@@author
\@@date
\endgroup
\thispagestyle{plain}% suppress the running head
\tuftebreak% add some space before the text begins
\@afterindentfalse\@afterheading% suppress indentation of the next paragraph
}
\makeatother
\title{Homework}
\author{hengxin}
\date{\today}
%%%%%%%%%%%%%%%%%%%%
\begin{document}
\maketitle
%%%%%%%%%%%%%%%%%%%%
\begin{abstract}
Abstract here~\footnote{footnote}.
\lipsum[10]
\end{abstract}
%%%%%%%%%%%%%%%%%%%%
\begin{center}
\fbox{\begin{tabular}{@{}c@{}}
Note 1: 123456789\\
Note 2: 123456789
\end{tabular}}
\end{center}
%%%%%%%%%%%%%%%%%%%%
\part{Part I}
\lipsum[2]~\footnote{problems}
$a + b = c$
\section{Section 1}
%%%%%%%%%%%%%%%%%%%%
\end{document}
输出