![使用几何包将标题排版在页面中心](https://linux22.com/image/465618/%E4%BD%BF%E7%94%A8%E5%87%A0%E4%BD%95%E5%8C%85%E5%B0%86%E6%A0%87%E9%A2%98%E6%8E%92%E7%89%88%E5%9C%A8%E9%A1%B5%E9%9D%A2%E4%B8%AD%E5%BF%83.png)
我想将标题放在页面中央,并以“Huge”字体排版。我已将章节标题排版为“Huge”字体。为什么文档标题没有以“Huge”字体排版?
\documentclass[10pt,oneside]{book}
%Some packages
\usepackage{amsmath, mathtools, amssymb, amsthm}
\usepackage{hyperref} % for "\texorpdfstring" command
\usepackage{enumitem}
\allowdisplaybreaks
%This package allows Chapter titles to be single spaced.
\usepackage{titlesec}
\titleformat{\chapter}[display]
{\setstretch{0.2}\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\titleformat{\section}
{\setstretch{0.2}\normalfont\Large\bfseries}{\thesection}{1em}{}
\titleformat{\subsection}
{\singlespacing\normalfont\large\bfseries}{\thesubsection}{1em}{}
\titleformat{\subsubsection}
{\singlespacing\normalfont\normalsize\bfseries}{\thesubsubsection}{1em}{}
%\titleformat{\chapter}[display]{\normalfont\huge\bfseries\onehalfspacing}{\chaptertitlename\ \thechapter}{40pt}{\huge}
%\titleformat{\section}{\singlespacing\normalfont\Large\bfseries}{\thesection}{1em}{}
%\titleformat{\subsection}{\singlespacing\normalfont\large\bfseries}{\thesubsection}{1em}{}
%\titleformat{\subsubsection}{\singlespacing\normalfont\normalsize\bfseries}{\thesubsubsection}{1em}{}
\usepackage{setspace}
\usepackage{sectsty}
\allsectionsfont{\onehalfspacing}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{calc,positioning,intersections}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
%These make top, right, bottom margins confirming to the requirements
\usepackage[a4paper,bindingoffset=0.0in,%
left=1.5in,right=1in,top=1in,bottom=1in,%
footskip=.25in]{geometry} %, showframe
\usepackage{setspace}
\usepackage{blindtext}
% small stuff
\usepackage{amsfonts}
\usepackage{hyperref}
\urlstyle{same}
\usepackage{footnote}
\hypersetup{colorlinks,linkcolor={black},citecolor={black},urlcolor={black}}
%Does not count introduction when numbering theorems, etc.
\setcounter{chapter}{0}
%Makes page numbers appear
\pagestyle{plain}
\begin{document}
%Makes the page numbers roman numerals, and doesn't count these pages in the table of contents.
\frontmatter
\thispagestyle{empty}
\vbox to 1truein{}
\centerline{The Rules of Arithmetic}
\newpage
\chapter{A Criterion for Equivalent Quotients}
\noindent \textbf{Theorem} \\
\begin{equation*}
\frac{a}{b} = \frac{ac}{bc}
\end{equation*}
{\em for any natural number $a$, $b$, and $c$.}
\vskip0.25in
This theorem can easily be extended to quotients. We illustrate the utility of the theorem and its corollary in the following examples.
\vskip0.25in
\noindent \textbf{Example} \vskip1.25mm
Express $\displaystyle{\frac{2.6}{6.5}}$ as a decimal.
\vskip0.2in
\noindent \textbf{Solution}
\begin{equation*}
\frac{2.6}{6.5} = \frac{2.6 \cdot 10}{6.5 \cdot 10}
= \frac{26}{65}
= \frac{2\cdot13}{5\cdot13}
= \frac{2}{5}
= 0.4. \ \rule{1.5ex}{1.5ex}
\end{equation*}
\vskip0.25in
\noindent \textbf{Example} \vskip1.25mm
Evaluate $\displaystyle{\frac{0.625}{0.00125}}$.
\vskip0.2in
\noindent \textbf{Solution}
\begin{equation*}
\frac{0.625}{0.00125}
= \frac{0.625\cdot10^5}{0.00125\cdot10^5}
= \frac{625 \cdot 100}{125}
= \frac{(5 \cdot 125)100}{125}
= 5 \cdot 100
= 500. \ \rule{1.5ex}{1.5ex}
\end{equation*}
\vskip0.25in
\noindent \textbf{Example} \vskip1.25mm
Evaluate $\displaystyle{\frac{1.43}{0.055} + \frac{169}{0.0104}}$.
\vskip0.2in
\noindent \textbf{Solution}
\begin{align*}
\frac{1.43}{0.055} + \frac{169}{0.0104}
&= \frac{1.43\cdot10^3}{0.055\cdot10^3} + \frac{169\cdot10^4}{0.0104\cdot10^4} \\
&= \frac{143\cdot10}{55} + \frac{169\cdot10^4}{104} \\
&= \frac{(11\cdot13)(2\cdot5)}{5\cdot11} + \frac{13^2\cdot(8\cdot1250)}{13\cdot8} \\
&= 2 \cdot 13 + 13 \cdot 1250 \cdot \\
&= 26 + 16250 \\
&= 16276. \ \rule{1.5ex}{1.5ex}
\end{align*}
\newpage
\chapter{Rule for the Addition of Quotients}
\noindent \textbf{Theorem} \\
\begin{equation*}
\frac{a}{c} + \frac{b}{c} = \frac{a + b}{c}
\end{equation*}
{\em for any natural numbers $a$, $b$, and $c$.}
\vskip0.25in
This theorem can easily be extended to quotients. We illustrate the utility of the theorem and its corollary in the following examples.
\vskip0.25in
\noindent \textbf{Example} \vskip1.25mm
Evaluate $\displaystyle{\frac{0.54}{0.081} + \frac{8.1}{0.243}}$.
\vskip0.2in
\noindent \textbf{Solution}
\begin{align*}
\frac{0.54}{0.081} + \frac{8.1}{0.243}
&= \frac{0.54 \cdot 1000}{0.081 \cdot 1000}
+ \frac{8.1 \cdot 1000}{0.243 \cdot 1000} \\
&= \frac{54 \cdot 100}{81}
+ \frac{81 \cdot 100}{243} \\
&= \frac{(2 \cdot 27)100}{3 \cdot 27}
+ \frac{81 \cdot 100}{3 \cdot 81} \\
&= \frac{2 \cdot 100}{3}
+ \frac{100}{3} \\
&= \frac{200}{3} + \frac{100}{3} \\
&= \frac{200 + 100}{3} \\
&= \frac{300}{3} \\
&= \frac{3 \cdot 100}{3} \\
&= 100. \ \rule{1.5ex}{1.5ex}
\end{align*}
\end{document}
答案1
使用\newgeometry
。
\documentclass[10pt,oneside]{book}
%Some packages
\usepackage{amsmath, mathtools, amssymb, amsthm}
\usepackage{enumitem}
\usepackage{titlesec}
\usepackage{setspace}
%\usepackage{sectsty} % not with titlesec
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{calc,positioning,intersections}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\usepackage[
a4paper,
bindingoffset=0.0in,
left=1.5in,
right=1in,
top=1in,
bottom=1in,
footskip=.25in,
%showframe,
]{geometry}
\usepackage{footnote}
\usepackage{blindtext}
\usepackage{hyperref}
\hypersetup{colorlinks,linkcolor={black},citecolor={black},urlcolor={black}}
\urlstyle{same}
\allowdisplaybreaks
%This package allows Chapter titles to be single spaced.
\titleformat{\chapter}[display]
{\setstretch{0.2}\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\titleformat{\section}
{\setstretch{0.2}\normalfont\Large\bfseries}{\thesection}{1em}{}
\titleformat{\subsection}
{\singlespacing\normalfont\large\bfseries}{\thesubsection}{1em}{}
\titleformat{\subsubsection}
{\singlespacing\normalfont\normalsize\bfseries}{\thesubsubsection}{1em}{}
%\titleformat{\chapter}[display]{\normalfont\huge\bfseries\onehalfspacing}{\chaptertitlename\ \thechapter}{40pt}{\huge}
%\titleformat{\section}{\singlespacing\normalfont\Large\bfseries}{\thesection}{1em}{}
%\titleformat{\subsection}{\singlespacing\normalfont\large\bfseries}{\thesubsection}{1em}{}
%\titleformat{\subsubsection}{\singlespacing\normalfont\normalsize\bfseries}{\thesubsubsection}{1em}{}
%\allsectionsfont{\onehalfspacing}% not with titlesec
%Makes page numbers appear
\pagestyle{plain}
\begin{document}
%Makes the page numbers roman numerals, and doesn't count these pages in the table of contents.
\frontmatter
\newgeometry{margin=0pt}
\pagestyle{empty}
\vspace*{-\topskip}
\vspace*{\fill}
\centerline{\Huge\bfseries The Rules of Arithmetic}
\vspace*{\fill}
\restoregeometry
\mainmatter
\chapter{A Criterion for Equivalent Quotients}
\noindent \textbf{Theorem} \\
\begin{equation*}
\frac{a}{b} = \frac{ac}{bc}
\end{equation*}
{\em for any natural number $a$, $b$, and $c$.}
\vskip0.25in
This theorem can easily be extended to quotients. We illustrate the utility of the theorem and its corollary in the following examples.
\vskip0.25in
\noindent \textbf{Example} \vskip1.25mm
Express $\displaystyle{\frac{2.6}{6.5}}$ as a decimal.
\vskip0.2in
\noindent \textbf{Solution}
\begin{equation*}
\frac{2.6}{6.5} = \frac{2.6 \cdot 10}{6.5 \cdot 10}
= \frac{26}{65}
= \frac{2\cdot13}{5\cdot13}
= \frac{2}{5}
= 0.4. \ \rule{1.5ex}{1.5ex}
\end{equation*}
\vskip0.25in
\noindent \textbf{Example} \vskip1.25mm
Evaluate $\displaystyle{\frac{0.625}{0.00125}}$.
\vskip0.2in
\noindent \textbf{Solution}
\begin{equation*}
\frac{0.625}{0.00125}
= \frac{0.625\cdot10^5}{0.00125\cdot10^5}
= \frac{625 \cdot 100}{125}
= \frac{(5 \cdot 125)100}{125}
= 5 \cdot 100
= 500. \ \rule{1.5ex}{1.5ex}
\end{equation*}
\vskip0.25in
\noindent \textbf{Example} \vskip1.25mm
Evaluate $\displaystyle{\frac{1.43}{0.055} + \frac{169}{0.0104}}$.
\vskip0.2in
\noindent \textbf{Solution}
\begin{align*}
\frac{1.43}{0.055} + \frac{169}{0.0104}
&= \frac{1.43\cdot10^3}{0.055\cdot10^3} + \frac{169\cdot10^4}{0.0104\cdot10^4} \\
&= \frac{143\cdot10}{55} + \frac{169\cdot10^4}{104} \\
&= \frac{(11\cdot13)(2\cdot5)}{5\cdot11} + \frac{13^2\cdot(8\cdot1250)}{13\cdot8} \\
&= 2 \cdot 13 + 13 \cdot 1250 \cdot \\
&= 26 + 16250 \\
&= 16276. \ \rule{1.5ex}{1.5ex}
\end{align*}
\chapter{Rule for the Addition of Quotients}
\noindent \textbf{Theorem} \\
\begin{equation*}
\frac{a}{c} + \frac{b}{c} = \frac{a + b}{c}
\end{equation*}
{\em for any natural numbers $a$, $b$, and $c$.}
\vskip0.25in
This theorem can easily be extended to quotients. We illustrate the utility of the theorem and its corollary in the following examples.
\vskip0.25in
\noindent \textbf{Example} \vskip1.25mm
Evaluate $\displaystyle{\frac{0.54}{0.081} + \frac{8.1}{0.243}}$.
\vskip0.2in
\noindent \textbf{Solution}
\begin{align*}
\frac{0.54}{0.081} + \frac{8.1}{0.243}
&= \frac{0.54 \cdot 1000}{0.081 \cdot 1000}
+ \frac{8.1 \cdot 1000}{0.243 \cdot 1000} \\
&= \frac{54 \cdot 100}{81}
+ \frac{81 \cdot 100}{243} \\
&= \frac{(2 \cdot 27)100}{3 \cdot 27}
+ \frac{81 \cdot 100}{3 \cdot 81} \\
&= \frac{2 \cdot 100}{3}
+ \frac{100}{3} \\
&= \frac{200}{3} + \frac{100}{3} \\
&= \frac{200 + 100}{3} \\
&= \frac{300}{3} \\
&= \frac{3 \cdot 100}{3} \\
&= 100. \ \rule{1.5ex}{1.5ex}
\end{align*}
\end{document}
我重新组织了你的序言,先加载包,然后再加载选项。不要同时使用titlesec
和sectsty
。
我对此有一些保留意见\setstretch{0.2}
,但我主要担心的是你的正文代码:LaTeX 是不是文字处理器,阅读一些入门手册会对你有益。
用于\\
结束行的是坏的我可以向你保证,我可能在环境\noindent
中使用过document
几次。不要使用\vskip
:它是一个具有一些特殊性的原始函数。
为了在居中标题下方添加一些内容:
\frontmatter
\newgeometry{margin=0pt}
\pagestyle{empty}
\vspace*{-\topskip}
\vspace*{\fill}
\centerline{\Huge\bfseries The Rules of Arithmetic}
\vbox to 0pt{
\vspace{1in}
\centering
\Huge\bfseries Quotients
\vss
}
\vspace*{\fill}
\restoregeometry
\mainmatter
(其余代码相同)