我正在写一篇论文。正文和图表/表格标题都是双倍行距。但是,我需要我的标题是单倍行距。我尝试使用 重置标题上的间距\captionsetup
,但似乎没有任何效果。
下面我附上了示例代码。
% thesis.tex 2014-08-08 Mark Senn
%
% This is the root file for a simple example thesis.
% This example can also be used to prepare a dissertation.
% See
% http://www.ecn.purdue.edu/~mark/puthesis/#Options
% for documentclass options.
% CHANGE NEXT LINE?
\documentclass[me,thesis]{puthesis}
\usepackage{amsmath}
\usepackage{multicol}
\usepackage{subfigure}
% Force LaTeX not to hyphenate words that have less than three letters on each side of the hyphen.
\lefthyphenmin4
\righthyphenmin4
% For multi-row cells and broken lines in tables
\usepackage{multirow}
\usepackage{hhline}
\usepackage{caption}
% Captions generally show both a period and a colon. This suppresses the colon and leaves only the period.
\captionsetup{labelsep=none}
% Try getting the captions to be single spaced.
\captionsetup[table]{font=singlespacing}
\captionsetup[figure]{font=singlespacing}
% For forcing figure placement where necessary
\usepackage{float}
% Automatically wrap around text when using "verbatim" environment.
\usepackage{listings}
\lstset{
basicstyle=\small\ttfamily,
columns=flexible,
breaklines=true
}
\usepackage{pdflscape}
%\usepackage{capt-of}
% Title of thesis (used on cover and in abstract).
% Use \title{Put Title Here} for a one-line title.
% Use \\ to separate lines in multi-line titles.
% Put % at the end of the last line of a title
% to avoid getting an extra space in the abstract.
\title{%
An Example Thesis Done with LaTeX\\
That Has a Long Title%
}
% First author name with first name first is used for cover.
% Second author name with last name first is used for abstract.
% Your full name as it appears in the University records appears
% on the cover.
% There are two forms of author, with and without initials.
% There are examples of both below.
\author{Ivan S. Bogdanovich}{Bogdanovich, Ivan S.}
% First is long title of degree (used on cover).
% Second is abbreviation for degree (used in abstract).
% Third is the month the degree was (will be) awarded (used on cover
% and in abstract).
% Last is the year the degree was (wlll be) awarded (used on cover
% and in abstract).
\pudegree{Master of Science and Mechanical Engineering}{MSME}{July}{2014}
% Major professor (used in abstract).
\majorprof{Heinrich von Weltschmerz}
% Campus (used only on cover)
\campus{Fort Wayne}
% My command definitions specific to my thesis.
% Let typing "\en" be exactly the same as typing "\ensuremath".
\let\en=\ensuremath
% Set things up so \margins will show where the margins on the page are.
\newcommand{\margins}{\Repeat{Show where the margins for the page are.}{4}}
% Define a \ve command with two arguments, so if it called with
% \ve an
% it will expand to
% {\en{a_1},~\en{a_2},\ \ldots,~\en{a_{n}}}
\newcommand{\ve}[2]{\en{#1_1},~\en{#1_2},\ \ldots,~\en{#1_{#2}}}
% To LaTeX only some parts of your thesis put the
% names of the parts to include here. For example,
% \includeonly{front} would only process front.tex.
% \includeonly{front,introduction} would only process
% front.tex and introduction.tex.
% To print the final copy of your thesis put a '%'
% in front of the \includeonly command and run LaTeX
% three times to make sure that all cross-references
% are correct. Then run BibTeX once and LaTeX twice
% more.
% CHANGE NEXT LINE?
%\includeonly{front,introduction}
\begin{document}
% Start a new volume for your thesis.
% All theses must have at least one volume.
% If your thesis has multiple volumes put another "\volume"
% command between chapters below.
\volume
\chapter{Sample Chapter}
This is a sample paragraph. This is a sample paragraph. This is a sample paragraph. This is a sample paragraph. This is a sample paragraph. This is a sample paragraph. This is a sample paragraph. This is a sample paragraph. This is a sample paragraph. This is a sample paragraph.
Sample table below.
\begin{table}[h]
\centering
\caption{This is a sample table caption. This is a sample table caption. This is a sample table caption. This is a sample table caption. This is a sample table caption. This is a sample table caption.}
\begin{tabular}{l|c|c|c|c}
\hline
& \bf 1 & \bf 2 & \bf 3 & 4 \\
\hline
\bf 5 & 6 & 7 & 8 & 9 \\
\hline
\end{tabular}
\label{Tab1}
\end{table}
Sample figure below.
\begin{figure}[h]
\centering
\caption{This is a sample figure caption. This is a sample figure caption. This is a sample figure caption. This is a sample figure caption. This is a sample figure caption. This is a sample figure caption.}
\label{Fig1}
\end{figure}
\end{document}
答案1
这puthesis
班级完全重新定义了字幕的工作方式。虽然添加了setspace
包裹序言解决了这个问题,其他问题又出现了。
我的建议是定义\@makecaption
宏以满足您的需求并提供一致的浮动标题。通过添加
\makeatletter
\long\def\@makecaption#1#2{%
\vskip\abovecaptionskip
\sbox\@tempboxa{#1 #2}%
\renewcommand{\baselinestretch}{1.0}\reset@font
\ifdim \wd\@tempboxa >\hsize
#1 #2\par
\else
\global \@minipagefalse
\hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
\fi
\vskip\belowcaptionskip}
\makeatother
在您的序言中,表格和图片的标题相同。上述定义(除了重置\baselinestretch
)直接取自report.cls
,的基类puthesis
。