仅一列中的单词之间有额外空格(表格中带有“p”列类型)

仅一列中的单词之间有额外空格(表格中带有“p”列类型)

这里的问题是,在这个表格的第三列中,单词之间突然出现了多余的空格。我不知道为什么会发生这种情况。谁能帮我解决一下?

当然也欢迎其他改进;我仍在学习乳胶。

梅威瑟:

\documentclass[11pt]{article}
\usepackage[
textwidth=155mm,
top=23.5mm,
bottom=23.5mm,
footskip=40pt,
heightrounded,
]{geometry}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern} % math & rm
\usepackage{microtype}
\usepackage{threeparttable}
\usepackage{threeparttablex} %
\usepackage[table,xcdraw]{xcolor}
\usepackage[skip=0.33\baselineskip]{caption}
\usepackage{array}
\usepackage{booktabs,makecell}
\usepackage{tabularx}
\begin{document}
\begin{table}[H]
    \caption{List of variables}

    \begin{threeparttable}
    \renewcommand{\arraystretch}{1.3}

        \begin{tabular}{l p{7cm} p{3cm} p{2cm}} %%zxqdcolumn
            \toprule 
            \multicolumn{1}{l}{Variable}  &  \multicolumn{1}{l}{Explanation}  & 
            \multicolumn{1}{l}{Measure of} &  \multicolumn{1}{l}{Source} \\
            \midrule

            \multicolumn{4}{c}{\textbf{Dependent variables}} \\
            \rule{0pt}{1ex}

            $Y^n_{eu,t}$ &  Yield on a 10-year zero coupon government bond of an eurozone country in the sample  & & Datastream \\
            $Y^n_{us,t}$ &  Yield on the 10-year US zero coupon government bond & & Datastream \\
            $R^n_{eu,t}$ &  10-year Overnight Index Swap rate of the EU & & Datastream \\
            $R^n_{us,t}$ &  10-year Overnight Index Swap rate of the US & & Bloomberg
             \\\multicolumn{4}{c}{\textbf{Control variables}} \\
        \rule{0pt}{1ex}
            $VSTOXX$ & Implied volatility of near term options on the EuroStoxx 50 index (eurozone equivalent of the VIX) & Euro-area risk aversion &  Datastream \\
            $CDS$ & 10-year credit default swap of an eurozone country in the sample. Defined in Datastream as ''the mid-rate spread between the entity and the relevant benchmark curve'' & Country specific credit risk &  Datastream \\
             $Redom$ & Redenomination risk. Calculated as the difference between the 5-year CDS of an eurozone country  dominated in dollars minus the 5-year CDS  dominated in Euro of that same country (this is called the quanto CDS), and quanto CDS of Germany ($Qcds_{t}$-$Qcds_{t_{Ger}}$) & Redenomination risk & Bloomberg \\
            $CESI_{j}$ &  The Citigroup Economic Surprise Index (CESI) measures the surprise content of the release of macroeconomic and fiscal news (not monetary policy news) on a daily basis. A positive value indicates a positive surprise. $j \in us,eu$.  & Macro-economic news & Datastream \\
            $ECB$ & Impulse dummies which equal 1 on ECB UMP announcement days and 0 otherwise. See also Table A.2 in Appendix A.2. & UMP announcements of the ECB &  ECB website \\
            \bottomrule
    \end{tabular}
\begin{tablenotes}[para,flushleft]\scriptsize{
    \item \textbf{Notes}: Rates and yields are measured in basis points. The variables $Y^n_{eu,t}$, $CDS$, $BAS$ and $Redom$ are collected for each eurozone country in the sample. The other  variables  are time-series observations.}
\end{tablenotes}
\end{threeparttable}
    \end{table}
\end{document}

答案1

主要建议:

  • 为了抑制第三列材料的完整对齐,请替换p{3cm}>{\raggedright\arraybackslash}p{3cm}

进一步的建议(无特定顺序):

  • 也禁止第二列的完全对齐。要允许第 2 列和第 3 列中的单词连字,请加载ragged2e包并指定\RaggedRight而不是\raggedright

  • 没有必要使用大量的\multicolumn{1}{l}{...}包装。

  • 似乎没有必要进行threeparttable设置。

  • 不要直接用数学模式书写——TeX 会将其解释为变量、、、和VSTOXX的乘积。我建议你设置一个辅助宏,比如说,——“变量名”的缩写——如下所示VSTOXX\vname

    \newcommand{\vname}[1]{\mathrm{#1}} % or: \mathit
    

    并将所有变量名称放入\vname包装器中。

  • l对最后一列使用一种列类型。

  • 不要使用大胆的对于两个中间标题,并将它们左对齐,而不是居中。

  • 使用tabular*环境而不是tabular环境,并将表格*的宽度设置为\textwidth

  • 不要使用环境H的放置说明符table——它几乎肯定会在表格之前的页面上创建一个巨大的空白。相反,使用放置p说明符,将其单独放置在页面上。

table如果实施了上述所有建议,您的情况将如下所示:

enter image description here

\documentclass[11pt]{article}
% I've simplified preamble to bare minimum
\usepackage[textwidth=155mm,vmargin=23.5mm, footskip=40pt,
            heightrounded]{geometry}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern} 
\usepackage{microtype}
\usepackage[skip=0.33\baselineskip]{caption}
\usepackage{booktabs,array,ragged2e}
\newcommand{\vname}[1]{\mathrm{#1}} % or: \mathit
\begin{document}

\begin{table}[p] % not "H"!
\renewcommand{\arraystretch}{1.3}
\setlength{\tabcolsep}{0pt} % let LaTeX figure out intercolumn whitespace
\caption{List of variables}

\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} 
     l 
     >{\RaggedRight\arraybackslash}p{7cm} 
     >{\RaggedRight\arraybackslash}p{3cm} 
     l} 
\toprule 
Variable & Explanation & Measure of & Source \\
\midrule
\multicolumn{4}{l}{Dependent variables} \\
$Y^n_{eu,t}$ & Yield on a 10-year zero coupon government bond of a eurozone country in the sample & & Datastream \\
$Y^n_{us,t}$ & Yield on the 10-year US zero coupon government bond & & Datastream \\
$R^n_{eu,t}$ & 10-year Overnight Index Swap rate of the EU & & Datastream \\
$R^n_{us,t}$ & 10-year Overnight Index Swap rate of the US & & Bloomberg \\
\addlinespace
\multicolumn{4}{l}{Control variables} \\
$\vname{VSTOXX}$   & Implied volatility of near term options on the EuroStoxx 50 index (eurozone equivalent of the VIX) & Euro-area risk aversion &  Datastream \\
$\vname{CDS}$      & 10-year credit default swap of an eurozone country in the sample. Defined in Datastream as ``the mid-rate spread between the entity and the relevant benchmark curve'' & Country specific credit risk &  Datastream \\
$\vname{Redom}$    & Redenomination risk. Calculated as the difference between the 5-year CDS of an eurozone country  dominated in dollars minus the 5-year CDS  dominated in Euro of that same country (this is called the quanto CDS), and quanto CDS of Germany ($\vname{Qcds}_{t}-\vname{Qcds}_{t_{\vname{Ger}}}$) & Redenomination risk & Bloomberg \\
$\vname{CESI}_{j}$ & The Citigroup Economic Surprise Index ($\vname{CESI}$) measures the surprise content of the release of macroeconomic and fiscal news (not monetary policy news) on a daily basis. A positive value indicates a positive surprise. $j\in\{us,eu\}$.  & Macroeconomic news & Datastream \\
$\vname{ECB}$      & Impulse dummies which equal $1$ on ECB UMP announcement days and~$0$ otherwise. See also Table A.2 in Appendix~A.2. & UMP announcements of the ECB &  ECB website \\
\bottomrule
\addlinespace
\end{tabular*}

\footnotesize
\textbf{Notes} Rates and yields are measured in basis points. The variables $Y^n_{eu,t}$, $\vname{CDS}$, $\vname{BAS}$ and $\vname{Redom}$ are collected for each eurozone country in the sample. The other  variables  are time series observations.

\end{table}
\end{document}

相关内容