在这里使用 prosseek 的答案:
我能够将表格缩小到文本宽度。不幸的是,当我这样做时,列标题之间的线条不再与它们下面的线条对齐?
我怎样才能解决这个问题?
\documentclass{report}
\usepackage{tabulary}
\begin{document}
I want a table that is the same width as the text I'm using tabulary and that has shrunk the table however the lines between the column headers are no longer properly aligned with the lines below then between the columns.
\renewcommand{\baselinestretch}{1.0}\normalsize
\begin{table}[!h]
\footnotesize
\centering
\begin{tabulary}{1.0\textwidth}{CCCC|C|CCCC|CC}
\hline
\multicolumn{5}{l}{Parameter Estimates Subset 1 and 2} \\
\cline{1-11}
A & L_{t-1} & S_{t-1} & C_{t-1} & $\mu$ & Q&L_{t}& S_{t} & C_{t} & $\lambda$ & H \\
\hline
L_t & 1.031 & 0 & 0 & 6.02 & L_t & 0.077 & 0 & 0 & 0.123& 0.017\\
& () & & & () & &(0.021) & & &(0.005)& (0.002)\\
S_t & 0 & 0.910 & 0 & -0.02& S_t & 0 & 0.720 & 0 & &\\
& & 0.037) & & () & & & (0.059)& & & \\
C_t & 0 & 0 & 0.681 & 0.28 &C_t & 0 & 0 & 2.130 & & \\
& & & (0.070) & () & & & & (0.107)& & \\
\hline
\multicolumn{5}{l}{Parameter Estimates Subset 2 and 3} \\
\cline{1-11}
A & L_{t-1} & S_{t-1} & C_{t-1} & $\mu$ & Q&L_{t}& S_{t} & C_{t} & $\lambda$ & H \\
\hline
L_t & 1.031 & 0 & 0 & 6.02 & L_t & 0.077 & 0 & 0 & 0.123& 0.017\\
& () & & & () & &(0.021) & & &(0.005)& (0.002)\\
S_t & 0 & 0.910 & 0 & -0.02& S_t & 0 & 0.720 & 0 & &\\
& & 0.037) & & () & & & (0.059)& & & \\
C_t & 0 & 0 & 0.681 & 0.28 &C_t & 0 & 0 & 2.130 & & \\
& & & (0.070) & () & & & & (0.107)& & \\
\hline
\end{tabulary}
\caption{Results of the Maximum Likelihood Estimation for splits 1-4}
\label{table:param3}
\end{table}
\renewcommand{\baselinestretch}{1.50}\normalsize
\end{document}
答案1
我懒得把这些都放上去,$
所以我创建了一个新列。但你必须使用$
所以我创建了一个新列。但是你在写L_t
“等”
\documentclass{report}
\usepackage{tabulary}
\newcolumntype{M}{>{$}C<{$}}
\begin{document}
I want a table that is the same width as the text I'm using tabulary and that has shrunk the table however the lines between the column headers are no longer properly aligned with the lines below then between the columns.
\renewcommand{\baselinestretch}{1.0}\normalsize
\begin{table}[!h]
\footnotesize
\centering
\begin{tabulary}{1.0\textwidth}{MMMM|M|MMMM|MM}
\hline
\multicolumn{5}{l}{Parameter Estimates Subset 1 and 2} \\
\cline{1-11}
A & L_{t-1} & S_{t-1} & C_{t-1} & \mu & Q&L_{t}& S_{t} & C_{t} & \lambda & H \\
\hline
L_t & 1.031 & 0 & 0 & 6.02 & L_t & 0.077 & 0 & 0 & 0.123& 0.017\\
& () & & & () & &(0.021) & & &(0.005)& (0.002)\\
S_t & 0 & 0.910 & 0 & -0.02& S_t & 0 & 0.720 & 0 & &\\
& & 0.037) & & () & & & (0.059)& & & \\
C_t & 0 & 0 & 0.681 & 0.28 &C_t & 0 & 0 & 2.130 & & \\
& & & (0.070) & () & & & & (0.107)& & \\
\hline
\multicolumn{5}{l}{Parameter Estimates Subset 2 and 3} \\
\cline{1-11}
A & L_{t-1} & S_{t-1} & C_{t-1} & \mu & Q&L_{t}& S_{t} & C_{t} & \lambda & H \\
\hline
L_t & 1.031 & 0 & 0 & 6.02 & L_t & 0.077 & 0 & 0 & 0.123& 0.017\\
& () & & & () & &(0.021) & & &(0.005)& (0.002)\\
S_t & 0 & 0.910 & 0 & -0.02& S_t & 0 & 0.720 & 0 & &\\
& & 0.037) & & () & & & (0.059)& & & \\
C_t & 0 & 0 & 0.681 & 0.28 &C_t & 0 & 0 & 2.130 & & \\
& & & (0.070) & () & & & & (0.107)& & \\
\hline
\end{tabulary}
\caption{Results of the Maximum Likelihood Estimation for splits 1-4}
\label{table:param3}
\end{table}
\renewcommand{\baselinestretch}{1.50}\normalsize
\end{document}
答案2
您可以使用基本tabular*
环境来完成这项工作,因为似乎不需要tabulary
环境的换行功能。列类型C
设置为自动以数学模式呈现其内容。
顺便说一句,直接操作低级宏并不是一个好主意\baselinestretch
。相反,可以考虑加载\setspace
包并发出指令\setstretch{1.5}
(或其他所需的值)。如果没有其他方法,这种方法将使您不必记住\baselinestretch
在每个环境之前和之后设置和重置宏table
。
\documentclass{article}
\usepackage{array,setspace,booktabs}
\newcolumntype{C}{>{$}c<{$}} % math-mode center-set column
\begin{document}
\setstretch{1.5} % don't modify the low-level parameter '\baselinestretch' directly
I was able to shrink my table to the textwidth. Unfortunately when I do this the lines between the column headers are no longer aligned with the lines below them?
\begin{table}[!ht]
\footnotesize
\setlength\tabcolsep{0pt} % let "tabular*" env. determine the intercolumn widths
\begin{tabular*}{\textwidth}{C@{\extracolsep{\fill}}CCC|C|CCCC|CC}
\hline
\addlinespace
\multicolumn{11}{l}{Parameter Estimates Subset 1 and 2} \\
\cline{1-11}
A & L_{t-1} & S_{t-1} & C_{t-1} & \mu & Q &L_{t}& S_{t} & C_{t} & \lambda & H \\
\hline
L_t & 1.031 & 0 & 0 & 6.02 & L_t & 0.077 & 0 & 0 & 0.123& 0.017\\
& () & & & () & &(0.021) & & &(0.005)& (0.002)\\
S_t & 0 & 0.910 & 0 & -0.02& S_t & 0 & 0.720 & 0 & &\\
& & (0.037) & & () & & & (0.059)& & & \\
C_t & 0 & 0 & 0.681 & 0.28 &C_t & 0 & 0 & 2.130 & & \\
& & & (0.070) & () & & & & (0.107)& & \\
\hline
\addlinespace
\multicolumn{11}{l}{Parameter Estimates Subset 2 and 3} \\
\cline{1-11}
A & L_{t-1} & S_{t-1} & C_{t-1} & \mu & Q&L_{t}& S_{t} & C_{t} & \lambda & H \\
\hline
L_t & 1.031 & 0 & 0 & 6.02 & L_t & 0.077 & 0 & 0 & 0.123& 0.017\\
& () & & & () & &(0.021) & & &(0.005)& (0.002)\\
S_t & 0 & 0.910 & 0 & -0.02& S_t & 0 & 0.720 & 0 & &\\
& & (0.037) & & () & & & (0.059)& & & \\
C_t & 0 & 0 & 0.681 & 0.28 &C_t & 0 & 0 & 2.130 & & \\
& & & (0.070) & () & & & & (0.107)& & \\
\hline
\end{tabular*}
\caption{Results of the Maximum Likelihood Estimation for splits 1--4}
\label{table:param3}
\end{table}
\end{document}