我对 LaTeX 非常非常陌生,就像我昨天才开始了解它的作用一样。我正在使用 Stata 15,想制作漂亮的表格。
下面的代码有问题。我一直收到错误消息:
159: Extra alignment tab has been changed to \cr.
<template> \endtemplate
l.159 \end{tabularx}
另外,我怎样才能将所有内容放在一个页面上?非常感谢大家的帮助。
我的代码:
\documentclass{report}
\usepackage{booktabs}
\usepackage{tabularx}
\begin{document}
\begin{center}
\textbf{Table 3. Summary Statistics of Food Chances in New York City Gentrifying Neighborhoods} \par \vspace{2ex}
\footnotesize
\newcolumntype{Y}{>{\raggedleft\arraybackslash}X}
\begin{tabularx} {12cm} {@{} l Y Y Y Y Y Y @{}}
\toprule
&\multicolumn{4}{c}{(1)} & \multicolumn{4}{c}{} \\
& Mean & Std. Dev. & Min & Max \\
\midrule
\emph{Mott Haven/Hunts Point} \\
Healthy Food Chances & 43.5 & 9.67 & 25 & 61 \\
Healthy Food Chances per km2 & 3.82 & 0.85 & 2.19 & 5.35 \\
Unhealthy Food Chances & 216 & 84.0 & 79 & 354 \\
Unhealthy Food Chances per km2 & 19.0 & 7.37 & 6.93 & 31.1 \\
All Food Chances & 365.5 & 121.2 & 159 & 575 \\
All Food Chances per km2 & 32.1 & 10.6 & 14.0 & 50.5 \\
\midrule
\emph{Morrisania/East Tremont} \\
Healthy Food Chances & 24.8 & 6.46 & 13 & 34 \\
Healthy Food Chances per km2 & 3.09 & 0.80 & 1.62 & 4.23 \\
Unhealthy Food Chances & 210.8 & 76.4 & 98 & 345 \\
Unhealthy Food Chances per km2 & 26.3 & 9.52 & 12.2 & 43.0 \\
All Food Chances & 325.7 & 107.6 & 163 & 517 \\
All Food Chances per km2 & 40.6 & 13.4 & 20.3 & 64.4 \\
\midrule
\emph{Williamsburg/Greenpoint} \\
Healthy Food Chances & 53.2 & 9.10 & 35 & 68 \\
Healthy Food Chances per km2 & 4.37 & 0.75 & 2.88 & 5.59 \\
Unhealthy Food Chances & 279.5 & 59.5 & 166 & 359 \\
Unhealthy Food Chances per km2 & 23.0 & 4.88 & 13.6 & 29.5 \\
All Food Chances & 508.9 & 124.4 & 290 & 711 \\
All Food Chances per km2 & 41.8 & 10.2 & 23.8 & 58.4 \\
\midrule
\emph{Bedford Stuyvesant} \\
Healthy Food Chances & 14.3 & 3.23 & 9 & 22 \\
Healthy Food Chances per km2 & 1.90 & 0.43 & 1.20 & 2.93 \\
Unhealthy Food Chances & 175.8 & 50.8 & 67 & 252 \\
Unhealthy Food Chances per km2 & 23.4 & 6.77 & 8.92 & 33.6 \\
All Food Chances & 260.6 & 70.4 & 110 & 366 \\
All Food Chances per km2 & 34.7 & 9.37 & 14.6 & 48.7 \\
\midrule
\emph{Bushwick} \\
Healthy Food Chances & 21.8 & 2.50 & 18 & 27 \\
Healthy Food Chances per km2 & 4.21 & 0.48 & 3.47 & 5.21 \\
Unhealthy Food Chances & 168.4 & 53.7 & 82 & 259 \\
Unhealthy Food Chances per km2 & 32.5 & 10.4 & 15.8 & 50.0 \\
All Food Chances & 258 & 81.5 & 121 & 398 \\
All Food Chances per km2 & 49.8 & 15.7 & 23.4 & 76.8 \\
\midrule
\emph{Sunset Park} \\
Healthy Food Chances & 25.7 & 5.39 & 17 & 35 \\
Healthy Food Chances per km2 & 2.68 & 0.56 & 1.77 & 3.65 \\
Unhealthy Food Chances & 246.0 & 73.4 & 125 & 369 \\
Unhealthy Food Chances per km2 & 25.7 & 7.66 & 13.0 & 38.5 \\
All Food Chances & 404.9 & 117.9 & 197 & 626 \\
All Food Chances per km2 & 42.3 & 12.3 & 20.6 & 65.3 \\
\midrule
\emph{North Crown Heights/Prospect Heights} \\
Healthy Food Chances & 38.5 & 6.08 & 24 & 51 \\
Healthy Food Chances per km2 & 9.30 & 1.47 & 5.79 & 12.3 \\
Unhealthy Food Chances & 159.2 & 40.1 & 82 & 222 \\
Unhealthy Food Chances per km2 & 38.4 & 9.68 & 19.8 & 53.6 \\
All Food Chances & 298.2 & 68.8 & 159 & 412 \\
All Food Chances per km2 & 72.0 & 16.6 & 38.4 & 99.4 \\
\midrule
\emph{South Crown Heights} \\
Healthy Food Chances & 29.9 & 4.41 & 21 & 35 \\
Healthy Food Chances per km2 & 7.20 & 1.06 & 5.07 & 8.45 \\
Unhealthy Food Chances & 125.4 & 24.1 & 76 & 167 \\
Unhealthy Food Chances per km2 & 30.3 & 5.81 & 18.3 & 40.3 \\
All Food Chances & 229.9 & 45.6 & 130 & 309 \\
All Food Chances per km2 & 55.5 & 11.0 & 31.4 & 74.6 \\
\midrule
\emph{Brownsville/Ocean Hill} \\
Healthy Food Chances & 18.5 & 4.01 & 8 & 23 \\
Healthy Food Chances per km2 & 3.75 & 0.81 & 1.63 & 4.67 \\
Unhealthy Food Chances & 116.3 & 38.8 & 43 & 183 \\
Unhealthy Food Chances per km2 & 23.6 & 7.88 & 8.74 & 37.2 \\
All Food Chances & 185.8 & 53.2 & 80 & 277 \\
All Food Chances per km2 & 37.8 & 10.8 & 16.3 & 56.3 \\
\midrule
\emph{Lower East Side/Chinatown} \\
Healthy Food Chances & 54.4 & 6.15 & 41 & 65 \\
Healthy Food Chances per km2 & 12.4 & 1.40 & 9.31 & 14.8 \\
Unhealthy Food Chances & 297.3 & 73.4 & 172 & 406 \\
Unhealthy Food Chances per km2 & 67.5 & 16.7 & 39.1 & 92.2 \\
All Food Chances & 767.0 & 179.9 & 478 & 1103 \\
All Food Chances per km2 & 174.2 & 40.9 & 108.6 & 250.5 \\
\midrule
\emph{Morningside Heights/Hamilton Heights} \\
Healthy Food Chances & 22.1 & 2.94 & 16 & 27 \\
Healthy Food Chances per km2 & 5.70 & 0.76 & 4.12 & 6.95 \\
Unhealthy Food Chances & 124.4 & 38.4 & 60 & 188 \\
Unhealthy Food Chances per km2 & 32.0 & 9.88 & 15.4 & 48.4 \\
All Food Chances & 250.3 & 66.7 & 136 & 363 \\
All Food Chances per km2 & 64.4 & 17.2 & 35.0 & 93.4 \\
\midrule
\emph{Central Harlem} \\
Healthy Food Chances & 22.2 & 3.11 & 16 & 27 \\
Healthy Food Chances per km2 & 6.13 & 0.86 & 4.41 & 7.45 \\
Unhealthy Food Chances & 136.8 & 44.7 & 68 & 207 \\
Unhealthy Food Chances per km2 & 37.7 & 12.3 & 18.8 & 57.1 \\
All Food Chances & 249.0 & 71.2 & 130 & 374 \\
All Food Chances per km2 & 68.7 & 19.6 & 35.9 & 103.1 \\
\midrule
\emph{East Harlem} \\
Healthy Food Chances & 21.9 & 2.79 & 17 & 26 \\
Healthy Food Chances per km2 & 3.52 & 0.45 & 2.73 & 4.18 \\
Unhealthy Food Chances & 147.1 & 53.5 & 57 & 236 \\
Unhealthy Food Chances per km2 & 23.7 & 8.60 & 9.17 & 38.0 \\
All Food Chances & 249.5 & 79.5 & 114 & 392 \\
All Food Chances per km2 & 40.1 & 12.8 & 18.3 & 63.1 \\
\midrule
\emph{Washington Heights/Inwood} \\
Healthy Food Chances & 40.3 & 5.06 & 32 & 48 \\
Healthy Food Chances per km2 & 5.56 & 0.70 & 4.41 & 6.62 \\
Unhealthy Food Chances & 269.3 & 78.5 & 140 & 388 \\
Unhealthy Food Chances per km2 & 37.1 & 10.8 & 19.3 & 53.5 \\
All Food Chances & 453.3 & 114.9 & 268 & 646 \\
All Food Chances per km2 & 62.5 & 15.8 & 37.0 & 89.1 \\
\midrule
\emph{Astoria} \\
Healthy Food Chances & 48.8 & 7.19 & 34 & 58 \\
Healthy Food Chances per km2 & 3.04 & 0.45 & 2.12 & 3.61 \\
Unhealthy Food Chances & 338 & 72.8 & 202 & 448 \\
Unhealthy Food Chances per km2 & 21.0 & 4.53 & 12.6 & 27.9 \\
All Food Chances & 620.0 & 140.9 & 352 & 858 \\
All Food Chances per km2 & 38.6 & 8.78 & 21.9 & 53.4 \\
\midrule
\emph{Total} \\
Healthy Food Chances & 32.0 & 14.0 & 8 & 68 \\
Healthy Food Chances per km2 & 5.11 & 2.81 & 1.20 & 14.8 \\
Unhealthy Food Chances & 200.7 & 90.3 & 43 & 448 \\
Unhealthy Food Chances per km2 & 30.7 & 14.7 & 6.93 & 92.2 \\
All Food Chances & 361.8 & 187.5 & 80 & 1103 \\
All Food Chances per km2 & 57.0 & 37.6 & 14.0 & 250.5 \\
\bottomrule
\end{tabularx}
\par\smallskip\noindent\parbox{12cm}{\raggedright \scriptsize \emph{Source}: NETS\_ACS\_032019.dta.}
\normalsize
\end{center}
\end{document}
答案1
正如我在评论中提到的那样,您的表格存在更多问题,如所提到的错误(我的评论已解决):
- 表格太大,一页都放不下,实际上它有两页半那么长,所以你需要
longtable
或ltablex
包 - 行的类型不一致;此外,如果除第一列之外其他列均为空,则应始终输入定义列的所有 & 符号
对于数字我将使用
S
列类型\documentclass{report} \usepackage{booktabs, longtable} % <--- \usepackage[skip=1ex]{caption} % <--- \usepackage{siunitx} % <--- %---------------- show page layout. don't use in a real document! \usepackage{showframe} \renewcommand\ShowFrameLinethickness{0.15pt} \renewcommand*\ShowFrameColor{\color{red}} %---------------------------------------------------------------% \begin{document} \begin{longtable}{@{} l *{5}{S[table-format=4.2]} @{}} \caption{Summary Statistics of Food Chances in New York City Gentrifying Neighborhoods} \label{tab:longtable} \\ \toprule & {Mean} & {Std. Dev.} & {Min} & {Max} \\ \midrule \endfirsthead \caption{Summary Statistics of Food Chances in New York City Gentrifying Neighborhoods (cont.)} \\ \toprule & {Mean} & {Std. Dev.} & {Min} & {Max} \\ \midrule \endhead \midrule \multicolumn{5}{r}{\footnotesize\itshape{continue on the next page}} \endfoot \midrule[\heavyrulewidth] \multicolumn{5}{l}{\footnotesize \emph{Source}: NETS\_ACS\_032019.dta.} \normalsize \endlastfoot % table body \multicolumn{5}{l}{\emph{Mott Haven/Hunts Point}} \\ Healthy Food Chances & 43.5 & 9.67 & 25 & 61 \\ Healthy Food Chances per \si{km^2} & 3.82 & 0.85 & 2.19 & 5.35 \\ Unhealthy Food Chances & 216 & 84.0 & 79 & 354 \\ Unhealthy Food Chances per \si{km^2}& 19.0 & 7.37 & 6.93 & 31.1 \\ All Food Chances & 365.5 & 121.2 & 159 & 575 \\ All Food Chances per \si{km^2} & 32.1 & 10.6 & 14.0 & 50.5 \\ \midrule \multicolumn{5}{l}{\emph{Morrisania/East Tremont}} \\ Healthy Food Chances & 24.8 & 6.46 & 13 & 34 \\ Healthy Food Chances per \si{km^2} & 3.09 & 0.80 & 1.62 & 4.23 \\ Unhealthy Food Chances & 210.8 & 76.4 & 98 & 345 \\ Unhealthy Food Chances per \si{km^2}& 26.3 & 9.52 & 12.2 & 43.0 \\ All Food Chances & 325.7 & 107.6 & 163 & 517 \\ All Food Chances per \si{km^2} & 40.6 & 13.4 & 20.3 & 64.4 \\ \midrule \multicolumn{5}{l}{\emph{Williamsburg/Greenpoint}} \\ Healthy Food Chances & 53.2 & 9.10 & 35 & 68 \\ Healthy Food Chances per \si{km^2} & 4.37 & 0.75 & 2.88 & 5.59 \\ Unhealthy Food Chances & 279.5 & 59.5 & 166 & 359 \\ Unhealthy Food Chances per \si{km^2}& 23.0 & 4.88 & 13.6 & 29.5 \\ All Food Chances & 508.9 & 124.4 & 290 & 711 \\ All Food Chances per \si{km^2} & 41.8 & 10.2 & 23.8 & 58.4 \\ \midrule \multicolumn{5}{l}{\emph{Bedford Stuyvesant}} \\ Healthy Food Chances & 14.3 & 3.23 & 9 & 22 \\ Healthy Food Chances per \si{km^2} & 1.90 & 0.43 & 1.20 & 2.93 \\ Unhealthy Food Chances & 175.8 & 50.8 & 67 & 252 \\ Unhealthy Food Chances per \si{km^2}& 23.4 & 6.77 & 8.92 & 33.6 \\ All Food Chances & 260.6 & 70.4 & 110 & 366 \\ All Food Chances per \si{km^2} & 34.7 & 9.37 & 14.6 & 48.7 \\ \midrule \multicolumn{5}{l}{\emph{Bushwick}} \\ Healthy Food Chances & 21.8 & 2.50 & 18 & 27 \\ Healthy Food Chances per \si{km^2} & 4.21 & 0.48 & 3.47 & 5.21 \\ Unhealthy Food Chances & 168.4 & 53.7 & 82 & 259 \\ Unhealthy Food Chances per \si{km^2}& 32.5 & 10.4 & 15.8 & 50.0 \\ All Food Chances & 258 & 81.5 & 121 & 398 \\ All Food Chances per \si{km^2} & 49.8 & 15.7 & 23.4 & 76.8 \\ \midrule \multicolumn{5}{l}{\emph{Sunset Park}} \\ Healthy Food Chances & 25.7 & 5.39 & 17 & 35 \\ Healthy Food Chances per \si{km^2} & 2.68 & 0.56 & 1.77 & 3.65 \\ Unhealthy Food Chances & 246.0 & 73.4 & 125 & 369 \\ Unhealthy Food Chances per \si{km^2}& 25.7 & 7.66 & 13.0 & 38.5 \\ All Food Chances & 404.9 & 117.9 & 197 & 626 \\ All Food Chances per \si{km^2} & 42.3 & 12.3 & 20.6 & 65.3 \\ \midrule \multicolumn{5}{l}{\emph{North Crown Heights/Prospect Heights}} \\ Healthy Food Chances & 38.5 & 6.08 & 24 & 51 \\ Healthy Food Chances per \si{km^2} & 9.30 & 1.47 & 5.79 & 12.3 \\ Unhealthy Food Chances & 159.2 & 40.1 & 82 & 222 \\ Unhealthy Food Chances per \si{km^2}& 38.4 & 9.68 & 19.8 & 53.6 \\ All Food Chances & 298.2 & 68.8 & 159 & 412 \\ All Food Chances per \si{km^2} & 72.0 & 16.6 & 38.4 & 99.4 \\ \midrule \multicolumn{5}{l}{\emph{South Crown Heights}} \\ Healthy Food Chances & 29.9 & 4.41 & 21 & 35 \\ Healthy Food Chances per \si{km^2} & 7.20 & 1.06 & 5.07 & 8.45 \\ Unhealthy Food Chances & 125.4 & 24.1 & 76 & 167 \\ Unhealthy Food Chances per \si{km^2}& 30.3 & 5.81 & 18.3 & 40.3 \\ All Food Chances & 229.9 & 45.6 & 130 & 309 \\ All Food Chances per \si{km^2} & 55.5 & 11.0 & 31.4 & 74.6 \\ \midrule \multicolumn{5}{l}{\emph{Brownsville/Ocean Hill}} \\ Healthy Food Chances & 18.5 & 4.01 & 8 & 23 \\ Healthy Food Chances per \si{km^2} & 3.75 & 0.81 & 1.63 & 4.67 \\ Unhealthy Food Chances & 116.3 & 38.8 & 43 & 183 \\ Unhealthy Food Chances per \si{km^2}& 23.6 & 7.88 & 8.74 & 37.2 \\ All Food Chances & 185.8 & 53.2 & 80 & 277 \\ All Food Chances per \si{km^2} & 37.8 & 10.8 & 16.3 & 56.3 \\ \midrule \multicolumn{5}{l}{\emph{Lower East Side/Chinatown}} \\ Healthy Food Chances & 54.4 & 6.15 & 41 & 65 \\ Healthy Food Chances per \si{km^2} & 12.4 & 1.40 & 9.31 & 14.8 \\ Unhealthy Food Chances & 297.3 & 73.4 & 172 & 406 \\ Unhealthy Food Chances per \si{km^2}& 67.5 & 16.7 & 39.1 & 92.2 \\ All Food Chances & 767.0 & 179.9 & 478 & 1103 \\ All Food Chances per \si{km^2} & 174.2 & 40.9 & 108.6 & 250.5 \\ \midrule \multicolumn{5}{l}{\emph{Morningside Heights/Hamilton Heights}} \\ Healthy Food Chances & 22.1 & 2.94 & 16 & 27 \\ Healthy Food Chances per \si{km^2} & 5.70 & 0.76 & 4.12 & 6.95 \\ Unhealthy Food Chances & 124.4 & 38.4 & 60 & 188 \\ Unhealthy Food Chances per \si{km^2}& 32.0 & 9.88 & 15.4 & 48.4 \\ All Food Chances & 250.3 & 66.7 & 136 & 363 \\ All Food Chances per \si{km^2} & 64.4 & 17.2 & 35.0 & 93.4 \\ \midrule \multicolumn{5}{l}{\emph{Central Harlem}} \\ Healthy Food Chances & 22.2 & 3.11 & 16 & 27 \\ Healthy Food Chances per \si{km^2} & 6.13 & 0.86 & 4.41 & 7.45 \\ Unhealthy Food Chances & 136.8 & 44.7 & 68 & 207 \\ Unhealthy Food Chances per \si{km^2}& 37.7 & 12.3 & 18.8 & 57.1 \\ All Food Chances & 249.0 & 71.2 & 130 & 374 \\ All Food Chances per \si{km^2} & 68.7 & 19.6 & 35.9 & 103.1 \\ \midrule \multicolumn{5}{l}{\emph{East Harlem}} \\ Healthy Food Chances & 21.9 & 2.79 & 17 & 26 \\ Healthy Food Chances per \si{km^2} & 3.52 & 0.45 & 2.73 & 4.18 \\ Unhealthy Food Chances & 147.1 & 53.5 & 57 & 236 \\ Unhealthy Food Chances per \si{km^2}& 23.7 & 8.60 & 9.17 & 38.0 \\ All Food Chances & 249.5 & 79.5 & 114 & 392 \\ All Food Chances per \si{km^2} & 40.1 & 12.8 & 18.3 & 63.1 \\ \midrule \multicolumn{5}{l}{\emph{Washington Heights/Inwood}} \\ Healthy Food Chances & 40.3 & 5.06 & 32 & 48 \\ Healthy Food Chances per \si{km^2} & 5.56 & 0.70 & 4.41 & 6.62 \\ Unhealthy Food Chances & 269.3 & 78.5 & 140 & 388 \\ Unhealthy Food Chances per \si{km^2}& 37.1 & 10.8 & 19.3 & 53.5 \\ All Food Chances & 453.3 & 114.9 & 268 & 646 \\ All Food Chances per \si{km^2} & 62.5 & 15.8 & 37.0 & 89.1 \\ \midrule \multicolumn{5}{l}{\emph{Astoria}} \\ Healthy Food Chances & 48.8 & 7.19 & 34 & 58 \\ Healthy Food Chances per \si{km^2} & 3.04 & 0.45 & 2.12 & 3.61 \\ Unhealthy Food Chances & 338 & 72.8 & 202 & 448 \\ Unhealthy Food Chances per \si{km^2}& 21.0 & 4.53 & 12.6 & 27.9 \\ All Food Chances & 620.0 & 140.9 & 352 & 858 \\ All Food Chances per \si{km^2} & 38.6 & 8.78 & 21.9 & 53.4 \\ \midrule \multicolumn{5}{l}{\emph{Total}} \\ Healthy Food Chances & 32.0 & 14.0 & 8 & 68 \\ Healthy Food Chances per \si{km^2} & 5.11 & 2.81 & 1.20 & 14.8 \\ Unhealthy Food Chances & 200.7 & 90.3 & 43 & 448 \\ Unhealthy Food Chances per \si{km^2}& 30.7 & 14.7 & 6.93 & 92.2 \\ All Food Chances & 361.8 & 187.5 & 80 & 1103 \\ All Food Chances per \si{km^2} & 57.0 & 37.6 & 14.0 & 250.5 \\ \end{longtable} \end{document}
这使:
(红线表示文本边框)
答案2
第一行中有一个 的数字是错误的\multicolumn
。无论如何,您声明了 7 个列,但实际使用了 5 个,因此我减少了它们的数量。我将第一列设置为X
类型,并将S
列类型用于最后 4 列,以便按小数点对齐数字。此外,我在行组之间添加了一些垂直填充。最后,由于表格无法放在一页上,我加载了 ,这将带来的ltables
优势。请注意,我们不需要环境:默认情况下,长表是居中的。longtable
tabularx
center
\documentclass{report}
\usepackage{siunitx}
\usepackage{booktabs, caption}
\usepackage{ltablex}
\begin{document}
\footnotesize
\captionsetup{font=bf}
\sisetup{table-format=3.2, table-number-alignment=center, per-mode=symbol}
\newcolumntype{Y}{>{\raggedleft\arraybackslash}X}
\setlength{\defaultaddspace}{0.6ex}
\begin{tabularx} {12cm} {@{}X SSSS@{}}
\caption{Table 3. Summary Statistics of Food Chances in New York City Gentrifying Neighborhoods} \\
\toprule
\multicolumn{1}{c}{(1)} & \multicolumn{4}{c}{} \\
& {Mean} & {Std. Dev} & {Min} & {Max }\\
\midrule
\endfirsthead
%
\midrule
\multicolumn{1}{c}{(1)} & \multicolumn{4}{c}{} \\
& {Mean} & {Std. Dev} & {Min} & {Max }\\
\midrule
\endhead
\midrule
\multicolumn{5}{r@{}}{\em to be continued}
\endfoot
%\\
\bottomrule \addlinespace[1ex]
\scriptsize \emph{Source}: NETS\_ACS\_032019.dta.
\endlastfoot
\emph{Mott Haven/Hunts Point}\smallskip \\
Healthy Food Chances & 43.5 & 9.67 & 25 & 61 \\
Healthy Food Chances\,/\,\si{\square\km} & 3.82 & 0.85 & 2.19 & 5.35 \\ \addlinespace
Unhealthy Food Chances & 216 & 84.0 & 79 & 354 \\
Unhealthy Food Chance\,/\,\si{\square\km} & 19.0 & 7.37 & 6.93 & 31.1 \\ \addlinespace
All Food Chances & 365.5 & 121.2 & 159 & 575 \\
All Food Chances\,/\,\si{\square\km} & 32.1 & 10.6 & 14.0 & 50.5 \\
\midrule
\emph{Morrisania/East Tremont}\smallskip \\
Healthy Food Chances & 24.8 & 6.46 & 13 & 34 \\
Healthy Food Chances\,/\,\si{\square\km} & 3.09 & 0.80 & 1.62 & 4.23 \\ \addlinespace
Unhealthy Food Chances & 210.8 & 76.4 & 98 & 345 \\
Unhealthy Food Chances\,/\,\si{\square\km} & 26.3 & 9.52 & 12.2 & 43.0 \\ \addlinespace
All Food Chances & 325.7 & 107.6 & 163 & 517 \\
All Food Chances\,/\,\si{\square\km} & 40.6 & 13.4 & 20.3 & 64.4 \\
\midrule
\emph{Williamsburg/Greenpoint}\smallskip \\
Healthy Food Chances & 53.2 & 9.10 & 35 & 68 \\
Healthy Food Chances\,/\,\si{\square\km} & 4.37 & 0.75 & 2.88 & 5.59 \\ \addlinespace
Unhealthy Food Chances & 279.5 & 59.5 & 166 & 359 \\
Unhealthy Food Chances\,/\,\si{\square\km} & 23.0 & 4.88 & 13.6 & 29.5 \\ \addlinespace
All Food Chances & 508.9 & 124.4 & 290 & 711 \\
All Food Chances\,/\,\si{\square\km} & 41.8 & 10.2 & 23.8 & 58.4 \\
\midrule
\emph{Bedford Stuyvesant} \smallskip\\
Healthy Food Chances & 14.3 & 3.23 & 9 & 22 \\
Healthy Food Chance\,/\,\si{\square\km} & 1.90 & 0.43 & 1.20 & 2.93 \\ \addlinespace
Unhealthy Food Chances & 175.8 & 50.8 & 67 & 252 \\
Unhealthy Food Chances\,/\,\si{\square\km} & 23.4 & 6.77 & 8.92 & 33.6 \\ \addlinespace
All Food Chances & 260.6 & 70.4 & 110 & 366 \\
All Food Chances\,/\,\si{\square\km} & 34.7 & 9.37 & 14.6 & 48.7 \\
\midrule
\emph{Bushwick}\smallskip \\
Healthy Food Chances & 21.8 & 2.50 & 18 & 27 \\
Healthy Food Chances\,/\,\si{\square\km} & 4.21 & 0.48 & 3.47 & 5.21 \\ \addlinespace
Unhealthy Food Chances & 168.4 & 53.7 & 82 & 259 \\
Unhealthy Food Chances\,/\,\si{\square\km} & 32.5 & 10.4 & 15.8 & 50.0 \\ \addlinespace
All Food Chances & 258 & 81.5 & 121 & 398 \\
All Food Chances\,/\,\si{\square\km} & 49.8 & 15.7 & 23.4 & 76.8 \\
\midrule
\emph{Sunset Park} \smallskip \\
Healthy Food Chances & 25.7 & 5.39 & 17 & 35 \\
Healthy Food Chances\,/\,\si{\square\km} & 2.68 & 0.56 & 1.77 & 3.65 \\ \addlinespace
Unhealthy Food Chances & 246.0 & 73.4 & 125 & 369 \\
Unhealthy Food Chances\,/\,\si{\square\km} & 25.7 & 7.66 & 13.0 & 38.5 \\ \addlinespace
All Food Chances & 404.9 & 117.9 & 197 & 626 \\
All Food Chances\,/\,\si{\square\km} & 42.3 & 12.3 & 20.6 & 65.3 \\
%% \midrule
\pagebreak[4]\emph{North Crown Heights/Prospect Heights}\smallskip \\
Healthy Food Chances & 38.5 & 6.08 & 24 & 51 \\
Healthy Food Chances\,/\,\si{\square\km} & 9.30 & 1.47 & 5.79 & 12.3 \\ \addlinespace
Unhealthy Food Chances & 159.2 & 40.1 & 82 & 222 \\
Unhealthy Food Chances\,/\,\si{\square\km} & 38.4 & 9.68 & 19.8 & 53.6 \\ \addlinespace
All Food Chances & 298.2 & 68.8 & 159 & 412 \\
All Food Chances\,/\,\si{\square\km} & 72.0 & 16.6 & 38.4 & 99.4 \\
\midrule
\emph{South Crown Heights}\smallskip \\
Healthy Food Chances & 29.9 & 4.41 & 21 & 35 \\
Healthy Food Chances\,/\,\si{\square\km} & 7.20 & 1.06 & 5.07 & 8.45 \\ \addlinespace
Unhealthy Food Chances & 125.4 & 24.1 & 76 & 167 \\
Unhealthy Food Chances\,/\,\si{\square\km} & 30.3 & 5.81 & 18.3 & 40.3 \\ \addlinespace
All Food Chances & 229.9 & 45.6 & 130 & 309 \\
All Food Chances\,/\,\si{\square\km} & 55.5 & 11.0 & 31.4 & 74.6 \\
\midrule
\emph{Brownsville/Ocean Hill}\smallskip \\
Healthy Food Chances & 18.5 & 4.01 & 8 & 23 \\
Healthy Food Chances\,/\,\si{\square\km} & 3.75 & 0.81 & 1.63 & 4.67 \\ \addlinespace
Unhealthy Food Chances & 116.3 & 38.8 & 43 & 183 \\
Unhealthy Food Chances\,/\,\si{\square\km} & 23.6 & 7.88 & 8.74 & 37.2 \\ \addlinespace
All Food Chances & 185.8 & 53.2 & 80 & 277 \\
All Food Chances\,/\,\si{\square\km} & 37.8 & 10.8 & 16.3 & 56.3 \\
\midrule
\emph{Lower East Side/Chinatown}\smallskip \\
Healthy Food Chances & 54.4 & 6.15 & 41 & 65 \\
Healthy Food Chances\,/\,\si{\square\km} & 12.4 & 1.40 & 9.31 & 14.8 \\ \addlinespace
Unhealthy Food Chances & 297.3 & 73.4 & 172 & 406 \\
Unhealthy Food Chances\,/\,\si{\square\km} & 67.5 & 16.7 & 39.1 & 92.2 \\ \addlinespace
All Food Chances & 767.0 & 179.9 & 478 & 1103 \\
All Food Chances\,/\,\si{\square\km} & 174.2 & 40.9 & 108.6 & 250.5 \\
\midrule
\emph{Morningside Heights/Hamilton Heights}\smallskip \\
Healthy Food Chances & 22.1 & 2.94 & 16 & 27 \\
Healthy Food Chances\,/\,\si{\square\km} & 5.70 & 0.76 & 4.12 & 6.95 \\ \addlinespace
Unhealthy Food Chances & 124.4 & 38.4 & 60 & 188 \\
Unhealthy Food Chances\,/\,\si{\square\km} & 32.0 & 9.88 & 15.4 & 48.4 \\ \addlinespace
All Food Chances & 250.3 & 66.7 & 136 & 363 \\
All Food Chances\,/\,\si{\square\km} & 64.4 & 17.2 & 35.0 & 93.4 \\
\midrule
\emph{Central Harlem}\smallskip \\
Healthy Food Chances & 22.2 & 3.11 & 16 & 27 \\
Healthy Food Chances\,/\,\si{\square\km} & 6.13 & 0.86 & 4.41 & 7.45 \\ \addlinespace
Unhealthy Food Chances & 136.8 & 44.7 & 68 & 207 \\
Unhealthy Food Chances\,/\,\si{\square\km} & 37.7 & 12.3 & 18.8 & 57.1 \\ \addlinespace
All Food Chances & 249.0 & 71.2 & 130 & 374 \\
All Food Chances\,/\,\si{\square\km} & 68.7 & 19.6 & 35.9 & 103.1 \\
\midrule
\emph{East Harlem}\smallskip \\
Healthy Food Chances & 21.9 & 2.79 & 17 & 26 \\
Healthy Food Chances\,/\,\si{\square\km} & 3.52 & 0.45 & 2.73 & 4.18 \\ \addlinespace
Unhealthy Food Chances & 147.1 & 53.5 & 57 & 236 \\
Unhealthy Food Chances\,/\,\si{\square\km} & 23.7 & 8.60 & 9.17 & 38.0 \\ \addlinespace
All Food Chances & 249.5 & 79.5 & 114 & 392 \\
All Food Chances\,/\,\si{\square\km} & 40.1 & 12.8 & 18.3 & 63.1 \\
\midrule
\emph{Washington Heights/Inwood}\smallskip \\
Healthy Food Chances & 40.3 & 5.06 & 32 & 48 \\
Healthy Food Chances\,/\,\si{\square\km} & 5.56 & 0.70 & 4.41 & 6.62 \\ \addlinespace
Unhealthy Food Chances & 269.3 & 78.5 & 140 & 388 \\
Unhealthy Food Chances\,/\,\si{\square\km} & 37.1 & 10.8 & 19.3 & 53.5 \\ \addlinespace
All Food Chances & 453.3 & 114.9 & 268 & 646 \\
All Food Chances\,/\,\si{\square\km} & 62.5 & 15.8 & 37.0 & 89.1 \\
\midrule
\emph{Astoria}\smallskip \\
Healthy Food Chances & 48.8 & 7.19 & 34 & 58 \\
Healthy Food Chances\,/\,\si{\square\km} & 3.04 & 0.45 & 2.12 & 3.61 \\ \addlinespace
Unhealthy Food Chances & 338 & 72.8 & 202 & 448 \\
Unhealthy Food Chances\,/\,\si{\square\km} & 21.0 & 4.53 & 12.6 & 27.9 \\ \addlinespace
All Food Chances & 620.0 & 140.9 & 352 & 858 \\
All Food Chances\,/\,\si{\square\km} & 38.6 & 8.78 & 21.9 & 53.4 \\
\midrule
\emph{Total}\smallskip\\
Healthy Food Chances & 32.0 & 14.0 & 8 & 68 \\
Healthy Food Chances\,/\,\si{\square\km} & 5.11 & 2.81 & 1.20 & 14.8 \\ \addlinespace
Unhealthy Food Chances & 200.7 & 90.3 & 43 & 448 \\
Unhealthy Food Chances\,/\,\si{\square\km} & 30.7 & 14.7 & 6.93 & 92.2 \\ \addlinespace
All Food Chances & 361.8 & 187.5 & 80 & 1103 \\
All Food Chances\,/\,\si{\square\km} & 57.0 & 37.6 & 14.0 & 250.5
\end{tabularx}
%
\end{document}
答案3
您的代码中存在一些问题,例如:
longtable
在这里使用tabularx
。longtable
可以跨页面,tabularx
但不能。- 在您的表格中,您只使用了 5 列,因此我将其减少到
{@{} ldddd @{}}
longtable
不需要center
,我删除了。dcolumn
格式化我使用的表格中的数字\newcolumntype{d}{D{.}{.}{2}}
- 我添加了缺失的部分
&
以标记部分标题行中的空列,例如\emph{Mott Haven/Hunts Point} & & & & \\
。 - 我删除了错误的,
&\multicolumn{4}{c}{(1)} & \multicolumn{4}{c}{} \\
因为您只有 5 列,而不是像您试图在此行中使用的 9 列......
使用以下代码
\documentclass{report}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{longtable}
\usepackage{dcolumn}
\newcolumntype{d}{D{.}{.}{2}} % two decimal numbers
\begin{document}
\textbf{Table 3. Summary Statistics of Food Chances in New York City Gentrifying Neighborhoods} \par \vspace{2ex}
\footnotesize
\begin{longtable}{@{} ldddd @{}}
\toprule
& Mean & Std. Dev. & Min & Max \\
\midrule
\endfirsthead
\toprule
\multicolumn{5}{c}{table continued} \\
\midrule
& Mean & Std. Dev. & Min & Max \\
\midrule
\endhead
\emph{Mott Haven/Hunts Point} & & & & \\
Healthy Food Chances & 43.5 & 9.67 & 25 & 61 \\
Healthy Food Chances per km2 & 3.82 & 0.85 & 2.19 & 5.35 \\
Unhealthy Food Chances & 216 & 84.0 & 79 & 354 \\
Unhealthy Food Chances per km2 & 19.0 & 7.37 & 6.93 & 31.1 \\
All Food Chances & 365.5 & 121.2 & 159 & 575 \\
All Food Chances per km2 & 32.1 & 10.6 & 14.0 & 50.5 \\
\midrule
\emph{Morrisania/East Tremont} & & & & \\
Healthy Food Chances & 24.8 & 6.46 & 13 & 34 \\
Healthy Food Chances per km2 & 3.09 & 0.80 & 1.62 & 4.23 \\
Unhealthy Food Chances & 210.8 & 76.4 & 98 & 345 \\
Unhealthy Food Chances per km2 & 26.3 & 9.52 & 12.2 & 43.0 \\
All Food Chances & 325.7 & 107.6 & 163 & 517 \\
All Food Chances per km2 & 40.6 & 13.4 & 20.3 & 64.4 \\
\midrule
\emph{Williamsburg/Greenpoint} & & & & \\
Healthy Food Chances & 53.2 & 9.10 & 35 & 68 \\
Healthy Food Chances per km2 & 4.37 & 0.75 & 2.88 & 5.59 \\
Unhealthy Food Chances & 279.5 & 59.5 & 166 & 359 \\
Unhealthy Food Chances per km2 & 23.0 & 4.88 & 13.6 & 29.5 \\
All Food Chances & 508.9 & 124.4 & 290 & 711 \\
All Food Chances per km2 & 41.8 & 10.2 & 23.8 & 58.4 \\
\midrule
\emph{Bedford Stuyvesant} & & & & \\
Healthy Food Chances & 14.3 & 3.23 & 9 & 22 \\
Healthy Food Chances per km2 & 1.90 & 0.43 & 1.20 & 2.93 \\
Unhealthy Food Chances & 175.8 & 50.8 & 67 & 252 \\
Unhealthy Food Chances per km2 & 23.4 & 6.77 & 8.92 & 33.6 \\
All Food Chances & 260.6 & 70.4 & 110 & 366 \\
All Food Chances per km2 & 34.7 & 9.37 & 14.6 & 48.7 \\
\midrule
\emph{Bushwick} & & & & \\
Healthy Food Chances & 21.8 & 2.50 & 18 & 27 \\
Healthy Food Chances per km2 & 4.21 & 0.48 & 3.47 & 5.21 \\
Unhealthy Food Chances & 168.4 & 53.7 & 82 & 259 \\
Unhealthy Food Chances per km2 & 32.5 & 10.4 & 15.8 & 50.0 \\
All Food Chances & 258 & 81.5 & 121 & 398 \\
All Food Chances per km2 & 49.8 & 15.7 & 23.4 & 76.8 \\
\midrule
\emph{Sunset Park} & & & & \\
Healthy Food Chances & 25.7 & 5.39 & 17 & 35 \\
Healthy Food Chances per km2 & 2.68 & 0.56 & 1.77 & 3.65 \\
Unhealthy Food Chances & 246.0 & 73.4 & 125 & 369 \\
Unhealthy Food Chances per km2 & 25.7 & 7.66 & 13.0 & 38.5 \\
All Food Chances & 404.9 & 117.9 & 197 & 626 \\
All Food Chances per km2 & 42.3 & 12.3 & 20.6 & 65.3 \\
\midrule
\emph{North Crown Heights/Prospect Heights} & & & & \\
Healthy Food Chances & 38.5 & 6.08 & 24 & 51 \\
Healthy Food Chances per km2 & 9.30 & 1.47 & 5.79 & 12.3 \\
Unhealthy Food Chances & 159.2 & 40.1 & 82 & 222 \\
Unhealthy Food Chances per km2 & 38.4 & 9.68 & 19.8 & 53.6 \\
All Food Chances & 298.2 & 68.8 & 159 & 412 \\
All Food Chances per km2 & 72.0 & 16.6 & 38.4 & 99.4 \\
\midrule
\emph{South Crown Heights} & & & & \\
Healthy Food Chances & 29.9 & 4.41 & 21 & 35 \\
Healthy Food Chances per km2 & 7.20 & 1.06 & 5.07 & 8.45 \\
Unhealthy Food Chances & 125.4 & 24.1 & 76 & 167 \\
Unhealthy Food Chances per km2 & 30.3 & 5.81 & 18.3 & 40.3 \\
All Food Chances & 229.9 & 45.6 & 130 & 309 \\
All Food Chances per km2 & 55.5 & 11.0 & 31.4 & 74.6 \\
\midrule
\emph{Brownsville/Ocean Hill} & & & & \\
Healthy Food Chances & 18.5 & 4.01 & 8 & 23 \\
Healthy Food Chances per km2 & 3.75 & 0.81 & 1.63 & 4.67 \\
Unhealthy Food Chances & 116.3 & 38.8 & 43 & 183 \\
Unhealthy Food Chances per km2 & 23.6 & 7.88 & 8.74 & 37.2 \\
All Food Chances & 185.8 & 53.2 & 80 & 277 \\
All Food Chances per km2 & 37.8 & 10.8 & 16.3 & 56.3 \\
\midrule
\emph{Lower East Side/Chinatown} & & & & \\
Healthy Food Chances & 54.4 & 6.15 & 41 & 65 \\
Healthy Food Chances per km2 & 12.4 & 1.40 & 9.31 & 14.8 \\
Unhealthy Food Chances & 297.3 & 73.4 & 172 & 406 \\
Unhealthy Food Chances per km2 & 67.5 & 16.7 & 39.1 & 92.2 \\
All Food Chances & 767.0 & 179.9 & 478 & 1103 \\
All Food Chances per km2 & 174.2 & 40.9 & 108.6 & 250.5 \\
\midrule
\emph{Morningside Heights/Hamilton Heights} & & & & \\
Healthy Food Chances & 22.1 & 2.94 & 16 & 27 \\
Healthy Food Chances per km2 & 5.70 & 0.76 & 4.12 & 6.95 \\
Unhealthy Food Chances & 124.4 & 38.4 & 60 & 188 \\
Unhealthy Food Chances per km2 & 32.0 & 9.88 & 15.4 & 48.4 \\
All Food Chances & 250.3 & 66.7 & 136 & 363 \\
All Food Chances per km2 & 64.4 & 17.2 & 35.0 & 93.4 \\
\midrule
\emph{Central Harlem} & & & & \\
Healthy Food Chances & 22.2 & 3.11 & 16 & 27 \\
Healthy Food Chances per km2 & 6.13 & 0.86 & 4.41 & 7.45 \\
Unhealthy Food Chances & 136.8 & 44.7 & 68 & 207 \\
Unhealthy Food Chances per km2 & 37.7 & 12.3 & 18.8 & 57.1 \\
All Food Chances & 249.0 & 71.2 & 130 & 374 \\
All Food Chances per km2 & 68.7 & 19.6 & 35.9 & 103.1 \\
\midrule
\emph{East Harlem} & & & & \\
Healthy Food Chances & 21.9 & 2.79 & 17 & 26 \\
Healthy Food Chances per km2 & 3.52 & 0.45 & 2.73 & 4.18 \\
Unhealthy Food Chances & 147.1 & 53.5 & 57 & 236 \\
Unhealthy Food Chances per km2 & 23.7 & 8.60 & 9.17 & 38.0 \\
All Food Chances & 249.5 & 79.5 & 114 & 392 \\
All Food Chances per km2 & 40.1 & 12.8 & 18.3 & 63.1 \\
\midrule
\emph{Washington Heights/Inwood} & & & & \\
Healthy Food Chances & 40.3 & 5.06 & 32 & 48 \\
Healthy Food Chances per km2 & 5.56 & 0.70 & 4.41 & 6.62 \\
Unhealthy Food Chances & 269.3 & 78.5 & 140 & 388 \\
Unhealthy Food Chances per km2 & 37.1 & 10.8 & 19.3 & 53.5 \\
All Food Chances & 453.3 & 114.9 & 268 & 646 \\
All Food Chances per km2 & 62.5 & 15.8 & 37.0 & 89.1 \\
\midrule
\emph{Astoria} & & & & \\
Healthy Food Chances & 48.8 & 7.19 & 34 & 58 \\
Healthy Food Chances per km2 & 3.04 & 0.45 & 2.12 & 3.61 \\
Unhealthy Food Chances & 338 & 72.8 & 202 & 448 \\
Unhealthy Food Chances per km2 & 21.0 & 4.53 & 12.6 & 27.9 \\
All Food Chances & 620.0 & 140.9 & 352 & 858 \\
All Food Chances per km2 & 38.6 & 8.78 & 21.9 & 53.4 \\
\midrule
\emph{Total} & & & & \\
Healthy Food Chances & 32.0 & 14.0 & 8 & 68 \\
Healthy Food Chances per km2 & 5.11 & 2.81 & 1.20 & 14.8 \\
Unhealthy Food Chances & 200.7 & 90.3 & 43 & 448 \\
Unhealthy Food Chances per km2 & 30.7 & 14.7 & 6.93 & 92.2 \\
All Food Chances & 361.8 & 187.5 & 80 & 1103 \\
All Food Chances per km2 & 57.0 & 37.6 & 14.0 & 250.5 \\
\bottomrule
\end{longtable}
\par\smallskip\noindent\parbox{12cm}{\raggedright \scriptsize \emph{Source}: NETS\_ACS\_032019.dta.}
\normalsize
\end{document}
得到结果:
答案4
这是我的建议。我已将 替换tabularx
为,longtable
因为 a) 您不需要自动换行,并且 b) 您的表格比单页长很多。此外,我已将 命令caption
用于标题(并使用caption
包来控制标题的字体)。最后,我还添加了缺失的两列。如果您不需要更多列,您可以替换\begin{longtable}{@{} l rrrrrrrr@{}}
by\begin{longtable}{@{} l rrrr@{}}
和&\multicolumn{4}{c}{(1)} & \multicolumn{4}{c}{} \\
by &\multicolumn{4}{c}{(1)}\\
。我还已将 替换km2
为\squarekilometre
fromsiunitx
包。
\documentclass{report}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{longtable}
\usepackage[font=bf]{caption}
\usepackage[load=abbr]{siunitx}
\begin{document}
{\footnotesize
\begin{longtable}{@{} l rrrrrrrr@{}}
\caption{Summary Statistics of Food Chances in New York City Gentrifying Neighborhoods}\\
\toprule
&\multicolumn{4}{c}{(1)} & \multicolumn{4}{c}{} \\
& Mean & Std. Dev. & Min & Max \\
\midrule
\endfirsthead
\toprule
&\multicolumn{4}{c}{(1)} & \multicolumn{4}{c}{} \\
& Mean & Std. Dev. & Min & Max \\
\midrule
\endhead
\multicolumn{9}{l}{\scriptsize \emph{Source}: NETS\_ACS\_032019.dta.}
\endlastfoot
\emph{Mott Haven/Hunts Point} \\*
Healthy Food Chances & 43.5 & 9.67 & 25 & 61 \\
Healthy Food Chances per \squarekilometre & 3.82 & 0.85 & 2.19 & 5.35 \\
Unhealthy Food Chances & 216 & 84.0 & 79 & 354 \\
Unhealthy Food Chances per \squarekilometre & 19.0 & 7.37 & 6.93 & 31.1 \\
All Food Chances & 365.5 & 121.2 & 159 & 575 \\
All Food Chances per \squarekilometre & 32.1 & 10.6 & 14.0 & 50.5 \\
\midrule
\emph{Morrisania/East Tremont} \\*
Healthy Food Chances & 24.8 & 6.46 & 13 & 34 \\
Healthy Food Chances per \squarekilometre & 3.09 & 0.80 & 1.62 & 4.23 \\
Unhealthy Food Chances & 210.8 & 76.4 & 98 & 345 \\
Unhealthy Food Chances per \squarekilometre & 26.3 & 9.52 & 12.2 & 43.0 \\
All Food Chances & 325.7 & 107.6 & 163 & 517 \\
All Food Chances per \squarekilometre & 40.6 & 13.4 & 20.3 & 64.4 \\
\midrule
\emph{Williamsburg/Greenpoint} \\*
Healthy Food Chances & 53.2 & 9.10 & 35 & 68 \\
Healthy Food Chances per \squarekilometre & 4.37 & 0.75 & 2.88 & 5.59 \\
Unhealthy Food Chances & 279.5 & 59.5 & 166 & 359 \\
Unhealthy Food Chances per \squarekilometre & 23.0 & 4.88 & 13.6 & 29.5 \\
All Food Chances & 508.9 & 124.4 & 290 & 711 \\
All Food Chances per \squarekilometre & 41.8 & 10.2 & 23.8 & 58.4 \\
\midrule
\emph{Bedford Stuyvesant} \\*
Healthy Food Chances & 14.3 & 3.23 & 9 & 22 \\
Healthy Food Chances per \squarekilometre & 1.90 & 0.43 & 1.20 & 2.93 \\
Unhealthy Food Chances & 175.8 & 50.8 & 67 & 252 \\
Unhealthy Food Chances per \squarekilometre & 23.4 & 6.77 & 8.92 & 33.6 \\
All Food Chances & 260.6 & 70.4 & 110 & 366 \\
All Food Chances per \squarekilometre & 34.7 & 9.37 & 14.6 & 48.7 \\
\midrule
\emph{Bushwick} \\*
Healthy Food Chances & 21.8 & 2.50 & 18 & 27 \\
Healthy Food Chances per \squarekilometre & 4.21 & 0.48 & 3.47 & 5.21 \\
Unhealthy Food Chances & 168.4 & 53.7 & 82 & 259 \\
Unhealthy Food Chances per \squarekilometre & 32.5 & 10.4 & 15.8 & 50.0 \\
All Food Chances & 258 & 81.5 & 121 & 398 \\
All Food Chances per \squarekilometre & 49.8 & 15.7 & 23.4 & 76.8 \\
\midrule
\emph{Sunset Park} \\*
Healthy Food Chances & 25.7 & 5.39 & 17 & 35 \\
Healthy Food Chances per \squarekilometre & 2.68 & 0.56 & 1.77 & 3.65 \\
Unhealthy Food Chances & 246.0 & 73.4 & 125 & 369 \\
Unhealthy Food Chances per \squarekilometre & 25.7 & 7.66 & 13.0 & 38.5 \\
All Food Chances & 404.9 & 117.9 & 197 & 626 \\
All Food Chances per \squarekilometre & 42.3 & 12.3 & 20.6 & 65.3 \\
\midrule
\emph{North Crown Heights/Prospect Heights} \\*
Healthy Food Chances & 38.5 & 6.08 & 24 & 51 \\
Healthy Food Chances per \squarekilometre & 9.30 & 1.47 & 5.79 & 12.3 \\
Unhealthy Food Chances & 159.2 & 40.1 & 82 & 222 \\
Unhealthy Food Chances per \squarekilometre & 38.4 & 9.68 & 19.8 & 53.6 \\
All Food Chances & 298.2 & 68.8 & 159 & 412 \\
All Food Chances per \squarekilometre & 72.0 & 16.6 & 38.4 & 99.4 \\
\midrule
\emph{South Crown Heights} \\*
Healthy Food Chances & 29.9 & 4.41 & 21 & 35 \\
Healthy Food Chances per \squarekilometre & 7.20 & 1.06 & 5.07 & 8.45 \\
Unhealthy Food Chances & 125.4 & 24.1 & 76 & 167 \\
Unhealthy Food Chances per \squarekilometre & 30.3 & 5.81 & 18.3 & 40.3 \\
All Food Chances & 229.9 & 45.6 & 130 & 309 \\
All Food Chances per \squarekilometre & 55.5 & 11.0 & 31.4 & 74.6 \\
\midrule
\emph{Brownsville/Ocean Hill} \\*
Healthy Food Chances & 18.5 & 4.01 & 8 & 23 \\
Healthy Food Chances per \squarekilometre & 3.75 & 0.81 & 1.63 & 4.67 \\
Unhealthy Food Chances & 116.3 & 38.8 & 43 & 183 \\
Unhealthy Food Chances per \squarekilometre & 23.6 & 7.88 & 8.74 & 37.2 \\
All Food Chances & 185.8 & 53.2 & 80 & 277 \\
All Food Chances per \squarekilometre & 37.8 & 10.8 & 16.3 & 56.3 \\
\midrule
\emph{Lower East Side/Chinatown} \\*
Healthy Food Chances & 54.4 & 6.15 & 41 & 65 \\
Healthy Food Chances per \squarekilometre & 12.4 & 1.40 & 9.31 & 14.8 \\
Unhealthy Food Chances & 297.3 & 73.4 & 172 & 406 \\
Unhealthy Food Chances per \squarekilometre & 67.5 & 16.7 & 39.1 & 92.2 \\
All Food Chances & 767.0 & 179.9 & 478 & 1103 \\
All Food Chances per \squarekilometre & 174.2 & 40.9 & 108.6 & 250.5 \\
\midrule
\emph{Morningside Heights/Hamilton Heights} \\*
Healthy Food Chances & 22.1 & 2.94 & 16 & 27 \\
Healthy Food Chances per \squarekilometre & 5.70 & 0.76 & 4.12 & 6.95 \\
Unhealthy Food Chances & 124.4 & 38.4 & 60 & 188 \\
Unhealthy Food Chances per \squarekilometre & 32.0 & 9.88 & 15.4 & 48.4 \\
All Food Chances & 250.3 & 66.7 & 136 & 363 \\
All Food Chances per \squarekilometre & 64.4 & 17.2 & 35.0 & 93.4 \\
\midrule
\emph{Central Harlem} \\*
Healthy Food Chances & 22.2 & 3.11 & 16 & 27 \\
Healthy Food Chances per \squarekilometre & 6.13 & 0.86 & 4.41 & 7.45 \\
Unhealthy Food Chances & 136.8 & 44.7 & 68 & 207 \\
Unhealthy Food Chances per \squarekilometre & 37.7 & 12.3 & 18.8 & 57.1 \\
All Food Chances & 249.0 & 71.2 & 130 & 374 \\
All Food Chances per \squarekilometre & 68.7 & 19.6 & 35.9 & 103.1 \\
\midrule
\emph{East Harlem} \\*
Healthy Food Chances & 21.9 & 2.79 & 17 & 26 \\
Healthy Food Chances per \squarekilometre & 3.52 & 0.45 & 2.73 & 4.18 \\
Unhealthy Food Chances & 147.1 & 53.5 & 57 & 236 \\
Unhealthy Food Chances per \squarekilometre & 23.7 & 8.60 & 9.17 & 38.0 \\
All Food Chances & 249.5 & 79.5 & 114 & 392 \\
All Food Chances per \squarekilometre & 40.1 & 12.8 & 18.3 & 63.1 \\
\midrule
\emph{Washington Heights/Inwood} \\*
Healthy Food Chances & 40.3 & 5.06 & 32 & 48 \\
Healthy Food Chances per \squarekilometre & 5.56 & 0.70 & 4.41 & 6.62 \\
Unhealthy Food Chances & 269.3 & 78.5 & 140 & 388 \\
Unhealthy Food Chances per \squarekilometre & 37.1 & 10.8 & 19.3 & 53.5 \\
All Food Chances & 453.3 & 114.9 & 268 & 646 \\
All Food Chances per \squarekilometre & 62.5 & 15.8 & 37.0 & 89.1 \\
\midrule
\emph{Astoria} \\*
Healthy Food Chances & 48.8 & 7.19 & 34 & 58 \\
Healthy Food Chances per \squarekilometre & 3.04 & 0.45 & 2.12 & 3.61 \\
Unhealthy Food Chances & 338 & 72.8 & 202 & 448 \\
Unhealthy Food Chances per \squarekilometre & 21.0 & 4.53 & 12.6 & 27.9 \\
All Food Chances & 620.0 & 140.9 & 352 & 858 \\
All Food Chances per \squarekilometre & 38.6 & 8.78 & 21.9 & 53.4 \\
\midrule
\emph{Total} \\*
Healthy Food Chances & 32.0 & 14.0 & 8 & 68 \\
Healthy Food Chances per \squarekilometre & 5.11 & 2.81 & 1.20 & 14.8 \\
Unhealthy Food Chances & 200.7 & 90.3 & 43 & 448 \\
Unhealthy Food Chances per \squarekilometre & 30.7 & 14.7 & 6.93 & 92.2 \\
All Food Chances & 361.8 & 187.5 & 80 & 1103 \\
All Food Chances per \squarekilometre & 57.0 & 37.6 & 14.0 & 250.5 \\
\bottomrule
\end{longtable}}
\end{document}
以下是关于如何重新设计表格的建议。我删除了第一列中的重复信息,并将两行合并为一行。此外,我使用了包S
中的类型列siunitx
,以便将数字与小数分隔符对齐。
\documentclass{report}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage[font=bf]{caption}
\usepackage[load=abbr]{siunitx}
\usepackage{geometry}
\begin{document}
{\footnotesize
\begin{longtable}{ p{3cm} S[table-format=3.1]
S[table-format=2.2]
S[table-format=3.2]
S[table-format=2.2]
S[table-format=3]
S[table-format=2.2]
S[table-format=3]
S[table-format=2.2]@{}}
\caption{Summary Statistics of Food Chances in New York City Gentrifying Neighborhoods}\\
\toprule
&\multicolumn{8}{c}{(1)} \\
Food Chances & \multicolumn{2}{c}{Mean} & \multicolumn{2}{c}{Std. Dev.} & \multicolumn{2}{c}{Min} & \multicolumn{2}{c}{Max} \\
\cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(lr){6-7} \cmidrule(lr){8-9}
& {total} & {per \squarekilometre} & {total} & {per \squarekilometre} & {total} & {per \squarekilometre} & {total} & {per \squarekilometre}\\
\midrule
\endfirsthead
\toprule
&\multicolumn{8}{c}{(1)} \\
Food Chances & \multicolumn{2}{c}{Mean} & \multicolumn{2}{c}{Std. Dev.} & \multicolumn{2}{c}{Min} & \multicolumn{2}{c}{Max} \\
\cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(lr){6-7} \cmidrule(lr){8-9}
& {total} & {per \squarekilometre} & {total} & {per \squarekilometre} & {total} & {per \squarekilometre} & {total} & {per \squarekilometre}\\
\midrule
\endhead
\multicolumn{9}{l}{\scriptsize \emph{Source}: NETS\_ACS\_032019.dta.}
\endlastfoot
\multicolumn{9}{@{}l}{\emph{Mott Haven/Hunts Point}} \\*
Healthy & 43.5 & 3.82 & 9.67 & 0.85 & 25 & 2.1& 61 & 5.35\\
Unhealthy & 216 & 19.0 & 84.0 & 7.37 & 79 & 6.39 & 354 & 31.1 \\
All & 365.5 & 32.1 & 121.2 & 10.6 & 159 & 14.0 & 575 & 50.5 \\
\midrule
\end{longtable}}
\end{document}
根据评论中的要求,我使用以下命令更改了第一列的列标题\multirow
:
\toprule
\multirow{2.5}{=}{\raggedright Food Chances by Neighborhood} & \multicolumn{2}{c}{Mean} & \multicolumn{2}{c}{Std. Dev.} & \multicolumn{2}{c}{Min} & \multicolumn{2}{c}{Max} \\
\cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(lr){6-7} \cmidrule(lr){8-9}
& {total} & {per \squarekilometre} & {total} & {per \squarekilometre} & {total} & {per \squarekilometre} & {total} & {per \squarekilometre}\\
\midrule