我有一些表格,我想将它们全部涂成浅灰色,但适用于表格环境(参见第二个表格示例)的相同命令行不适用于长表环境(参见第一个表格示例)。我怎样才能以与表格表相同的方式为长表着色?感谢您的帮助!
% PREAMBLE
\documentclass[12pt,a4paper]{article}
\usepackage{longtable}
\setlength{\LTpre}{0pt}
\setlength{\LTpost}{-6pt}
\usepackage{array}
\usepackage[UKenglish]{babel}
\usepackage{geometry}
\usepackage{booktabs}
\usepackage{array}
\usepackage{lscape}
\usepackage{siunitx}
\usepackage{parskip}
\usepackage{xcolor}
\definecolor{lightgray}{gray}{0.8}
\usepackage[skip=2pt,font=scriptsize]{caption}
\newcommand{\oneS}{\ensuremath{{}^{\textstyle *}}}
\newcommand{\twoS}{\ensuremath{{}^{\textstyle **}}}
\begin{document}
% LONGTABLE WHERE COLORBOX IS NOT WORKING
\newgeometry{left=1.5cm,right=1.5cm,top=1.8cm,bottom=1.8cm}
\begin{landscape}
\scriptsize
\thispagestyle{empty}
\scriptsize
%\begingroup\setlength{\fboxsep}{0pt} >>> colorbox commands that return error: Missing \endgroup inserted
%\colorbox{lightgray}{
\begin{longtable}{
l S[table-format=-1.4] S[table-format=-1.4] S[table-format=-3.2] S[table-format=-5.2] S[table-format= 7.2] S[table-format=-3.2] S[table-format=-3.2] S[table-format=-3.2] S[table-format=-3.2] @{\hspace{0.8cm}} r r r r }
\caption{Summary statistics} \label{fig:sumstat} \\
\toprule
{Future i.e. underlying asset} & \multicolumn{5}{l}{Daily returns on long-only positions} & \multicolumn{4}{l}{Ljung-Box } & \multicolumn{2}{l}{Avg. vol. (\$ mil.)} & \multicolumn{2}{l}{Avg. open interest} \\
\cmidrule(r){2-6} \cmidrule(r){7-10} \cmidrule(r){11-12} \cmidrule(r){13-14}
& {Mean (\%)} & {Std. (\%)} & {Skew. (\%)} & {Kurt. (\%)} & {Jarque-Bera} & {(5)} & {(20)} & {(60)} & {(120)} & {2000} & {2014} & {2000} & {2014} \\
\midrule
\endfirsthead
\toprule
{Future i.e. underlying asset} & \multicolumn{5}{l}{Daily returns on long-only positions} & \multicolumn{4}{l}{Ljung-Box } & \multicolumn{2}{l}{Avg. vol. (\$ mil.)} & \multicolumn{2}{l}{Avg. open interest} \\
\cmidrule(r){2-6} \cmidrule(r){7-10} \cmidrule(r){11-12} \cmidrule(r){13-14}
& {Mean (\%)} & {Std. (\%)} & {Skew. (\%)} & {Kurt. (\%)} & {Jarque-Bera} & {(5)} & {(20)} & {(60)} & {(120)} & {2000} & {2014} & {2000} & {2014} \\
\midrule
\endhead
\bottomrule \multicolumn{14}{r}{\emph{Continued on next page}}
\endfoot
\bottomrule
\endlastfoot
Frozen Concentrated Orange Juice & -0.0184 & 1.8845 & -8.68 & 764.51 \twoS & 3170.82 \twoS & 20.61 \twoS & 43.77 \twoS & 98.60 \twoS & 150.82 \oneS & 43 & 37 & 25727 & 16991 \\
\end{longtable}
% }\endgroup >>> colorbox commands that return error: Missing \endgroup inserted
\thispagestyle{empty}
\end{landscape}
\restoregeometry
% TABULAR WHERE COLORBOX IS WORKING
\newgeometry{left=5cm, top=5.3cm,bottom=5.3cm}
\thispagestyle{empty}
\begin{landscape}
\begin{table}[ht]
\scriptsize
\caption{Interest rate term structures }\label{fig:termstruct}
\centering
\begingroup\setlength{\fboxsep}{0pt}
\colorbox{lightgray}{ % >>> same colorbox commands as above working here with tabular environment
\begin{tabular}{ lllccccc }
\toprule
{Country} & {Currency} & {Rates description} & \multicolumn{5}{l}{Availability} \\
\cmidrule(r){3-3} \cmidrule(r){4-8}
& & {Overnight / Further out} & {O/N} & {1W} & {1M} & {2M} & {3M} \\
\midrule
India & INR & India National Stock Exchange Interbank Offer Rate / INR Swap Onshore OIS & x & o & x & x & x \\
\bottomrule
\end{tabular}
}\endgroup % >>> same colorbox commands as above but working here with tabular environment
\end{table}
\end{landscape}
\restoregeometry
\end{document}
这是灰色的工作表(表格)的图片:
更新(根据 Christian 使用 tcolorbox 的解决方案)
这似乎相当棘手。现在着色可以在多页上进行,但如果我调整设置,使标题不着色,则第二页上的着色将从顶部以下开始(为了不给标题着色,我在第一页上去掉了相同的数量 -> 参见图片)。此外,底部规则在某种程度上落后于颜色(如果我选择非常浅的灰色,情况也是如此)。
调整后的 Christian 解决方案代码如下:
\begin{tcolorbox}[left=2pt,top=-9pt,boxrule=0pt,boxsep=0pt,arc=0mm,auto outer arc, breakable]
第一页:除了缺少底部规则外几乎完美
第二页:现在颜色从顶部开始
更新(尝试 rowcolor 宏之后)
不幸的是,这仍然在 cmidrules 周围留下了空白(见图)。
更新(将标题放在表格外面后)
不幸的是,这也不起作用。标题现在被排除了(因此不是灰色),但颜色仍然从顶部规则上方开始,因此如果我将其向下移动,第二页上的颜色将从顶部规则下方开始。
更新(在正确尝试使用 cline 而不是 cmidrule 的 rowcolor 宏之后)
cmidrule 的空白现在已经消失了,但仍然有一些我不满意的地方:我在两行之间插入空格的地方有空白;下一页的继续也是灰色的;一些重要的星号被颜色切断了。(这可能是我的错,因为表格太乱了,我很抱歉,但我才刚开始使用 Latex 不久,我还是个菜鸟)。图片之后,我会发布我使用它的整个表格代码,希望你们能找到解决方案。顺便说一句,感谢你们迄今为止的所有意见 - 我从你们的回答中学到了很多东西!!
表格当前的代码(尝试 rowcolor 宏后)
\documentclass[12pt,a4paper]{article}
\usepackage{mathpazo}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{latexsym}
\usepackage{graphicx}
\graphicspath{{./eps/}}
\usepackage{longtable}
\setlength{\LTpre}{0pt}
\setlength{\LTpost}{-6pt}
\usepackage{natbib}
\usepackage{array}
\usepackage[applemac]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[UKenglish]{babel}
\usepackage[UKenglish]{isodate}
\usepackage{geometry}
\usepackage{booktabs}
\usepackage{rotating}
\usepackage{tabularx}
\usepackage{array}
\usepackage{lscape}
\usepackage{siunitx}
\usepackage{appendix}
\usepackage{parskip}
\usepackage[table]{xcolor}
\definecolor{lightgray}{gray}{0.9}
\usepackage[skip=2pt,font=scriptsize]{caption}
\newcommand{\oneS}{\ensuremath{{}^{\textstyle *}}}
\newcommand{\twoS}{\ensuremath{{}^{\textstyle **}}}
\begin{document}
% Table 2: Descriptive statistics
\newgeometry{left=1.5cm,right=1.5cm,top=1.8cm,bottom=1.8cm}
\begin{landscape}
\scriptsize
\thispagestyle{empty}
\scriptsize
\def\arraystretch{1.5}
\rowcolors{3}{lightgray}{lightgray}%%%% start with line 3
\begin{longtable}{
l S[table-format=-1.4] S[table-format=-1.4] S[table-format=-3.2] S[table-format=-5.2] S[table-format= 7.2] S[table-format=-3.2] S[table-format=-3.2] S[table-format=-3.2] S[table-format=-3.2] @{\hspace{0.8cm}} r r r r }
\caption{Summary statistics} \label{fig:sumstat} \\ \hline
{Future i.e. underlying asset} & \multicolumn{5}{l}{Daily returns on long-only positions} & \multicolumn{4}{l}{Ljung-Box } & \multicolumn{2}{l}{Avg. vol. (\$ mil.)} & \multicolumn{2}{l}{Avg. open interest} \\
\cline{2-6} \cline{7-10} \cline{11-12} \cline{13-14}
& {Mean (\%)} & {Std. (\%)} & {Skew. (\%)} & {Kurt. (\%)} & {Jarque-Bera} & {(5)} & {(20)} & {(60)} & {(120)} & {2000} & {2014} & {2000} & {2014} \\
\hline
\endfirsthead
\hline
{Future i.e. underlying asset} & \multicolumn{5}{l}{Daily returns on long-only positions} & \multicolumn{4}{l}{Ljung-Box } & \multicolumn{2}{l}{Avg. vol. (\$ mil.)} & \multicolumn{2}{l}{Avg. open interest} \\
\cline{2-6} \cline{7-10} \cline{11-12} \cline{13-14}
& {Mean (\%)} & {Std. (\%)} & {Skew. (\%)} & {Kurt. (\%)} & {Jarque-Bera} & {(5)} & {(20)} & {(60)} & {(120)} & {2000} & {2014} & {2000} & {2014} \\
\hline
\endhead
\hline \multicolumn{14}{r}{\emph{Continued on next page}}
\endfoot
\hline
\endlastfoot
Azuki Red Beans & -0.0506 & 1.2311 & -8.48 & 498.31 \twoS & 581.33 \twoS & 9.02 & 22.62 & 82.93 \oneS & 148.58 \oneS & 256 & 8 & 24081 & 1195 \\
Canola & -0.0040 & 1.2639 & -34.98 & 782.19 \twoS & 3483.86 \twoS & 18.63 \twoS & 78.35 \twoS & 126.33 \twoS & 219.49 \twoS & 35 & 137 & 57000 & 148689 \\
Cocoa & 0.0152 & 1.9748 & -22.63 & 526.62 \twoS & 783.74 \twoS & 5.05 & 22.98 & 73.80 & 151.80 \oneS & 58 & 568 & 112073 & 166484 \\
Coffee & -0.0628 & 2.0621 & 10.13 & 694.97 \twoS & 2295.38 \twoS & 13.29 \oneS & 38.74 \twoS & 87.90 \oneS & 135.62 & 219 & 1'288 & 44670 & 142144 \\
Corn & -0.0181 & 1.7912 & 6.17 & 498.40 \twoS & 579.88 \twoS & 6.36 & 44.37 \twoS & 97.27 \twoS & 168.05 \twoS & 736 & 5'987 & 428941 & 1033440 \\
Cotton & -0.0355 & 1.7950 & -5.54 & 405.78 \oneS & 166.01 \twoS & 17.92 \twoS & 44.70 \twoS & 105.17 \twoS & 187.02 \twoS & 389 & 961 & 59894 & 171613 \\
Frozen Concentrated Orange Juice & -0.0184 & 1.8845 & -8.68 & 764.51 \twoS & 3170.82 \twoS & 20.61 \twoS & 43.77 \twoS & 98.60 \twoS & 150.82 \oneS & 43 & 37 & 25727 & 16991 \\
Lean Hogs & -0.0450 & 1.4720 & -11.03 & 383.29 & 108.94 \twoS & 0.15 & 24.79 & 98.73 \twoS & 177.33 \twoS & 205 & 1'383 & 49182 & 222955 \\
Live Cattle & -0.0076 & 0.8947 & -21.20 & 524.61 \twoS & 766.75 \twoS & 11.41 \oneS & 61.44 \twoS & 114.85 \twoS & 219.51 \twoS & 106 & 2'404 & 35788 & 271159 \\
Lumber & -0.0735 & 1.8705 & 14.40 & 290.86 & 13.40 \twoS & 28.93 \twoS & 41.23 \twoS & 91.75 \twoS & 167.33 \twoS & 26 & 37 & 3479 & 6036 \\
Milk & 0.0228 & 0.9491 & 11.11 & 755.16 \twoS & 3047.50 \twoS & 38.97 \twoS & 119.47 \twoS & 214.46 \twoS & 277.08 \twoS & 4 & 60 & 7370 & 17752 \\
Oats & 0.0215 & 1.9433 & -15.61 & 548.80 \twoS & 922.74 \twoS & 40.62 \twoS & 65.32 \twoS & 119.86 \twoS & 177.37 \twoS & 9 & 16 & 15592 & 9548 \\
Rapeseed & 0.0296 & 0.9648 & -32.82 & 614.05 \twoS & 1510.62 \twoS & 42.49 \twoS & 102.01 \twoS & 146.87 \twoS & 196.53 \twoS & 4 & 135 & 11006 & 52218 \\
Rough Rice & -0.0350 & 1.5563 & 2.24 & 438.54 \twoS & 281.95 \twoS & 36.49 \twoS & 52.26 \twoS & 106.70 \twoS & 188.64 \twoS & 8 & 34 & 6573 & 10987 \\
Rubber & 0.0031 & 2.0663 & -40.18 & 548.06 \twoS & 997.78 \twoS & 4.25 & 49.33 \twoS & 149.77 \twoS & 212.53 \twoS & 1 & 1 & 160418 & 14016 \\
Soybean Meal & 0.0675 & 1.7365 & -13.68 & 467.56 \twoS & 423.02 \twoS & 4.50 & 33.19 \oneS & 71.00 & 149.34 \oneS & 421 & 5'876 & 113168 & 227463 \\
Soybean Oil & 0.0040 & 1.5492 & 10.94 & 502.91 \twoS & 611.23 \twoS & 0.77 & 14.75 & 57.70 & 148.56 \oneS & 208 & 2'311 & 136633 & 272694 \\
Soybean & 0.0384 & 1.5740 & -20.22 & 490.62 \twoS & 557.26 \twoS & 4.41 & 33.68 \oneS & 88.55 \twoS & 178.72 \twoS & 1'266 & 10'905 & 164866 & 456361 \\
Sugar \#11 International & 0.0143 & 2.0998 & -31.41 & 494.08 \twoS & 610.66 \twoS & 12.69 \oneS & 28.95 & 108.76 \twoS & 205.47 \twoS & 171 & 1'943 & 170865 & 652621 \\
Wheat & -0.0375 & 1.9741 & 5.60 & 495.17 \twoS & 560.82 \twoS & 0.83 & 26.73 & 91.33 \twoS & 158.60 \oneS & 336 & 3'308 & 135389 & 369247 \\
Ultra U.S. Treasury Bond & 0.0207 & 0.6554 & -15.76 & 448.51 \twoS & 338.23 \twoS & 3.98 & 24.19 & 58.73 & 159.24 \twoS & 24'011 & 52'455 & 467187 & 630200 \\
Australian Gov't Bond 10Y & 0.0013 & 0.0686 & -9.82 & 466.84 \twoS & 414.14 \twoS & 12.90 \oneS & 24.76 & 83.09 \oneS & 173.44 \twoS & 1'455 & 5'216 & 165420 & 476535 \\
Australian Gov't Bond 3Y & 0.0019 & 0.0705 & 10.65 & 558.89 \twoS & 990.22 \twoS & 1.45 & 20.53 & 89.57 \twoS & 162.75 \twoS & 3'719 & 10'517 & 358211 & 572109 \\
Canadian Gov't Bond 10Y & 0.0153 & 0.3614 & -14.13 & 466.70 \twoS & 419.55 \twoS & 7.15 & 18.00 & 62.10 & 143.37 & 537 & 4'783 & 47155 & 282932 \\
Eurobobl & 0.0110 & 0.2225 & -19.45 & 475.48 \twoS & 474.07 \twoS & 10.59 & 23.58 & 74.05 & 143.69 & 33'461 & 55'611 & 346668 & 910191 \\
Eurobund & 0.0154 & 0.3513 & -9.35 & 451.08 \twoS & 340.08 \twoS & 14.25 \oneS & 26.77 & 74.06 & 130.28 & 82'510 & 93'541 & 642232 & 952275 \\
Euroschatz & 0.0041 & 0.0885 & -21.56 & 786.79 \twoS & 3504.74 \twoS & 16.06 \twoS & 41.86 \twoS & 107.02 \twoS & 199.08 \twoS & 22'679 & 36'028 & 305729 & 864832 \\
Japanese Gov't Bond 10Y & 0.0090 & 0.2179 & -42.09 & 863.28 \twoS & 4760.13 \twoS & 8.71 & 29.58 & 91.84 \twoS & 166.36 \twoS & 49'603 & 43'313 & 137348 & 91986 \\
Long Gilt & 0.0104 & 0.3826 & -1.62 & 509.27 \twoS & 642.83 \twoS & 13.67 \oneS & 30.27 & 79.71 \oneS & 156.02 \oneS & 3'535 & 27'988 & 69257 & 355250 \\
Long Swiss Confederation & 0.0111 & 0.2748 & -6.38 & 545.83 \twoS & 889.23 \twoS & 53.59 \twoS & 80.77 \twoS & 126.89 \twoS & 194.76 \twoS & 235 & 39 & 14044 & 5847 \\
U.S. Treasury Note 10Y & 0.0196 & 0.4106 & -3.10 & 619.08 \twoS & 1494.68 \twoS & 8.70 & 35.05 \oneS & 65.91 & 162.87 \twoS & 17'967 & 162'889 & 582852 & 2163999 \\
U.S. Treasury Note 2Y & 0.0068 & 0.1087 & 7.20 & 1168.10 \twoS & 11061.84 \twoS & 12.15 \oneS & 62.03 \twoS & 112.94 \twoS & 203.96 \twoS & 1'166 & 50'400 & 51123 & 915589 \\
U.S. Treasury Note 5Y & 0.0148 & 0.2694 & -6.74 & 653.82 \twoS & 1839.84 \twoS & 11.64 \oneS & 41.60 \twoS & 80.85 \oneS & 176.22 \twoS & 9'089 & 83'868 & 400775 & 1719007 \\
Light Sweet Crude Oil (WTI) & 0.0153 & 2.2460 & -32.40 & 626.96 \twoS & 1630.41 \twoS & 11.22 \oneS & 34.71 \oneS & 94.42 \twoS & 160.52 \twoS & 4'398 & 37'065 & 456534 & 699002 \\
Gasoil & 0.0516 & 2.0066 & -19.57 & 554.39 \twoS & 972.18 \twoS & 5.35 & 21.43 & 53.77 & 139.47 & 695 & 19'906 & 111039 & 418798 \\
RBOB Gasoline & 0.0625 & 2.3566 & -24.29 & 508.62 \twoS & 673.32 \twoS & 8.31 & 35.67 \oneS & 92.23 \twoS & 163.61 \twoS & 127 & 1'788 & 88433 & 194846 \\
Heating Oil & 0.0360 & 2.1785 & -14.55 & 501.86 \twoS & 610.42 \twoS & 6.11 & 25.38 & 78.77 & 146.84 \oneS & 133 & 1'291 & 137530 & 203354 \\
Henry Hub Natural Gas & -0.1232 & 3.1845 & 5.43 & 528.06 \twoS & 764.99 \twoS & 22.23 \twoS & 38.98 \twoS & 85.67 \oneS & 136.13 & 3'028 & 10'306 & 325705 & 743292 \\
Aluminum & -0.0156 & 1.4244 & -26.87 & 532.39 \twoS & 834.93 \twoS & 7.32 & 28.77 & 79.11 \oneS & 141.59 & N/A & 6'159 & 7079 & 318966 \\
Copper & 0.0344 & 1.8510 & -19.03 & 702.81 \twoS & 2402.34 \twoS & 22.34 \twoS & 67.49 \twoS & 167.83 \twoS & 255.37 \twoS & 231 & 5'112 & 71885 & 128024 \\
Lead & 0.0394 & 2.1804 & -22.49 & 615.78 \twoS & 1493.00 \twoS & 14.26 \oneS & 38.81 \twoS & 87.45 & 189.45 \twoS & N/A & 999 & 883 & 40201 \\
Tin & -0.0011 & 1.9655 & -15.04 & 571.40 \twoS & 1094.17 \twoS & 13.67 \oneS & 24.79 & 72.21 & 165.87 \twoS & N/A & 485 & 1760 & 115101 \\
Nickel & 0.0235 & 2.4578 & -12.07 & 644.24 \twoS & 1747.51 \twoS & 4.37 & 13.91 & 62.01 & 109.32 & N/A & 2'184 & 946 & 49631 \\
Zinc & -0.0057 & 1.9730 & -17.62 & 573.15 \twoS & 1113.17 \twoS & 14.15 \oneS & 29.69 & 75.20 & 162.30 \twoS & N/A & 2'423 & 1760 & 115101 \\
Gold & 0.0305 & 1.1971 & -28.16 & 853.30 \twoS & 4539.09 \twoS & 0.62 & 34.75 \oneS & 87.88 \oneS & 174.93 \twoS & 784 & 25'989 & 138832 & 329134 \\
Palladium & 0.0102 & 2.1923 & -26.81 & 698.41 \twoS & 2371.53 \twoS & 36.51 \twoS & 55.17 \twoS & 102.20 \twoS & 179.60 \twoS & 14 & 430 & 2193 & 36291 \\
Platinum & 0.0376 & 1.5101 & -48.56 \oneS & 735.37 \twoS & 2920.08 \twoS & 17.44 \twoS & 38.48 \twoS & 104.69 \twoS & 156.09 \oneS & 34 & 932 & 9184 & 59756 \\
Silver & 0.0250 & 2.0767 & -96.58 \twoS & 1048.60 \twoS & 8771.42 \twoS & 4.39 & 21.95 & 78.18 & 163.82 \twoS & 315 & 6'661 & 76057 & 111035 \\
Australian Bank Bill 3M & 0.0005 & 0.0519 & 299.28 \twoS & 5248.30 \twoS & 364590.55 \twoS & 27.00 \twoS & 72.25 \twoS & 130.24 \twoS & 203.28 \twoS & 2'443 & 4'541 & 411190 & 537365 \\
Canadian Bank Bill 3M & 0.0024 & 0.0506 & 42.88 \oneS & 1456.60 \twoS & 19738.37 \twoS & 19.17 \twoS & 49.78 \twoS & 135.91 \twoS & 221.26 \twoS & 1'783 & 3'446 & 205303 & 408228 \\
Euribor 3M & 0.0012 & 0.0295 & 76.32 \twoS & 1797.30 \twoS & 33243.78 \twoS & 89.68 \twoS & 152.44 \twoS & 263.86 \twoS & 376.17 \twoS & 28'455 & 32'541 & 1253952 & 1589255 \\
New Zealand Bank Bill 3M & 0.0011 & 0.0363 & 156.65 \twoS & 2118.90 \twoS & 49989.65 \twoS & 76.46 \twoS & 155.79 \twoS & 259.73 \twoS & 364.35 \twoS & 220 & 136 & 63039 & 70274 \\
Short Sterling 3M & 0.0018 & 0.0424 & 17.80 & 1830.90 \twoS & 34413.00 \twoS & 59.35 \twoS & 129.74 \twoS & 244.83 \twoS & 363.65 \twoS & 6'388 & 11'994 & 786150 & 1041323 \\
Eurodollar & 0.0026 & 0.0431 & 131.20 \twoS & 2812.70 \twoS & 93663.21 \twoS & 116.41 \twoS & 181.15 \twoS & 318.82 \twoS & 392.11 \twoS & 39'664 & 16'242 & 3136864 & 895134 \\
AEX (Netherlands) & -0.0133 & 1.5396 & -22.67 & 1013.40 \twoS & 7498.03 \twoS & 46.31 \twoS & 86.79 \twoS & 156.92 \twoS & 253.75 \twoS & 1'931 & 2'366 & 41800 & 79304 \\
CAC 40 (France) & -0.0044 & 1.5408 & -3.46 & 746.75 \twoS & 2929.66 \twoS & 36.11 \twoS & 66.48 \twoS & 129.88 \twoS & 221.36 \twoS & 5'924 & 5'242 & 351323 & 381862 \\
DAX (Germany) & 0.0008 & 1.5721 & -3.70 & 830.23 \twoS & 4126.65 \twoS & 28.27 \twoS & 68.89 \twoS & 145.43 \twoS & 230.89 \twoS & 10'730 & 20'555 & 228371 & 162915 \\
EURO STOXX 50 (Europe) & -0.0082 & 1.6192 & 11.02 & 783.26 \twoS & 3434.34 \twoS & 50.97 \twoS & 103.50 \twoS & 188.80 \twoS & 288.50 \twoS & 3'799 & 25'840 & 416090 & 2795034 \\
FTSE MIB (Italy) & -0.0156 & 1.5338 & -26.31 & 833.06 \twoS & 4210.57 \twoS & 39.90 \twoS & 73.75 \twoS & 148.48 \twoS & 268.26 \twoS & 2'309 & 2'052 & 11628 & 45977 \\
FTSE 100 (United Kingdom) & -0.0001 & 1.2572 & -9.71 & 926.07 \twoS & 5757.65 \twoS & 59.07 \twoS & 94.93 \twoS & 186.20 \twoS & 321.70 \twoS & 3'771 & 10'389 & 240624 & 647792 \\
Hang Seng (Hongkong) & 0.0135 & 1.6649 & -16.32 & 949.17 \twoS & 6200.07 \twoS & 10.32 & 57.15 \twoS & 120.85 \twoS & 202.39 \twoS & 1'619 & 10'961 & 33608 & 121727 \\
IBEX 35 (Spain) & 0.0023 & 1.5751 & 6.20 & 777.89 \twoS & 3353.76 \twoS & 20.09 \twoS & 44.29 \twoS & 102.28 \twoS & 188.23 \twoS & 2'338 & 1'684 & 46959 & 69191 \\
KOSPI 200 (South Korea) & 0.0175 & 1.8296 & -44.71 \oneS & 761.27 \twoS & 3239.77 \twoS & 9.80 & 32.55 \oneS & 115.75 \twoS & 224.64 \twoS & 3'199 & 21'372 & 36127 & 114246 \\
MSCI Taiwan & 0.0030 & 1.8566 & -31.66 & 968.52 \twoS & 6617.40 \twoS & 46.07 \twoS & 97.77 \twoS & 170.87 \twoS & 262.07 \twoS & 408 & 1'958 & 25092 & 221379 \\
NASDAQ 100 (U.S.) & -0.0089 & 1.9399 & 7.76 & 903.03 \twoS & 5339.96 \twoS & 31.70 \twoS & 93.67 \twoS & 199.40 \twoS & 322.55 \twoS & 7'312 & 281 & 35905 & 9260 \\
Nikkei 225 (Japan) & -0.0063 & 1.6453 & -12.16 & 874.19 \twoS & 4846.92 \twoS & 27.41 \twoS & 49.96 \twoS & 115.91 \twoS & 200.30 \twoS & 151 & 1'290 & 15735 & 67237 \\
S\&P Toronto 60 (Canada) & 0.0125 & 1.2849 & -58.78 \oneS & 1156.30 \twoS & 10962.79 \twoS & 32.43 \twoS & 61.59 \twoS & 142.15 \twoS & 230.70 \twoS & 573 & 1'539 & 63260 & 144992 \\
S\&P 500 (U.S.) & 0.0040 & 1.3219 & -2.63 & 1282.40 \twoS & 14163.06 \twoS & 38.01 \twoS & 82.31 \twoS & 173.96 \twoS & 261.28 \twoS & 19'130 & 4'015 & 403594 & 182424 \\
IPC (Mexico) & 0.0228 & 1.4116 & -0.59 & 880.18 \twoS & 4939.79 \twoS & 34.95 \twoS & 73.64 \twoS & 124.08 \twoS & 195.83 \twoS & 1 & 169 & 1086 & 55327 \\
Bovespa (Brazil) & -0.0135 & 1.8909 & -26.57 & 606.92 \twoS & 1423.80 \twoS & 13.67 \oneS & 58.73 \twoS & 101.27 \twoS & 178.58 \twoS & 204 & 2'389 & 27676 & 312498 \\
MSCI Singapore & 0.0085 & 1.4114 & -43.15 \oneS & 1001.30 \twoS & 7326.78 \twoS & 14.36 \oneS & 64.26 \twoS & 137.04 \twoS & 247.84 \twoS & 81 & 595 & 4123 & 56762 \\
AUD/USD & 0.0079 & 0.8860 & -43.54 \oneS & 1158.80 \twoS & 10933.65 \twoS & 19.48 \twoS & 58.86 \twoS & 131.11 \twoS & 241.61 \twoS & N/A & N/A & N/A & N/A \\
EUR/USD & 0.0085 & 0.6700 & 9.27 & 463.11 \twoS & 395.45 \twoS & 6.31 & 22.59 & 67.66 & 152.46 \oneS & N/A & N/A & N/A & N/A \\
GBP/USD & 0.0004 & 0.5929 & -45.30 \oneS & 736.82 \twoS & 2920.61 \twoS & 3.35 & 40.97 \twoS & 136.90 \twoS & 239.83 \twoS & N/A & N/A & N/A & N/A \\
NZD/USD & 0.0124 & 0.8917 & -41.20 & 587.22 \twoS & 1310.25 \twoS & 7.39 & 23.55 & 84.87 & 172.86 \twoS & N/A & N/A & N/A & N/A \\
BRL/USD & -0.0074 & 1.1436 & -49.34 \oneS & 1024.00 \twoS & 7834.59 \twoS & 19.81 \twoS & 58.41 \twoS & 130.30 \twoS & 191.40 \twoS & N/A & N/A & N/A & N/A \\
CAD/USD & 0.0087 & 0.5996 & -10.18 & 622.54 \twoS & 1532.79 \twoS & 18.68 \twoS & 50.68 \twoS & 130.16 \twoS & 229.81 \twoS & N/A & N/A & N/A & N/A \\
CHF/USD & 0.0160 & 0.7299 & -22.03 & 1218.40 \twoS & 12404.99 \twoS & 7.54 & 44.20 \twoS & 105.18 \twoS & 191.89 \twoS & N/A & N/A & N/A & N/A \\
INR/USD & -0.0102 & 0.4514 & -83.39 \twoS & 1750.20 \twoS & 31272.79 \twoS & 22.96 \twoS & 45.01 \twoS & 138.67 \twoS & 287.85 \twoS & N/A & N/A & N/A & N/A \\
JPY/USD & -0.0005 & 0.6857 & 49.31 \oneS & 1099.90 \twoS & 9532.93 \twoS & 11.25 \oneS & 36.77 \oneS & 101.95 \twoS & 151.66 \oneS & N/A & N/A & N/A & N/A \\
KRW/USD & 0.0018 & 0.7174 & 62.96 \twoS & 5505.20 \twoS & 397837.97 \twoS & 22.50 \twoS & 142.56 \twoS & 370.24 \twoS & 534.95 \twoS & N/A & N/A & N/A & N/A \\
MXN/USD & -0.0088 & 0.7140 & -74.34 \twoS & 1423.20 \twoS & 18837.97 \twoS & 22.67 \twoS & 62.23 \twoS & 128.15 \twoS & 198.38 \twoS & N/A & N/A & N/A & N/A \\
NOK/USD & 0.0077 & 0.8140 & -9.00 & 576.40 \twoS & 1125.91 \twoS & 5.39 & 29.01 & 98.07 \twoS & 181.81 \twoS & N/A & N/A & N/A & N/A \\
PLN/USD & 0.0088 & 0.9634 & -39.42 & 773.60 \twoS & 3382.81 \twoS & 11.68 \oneS & 52.42 \twoS & 118.06 \twoS & 249.66 \twoS & N/A & N/A & N/A & N/A \\
SEK/USD & 0.0076 & 0.8347 & 0.29 & 598.55 \twoS & 1307.98 \twoS & 8.89 & 34.02 \oneS & 98.45 \twoS & 221.08 \twoS & N/A & N/A & N/A & N/A \\
SGD/USD & 0.0077 & 0.3432 & 7.99 & 817.99 \twoS & 3941.20 \twoS & 4.41 & 29.67 & 85.70 \oneS & 154.16 \oneS & N/A & N/A & N/A & N/A \\
TRY/USD & -0.0383 & 1.3971 & -668.12 \twoS & 13878.00 \twoS & 2731629.47 \twoS & 28.88 \twoS & 65.38 \twoS & 173.38 \twoS & 310.09 \twoS & N/A & N/A & N/A & N/A \\
ZAR/USD & -0.0152 & 1.1655 & -109.65 \twoS & 1467.00 \twoS & 20691.50 \twoS & 6.60 & 34.75 & 60.13 & 130.08 & N/A & N/A & N/A & N/A \\
\end{longtable}
\noindent {\em Notes:} The Jarque-Bera statistic tests the null hypothesis that the daily returns are normally distributed. The Ljung-Box statistic tests the null hypothesis that daily return residuals exhibit no autocorrelation for a fixed number of lags (L). The average dollar volume is the notional value of contracts for all maturity months traded on an average day, defined as: number of contracts traded x futures price x multiplier x exchange rate. There is no volume and open interest data for the currency futures because they were constructed as forwards from spot exchange rates and the country specific interest rate term structure (see further appendix). Volume and open interest data for contracts from the London Metals Exchange (LME) is only available from mid September 2005 onwards.
\noindent \begin{tabular}{ r @{\hspace{0.1cm}} l }
* & Indicate statistical significance at the 5\% level. \\
** & Indicate statistical significance at the 1\% level. \\
\end{tabular}
\thispagestyle{empty}
\end{landscape}
\restoregeometry
\end{document}
答案1
也许这就是 OP 所要求的,但我无法测试任何功能,因为 OP 的示例很零散。我将其改为tcolorbox
没有圆角并关闭了框规则。为了完全演示颜色框,我使用了黄色背景颜色。
\documentclass[12pt,a4paper]{article}
\usepackage{longtable}
\setlength{\LTpre}{0pt}
\setlength{\LTpost}{-6pt}
\usepackage{array}
\usepackage[applemac]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[UKenglish]{babel}
\usepackage[UKenglish]{isodate}
\usepackage{geometry}
\usepackage{booktabs}
\usepackage{array}
\usepackage{lscape}
\usepackage{siunitx}
\usepackage{parskip}
\usepackage{xcolor}
\usepackage{tcolorbox}%
\definecolor{lightgray}{gray}{0.98}
\usepackage[skip=2pt,font=scriptsize]{caption}
\newcommand{\oneS}{\ensuremath{{}^{\textstyle *}}}
\newcommand{\twoS}{\ensuremath{{}^{\textstyle **}}}
\tcbuselibrary{breakable}
\begin{document}%
\newgeometry{left=1.5cm,right=1.5cm,top=1.8cm,bottom=1.8cm}
\begin{landscape}
\scriptsize
\thispagestyle{empty}
\scriptsize
%\begingroup\setlength{\fboxsep}{0pt} >>> NOT WORKING returns "Missing \endgroup inserted" error
%\colorbox{lightgray}{
\begin{tcolorbox}[boxrule=0pt,colback=yellow,oversize=1cm,arc=0mm,auto outer arc, breakable]
\begin{longtable}{%
l S[table-format=-1.4] S[table-format=-1.4] S[table-format=-3.2] S[table-format=-5.2]
S[table-format= 7.2] S[table-format=-3.2] S[table-format=-3.2] S[table-format=-3.2]
S[table-format=-3.2] @{\hspace{0.8cm}} r r r r }
\caption{Summary statistics} \label{fig:sumstat} \\
\toprule
{Future i.e. underlying asset} & \multicolumn{5}{l}{Daily returns on long-only
positions} & \multicolumn{4}{l}{Ljung-Box } & \multicolumn{2}{l}{Avg. vol. (\$ mil.)}
& \multicolumn{2}{l}{Avg. open interest} \\
\cmidrule(r){2-6} \cmidrule(r){7-10} \cmidrule(r){11-12} \cmidrule(r){13-14}
& {Mean (\%)} & {Std. (\%)} & {Skew. (\%)} & {Kurt. (\%)} & {Jarque-Bera} & {(5)} &
{(20)} & {(60)} & {(120)} & {2000} & {2014} & {2000} & {2014} \\
\midrule
\endfirsthead
\toprule
{Future i.e. underlying asset} & \multicolumn{5}{l}{Daily returns on long-only
positions} & \multicolumn{4}{l}{Ljung-Box } & \multicolumn{2}{l}{Avg. vol. (\$ mil.)}
& \multicolumn{2}{l}{Avg. open interest} \\
\cmidrule(r){2-6} \cmidrule(r){7-10} \cmidrule(r){11-12} \cmidrule(r){13-14}
& {Mean (\%)} & {Std. (\%)} & {Skew. (\%)} & {Kurt. (\%)} & {Jarque-Bera} & {(5)}
& {(20)} & {(60)} & {(120)} & {2000} & {2014} & {2000} & {2014} \\
\midrule
\endhead
\bottomrule \multicolumn{14}{r}{\emph{Continued on next page}}
\endfoot
\bottomrule
\endlastfoot
Frozen Concentrated Orange Juice & -0.0184 & 1.8845 & -8.68 & 764.51
\twoS & 3170.82 \twoS & 20.61 \twoS & 43.77 \twoS & 98.60 \twoS
& 150.82 \oneS & 43 & 37 & 25727 & 16991 \\
\end{longtable}
\end{tcolorbox}%
% }\endgroup >>> NOT WORKING returns "Missing \endgroup inserted"error
\thispagestyle{empty}
\end{landscape}
\restoregeometry
\end{document}%
屏幕截图显示了一个版本,其中我复制了表格的最后一行以放大下一页的表格,但为了简洁起见,我没有在此示例中发布此重复。
编辑-更新 正如 OP 所要求的:
表格周围的颜色框更加紧密,背景颜色为灰色,为了使帖子保持较小,我只会给出更改 - 在我上面的例子中替换它。
在序言中使用
\usepackage{caption}
在使用前在相关位置\begin{longtable}
将其紧紧地tcolorbox
围绕在桌子周围。
\captionof{table}{Summary statistics} \label{fig:sumstat}
\begin{tcolorbox}[left=2pt,top=0pt,boxrule=0pt,bottom=0pt,boxsep=0pt,colback=gray,arc=0mm,auto outer arc, breakable]
答案2
您可以使用宏为表格着色\rowcolors
:
\documentclass[12pt,a4paper]{article}
\usepackage{longtable}
\setlength{\LTpre}{0pt}
\setlength{\LTpost}{-6pt}
\usepackage{array}
\usepackage[UKenglish]{babel}
\usepackage{geometry}
\usepackage{booktabs}
\usepackage{array}
\usepackage{lscape}
\usepackage{siunitx}
\usepackage{parskip}
\usepackage[table]{xcolor}
\definecolor{lightgray}{gray}{0.8}
\usepackage[skip=2pt,font=scriptsize]{caption}
\newcommand{\oneS}{\ensuremath{{}^{\textstyle *}}}
\newcommand{\twoS}{\ensuremath{{}^{\textstyle **}}}
\begin{document}
\newgeometry{left=1.5cm,right=1.5cm,top=1.8cm,bottom=1.8cm}
\begin{landscape}
\scriptsize
\thispagestyle{empty}
\def\arraystretch{1.5}
\rowcolors{3}{lightgray}{lightgray}%%%% start with line 3
\begin{longtable}{l
S[table-format=-1.4]
S[table-format=-1.4]
S[table-format=-3.2]
S[table-format=-5.2]
S[table-format= 7.2]
S[table-format=-3.2]
S[table-format=-3.2]
S[table-format=-3.2]
S[table-format=-3.2]
>{\hspace*{0.8cm}}r r r r }
\caption{Summary statistics} \label{fig:sumstat} \\\hline
{Future i.e. underlying asset} & \multicolumn{5}{l}{Daily returns on long-only positions} & \multicolumn{4}{l}{Ljung-Box } & \multicolumn{2}{l}{Avg. vol. (\$ mil.)} & \multicolumn{2}{l}{Avg. open interest} \\
\cline{2-6} \cline{7-10} \cline{11-12} \cline{13-14}
& {Mean (\%)} & {Std. (\%)} & {Skew. (\%)} & {Kurt. (\%)} & {Jarque-Bera} & {(5)} & {(20)} & {(60)} & {(120)} & {2000} & {2014} & {2000} & {2014} \\
\hline
\endfirsthead
\hline
{Future i.e. underlying asset} & \multicolumn{5}{l}{Daily returns on long-only positions} & \multicolumn{4}{l}{Ljung-Box } & \multicolumn{2}{l}{Avg. vol. (\$ mil.)} & \multicolumn{2}{l}{Avg. open interest} \\
\cline{2-6} \cline{7-10} \cline{11-12} \cline{13-14}
& {Mean (\%)} & {Std. (\%)} & {Skew. (\%)} & {Kurt. (\%)} & {Jarque-Bera} & {(5)} & {(20)} & {(60)} & {(120)} & {2000} & {2014} & {2000} & {2014} \\
\hline
\endhead
\hline \multicolumn{14}{r}{\emph{Continued on next page}}
\endfoot
\hline
\endlastfoot
Frozen Concentrated Orange Juice & -0.0184 & 1.8845 & -8.68 & 764.51 \twoS & 3170.82 \twoS & 20.61 \twoS & 43.77 \twoS & 98.60 \twoS & 150.82 \oneS & 43 & 37 & 25727 & 16991 \\
Frozen Concentrated Orange Juice & -0.0184 & 1.8845 & -8.68 & 764.51 \twoS & 3170.82 \twoS & 20.61 \twoS & 43.77 \twoS & 98.60 \twoS & 150.82 \oneS & 43 & 37 & 25727 & 16991 \\
Frozen Concentrated Orange Juice & -0.0184 & 1.8845 & -8.68 & 764.51 \twoS & 3170.82 \twoS & 20.61 \twoS & 43.77 \twoS & 98.60 \twoS & 150.82 \oneS & 43 & 37 & 25727 & 16991 \\
Frozen Concentrated Orange Juice & -0.0184 & 1.8845 & -8.68 & 764.51 \twoS & 3170.82 \twoS & 20.61 \twoS & 43.77 \twoS & 98.60 \twoS & 150.82 \oneS & 43 & 37 & 25727 & 16991 \\
Frozen Concentrated Orange Juice & -0.0184 & 1.8845 & -8.68 & 764.51 \twoS & 3170.82 \twoS & 20.61 \twoS & 43.77 \twoS & 98.60 \twoS & 150.82 \oneS & 43 & 37 & 25727 & 16991 \\
Frozen Concentrated Orange Juice & -0.0184 & 1.8845 & -8.68 & 764.51 \twoS & 3170.82 \twoS & 20.61 \twoS & 43.77 \twoS & 98.60 \twoS & 150.82 \oneS & 43 & 37 & 25727 & 16991 \\
Frozen Concentrated Orange Juice & -0.0184 & 1.8845 & -8.68 & 764.51 \twoS & 3170.82 \twoS & 20.61 \twoS & 43.77 \twoS & 98.60 \twoS & 150.82 \oneS & 43 & 37 & 25727 & 16991 \\
Frozen Concentrated Orange Juice & -0.0184 & 1.8845 & -8.68 & 764.51 \twoS & 3170.82 \twoS & 20.61 \twoS & 43.77 \twoS & 98.60 \twoS & 150.82 \oneS & 43 & 37 & 25727 & 16991 \\
Frozen Concentrated Orange Juice & -0.0184 & 1.8845 & -8.68 & 764.51 \twoS & 3170.82 \twoS & 20.61 \twoS & 43.77 \twoS & 98.60 \twoS & 150.82 \oneS & 43 & 37 & 25727 & 16991 \\
Frozen Concentrated Orange Juice & -0.0184 & 1.8845 & -8.68 & 764.51 \twoS & 3170.82 \twoS & 20.61 \twoS & 43.77 \twoS & 98.60 \twoS & 150.82 \oneS & 43 & 37 & 25727 & 16991 \\
Frozen Concentrated Orange Juice & -0.0184 & 1.8845 & -8.68 & 764.51 \twoS & 3170.82 \twoS & 20.61 \twoS & 43.77 \twoS & 98.60 \twoS & 150.82 \oneS & 43 & 37 & 25727 & 16991 \\
Frozen Concentrated Orange Juice & -0.0184 & 1.8845 & -8.68 & 764.51 \twoS & 3170.82 \twoS & 20.61 \twoS & 43.77 \twoS & 98.60 \twoS & 150.82 \oneS & 43 & 37 & 25727 & 16991 \\
Frozen Concentrated Orange Juice & -0.0184 & 1.8845 & -8.68 & 764.51 \twoS & 3170.82 \twoS & 20.61 \twoS & 43.77 \twoS & 98.60 \twoS & 150.82 \oneS & 43 & 37 & 25727 & 16991 \\
Frozen Concentrated Orange Juice & -0.0184 & 1.8845 & -8.68 & 764.51 \twoS & 3170.82 \twoS & 20.61 \twoS & 43.77 \twoS & 98.60 \twoS & 150.82 \oneS & 43 & 37 & 25727 & 16991 \\
Frozen Concentrated Orange Juice & -0.0184 & 1.8845 & -8.68 & 764.51 \twoS & 3170.82 \twoS & 20.61 \twoS & 43.77 \twoS & 98.60 \twoS & 150.82 \oneS & 43 & 37 & 25727 & 16991 \\
Frozen Concentrated Orange Juice & -0.0184 & 1.8845 & -8.68 & 764.51 \twoS & 3170.82 \twoS & 20.61 \twoS & 43.77 \twoS & 98.60 \twoS & 150.82 \oneS & 43 & 37 & 25727 & 16991 \\
Frozen Concentrated Orange Juice & -0.0184 & 1.8845 & -8.68 & 764.51 \twoS & 3170.82 \twoS & 20.61 \twoS & 43.77 \twoS & 98.60 \twoS & 150.82 \oneS & 43 & 37 & 25727 & 16991 \\
\end{longtable}
\thispagestyle{empty}
\end{landscape}
\end{document}