我正在写的论文使用了这个 .sty 模板,并且有几行用于设置 \textfloatsep、\floatsep 和 \intextsep,但无论我把它们做多大,它们似乎都不会影响图 A 和 B 彼此相邻时之间的间距。 图形和文本之间的间距可以成功更改,但是当图形像本例一样彼此相邻时,乳胶不会遵守 \floatsep 设置的间距。在此处的示例中,间距设置为 175pt 以过度夸张,但这并没有反映在文档中。我可以通过应用 vspace 来强制图形之间的间距,但这可能会给其他地方的图形带来新的问题。 有没有办法在整个文档中强制执行图形和文本之间的严格最小间距,这样我就不必逐一检查每个图形并测量间距?
thesistemplate.sty 文件:
\setlength{\voffset}{-0.5in}
\marginparwidth 40pt \marginparsep 10pt
\topmargin 0in \headsep .31in
\textheight 8.94in \textwidth 6.5in
\brokenpenalty=10000
\RequirePackage{afterpage} %needed for manual Page Head fix
\RequirePackage{atbegshi}
\oddsidemargin 0.00in
\if@twoside
\evensidemargin 0.0in
\else
\evensidemargin 0.0in
\fi
\textfloatsep 175pt plus 2pt minus 4pt
\floatsep 175pt plus 2pt minus 4pt
\intextsep 175pt plus 2pt minus 4pt %%%% added FRW
\def\textfraction{.25}
\def\floatpagefraction{.5}
\def\cl@chapter{\@elt{section}\@elt{footnote}}
\def\thefigure{\@arabic\c@figure}
\def\thetable{\@arabic\c@table}
\def\thechapter{\@arabic\c@chapter}
\def\theequation{\arabic{equation}}
\renewcommand{\figurename}{FIG.}
\renewcommand{\tablename}{TABLE}
\renewcommand{\bibname}{BIBLIOGRAPHY}
\renewcommand{\chaptername}{CHAPTER}
\renewcommand{\appendixname}{APPENDIX}
\setcounter{tocdepth}{1}
\renewcommand\@dotsep{0.4}
\renewcommand{\@pnumwidth}{0pt{}}
%\renewcommand{\@}{2em}
\renewcommand{\large}{\fontsize{12.0}{\baselineskip}}
\renewcommand{\dotfill}{%
\leavevmode\cleaders\hbox to 0.3em{\hss .\hss }\hfill\kern0pt }
\newcommand{\tocShipoutHook}{\noindent{Chapter}~\hfill{Page}\par\vspace{0pt}}
\newcommand{\lofShipoutHook}{\noindent{Figure}~\hfill{Page}\par\vspace{0pt}}
\newcommand{\lotShipoutHook}{\noindent{Table}~\hfill{Page}\par\vspace{0pt}}
\newcommand{\MyShipoutHook}{}
\long\def\@caption#1[#2]#3{%
\par
\addcontentsline{\csname ext@#1\endcsname}{#1}%
{\csname the#1\endcsname. {\ignorespaces #2}}%
\begingroup
\@parboxrestore
\if@minipage
\@setminipage
\fi
\normalsize
\@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
\endgroup}
\def\dept#1{\gdef\@dept{#1}}
\def\principaladviser#1{\gdef\@principaladviser{#1}}
\def\submitdate#1{\gdef\@submitdate{#1}}
\def\copyrightyear#1{\gdef\@copyrightyear{#1}} % \author, \title in report
\def\degrees#1{\gdef\@degrees{#1}}
\def\abstract#1{\def\@abstract{#1}}
\def\@title{}\def\@author{}\def\@dept{computer science}
\def\@principaladviser{}
\def\@degrees{}
\def\@abstract{}
\def\vita#1{\gdef\@vita{#1}}
\def\@vita{}
\def\@submitdate{\ifcase\the\month\or
January\or February\or March\or April\or May\or June\or
July\or August\or September\or October\or November\or December\fi
\space \number\the\year}
\ifnum\month=12
\@tempcnta=\year \advance\@tempcnta by 1
\edef\@copyrightyear{\number\the\@tempcnta}
\else
\def\@copyrightyear{\number\the\year}
\fi
\newif\ifcopyright \newif\iffigurespage \newif\iftablespage
\copyrighttrue \figurespagetrue \tablespagetrue
\newif\ifphd
\phdtrue
\def\signline#1{\\
{\small #1} \\}
\def\@member{}
\def\member#1{\expandafter\def\expandafter\@member\expandafter
{\@member{\signline{#1\ (Member)}}}}
\def\titlep{%
\def\baselinestretch{2.0}\@normalsize
\thispagestyle{empty}%
\begin{center}
{\large\bf\uppercase\expandafter{\@title}}
\end{center}
\renewcommand{\baselinestretch}{1.0}\@normalsize
\begin{center}
by\\
\ \\
%\vspace{15pt}
\@author\\
\@degrees\\
\end{center}
%\vfill
\vspace{15pt}
\begin{center}
A \ifphd Dissertation \else Thesis \fi Submitted to the Faculty of\\
B University in Partial Fulfillment of the\\
Requirements for the Degree of\\
%\vspace{18pt}
\ \\
\ifphd \uppercase{Doctor of Philosophy} \else \uppercase{Master of Science}\fi \\
%\vspace{18pt}
\ \\
\uppercase\expandafter{\@dept}\\
%\vspace{18pt}
\ \\
\uppercase{B University}\\
\@submitdate\\
\end{center}
\vfill
\hfill\parbox[t]{2.5in}{Approved by:\\
\signline{\@principaladviser\ (Director)}
\@member}
\vfill\newpage}
\def\abstractpage{\def\baselinestretch{1.3}\@normalsize\pagestyle{empty}%
\begin{center}
{\large\bf ABSTRACT}\\
%\vspace{18pt}
\ \\
\renewcommand{\baselinestretch}{1.0}\@normalsize
{\large\uppercase\expandafter{\@title}}\\
\vspace{18pt}
\@author\\
B University, \number\the\year\\
Director: Dr. \@principaladviser
\end{center}
\vspace{25pt}
\par
\@abstract
\vfill\newpage}
\def\vitapage{\def\baselinestretch{1.3}\@normalsize\pagestyle{myheadings}
\chapter*{VITA}
\addtocontents{toc}{\vspace*{12pt}}
\addcontentsline{toc}{chapter}{VITA}
\begin{flushleft}
\@author\\
Department of \@dept \\
B University \\
C City, D State ZipCode
\end{flushleft}
\par
\@vita
\vfill
\begin{flushleft}
Typeset using \LaTeX .
\end{flushleft}}
\def\copyrightpage{%
\pagestyle{myheadings}
% \vspace*{2in}
\vspace*{\fill}
\begin{center}
Copyright,\ \@copyrightyear,\ by
\@author,\
All Rights Reserved.
\end{center}
\vfill\newpage}
\def\beforepreface{
\pagenumbering{roman}
\pagestyle{empty}
\newpage
% \titlep
%\cleardoublepage
% \abstractpage
%\cleardoublepage
% \ifcopyright\copyrightpage\fi }
}
\def\prefacesection#1{%
\pagestyle{myheadings}
\cleardoublepage
\def\baselinestretch{1.3}\@normalsize
\chapter*{#1}}
\def\afterpreface{\cleardoublepage
\def\baselinestretch{1}\@normalsize
\renewcommand{\MyShipoutHook}{\tocShipoutHook}
\AtBeginShipout{\MyShipoutHook}
% \tableofcontents
\renewcommand{\MyShipoutHook}{}
\def\baselinestretch{1.3}\@normalsize
\pagenumbering{arabic}
\pagestyle{myheadings}
}
\def\tableofcontents{\pagestyle{myheadings}\chapter*{Table of Contents}
\@starttoc{toc}
\addtocontents{toc}{\hfill Page\par}
}
\def\listoffigures{\chapter*{List of Figures}
{\setlength{\parskip}{12\p@} \@starttoc{lof}}%
\addtocontents{lof}{\noindent Figure\hfill Page\par}
}
\renewcommand*\l@figure{\@dottedtocline{1}{0em}{0em}}
\renewcommand*\l@table{\@dottedtocline{1}{0em}{0em}}
\def\listoftables{\chapter*{List of Tables}
{\setlength{\parskip}{12\p@} \@starttoc{lot}}%
\addtocontents{lot}{\noindent Table\hfill Page\par}
}
\pagestyle{myheadings}
\markboth{}{}
%
% FRW added custom footnote without number for document style phrase
%
\def\nnfootnote{%
\@ifnextchar [\@xfootnotenext
{\protected@xdef%
% \@thefnmark{\thempfn}% removed the number from FOOTNOTETEXT command:
\@thefnmark{ }%
\@footnotetext}}
%
\renewcommand{\chapter}{\if@openright\cleardoublepage\else\clearpage\fi
\thispagestyle{myheadings}%
\global\@topnum\z@
\@afterindentfalse
\secdef\@chapter\@schapter}
\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
\refstepcounter{chapter}%
\typeout{\@chapapp\space\thechapter}%
\addcontentsline{toc}{chapter}%
{\protect\numberline{\thechapter.}\uppercase{#1}}%
\else
\addcontentsline{toc}{chapter}{\uppercase{#1}}%
\fi
\if@twocolumn
\@topnewpage[\@makechapterhead{#2}]%
\else
\@makechapterhead{#2}%
\@afterheading
\fi}
\def\@makechapterhead#1{%
% \vspace*{50\p@}%
{\parindent \z@ \raggedright \normalfont
\renewcommand{\baselinestretch}{2}
\ifnum \c@secnumdepth >\m@ne
% \centerline{\large\bfseries \@chapapp\space \thechapter}
\begin{center}
\large\bfseries \@chapapp\space \thechapter
\end{center}
\par\nobreak
\vskip 12\p@
\fi
\interlinepenalty\@M
% \centerline{\large \bfseries \uppercase{#1}}\par\nobreak
\begin{center}
\large \bfseries \uppercase{#1}
\end{center}
\vskip 18\p@
}}
\def\@schapter#1{\if@twocolumn
\@topnewpage[\@makeschapterhead{#1}]%
\else
\@makeschapterhead{#1}%
\@afterheading
\fi}
\def\@makeschapterhead#1{%
%\vspace*{50\p@}%
{\parindent \z@ \raggedright
\normalfont
\interlinepenalty\@M
% \centerline{
\begin{center}
\large \bfseries \uppercase{#1}
\end{center}
\par\nobreak
\vskip 18\p@
}}
\renewcommand{\section}{
\secdef\@section\@ssection}
\def\@section[#1]#2{\ifnum \c@secnumdepth >\m@ne
\refstepcounter{section}%
\addcontentsline{toc}{section}%
{\protect\quad\numberline{\thesection}\uppercase{#1}}%
\else
\addcontentsline{toc}{section}{\uppercase{#1}}%
\fi
\@makesectionhead{#2}%
}
\def\@makesectionhead#1{%
\vskip 12\p@
{\bfseries \noindent \thesection\space\parbox[t]{5.5in}{\raggedright\uppercase{#1}}}
\vskip 12\p@
}
\def\@ssection#1{
\@makessectionhead{#1}%
}
\def\@makessectionhead#1{%
\vskip 12\p@
{\bfseries \noindent \raggedright\uppercase{#1}}
\vskip 12\p@
}
\renewcommand{\subsection}{
\secdef\@subsection\@ssubsection}
\def\@subsection[#1]#2{\ifnum \c@secnumdepth >\m@ne
\refstepcounter{subsection}%
\addcontentsline{toc}{subsection}%
{\protect\numberline{\thesubsection}\uppercase{#1}}%
\fi
%\chaptermark{#1}%
%\addtocontents{lof}{\protect\addvspace{10\p@}}%
%\addtocontents{lot}{\protect\addvspace{10\p@}}%
\@makesubsectionhead{#2}%
}
\def\@makesubsectionhead#1{%
\vskip 12\p@
{\bfseries \noindent \raggedright\thesubsection\space\uppercase{#1}}
\vskip 12\p@
}
\def\@ssection#1{
\@makessubsectionhead{#1}%
}
\def\@makessubsectionhead#1{%
\vskip 12\p@
{\bfseries \noindent \raggedright\uppercase{#1}}
\vskip 12\p@
}
主文件Main.tex:
\tolerance=10000
\documentclass[12pt]{report}
\usepackage{graphicx}
\usepackage{thesistemplate}
\usepackage{indentfirst}
\usepackage{afterpage}
\usepackage{lipsum}
\begin{document}
\title{Title of the Thesis}
\author{John Smith}
\beforepreface
\afterpreface
\chapter[This is a long title This is a long title \\This is a long title This is a long title]{This is a long title This is a long title This is a long title This is a long title}
\lipsum[3-5]
\begin{figure}
\centering
\includegraphics[width=4.5in]{example-image-a}
\caption{This is a long caption This is a long caption This is a long caption This is a long caption}
\label{fig:my_labels}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=4.5in]{example-image-b}
\caption{This is a long caption This is a long caption This is a long caption This is a long caption}
\label{fig:my_labels}
\end{figure}
\section{This is a long title This is a long title This is a long title This is a long title}
\lipsum[3-5]
\begin{figure}
\centering
\includegraphics[width=4.5in]{example-image-c}
\caption{This is a long caption This is a long caption This is a long caption This is a long caption}
\label{fig:my_label}
\end{figure}
\addtocontents{toc}{\vspace*{12pt}}
\end{document}
答案1
这是一个浮动页面,因此您需要设置\@fpsep
例如
\@fpsep=\floatsep
但是 175.0pt 加上 2.0pt 减去 4.0pt 就太大了