我是 LaTex 的新手。如果我的示例文本不够简洁,我深感抱歉。
我需要能够编写双倍行距的文档,具有从 .csv 文件输入的单倍行距的表格,并且使文本环绕表格。
为此,我使用了 setspace、wrapfig 和 pgfplotstable 包,但是当我将表格的单倍行距切换回文本的双倍行距时,我得到的换行符是三倍行距。我该如何修复这个问题?
谢谢。
\documentclass[12pt]{article}%
\usepackage[nohead]{geometry}
\usepackage[doublespacing]{setspace}
\usepackage{wrapfig}
\usepackage{pgfplotstable}
\usepackage{booktabs}
\usepackage{array}
\usepackage{colortbl}
\usepackage{epstopdf}
\usepackage{caption}
\geometry{left=1in,right=1in,top=1.00in,bottom=1.0in}
\begin{document}
\noindent I have things to say. Important things. Very very very very very very very very very imporant things. My repec score is a billion gagillion trillion. I have things to say. Important things. Very very very very very very very very very imporant things. My repec score is a billion2
\singlespacing
\begin{wraptable}{o}{4.25in}
\captionsetup{singlelinecheck = false, justification=justified, format=hang}
\caption{Statistic, Variable}
\label{tab:1}
\scriptsize
\pgfplotstabletypeset[
col sep=semicolon,
string type,
% column type=c,
every head row/.style={
before row={\toprule}, after row=\midrule,},
every row no 0/.style={before row={\multicolumn{8}{l}{\textit{All}} \\ },
after row={\multicolumn{8}{l}{} \\ },},
every row no 1/.style={before row={\multicolumn{8}{l}{\textit{Sub group 1}} \\ }, },
every row no 2/.style={after row={\multicolumn{8}{l}{\textit{}} \\ }, },
every row no 3/.style={before row={\multicolumn{8}{l}{\textit{Sub group 2}} \\}, },
every row no 6/.style={after row={\multicolumn{8}{l}{\textit{}} \\ }, },
every row no 7/.style={before row={\multicolumn{8}{l}{\textit{Sub group 3}} \\}, },
every row no 8/.style={after row={\multicolumn{8}{l}{\textit{}} \\ }, },
every row no 9/.style={before row={\multicolumn{8}{l}{\textit{Included Covariates:}} \\ }, },
every last row/.style={
after row={
\bottomrule
\multicolumn{8}{p{3.6in}}{Note:} },
},
columns/r0/.style={column name=, column type=l},
columns/r1/.style={column name=(73), column type=c},
columns/r2/.style={column name=\textbf{(74)}, column type=c},
columns/r3/.style={column name=(75), column type=c},
columns/r4/.style={column name=(76), column type=c},
columns/r5/.style={column name=\textbf{(77)}, column type=c},
columns/r6/.style={column name=\textbf{(78)}, column type=c},
columns/r7/.style={column name=(79), column type=c},
]{example.csv}
\end{wraptable}
\doublespacing
\noindent gagillion trillion. I have things to say. Important things. Very very very very very very very very very imporant things. My repec score is a billion3. I have things to say. Important things. Very very very very very very very very very imporant things. My repec score is a billion4. I have things to say. Important things. Very very very very very very very very very imporant things. My repec score is a billion5.
\end{document}
答案1
当改变字体形状和大小或行距等环境属性时,如果这种改变不是全局性的,那么最好将改变限制在受影响的环境中。
大多数 LaTeX 环境都使用 来标识(和输入)
\begin{<envname>} ... \end{<envname>}
,并被定义为“本地组”。当进入一个组时,周围环境的属性会被保存,并在退出/结束本地组时恢复。因此,将“形状”更改封闭在封闭环境中几乎总是安全的,并期望在\end
处理 时此更改会消失。
在本例中,\singlespacing
紧接着进入\begin{wraptable}
应该就会得到预期的结果。