基本上,我试图确保任何章节第二页上的文本都符合标题。我通过包含\headsep = 45pt
(它确保非第一章的页面符合标题)解决了这个问题。
这可确保文本不会出现在标题部分。现在的问题是标题长度。它太长,占用了太多页面空间。我想让它更紧凑,并在页面上稍微往上推一点(不妨碍任何文本,也避免必须包含 headsep 命令(如上所述))。提前致谢。
问候,迈克尔
\documentclass[a4paper,10pt]{book}
\usepackage{lipsum}
\usepackage{sectsty}
\usepackage{layout}
\usepackage{titlesec}
\usepackage{afterpage}
\usepackage{wallpaper}
\usepackage{transparent}
\usepackage{eso-pic}
\usepackage{mathpazo} % package to change fonts
\usepackage{graphicx}
\usepackage[margin=1in,bottom=0.5cm,paperwidth=8.5in, paperheight=11in]{geometry}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{import} % For math stuff
\usepackage{hyperref}
\usepackage{fancyhdr}
\usepackage{chappg}
\usepackage{graphicx}
\usepackage{attrib}
\usepackage{float}
\usepackage[figurewithin=chapter]{caption}
\usepackage{longtable} % For tables spanning multiple pages
\usepackage{booktabs} % For help formatting tables
\usepackage{multirow} % For merged cells in a table
\usepackage{graphbox} % Related to centering images vertically
\usepackage{fullpage}
\usepackage{pifont}
\hypersetup{colorlinks=false,% ensures ToC remains black if colour applied to chapter headings
linkcolor=black}
% IMPORTANT NOTE: YOU MUST USE THE LINE:
% \graphicspath{{CHAPTERNAME/Images/}}
% OR SOMETHING SIMILAR AT THE TOP OF EACH CHAPTER FILE
% FOR LATEX TO FIND YOUR IMAGES
\fancypagestyle{F1}{\fancyhf{}\renewcommand{\headrulewidth}{0pt}\fancyfoot[c]{\scriptsize \vspace{0.1cm} Company Name}}
\fancypagestyle{F2}{\fancyhf{}
\renewcommand{\headrulewidth}{0pt}\fancyfoot[L]{\scriptsize \vspace{0.1cm} \texttransparent{0.5}{Company Name}}\fancyfoot[C]{\thepage}}
% Setup page style, headers sets up non chapter pages
\setlength{\parindent}{0pt}
\setlength{\parskip}{14pt}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0.1 pt}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[L]{\small \texttransparent{0.5}{Product}}
\fancyhead[R]{\transparent{0.5}\includegraphics[scale=0.5]{Tex.png}}\fancyfoot[L]{\scriptsize \vspace{0.1cm} \texttransparent{0.5} {Some Company Name}}
\raggedbottom
\definecolor{ChapTitle}{RGB}{54,95,145}
\definecolor{SectTitle}{RGB}{79,129,189}
\allsectionsfont{\color{SectTitle}}
\chapterfont{\color{ChapTitle}}
\captionsetup{justification=raggedright,singlelinecheck=false, font={color=SectTitle}}
\fancypagestyle{plain}{\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0.4pt}
\renewcommand{\headsep}{14pt}
\fancyhead[L]{\small\texttransparent{0.5}{Product Name}}
\fancyhead[R]{\transparent{0.5}\includegraphics[scale = 0.5]{Tex.png}}
\fancyfoot[L]{\scriptsize \vspace{0.1cm} \texttransparent{0.5} {Product Name}}\fancyfoot[C]{\thepage}}
\titlespacing{\chapter}{0pt}{12pt}{20pt}
\titlespacing{\section}{0pt}{14pt}{-8pt}
%Allows proper alignment in ToC in chapters with more than 9 sections
\makeatletter
\renewcommand{\@pnumwidth}{3em}
\renewcommand{\@tocrmarg}{4em}
\makeatother
% For proper handling of the references
\renewcommand\bibname{References}
\makeatletter % To make References a section but a chapter. This way, I like it more in my ToC and because there is no blank page created in front of the references.
\renewenvironment{thebibliography}[1]
{\section*{\bibname}%
\@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}%
\list{\@biblabel{\@arabic\c@enumiv}}%
{\settowidth\labelwidth{\@biblabel{#1}}%
\leftmargin\labelwidth
\advance\leftmargin\labelsep
\@openbib@code
\usecounter{enumiv}%
\let\p@enumiv\@empty
\renewcommand\theenumiv{\@arabic\c@enumiv}}%
\sloppy
\clubpenalty4000
\@clubpenalty \clubpenalty
\widowpenalty4000%
\sfcode`\.\@m}
{\def\@noitemerr
{\@latex@warning{Empty `thebibliography' environment}}%
\endlist}
\makeatother
\newcommand{\Note}{\textbf{\textcolor{SectTitle}{NOTE:} }}
\newcommand{\cmark}{\ding{51}}
\newcommand{\xmark}{\ding{55}}
\newcommand\blankpage{
\null
\thispagestyle{empty}
\addtocounter{page}{-1}
\newpage}
\thispagestyle{F2}
\titleformat{\chapter}
{\color{ChapTitle}\filright\normalfont\huge\bfseries}{\chaptername \hspace{0.25em}\thechapter:} {0.2em} {}
\fancyfoot[C]{\thepage}
\titleformat{\section}
{\Large\color{SectTitle}\bfseries}{\thesection}{0.5em}{}
\headsep=45pt
\begin{document}
\begin{titlepage}
\begin{center}
\begin{flushright}
\includegraphics[scale=1]{Tex.png}
\vspace{1in}
\end{flushright}
\Huge{\bfseries My First Book \huge }
\line(1,0){450}\\[0.1in]
\textbf{\LARGE My Corporation \\}
\textsc{\large \today}
\begin{center}
\vspace{3.5in}
\underline{\textsf{\small Name and Address}} \\
\textsf{\small Other info. }
\end{center}
\newpage
\thispagestyle{F1}
\end{center}
\end{titlepage}
\frontmatter
\renewcommand*\contentsname{\hfill \color{black}Contents \hfill}
\hypersetup{linkcolor=black}
\pagenumbering{roman}
\setcounter{page}{1}
\fancyfoot[C]{\thepage}
\tableofcontents
\hypersetup{linkcolor=black}
\mainmatter
\chapter{Introduction}
\lispum[1]
\section{First Section}
\lipsum[2]
\section{First Section}
\lipsum[3]
\section{Second Section}
\lipsum[4]
\end{document}
答案1
如果我理解的话可以分两步完成
- 消除
\usepackage{fullpage}
- 编辑行
\usepackage[margin=1in, bottom=0.5cm, paperwidth=8.5in, paperheight=11in]{geometry}
几何学提供了一种非常简单的方法来更改页面布局。
因此我认为可以在这里输入例如
\usepackage[margin=1in, bottom=0.5cm, top=1cm, paperwidth=8.5in, paperheight=11in]{geometry}