baselinestretch 与 setspace

baselinestretch 与 setspace

在我的序言中,我使用\renewcommand{\baselinestretch}{1.5}“一半”行距。这很有效。

然后我开始tnote使用threeparttable

我将字体大小改为,\scriptsize因为我认为它对于表格注释来说足够大。我发现 s 上的行距\tnote \item太大了。我在 LaTeX wikibook 中找到一条建议,可以使用 更改列表中的行距\itemsep1pt \parskip0pt \parsep0pt

不幸的是,这仅在使用该包时才有效。但激活此包会对所有/环境setspace产生影响,因为所有单元格的填充都会变小。tabletabular

我怎样才能避免对表格产生这种影响,或者是否有另一种可能性来改变列表中的行距,例如tnote列表中的行距threeparttable

妇女权利委员会:

\documentclass[a4paper,12pt]{report}
% language settings
\usepackage[english,german,ngerman]{babel}
% Specifies which font encoding LaTeX should use.
\usepackage[T1]{fontenc}   
% Allows the specification of an input encoding.
\usepackage[utf8]{inputenc}  
% define page layout
\usepackage[left=3.5cm,right=3cm,top=3cm,bottom=2.5cm]{geometry}
% line spacing
%\renewcommand{\baselinestretch}{1.5}
% to set custiom line spacing
% http://en.wikibooks.org/wiki/LaTeX/Paragraph_Formatting#Line_Spacing
\usepackage{setspace}
%\onehalfspacing
%\doublespacing
\setstretch{1.5}
% intention of a paragraph
\parindent0pt
% Prints current chapter heading and the page number in the header on each page.
\pagestyle{headings}
% Set of commands for inclusion of graphics.
\usepackage{graphicx}
\usepackage{epstopdf}
% used to control how to float figures
\usepackage{float}
% Use the harvard family of bibliographic styles.
\usepackage{harvard}
\bibliographystyle{agsm}
\citationmode{abbr} 
% used to layout source file regions
\usepackage{listings}
% euro
\usepackage[left]{eurosym}
\usepackage{enumerate}
% used for nameref
\usepackage{nameref}
\usepackage{url}
% used to define color and colors for table cells
\usepackage{color}
\usepackage{colortbl}
% color definitions
\definecolor{dunkelgrau}{rgb}{0.8,0.8,0.8}
\definecolor{hellgrau}{rgb}{0.95,0.95,0.95}
% tables of three parts.
% http://www.tex.ac.uk/CTAN/macros/latex/contrib/threeparttable/threeparttable.pdf
\usepackage{threeparttable}
% for combining cells across rows
\usepackage{multirow}
% for combining cells across columns
\usepackage{multicol}
% for using array environments.
\usepackage{array}
% for using verbatim and comment environments
\usepackage{verbatim}
% for footnotes in tables
%\usepackage{tablefootnote}
%\usepackage{footnote}
%\makesavenoteenv{tabular}
% provide a 'landscape' environment
\usepackage{lscape}
% define vcentered colum types
\newcolumntype{C}{>{$\vcenter\bgroup\hbox\bgroup}c<{\egroup\egroup$}}
\newcolumntype{L}{>{$\vcenter\bgroup\hbox\bgroup}l<{\egroup\egroup$}}
\newcolumntype{R}{>{$\vcenter\bgroup\hbox\bgroup}r<{\egroup\egroup$}}
% provide blind test with \blindtext
\usepackage{blindtext}
%-----------------------------------------------------------------------------
\begin{document}
%-----------------------------------------------------------------------------
\setlength{\extrarowheight}{2pt}
%-----------------------------------------------------------------------------
\pagenumbering{arabic}
% -----------------------------------------------------------------------------
\chapter{Chapter 1}
% -----------------------------------------------------------------------------
\section{Section 1}
% -----------------------------------------------------------------------------
\blindtext
% -----------------------------------------------------------------------------
\begin{table}
\begin{center}
\begin{threeparttable}
\begin{tabular}{|L|C|C|C|C|C|C|C|}
\hline
\rowcolor{dunkelgrau}
Head1                   & Head2     \\
\hline
first row\tnote{1}      & abcd abcd abcd        \\
\hline
second row\tnote{2}     & efgh efgh efgh        \\
\hline
third row               & ijkl ijkl ijkl        \\
\hline
\end{tabular}
\caption{Caption of table}
\label{table:labelOfTable}
\begin{tablenotes}
\item[1]{\scriptsize note 1}
\item[2]{\scriptsize note 2}
\end{tablenotes}
\end{threeparttable}
\end{center}
\end{table}
% -----------------------------------------------------------------------------
\end{document}

答案1

如果您想调整文本的间距,您应该避免更改,\baselinestretch因为它会改变文档中所有内容的间距,包括脚注和表格,这通常是不可取的(当然,如果您想要这种效果那么\renewcommand{\baselinestretch}{1.5}是正确的)

如果您想要获得令人愉悦的印刷效果,请依赖该setspace包,因为它只会更改正文和参考书目的间距。正如 Paul Stanley 指出的那样,将文档设置为\onehalfspace小于 1.5 的基线拉伸。如果您想要相同的效果,请使用\setstretch{1.5}

现在,关于您的表格,有几种方法。首先,不要使用环境center,而是使用\centering。其次,您已指定过多列的方法 - 您的表格只有两列。如果您的表格与当前表格的外观和感觉相同,最简单的方法是使用在\renewcommand{\arraystretch}{1.2}每行上方和下方添加空间。这文档可能对你有用。

如果您想要一个美观的表格,请使用该booktabs包并避免使用垂直线和水平线,除了顶部、底部和头部各一个。如果您这样做,那么这\setlength{\extrarowheight}{3pt}是增加间距的最佳方法,表格整体看起来会好看得多。下面的 MWE 应该可以澄清一些事情:

\documentclass[12pt]{report}

\usepackage{setspace}
\setstretch{1.5}

\usepackage{threeparttable}
\usepackage{array}
\usepackage{booktabs}

\usepackage{blindtext}

\begin{document}

\begin{table}[ht!]
\renewcommand{\arraystretch}{1.2}
\centering% do not use the center environment
\begin{threeparttable}
\begin{tabular}{|l|c|}% you only have two columns
\hline
Head1                   & Head2     \\
\hline
first row\tnote{1}      & abcd abcd abcd        \\
\hline
second row\tnote{2}     & efgh efgh efgh        \\
\hline
third row               & ijkl ijkl ijkl        \\
\hline
\end{tabular}
\caption{Caption of table}
\begin{tablenotes}
\item[1]{\scriptsize note 1}
\item[2]{\scriptsize note 2}
\end{tablenotes}
\end{threeparttable}
\end{table}

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam lobor-
tis facilisis sem. Nullam nec mi et neque pharetra sollicitudin. Praesent
imperdiet mi nec ante.

\begin{table}\begin{table}[h!]
\centering
\setlength{\extrarowheight}{5pt}
\begin{threeparttable}
\begin{tabular}{lc}
\toprule
Head1                   & Head2     \\
\midrule
first row\tnote{1}      & abcd abcd abcd        \\
second row\tnote{2}     & efgh efgh efgh        \\
third row               & ijkl ijkl ijkl        \\
\bottomrule
\end{tabular}
\caption{A prettier Table}
\begin{tablenotes}
\item[1]{\scriptsize note 1}
\item[2]{\scriptsize note 2}
\end{tablenotes}
\end{threeparttable}
\end{table}

\end{document}

在此处输入图片描述

相关内容