目前页面顶部到章节顶部的高度为 3.5 厘米。我想将其减小到 1.5 厘米。目前章节底部的高度为 1.5 厘米,如果可能的话,我想将其减小到 0.5 厘米。我尝试解决以下问题407843和 28195992 和148747没有成功。我已将代码放在序言中,但不确定这是否正确?
我有一个例子,但etoolbox
例子不正确,我不知道为什么。我的书有 14 章,我在这个例子中使用了序言中的一些信息。顺便说一句,参考书目问题已经解决,感谢那些为此付出努力的人。
\documentclass[pdftex,11pt,a4paper]{book} % report maybe book??
\usepackage{titlesec}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage{afterpage}
\usepackage{color}
\usepackage{fancyhdr}
\usepackage{float}
\usepackage{typearea}
\usepackage{titlesec}
\usepackage{graphicx}
\usepackage[all]{xy}
\usepackage{pdfpages}
\usepackage{multicol}
\usepackage{url}
\usepackage{textcomp}
\usepackage{lmodern}% http://ctan.org/pkg/lm
\usepackage{hyperref} % Needs to be last package included
\usepackage[alphabetic,initials,nobysame]{amsrefs} %must be loaded after hyperref to work properly
%\texorpdfstring{tex}{string}
\hypersetup{
unicode=false, % non-Latin characters in Acrobat’s bookmarks
pdftoolbar=true, % show Acrobat’s toolbar?
pdfmenubar=true, % show Acrobat’s menu?
pdffitwindow=false, % window fit to page when opened
pdfstartview={FitH}, % fits the width of the page to the window
pdftitle={Thermal Fluid Heating, A Practical Guide for the Thermal Fluid Practitioner}, % title
pdfauthor={Geoff Senior}, % author
pdfsubject={Thermal Fluid Heating}, % subject of the document
pdfcreator={Geoff Senior}, % creator of the document
pdfproducer={Geoff Senior}, % producer of the document
pdfkeywords={Thermal Fluid Heating, Hot Oil Heating, High Temperature Oil Heating}, % list of keywords
pdfnewwindow=true, % links in new window
colorlinks=true, % false: boxed links; true: colored links
linkcolor=black, %red, % color of internal links % black for print, red for electronic
citecolor=black, %green, % color of links to bibliography % black for print, green for electronic
filecolor=black, %magenta, % color of file links % black for print, magenta for electronic
urlcolor=black %cyan % color of external links % black for print, cyan for electronic
}
% Set margins
\usepackage[inner=20mm, outer=10mm, textwidth=150mm, paperwidth=210mm, paperheight=297mm]{geometry}
\setlength{\voffset}{-1.45in}
\setlength{\textwidth}{18cm}
\setlength{\textheight}{27cm}
\setlength{\topmargin}{1.5cm}
\setlength{\headsep}{15pt} % Optional - separation between header and top of text - default is 25pt
\setlength{\footskip}{-0.25in} % Optional - separation between footer and bottom of text - default is 30pt
% Fancyhdr commands
\setlength{\headheight}{15pt}
\pagestyle{fancy}
\fancyhf{}
\makeatletter
\renewcommand{\chaptermark}[1]{\markboth{\@chapapp\ \thechapter:\ #1}{}}
\makeatother
\renewcommand{\sectionmark}[1]{\markright{\thesection:\ #1}{}}
\fancyhead[LE]{\slshape \leftmark}
\fancyhead[RO]{\slshape \rightmark}
\fancyfoot[C]{\thepage}
\setlength{\parindent}{0pt}
% setting level of subsections
\setcounter{secnumdepth}{4}
\pdfminorversion=7
\usepackage{etoolbox}
%etoolbox
\makeatletter
\patchcmd{\@makeschapterhead}{50\p@}{\chapheadtopskip}{}{}
\patchcmd{\@makeschapterhead}{40\p@}{\chapheadbelowskip}{}{}
\makeatother
% Set new lengths
\newlength{\chapheadtopskip}\setlength{\chapheadtopskip}{20pt}
\newlength{\chapheadsep}\setlength{\chapheadsep}{40pt}
\newlength{\chapheadbelowskip}\setlength{\chapheadbelowskip}{15pt}
\newcommand{\blanknonumber}{\newpage \thispagestyle{empty}}
\makeatletter
\renewcommand{\chaptermark}[1]{\markboth{\@chapapp\ \thechapter:\ #1}{}}
\makeatother
\renewcommand{\sectionmark}[1]{\markright{\thesection:\ #1}{}}
\titleformat{\chapter}[display]
{\bfseries\Huge}
{\LARGE\filright\MakeUppercase{\chaptertitlename} \Huge\thechapter}
{2ex}
{\titlerule
\vspace{1ex}%
\filright}
[\vspace{1ex}%
\titlerule]
%\frontmatter %Set pages to roman (i, ii, ...)
\makeatletter
\@openrighttrue
\makeatother
\begin{document}
\texorpdfstring{tex}{string}
\addcontentsline{toc}{chapter}{Table of Contents}
\tableofcontents
\addcontentsline{toc}{chapter}{List of Figures}
\listoffigures
\newgeometry{textwidth=150mm}
\restoregeometry
\chapter{Introduction}
\label{chapter_introduction}
\fancyhead[LE]{\slshape \leftmark}
\fancyhead[RO]{\slshape \rightmark}
\fancyfoot[C]{\thepage}
\flushbottom
The motive behind writing this book is to provide, as a guide, some practical information about thermal fluid heating systems as used in industrial heating applications. \\
\chapter{Thermal Fluid Systems}
\label{chapter_Thermal Fluid Systems}
\noindent
\section{Historical}
\label{history}
There is not much that can be found regarding the history of hot oil heating, however it is believed that its inception was as a result of Oil Companies or Road Paving Organisations (circa 1940's) wanting to heat bitumen without the use of steam, particularly so in a road making environment, away from the refinery locations where high pressure equipment was paramount.
\end{document}
答案1
太渴望评论了……
你的错误在于,试图同时使用这两种方法:修补\@makeschapterhead
和titlesec
更改章节标题的界面。使用会titlesec
导致 的定义发生变化\@makeschapterhead
,因此补丁不再成功。您可以通过在命令中添加补丁失败处理来测试这一点\patchcmd
,例如
\makeatletter
\patchcmd{\@makeschapterhead}{50\p@}{\chapheadtopskip}{}{\errmessage{Cannot
patch \string\@makeschapterhead\space above skip value}}
\patchcmd{\@makeschapterhead}{40\p@}{\chapheadbelowskip}{}{\errmessage{Cannot
patch \string\@makeschapterhead\space below skip value}}
\makeatother
会导致
Cannot patch \@makeschapterhead above skip value.
<argument> ...chapterhead \space above skip value}
l.83 ...\@makeschapterhead\space above skip value}}
Cannot patch \@makeschapterhead below skip value.
<argument> ...chapterhead \space below skip value}
l.85 ...\@makeschapterhead\space below skip value}}
因此必须删除titlesec
软件包和titlesec
代码并使用来自Mico 对已链接问题的回答。在这种情况下,还请注意,这\@makeschapterhead
是仅由(带星号)使用的命令\chapter*
。对于\chapter
(不带星号),您还需要修补,\@makechapterhead
如已链接的答案中所示。或者,您可以删除补丁并使用titlesec
如下所示的界面chadoulis 对已链接问题的回答。
请注意,我认为您的代码还有其他几点值得怀疑。我对此写了一些评论。因此,我不会再发布完整的代码。使用以下代码的最小化完整示例titlesec
将是:
\documentclass[12pt,a4paper]{book}
\usepackage{titlesec}
\titleformat{\chapter}[display]{\normalfont\Huge\bfseries}{\chaptertitlename\
\thechapter}{0.25cm}{\Huge}% see titlesec manual
\titlespacing{\chapter}{0pt}{1.5cm}{0.5cm}% see titlesec manual
\usepackage{lipsum}% for demonstration only.
\begin{document}
\chapter{Title of Chapter}
\lipsum
\end{document}
1.5cm
如果 1.5 厘米距离页面顶部而不是文本区域的开始处,则可以将偶数减小为负值。
一个最小化的完整示例,不使用titlesec
但修补类,将是:
\documentclass[12pt,a4paper]{book}
\usepackage{etoolbox} % for "\patchcmd" macro
\makeatletter
% Reduce extra space between start of text area and and chapter header lines:
\patchcmd{\@makechapterhead} {50\p@}{1.5cm }{}{\errmessage{Cannot patch \string\@makechapterhead\space above skip value}}% for \chapter
\patchcmd{\@makeschapterhead}{50\p@}{1.5cm }{}{\errmessage{Cannot patch \string\@makeschapterhead\space above skip value}} % for \chapter*
% Reduce extra space between chapter header and section header lines by 50%:
\patchcmd{\@makechapterhead} {40\p@}{0.5cm }{}{\errmessage{Cannot patch \string\@makechapterhead\space below skip value}}% for \chapter
\patchcmd{\@makeschapterhead}{40\p@}{0.5cm }{}{\errmessage{Cannot patch \string\@makeschapterhead\space below skip value}} % for \chapter*
% Optionally reduce the extra space between number line and title text
\patchcmd{\@makechapterhead} {20\p@}{0.25cm }{}{\errmessage{Cannot patch \string\@makechapterhead\space number title skip value}}% for \chapter only
\makeatother
\usepackage{lipsum}% for demonstration only.
\begin{document}
\chapter{Background}
\lipsum
\end{document}
再一次,cm
如果您愿意的话,这些值甚至可以是负数。