Error message with tabularxHow to typeset tabularx with 34 columns? (Error message)Error message with hobby packageDisplay Math Should End With $$ error messageMessage error with tkz-fctCommands not recognized and missing $ error messageCryptic (to me) error messageTables with error messagePersistent error with tabularxProblem with unclear error messageProblem with tabularx package: Error message “Illegal pream-token (x): `c' used.”
GitLab account hacked and repo wiped
What word describes the sound of an instrument based on the shape of the waveform of its sound?
How to replace space with '+' symbol in a triangular array?
Find the area of the smallest rectangle to contain squares of sizes up to n
How long does it take a postcard to get from USA to Germany?
Can an earth elemental drag a tiny creature underground with Earth Glide?
Hostile Divisor Numbers
What is monoid homomorphism exactly?
What are these silver "sporks" for?
Primes in a Diamond
How to speed up large double sums in a table?
While drilling into kitchen wall, hit a wire - any advice?
Why can’t you see at the start of the Big Bang?
Is the US ESTA (Electronic System for Travel Authorization) a visa?
What detail can Hubble see on Mars?
Given four points how can I find an equation for any pattern?
HSA - Continue to Invest?
Subnumcases as a part of align
Emergency stop in plain TeX, pdfTeX, XeTeX and LuaTeX?
How is trade in services conducted under the WTO in the absence of the Doha conclusion?
What is the thing used to help pouring liquids called?
As a GM, is it bad form to ask for a moment to think when improvising?
What does the coin flipping before dying mean?
Is it normal for gliders not to have attitude indicators?
Error message with tabularx
How to typeset tabularx with 34 columns? (Error message)Error message with hobby packageDisplay Math Should End With $$ error messageMessage error with tkz-fctCommands not recognized and missing $ error messageCryptic (to me) error messageTables with error messagePersistent error with tabularxProblem with unclear error messageProblem with tabularx package: Error message “Illegal pream-token (x): `c' used.”
I am very very very new to LaTeX, like I just started understanding what is does yesterday. I am using Stata 15 and wanted to make nice tables.
There is a problem with the code below. I keep getting the error message:
159: Extra alignment tab has been changed to cr.
<template> endtemplate
l.159 endtabularx
Also, How can I get this all on one page? All and any help is much appreicated.
MY CODE:
documentclassreport
usepackagebooktabs
usepackagetabularx
begindocument
begincenter
textbfTable 3. Summary Statistics of Food Chances in New York City Gentrifying Neighborhoods par vspace2ex
footnotesize
newcolumntypeY>raggedleftarraybackslashX
begintabularx 12cm @ l Y Y Y Y Y Y @
toprule
&multicolumn4c(1) & multicolumn4c \
& Mean & Std. Dev. & Min & Max \
midrule
emphMott 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
emphMorrisania/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
emphWilliamsburg/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
emphBedford 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
emphBushwick \
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
emphSunset 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
emphNorth 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
emphSouth 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
emphBrownsville/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
emphLower 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
emphMorningside 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
emphCentral 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
emphEast 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
emphWashington 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
emphAstoria \
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
emphTotal \
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
endtabularx
parsmallskipnoindentparbox12cmraggedright scriptsize emphSource: NETS_ACS_032019.dta.
normalsize
endcenter
enddocument
errors tabularx
add a comment |
I am very very very new to LaTeX, like I just started understanding what is does yesterday. I am using Stata 15 and wanted to make nice tables.
There is a problem with the code below. I keep getting the error message:
159: Extra alignment tab has been changed to cr.
<template> endtemplate
l.159 endtabularx
Also, How can I get this all on one page? All and any help is much appreicated.
MY CODE:
documentclassreport
usepackagebooktabs
usepackagetabularx
begindocument
begincenter
textbfTable 3. Summary Statistics of Food Chances in New York City Gentrifying Neighborhoods par vspace2ex
footnotesize
newcolumntypeY>raggedleftarraybackslashX
begintabularx 12cm @ l Y Y Y Y Y Y @
toprule
&multicolumn4c(1) & multicolumn4c \
& Mean & Std. Dev. & Min & Max \
midrule
emphMott 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
emphMorrisania/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
emphWilliamsburg/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
emphBedford 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
emphBushwick \
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
emphSunset 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
emphNorth 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
emphSouth 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
emphBrownsville/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
emphLower 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
emphMorningside 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
emphCentral 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
emphEast 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
emphWashington 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
emphAstoria \
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
emphTotal \
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
endtabularx
parsmallskipnoindentparbox12cmraggedright scriptsize emphSource: NETS_ACS_032019.dta.
normalsize
endcenter
enddocument
errors tabularx
delete line&multicolumn4c(1) & multicolumn4c \
(which require 9 columns, but you define only 7. also this line is empty, so it is not needed in table. welcome to tex.se! However, your table has some other issues. it is to huge for placement ion one page, etc. welcome to tex.se!
– Zarko
Apr 27 at 19:48
2
I would never use tabularx for tables of figures (and I wrote it) it is designed to control line breaking of paragraphs of text within tables, and you have no such entries.
– David Carlisle
Apr 27 at 20:06
Thank you both for your comments. I'm so grateful. I have been looking online and trying to teach myself from examples but its not going so well...I'm using Stata's command tabout to create a tex file which i then typeset in TeXShop. David, if I do not use tabularx to create a table then can you please suggest what I should be doing and maybe an example I can follow?
– BRB
Apr 27 at 21:05
add a comment |
I am very very very new to LaTeX, like I just started understanding what is does yesterday. I am using Stata 15 and wanted to make nice tables.
There is a problem with the code below. I keep getting the error message:
159: Extra alignment tab has been changed to cr.
<template> endtemplate
l.159 endtabularx
Also, How can I get this all on one page? All and any help is much appreicated.
MY CODE:
documentclassreport
usepackagebooktabs
usepackagetabularx
begindocument
begincenter
textbfTable 3. Summary Statistics of Food Chances in New York City Gentrifying Neighborhoods par vspace2ex
footnotesize
newcolumntypeY>raggedleftarraybackslashX
begintabularx 12cm @ l Y Y Y Y Y Y @
toprule
&multicolumn4c(1) & multicolumn4c \
& Mean & Std. Dev. & Min & Max \
midrule
emphMott 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
emphMorrisania/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
emphWilliamsburg/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
emphBedford 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
emphBushwick \
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
emphSunset 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
emphNorth 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
emphSouth 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
emphBrownsville/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
emphLower 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
emphMorningside 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
emphCentral 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
emphEast 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
emphWashington 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
emphAstoria \
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
emphTotal \
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
endtabularx
parsmallskipnoindentparbox12cmraggedright scriptsize emphSource: NETS_ACS_032019.dta.
normalsize
endcenter
enddocument
errors tabularx
I am very very very new to LaTeX, like I just started understanding what is does yesterday. I am using Stata 15 and wanted to make nice tables.
There is a problem with the code below. I keep getting the error message:
159: Extra alignment tab has been changed to cr.
<template> endtemplate
l.159 endtabularx
Also, How can I get this all on one page? All and any help is much appreicated.
MY CODE:
documentclassreport
usepackagebooktabs
usepackagetabularx
begindocument
begincenter
textbfTable 3. Summary Statistics of Food Chances in New York City Gentrifying Neighborhoods par vspace2ex
footnotesize
newcolumntypeY>raggedleftarraybackslashX
begintabularx 12cm @ l Y Y Y Y Y Y @
toprule
&multicolumn4c(1) & multicolumn4c \
& Mean & Std. Dev. & Min & Max \
midrule
emphMott 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
emphMorrisania/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
emphWilliamsburg/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
emphBedford 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
emphBushwick \
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
emphSunset 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
emphNorth 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
emphSouth 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
emphBrownsville/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
emphLower 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
emphMorningside 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
emphCentral 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
emphEast 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
emphWashington 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
emphAstoria \
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
emphTotal \
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
endtabularx
parsmallskipnoindentparbox12cmraggedright scriptsize emphSource: NETS_ACS_032019.dta.
normalsize
endcenter
enddocument
errors tabularx
errors tabularx
edited Apr 27 at 21:39
Kurt
42.9k950167
42.9k950167
asked Apr 27 at 19:10
BRBBRB
192
192
delete line&multicolumn4c(1) & multicolumn4c \
(which require 9 columns, but you define only 7. also this line is empty, so it is not needed in table. welcome to tex.se! However, your table has some other issues. it is to huge for placement ion one page, etc. welcome to tex.se!
– Zarko
Apr 27 at 19:48
2
I would never use tabularx for tables of figures (and I wrote it) it is designed to control line breaking of paragraphs of text within tables, and you have no such entries.
– David Carlisle
Apr 27 at 20:06
Thank you both for your comments. I'm so grateful. I have been looking online and trying to teach myself from examples but its not going so well...I'm using Stata's command tabout to create a tex file which i then typeset in TeXShop. David, if I do not use tabularx to create a table then can you please suggest what I should be doing and maybe an example I can follow?
– BRB
Apr 27 at 21:05
add a comment |
delete line&multicolumn4c(1) & multicolumn4c \
(which require 9 columns, but you define only 7. also this line is empty, so it is not needed in table. welcome to tex.se! However, your table has some other issues. it is to huge for placement ion one page, etc. welcome to tex.se!
– Zarko
Apr 27 at 19:48
2
I would never use tabularx for tables of figures (and I wrote it) it is designed to control line breaking of paragraphs of text within tables, and you have no such entries.
– David Carlisle
Apr 27 at 20:06
Thank you both for your comments. I'm so grateful. I have been looking online and trying to teach myself from examples but its not going so well...I'm using Stata's command tabout to create a tex file which i then typeset in TeXShop. David, if I do not use tabularx to create a table then can you please suggest what I should be doing and maybe an example I can follow?
– BRB
Apr 27 at 21:05
delete line
&multicolumn4c(1) & multicolumn4c \
(which require 9 columns, but you define only 7. also this line is empty, so it is not needed in table. welcome to tex.se! However, your table has some other issues. it is to huge for placement ion one page, etc. welcome to tex.se!– Zarko
Apr 27 at 19:48
delete line
&multicolumn4c(1) & multicolumn4c \
(which require 9 columns, but you define only 7. also this line is empty, so it is not needed in table. welcome to tex.se! However, your table has some other issues. it is to huge for placement ion one page, etc. welcome to tex.se!– Zarko
Apr 27 at 19:48
2
2
I would never use tabularx for tables of figures (and I wrote it) it is designed to control line breaking of paragraphs of text within tables, and you have no such entries.
– David Carlisle
Apr 27 at 20:06
I would never use tabularx for tables of figures (and I wrote it) it is designed to control line breaking of paragraphs of text within tables, and you have no such entries.
– David Carlisle
Apr 27 at 20:06
Thank you both for your comments. I'm so grateful. I have been looking online and trying to teach myself from examples but its not going so well...I'm using Stata's command tabout to create a tex file which i then typeset in TeXShop. David, if I do not use tabularx to create a table then can you please suggest what I should be doing and maybe an example I can follow?
– BRB
Apr 27 at 21:05
Thank you both for your comments. I'm so grateful. I have been looking online and trying to teach myself from examples but its not going so well...I'm using Stata's command tabout to create a tex file which i then typeset in TeXShop. David, if I do not use tabularx to create a table then can you please suggest what I should be doing and maybe an example I can follow?
– BRB
Apr 27 at 21:05
add a comment |
4 Answers
4
active
oldest
votes
as i mentioned in my comment, your table has more issues as mentioned error (which is solved by my comment):
- table is to huge that can be fit on one page, actually it is long two and half page, so you need
longtable
orltablex
packages for it - rows are not consistent typed; also in case if you have except the first column all other empty, you should always typed all ampersands which define columns
for numbers in i would use
S
column typedocumentclassreport
usepackagebooktabs, longtable % <---
usepackage[skip=1ex]caption % <---
usepackagesiunitx % <---
%---------------- show page layout. don't use in a real document!
usepackageshowframe
renewcommandShowFrameLinethickness0.15pt
renewcommand*ShowFrameColorcolorred
%---------------------------------------------------------------%
begindocument
beginlongtable@ l *5S[table-format=4.2] @
captionSummary Statistics of Food Chances in New York City Gentrifying Neighborhoods
labeltab:longtable \
toprule
& Mean & Std. Dev. & Min & Max \
midrule
endfirsthead
captionSummary Statistics of Food Chances in New York City Gentrifying Neighborhoods (cont.) \
toprule
& Mean & Std. Dev. & Min & Max \
midrule
endhead
midrule
multicolumn5rfootnotesizeitshapecontinue on the next page
endfoot
midrule[heavyrulewidth]
multicolumn5lfootnotesize emphSource: NETS_ACS_032019.dta.
normalsize
endlastfoot
% table body
multicolumn5lemphMott Haven/Hunts Point \
Healthy Food Chances & 43.5 & 9.67 & 25 & 61 \
Healthy Food Chances per sikm^2 & 3.82 & 0.85 & 2.19 & 5.35 \
Unhealthy Food Chances & 216 & 84.0 & 79 & 354 \
Unhealthy Food Chances per sikm^2& 19.0 & 7.37 & 6.93 & 31.1 \
All Food Chances & 365.5 & 121.2 & 159 & 575 \
All Food Chances per sikm^2 & 32.1 & 10.6 & 14.0 & 50.5 \
midrule
multicolumn5lemphMorrisania/East Tremont \
Healthy Food Chances & 24.8 & 6.46 & 13 & 34 \
Healthy Food Chances per sikm^2 & 3.09 & 0.80 & 1.62 & 4.23 \
Unhealthy Food Chances & 210.8 & 76.4 & 98 & 345 \
Unhealthy Food Chances per sikm^2& 26.3 & 9.52 & 12.2 & 43.0 \
All Food Chances & 325.7 & 107.6 & 163 & 517 \
All Food Chances per sikm^2 & 40.6 & 13.4 & 20.3 & 64.4 \
midrule
multicolumn5lemphWilliamsburg/Greenpoint \
Healthy Food Chances & 53.2 & 9.10 & 35 & 68 \
Healthy Food Chances per sikm^2 & 4.37 & 0.75 & 2.88 & 5.59 \
Unhealthy Food Chances & 279.5 & 59.5 & 166 & 359 \
Unhealthy Food Chances per sikm^2& 23.0 & 4.88 & 13.6 & 29.5 \
All Food Chances & 508.9 & 124.4 & 290 & 711 \
All Food Chances per sikm^2 & 41.8 & 10.2 & 23.8 & 58.4 \
midrule
multicolumn5lemphBedford Stuyvesant \
Healthy Food Chances & 14.3 & 3.23 & 9 & 22 \
Healthy Food Chances per sikm^2 & 1.90 & 0.43 & 1.20 & 2.93 \
Unhealthy Food Chances & 175.8 & 50.8 & 67 & 252 \
Unhealthy Food Chances per sikm^2& 23.4 & 6.77 & 8.92 & 33.6 \
All Food Chances & 260.6 & 70.4 & 110 & 366 \
All Food Chances per sikm^2 & 34.7 & 9.37 & 14.6 & 48.7 \
midrule
multicolumn5lemphBushwick \
Healthy Food Chances & 21.8 & 2.50 & 18 & 27 \
Healthy Food Chances per sikm^2 & 4.21 & 0.48 & 3.47 & 5.21 \
Unhealthy Food Chances & 168.4 & 53.7 & 82 & 259 \
Unhealthy Food Chances per sikm^2& 32.5 & 10.4 & 15.8 & 50.0 \
All Food Chances & 258 & 81.5 & 121 & 398 \
All Food Chances per sikm^2 & 49.8 & 15.7 & 23.4 & 76.8 \
midrule
multicolumn5lemphSunset Park \
Healthy Food Chances & 25.7 & 5.39 & 17 & 35 \
Healthy Food Chances per sikm^2 & 2.68 & 0.56 & 1.77 & 3.65 \
Unhealthy Food Chances & 246.0 & 73.4 & 125 & 369 \
Unhealthy Food Chances per sikm^2& 25.7 & 7.66 & 13.0 & 38.5 \
All Food Chances & 404.9 & 117.9 & 197 & 626 \
All Food Chances per sikm^2 & 42.3 & 12.3 & 20.6 & 65.3 \
midrule
multicolumn5lemphNorth Crown Heights/Prospect Heights \
Healthy Food Chances & 38.5 & 6.08 & 24 & 51 \
Healthy Food Chances per sikm^2 & 9.30 & 1.47 & 5.79 & 12.3 \
Unhealthy Food Chances & 159.2 & 40.1 & 82 & 222 \
Unhealthy Food Chances per sikm^2& 38.4 & 9.68 & 19.8 & 53.6 \
All Food Chances & 298.2 & 68.8 & 159 & 412 \
All Food Chances per sikm^2 & 72.0 & 16.6 & 38.4 & 99.4 \
midrule
multicolumn5lemphSouth Crown Heights \
Healthy Food Chances & 29.9 & 4.41 & 21 & 35 \
Healthy Food Chances per sikm^2 & 7.20 & 1.06 & 5.07 & 8.45 \
Unhealthy Food Chances & 125.4 & 24.1 & 76 & 167 \
Unhealthy Food Chances per sikm^2& 30.3 & 5.81 & 18.3 & 40.3 \
All Food Chances & 229.9 & 45.6 & 130 & 309 \
All Food Chances per sikm^2 & 55.5 & 11.0 & 31.4 & 74.6 \
midrule
multicolumn5lemphBrownsville/Ocean Hill \
Healthy Food Chances & 18.5 & 4.01 & 8 & 23 \
Healthy Food Chances per sikm^2 & 3.75 & 0.81 & 1.63 & 4.67 \
Unhealthy Food Chances & 116.3 & 38.8 & 43 & 183 \
Unhealthy Food Chances per sikm^2& 23.6 & 7.88 & 8.74 & 37.2 \
All Food Chances & 185.8 & 53.2 & 80 & 277 \
All Food Chances per sikm^2 & 37.8 & 10.8 & 16.3 & 56.3 \
midrule
multicolumn5lemphLower East Side/Chinatown \
Healthy Food Chances & 54.4 & 6.15 & 41 & 65 \
Healthy Food Chances per sikm^2 & 12.4 & 1.40 & 9.31 & 14.8 \
Unhealthy Food Chances & 297.3 & 73.4 & 172 & 406 \
Unhealthy Food Chances per sikm^2& 67.5 & 16.7 & 39.1 & 92.2 \
All Food Chances & 767.0 & 179.9 & 478 & 1103 \
All Food Chances per sikm^2 & 174.2 & 40.9 & 108.6 & 250.5 \
midrule
multicolumn5lemphMorningside Heights/Hamilton Heights \
Healthy Food Chances & 22.1 & 2.94 & 16 & 27 \
Healthy Food Chances per sikm^2 & 5.70 & 0.76 & 4.12 & 6.95 \
Unhealthy Food Chances & 124.4 & 38.4 & 60 & 188 \
Unhealthy Food Chances per sikm^2& 32.0 & 9.88 & 15.4 & 48.4 \
All Food Chances & 250.3 & 66.7 & 136 & 363 \
All Food Chances per sikm^2 & 64.4 & 17.2 & 35.0 & 93.4 \
midrule
multicolumn5lemphCentral Harlem \
Healthy Food Chances & 22.2 & 3.11 & 16 & 27 \
Healthy Food Chances per sikm^2 & 6.13 & 0.86 & 4.41 & 7.45 \
Unhealthy Food Chances & 136.8 & 44.7 & 68 & 207 \
Unhealthy Food Chances per sikm^2& 37.7 & 12.3 & 18.8 & 57.1 \
All Food Chances & 249.0 & 71.2 & 130 & 374 \
All Food Chances per sikm^2 & 68.7 & 19.6 & 35.9 & 103.1 \
midrule
multicolumn5lemphEast Harlem \
Healthy Food Chances & 21.9 & 2.79 & 17 & 26 \
Healthy Food Chances per sikm^2 & 3.52 & 0.45 & 2.73 & 4.18 \
Unhealthy Food Chances & 147.1 & 53.5 & 57 & 236 \
Unhealthy Food Chances per sikm^2& 23.7 & 8.60 & 9.17 & 38.0 \
All Food Chances & 249.5 & 79.5 & 114 & 392 \
All Food Chances per sikm^2 & 40.1 & 12.8 & 18.3 & 63.1 \
midrule
multicolumn5lemphWashington Heights/Inwood \
Healthy Food Chances & 40.3 & 5.06 & 32 & 48 \
Healthy Food Chances per sikm^2 & 5.56 & 0.70 & 4.41 & 6.62 \
Unhealthy Food Chances & 269.3 & 78.5 & 140 & 388 \
Unhealthy Food Chances per sikm^2& 37.1 & 10.8 & 19.3 & 53.5 \
All Food Chances & 453.3 & 114.9 & 268 & 646 \
All Food Chances per sikm^2 & 62.5 & 15.8 & 37.0 & 89.1 \
midrule
multicolumn5lemphAstoria \
Healthy Food Chances & 48.8 & 7.19 & 34 & 58 \
Healthy Food Chances per sikm^2 & 3.04 & 0.45 & 2.12 & 3.61 \
Unhealthy Food Chances & 338 & 72.8 & 202 & 448 \
Unhealthy Food Chances per sikm^2& 21.0 & 4.53 & 12.6 & 27.9 \
All Food Chances & 620.0 & 140.9 & 352 & 858 \
All Food Chances per sikm^2 & 38.6 & 8.78 & 21.9 & 53.4 \
midrule
multicolumn5lemphTotal \
Healthy Food Chances & 32.0 & 14.0 & 8 & 68 \
Healthy Food Chances per sikm^2 & 5.11 & 2.81 & 1.20 & 14.8 \
Unhealthy Food Chances & 200.7 & 90.3 & 43 & 448 \
Unhealthy Food Chances per sikm^2& 30.7 & 14.7 & 6.93 & 92.2 \
All Food Chances & 361.8 & 187.5 & 80 & 1103 \
All Food Chances per sikm^2 & 57.0 & 37.6 & 14.0 & 250.5 \
endlongtable
enddocument
which gives:
(red lines indicate text borders)
Thank you for showing me this Zarko!
– BRB
Apr 27 at 21:05
add a comment |
The first row had a wrong number for one of the multicolumn
. Anyway, you declared 7 coluns and were using 5, so I reduces their number. I set the 1st column as X
type, and used the S
column type for the 4 last columns, to align the numbers by the decimal dot. Also, I added some vertical padding between groups of rows. Last, as the table cannot fit on one page, I loaded ltables
which brings the advantages of longtable
to tabularx
. Note that we don't need the center
environment: by default, longtables are centred.
documentclassreport
usepackagesiunitx
usepackagebooktabs, caption
usepackageltablex
begindocument
footnotesize
captionsetupfont=bf
sisetuptable-format=3.2, table-number-alignment=center, per-mode=symbol
newcolumntypeY>raggedleftarraybackslashX
setlengthdefaultaddspace0.6ex
begintabularx 12cm @X SSSS@
captionTable 3. Summary Statistics of Food Chances in New York City Gentrifying Neighborhoods \
toprule
multicolumn1c(1) & multicolumn4c \
& Mean & Std. Dev & Min & Max \
midrule
endfirsthead
%
midrule
multicolumn1c(1) & multicolumn4c \
& Mean & Std. Dev & Min & Max \
midrule
endhead
midrule
multicolumn5r@em to be continued
endfoot
%\
bottomrule addlinespace[1ex]
scriptsize emphSource: NETS_ACS_032019.dta.
endlastfoot
emphMott Haven/Hunts Pointsmallskip \
Healthy Food Chances & 43.5 & 9.67 & 25 & 61 \
Healthy Food Chances,/,sisquarekm & 3.82 & 0.85 & 2.19 & 5.35 \ addlinespace
Unhealthy Food Chances & 216 & 84.0 & 79 & 354 \
Unhealthy Food Chance,/,sisquarekm & 19.0 & 7.37 & 6.93 & 31.1 \ addlinespace
All Food Chances & 365.5 & 121.2 & 159 & 575 \
All Food Chances,/,sisquarekm & 32.1 & 10.6 & 14.0 & 50.5 \
midrule
emphMorrisania/East Tremontsmallskip \
Healthy Food Chances & 24.8 & 6.46 & 13 & 34 \
Healthy Food Chances,/,sisquarekm & 3.09 & 0.80 & 1.62 & 4.23 \ addlinespace
Unhealthy Food Chances & 210.8 & 76.4 & 98 & 345 \
Unhealthy Food Chances,/,sisquarekm & 26.3 & 9.52 & 12.2 & 43.0 \ addlinespace
All Food Chances & 325.7 & 107.6 & 163 & 517 \
All Food Chances,/,sisquarekm & 40.6 & 13.4 & 20.3 & 64.4 \
midrule
emphWilliamsburg/Greenpointsmallskip \
Healthy Food Chances & 53.2 & 9.10 & 35 & 68 \
Healthy Food Chances,/,sisquarekm & 4.37 & 0.75 & 2.88 & 5.59 \ addlinespace
Unhealthy Food Chances & 279.5 & 59.5 & 166 & 359 \
Unhealthy Food Chances,/,sisquarekm & 23.0 & 4.88 & 13.6 & 29.5 \ addlinespace
All Food Chances & 508.9 & 124.4 & 290 & 711 \
All Food Chances,/,sisquarekm & 41.8 & 10.2 & 23.8 & 58.4 \
midrule
emphBedford Stuyvesant smallskip\
Healthy Food Chances & 14.3 & 3.23 & 9 & 22 \
Healthy Food Chance,/,sisquarekm & 1.90 & 0.43 & 1.20 & 2.93 \ addlinespace
Unhealthy Food Chances & 175.8 & 50.8 & 67 & 252 \
Unhealthy Food Chances,/,sisquarekm & 23.4 & 6.77 & 8.92 & 33.6 \ addlinespace
All Food Chances & 260.6 & 70.4 & 110 & 366 \
All Food Chances,/,sisquarekm & 34.7 & 9.37 & 14.6 & 48.7 \
midrule
emphBushwicksmallskip \
Healthy Food Chances & 21.8 & 2.50 & 18 & 27 \
Healthy Food Chances,/,sisquarekm & 4.21 & 0.48 & 3.47 & 5.21 \ addlinespace
Unhealthy Food Chances & 168.4 & 53.7 & 82 & 259 \
Unhealthy Food Chances,/,sisquarekm & 32.5 & 10.4 & 15.8 & 50.0 \ addlinespace
All Food Chances & 258 & 81.5 & 121 & 398 \
All Food Chances,/,sisquarekm & 49.8 & 15.7 & 23.4 & 76.8 \
midrule
emphSunset Park smallskip \
Healthy Food Chances & 25.7 & 5.39 & 17 & 35 \
Healthy Food Chances,/,sisquarekm & 2.68 & 0.56 & 1.77 & 3.65 \ addlinespace
Unhealthy Food Chances & 246.0 & 73.4 & 125 & 369 \
Unhealthy Food Chances,/,sisquarekm & 25.7 & 7.66 & 13.0 & 38.5 \ addlinespace
All Food Chances & 404.9 & 117.9 & 197 & 626 \
All Food Chances,/,sisquarekm & 42.3 & 12.3 & 20.6 & 65.3 \
%% midrule
pagebreak[4]emphNorth Crown Heights/Prospect Heightssmallskip \
Healthy Food Chances & 38.5 & 6.08 & 24 & 51 \
Healthy Food Chances,/,sisquarekm & 9.30 & 1.47 & 5.79 & 12.3 \ addlinespace
Unhealthy Food Chances & 159.2 & 40.1 & 82 & 222 \
Unhealthy Food Chances,/,sisquarekm & 38.4 & 9.68 & 19.8 & 53.6 \ addlinespace
All Food Chances & 298.2 & 68.8 & 159 & 412 \
All Food Chances,/,sisquarekm & 72.0 & 16.6 & 38.4 & 99.4 \
midrule
emphSouth Crown Heightssmallskip \
Healthy Food Chances & 29.9 & 4.41 & 21 & 35 \
Healthy Food Chances,/,sisquarekm & 7.20 & 1.06 & 5.07 & 8.45 \ addlinespace
Unhealthy Food Chances & 125.4 & 24.1 & 76 & 167 \
Unhealthy Food Chances,/,sisquarekm & 30.3 & 5.81 & 18.3 & 40.3 \ addlinespace
All Food Chances & 229.9 & 45.6 & 130 & 309 \
All Food Chances,/,sisquarekm & 55.5 & 11.0 & 31.4 & 74.6 \
midrule
emphBrownsville/Ocean Hillsmallskip \
Healthy Food Chances & 18.5 & 4.01 & 8 & 23 \
Healthy Food Chances,/,sisquarekm & 3.75 & 0.81 & 1.63 & 4.67 \ addlinespace
Unhealthy Food Chances & 116.3 & 38.8 & 43 & 183 \
Unhealthy Food Chances,/,sisquarekm & 23.6 & 7.88 & 8.74 & 37.2 \ addlinespace
All Food Chances & 185.8 & 53.2 & 80 & 277 \
All Food Chances,/,sisquarekm & 37.8 & 10.8 & 16.3 & 56.3 \
midrule
emphLower East Side/Chinatownsmallskip \
Healthy Food Chances & 54.4 & 6.15 & 41 & 65 \
Healthy Food Chances,/,sisquarekm & 12.4 & 1.40 & 9.31 & 14.8 \ addlinespace
Unhealthy Food Chances & 297.3 & 73.4 & 172 & 406 \
Unhealthy Food Chances,/,sisquarekm & 67.5 & 16.7 & 39.1 & 92.2 \ addlinespace
All Food Chances & 767.0 & 179.9 & 478 & 1103 \
All Food Chances,/,sisquarekm & 174.2 & 40.9 & 108.6 & 250.5 \
midrule
emphMorningside Heights/Hamilton Heightssmallskip \
Healthy Food Chances & 22.1 & 2.94 & 16 & 27 \
Healthy Food Chances,/,sisquarekm & 5.70 & 0.76 & 4.12 & 6.95 \ addlinespace
Unhealthy Food Chances & 124.4 & 38.4 & 60 & 188 \
Unhealthy Food Chances,/,sisquarekm & 32.0 & 9.88 & 15.4 & 48.4 \ addlinespace
All Food Chances & 250.3 & 66.7 & 136 & 363 \
All Food Chances,/,sisquarekm & 64.4 & 17.2 & 35.0 & 93.4 \
midrule
emphCentral Harlemsmallskip \
Healthy Food Chances & 22.2 & 3.11 & 16 & 27 \
Healthy Food Chances,/,sisquarekm & 6.13 & 0.86 & 4.41 & 7.45 \ addlinespace
Unhealthy Food Chances & 136.8 & 44.7 & 68 & 207 \
Unhealthy Food Chances,/,sisquarekm & 37.7 & 12.3 & 18.8 & 57.1 \ addlinespace
All Food Chances & 249.0 & 71.2 & 130 & 374 \
All Food Chances,/,sisquarekm & 68.7 & 19.6 & 35.9 & 103.1 \
midrule
emphEast Harlemsmallskip \
Healthy Food Chances & 21.9 & 2.79 & 17 & 26 \
Healthy Food Chances,/,sisquarekm & 3.52 & 0.45 & 2.73 & 4.18 \ addlinespace
Unhealthy Food Chances & 147.1 & 53.5 & 57 & 236 \
Unhealthy Food Chances,/,sisquarekm & 23.7 & 8.60 & 9.17 & 38.0 \ addlinespace
All Food Chances & 249.5 & 79.5 & 114 & 392 \
All Food Chances,/,sisquarekm & 40.1 & 12.8 & 18.3 & 63.1 \
midrule
emphWashington Heights/Inwoodsmallskip \
Healthy Food Chances & 40.3 & 5.06 & 32 & 48 \
Healthy Food Chances,/,sisquarekm & 5.56 & 0.70 & 4.41 & 6.62 \ addlinespace
Unhealthy Food Chances & 269.3 & 78.5 & 140 & 388 \
Unhealthy Food Chances,/,sisquarekm & 37.1 & 10.8 & 19.3 & 53.5 \ addlinespace
All Food Chances & 453.3 & 114.9 & 268 & 646 \
All Food Chances,/,sisquarekm & 62.5 & 15.8 & 37.0 & 89.1 \
midrule
emphAstoriasmallskip \
Healthy Food Chances & 48.8 & 7.19 & 34 & 58 \
Healthy Food Chances,/,sisquarekm & 3.04 & 0.45 & 2.12 & 3.61 \ addlinespace
Unhealthy Food Chances & 338 & 72.8 & 202 & 448 \
Unhealthy Food Chances,/,sisquarekm & 21.0 & 4.53 & 12.6 & 27.9 \ addlinespace
All Food Chances & 620.0 & 140.9 & 352 & 858 \
All Food Chances,/,sisquarekm & 38.6 & 8.78 & 21.9 & 53.4 \
midrule
emphTotalsmallskip\
Healthy Food Chances & 32.0 & 14.0 & 8 & 68 \
Healthy Food Chances,/,sisquarekm & 5.11 & 2.81 & 1.20 & 14.8 \ addlinespace
Unhealthy Food Chances & 200.7 & 90.3 & 43 & 448 \
Unhealthy Food Chances,/,sisquarekm & 30.7 & 14.7 & 6.93 & 92.2 \ addlinespace
All Food Chances & 361.8 & 187.5 & 80 & 1103 \
All Food Chances,/,sisquarekm & 57.0 & 37.6 & 14.0 & 250.5
endtabularx
%
enddocument
Thank you very much, Bernard! I like this table a lot. Can you please explain, what is the (1) at the top of the table associated with? And is it possible to remove it or replace with different text?
– BRB
Apr 27 at 21:21
Also, when I try the code on my computer the column headers are centered in the middle of the table instead of over the data. How can I fix this? Thank you
– BRB
Apr 27 at 21:30
The $(1)$ was in your code. As I didn't know what it corresponded to, I didn't touch it. Inmulticolumn1c(1)
you can replace it with whatever you want.
– Bernard
Apr 27 at 21:32
Do you mean you don't obtain the same alignment for the column headers?
– Bernard
Apr 27 at 21:34
That is correct. The alignment was centered on the entire table. In your helpful example, it was aligned over the 4 columns of the corresponding data.
– BRB
Apr 28 at 5:15
|
show 1 more comment
You have some issues in your given code, for example:
- Use
longtable
insteadtabularx
here.longtable
can span pages,tabularx
not. - In your table you are only using 5 columns, so I reduced it to
@ ldddd @
longtable
needs nocenter
, I deleted it.- to format the numbers in the table I used
dcolumn
withnewcolumntypedD..2
- I added the missing
&
to mark the empty columns in your part header lines likeemphMott Haven/Hunts Point & & & & \
. - I deleted the wrong
&multicolumn4c(1) & multicolumn4c \
because you have only 5 columns and not 9 as you tried to use in this line ...
With the following code
documentclassreport
usepackagebooktabs
usepackagetabularx
usepackagelongtable
usepackagedcolumn
newcolumntypedD..2 % two decimal numbers
begindocument
textbfTable 3. Summary Statistics of Food Chances in New York City Gentrifying Neighborhoods par vspace2ex
footnotesize
beginlongtable@ ldddd @
toprule
& Mean & Std. Dev. & Min & Max \
midrule
endfirsthead
toprule
multicolumn5ctable continued \
midrule
& Mean & Std. Dev. & Min & Max \
midrule
endhead
emphMott 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
emphMorrisania/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
emphWilliamsburg/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
emphBedford 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
emphBushwick & & & & \
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
emphSunset 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
emphNorth 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
emphSouth 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
emphBrownsville/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
emphLower 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
emphMorningside 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
emphCentral 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
emphEast 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
emphWashington 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
emphAstoria & & & & \
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
emphTotal & & & & \
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
endlongtable
parsmallskipnoindentparbox12cmraggedright scriptsize emphSource: NETS_ACS_032019.dta.
normalsize
enddocument
you get the result:
Thank you very much, Kurt.
– BRB
Apr 28 at 5:17
Again, thank you everyone for your helpful insights.
– BRB
Apr 28 at 5:17
add a comment |
Here is my suggestion. I have replaced tabularx
by longtable
as you a) don't need automatic line breaks of paragraphs and b) have a table that is a lot longer than a single page. Additionally, I have used the caption
comand for the caption (and used the caption
package in order to control the font of the caption). Lastly, I have also added the missing two columns. If you don't need more columns, you can replace beginlongtable@ l rrrrrrrr@
by beginlongtable@ l rrrr@
and &multicolumn4c(1) & multicolumn4c \
by &multicolumn4c(1)\
. I have also replaced km2
by squarekilometre
from the siunitx
package.
documentclassreport
usepackagebooktabs
usepackagetabularx
usepackagelongtable
usepackage[font=bf]caption
usepackage[load=abbr]siunitx
begindocument
footnotesize
beginlongtable@ l rrrrrrrr@
captionSummary Statistics of Food Chances in New York City Gentrifying Neighborhoods\
toprule
&multicolumn4c(1) & multicolumn4c \
& Mean & Std. Dev. & Min & Max \
midrule
endfirsthead
toprule
&multicolumn4c(1) & multicolumn4c \
& Mean & Std. Dev. & Min & Max \
midrule
endhead
multicolumn9lscriptsize emphSource: NETS_ACS_032019.dta.
endlastfoot
emphMott 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
emphMorrisania/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
emphWilliamsburg/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
emphBedford 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
emphBushwick \*
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
emphSunset 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
emphNorth 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
emphSouth 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
emphBrownsville/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
emphLower 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
emphMorningside 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
emphCentral 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
emphEast 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
emphWashington 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
emphAstoria \*
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
emphTotal \*
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
endlongtable
enddocument
Here is a suggestion on how one could redesign the table. I have removed the repeated information in the first column and combined two rows to one. Additionally, I have used S
type columns from the siunitx
package in order to align the numbers relative to their decimal separator.
documentclassreport
usepackagebooktabs
usepackagelongtable
usepackage[font=bf]caption
usepackage[load=abbr]siunitx
usepackagegeometry
begindocument
footnotesize
beginlongtable p3cm 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]@
captionSummary Statistics of Food Chances in New York City Gentrifying Neighborhoods\
toprule
&multicolumn8c(1) \
Food Chances & multicolumn2cMean & multicolumn2cStd. Dev. & multicolumn2cMin & multicolumn2cMax \
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
&multicolumn8c(1) \
Food Chances & multicolumn2cMean & multicolumn2cStd. Dev. & multicolumn2cMin & multicolumn2cMax \
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
multicolumn9lscriptsize emphSource: NETS_ACS_032019.dta.
endlastfoot
multicolumn9@lemphMott 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
endlongtable
enddocument
As requested in the comments, I have changed the column header of the first column using multirow
:
toprule
multirow2.5=raggedright Food Chances by Neighborhood & multicolumn2cMean & multicolumn2cStd. Dev. & multicolumn2cMin & multicolumn2cMax \
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
So grateful for everyone's insights!
– BRB
Apr 27 at 21:05
Another thought is to change how I'm displaying this information. Following Tufte's suggestion to provide a lot of information I choose this format but maybe you all have another suggestion. I could create 3 separate tables that each show only one type of food chance category. Would that be better?
– BRB
Apr 27 at 21:08
@BRB: How you should present your data heavily depends on how you want to discuss them. I have however edited my answer to also include a suggestion how you could reduce the amount of text in the first column.
– leandriis
Apr 28 at 8:34
Thank you for helping rethink the structure. I have been trying to add the header "Food Chances by Neighborhood" above the column of Mott Haven...but keep failing. What am I doing wrong? multicolumn8@lFood Chances by Neighborhood \ & multicolumn2cMean & multicolumn2cStd. Dev. & multicolumn2cMin & multicolumn2cMax \ 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\
– BRB
Apr 29 at 19:05
@BRB: I have edited my answer to also include the longer column header.
– leandriis
Apr 29 at 19:28
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "85"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f487959%2ferror-message-with-tabularx%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
as i mentioned in my comment, your table has more issues as mentioned error (which is solved by my comment):
- table is to huge that can be fit on one page, actually it is long two and half page, so you need
longtable
orltablex
packages for it - rows are not consistent typed; also in case if you have except the first column all other empty, you should always typed all ampersands which define columns
for numbers in i would use
S
column typedocumentclassreport
usepackagebooktabs, longtable % <---
usepackage[skip=1ex]caption % <---
usepackagesiunitx % <---
%---------------- show page layout. don't use in a real document!
usepackageshowframe
renewcommandShowFrameLinethickness0.15pt
renewcommand*ShowFrameColorcolorred
%---------------------------------------------------------------%
begindocument
beginlongtable@ l *5S[table-format=4.2] @
captionSummary Statistics of Food Chances in New York City Gentrifying Neighborhoods
labeltab:longtable \
toprule
& Mean & Std. Dev. & Min & Max \
midrule
endfirsthead
captionSummary Statistics of Food Chances in New York City Gentrifying Neighborhoods (cont.) \
toprule
& Mean & Std. Dev. & Min & Max \
midrule
endhead
midrule
multicolumn5rfootnotesizeitshapecontinue on the next page
endfoot
midrule[heavyrulewidth]
multicolumn5lfootnotesize emphSource: NETS_ACS_032019.dta.
normalsize
endlastfoot
% table body
multicolumn5lemphMott Haven/Hunts Point \
Healthy Food Chances & 43.5 & 9.67 & 25 & 61 \
Healthy Food Chances per sikm^2 & 3.82 & 0.85 & 2.19 & 5.35 \
Unhealthy Food Chances & 216 & 84.0 & 79 & 354 \
Unhealthy Food Chances per sikm^2& 19.0 & 7.37 & 6.93 & 31.1 \
All Food Chances & 365.5 & 121.2 & 159 & 575 \
All Food Chances per sikm^2 & 32.1 & 10.6 & 14.0 & 50.5 \
midrule
multicolumn5lemphMorrisania/East Tremont \
Healthy Food Chances & 24.8 & 6.46 & 13 & 34 \
Healthy Food Chances per sikm^2 & 3.09 & 0.80 & 1.62 & 4.23 \
Unhealthy Food Chances & 210.8 & 76.4 & 98 & 345 \
Unhealthy Food Chances per sikm^2& 26.3 & 9.52 & 12.2 & 43.0 \
All Food Chances & 325.7 & 107.6 & 163 & 517 \
All Food Chances per sikm^2 & 40.6 & 13.4 & 20.3 & 64.4 \
midrule
multicolumn5lemphWilliamsburg/Greenpoint \
Healthy Food Chances & 53.2 & 9.10 & 35 & 68 \
Healthy Food Chances per sikm^2 & 4.37 & 0.75 & 2.88 & 5.59 \
Unhealthy Food Chances & 279.5 & 59.5 & 166 & 359 \
Unhealthy Food Chances per sikm^2& 23.0 & 4.88 & 13.6 & 29.5 \
All Food Chances & 508.9 & 124.4 & 290 & 711 \
All Food Chances per sikm^2 & 41.8 & 10.2 & 23.8 & 58.4 \
midrule
multicolumn5lemphBedford Stuyvesant \
Healthy Food Chances & 14.3 & 3.23 & 9 & 22 \
Healthy Food Chances per sikm^2 & 1.90 & 0.43 & 1.20 & 2.93 \
Unhealthy Food Chances & 175.8 & 50.8 & 67 & 252 \
Unhealthy Food Chances per sikm^2& 23.4 & 6.77 & 8.92 & 33.6 \
All Food Chances & 260.6 & 70.4 & 110 & 366 \
All Food Chances per sikm^2 & 34.7 & 9.37 & 14.6 & 48.7 \
midrule
multicolumn5lemphBushwick \
Healthy Food Chances & 21.8 & 2.50 & 18 & 27 \
Healthy Food Chances per sikm^2 & 4.21 & 0.48 & 3.47 & 5.21 \
Unhealthy Food Chances & 168.4 & 53.7 & 82 & 259 \
Unhealthy Food Chances per sikm^2& 32.5 & 10.4 & 15.8 & 50.0 \
All Food Chances & 258 & 81.5 & 121 & 398 \
All Food Chances per sikm^2 & 49.8 & 15.7 & 23.4 & 76.8 \
midrule
multicolumn5lemphSunset Park \
Healthy Food Chances & 25.7 & 5.39 & 17 & 35 \
Healthy Food Chances per sikm^2 & 2.68 & 0.56 & 1.77 & 3.65 \
Unhealthy Food Chances & 246.0 & 73.4 & 125 & 369 \
Unhealthy Food Chances per sikm^2& 25.7 & 7.66 & 13.0 & 38.5 \
All Food Chances & 404.9 & 117.9 & 197 & 626 \
All Food Chances per sikm^2 & 42.3 & 12.3 & 20.6 & 65.3 \
midrule
multicolumn5lemphNorth Crown Heights/Prospect Heights \
Healthy Food Chances & 38.5 & 6.08 & 24 & 51 \
Healthy Food Chances per sikm^2 & 9.30 & 1.47 & 5.79 & 12.3 \
Unhealthy Food Chances & 159.2 & 40.1 & 82 & 222 \
Unhealthy Food Chances per sikm^2& 38.4 & 9.68 & 19.8 & 53.6 \
All Food Chances & 298.2 & 68.8 & 159 & 412 \
All Food Chances per sikm^2 & 72.0 & 16.6 & 38.4 & 99.4 \
midrule
multicolumn5lemphSouth Crown Heights \
Healthy Food Chances & 29.9 & 4.41 & 21 & 35 \
Healthy Food Chances per sikm^2 & 7.20 & 1.06 & 5.07 & 8.45 \
Unhealthy Food Chances & 125.4 & 24.1 & 76 & 167 \
Unhealthy Food Chances per sikm^2& 30.3 & 5.81 & 18.3 & 40.3 \
All Food Chances & 229.9 & 45.6 & 130 & 309 \
All Food Chances per sikm^2 & 55.5 & 11.0 & 31.4 & 74.6 \
midrule
multicolumn5lemphBrownsville/Ocean Hill \
Healthy Food Chances & 18.5 & 4.01 & 8 & 23 \
Healthy Food Chances per sikm^2 & 3.75 & 0.81 & 1.63 & 4.67 \
Unhealthy Food Chances & 116.3 & 38.8 & 43 & 183 \
Unhealthy Food Chances per sikm^2& 23.6 & 7.88 & 8.74 & 37.2 \
All Food Chances & 185.8 & 53.2 & 80 & 277 \
All Food Chances per sikm^2 & 37.8 & 10.8 & 16.3 & 56.3 \
midrule
multicolumn5lemphLower East Side/Chinatown \
Healthy Food Chances & 54.4 & 6.15 & 41 & 65 \
Healthy Food Chances per sikm^2 & 12.4 & 1.40 & 9.31 & 14.8 \
Unhealthy Food Chances & 297.3 & 73.4 & 172 & 406 \
Unhealthy Food Chances per sikm^2& 67.5 & 16.7 & 39.1 & 92.2 \
All Food Chances & 767.0 & 179.9 & 478 & 1103 \
All Food Chances per sikm^2 & 174.2 & 40.9 & 108.6 & 250.5 \
midrule
multicolumn5lemphMorningside Heights/Hamilton Heights \
Healthy Food Chances & 22.1 & 2.94 & 16 & 27 \
Healthy Food Chances per sikm^2 & 5.70 & 0.76 & 4.12 & 6.95 \
Unhealthy Food Chances & 124.4 & 38.4 & 60 & 188 \
Unhealthy Food Chances per sikm^2& 32.0 & 9.88 & 15.4 & 48.4 \
All Food Chances & 250.3 & 66.7 & 136 & 363 \
All Food Chances per sikm^2 & 64.4 & 17.2 & 35.0 & 93.4 \
midrule
multicolumn5lemphCentral Harlem \
Healthy Food Chances & 22.2 & 3.11 & 16 & 27 \
Healthy Food Chances per sikm^2 & 6.13 & 0.86 & 4.41 & 7.45 \
Unhealthy Food Chances & 136.8 & 44.7 & 68 & 207 \
Unhealthy Food Chances per sikm^2& 37.7 & 12.3 & 18.8 & 57.1 \
All Food Chances & 249.0 & 71.2 & 130 & 374 \
All Food Chances per sikm^2 & 68.7 & 19.6 & 35.9 & 103.1 \
midrule
multicolumn5lemphEast Harlem \
Healthy Food Chances & 21.9 & 2.79 & 17 & 26 \
Healthy Food Chances per sikm^2 & 3.52 & 0.45 & 2.73 & 4.18 \
Unhealthy Food Chances & 147.1 & 53.5 & 57 & 236 \
Unhealthy Food Chances per sikm^2& 23.7 & 8.60 & 9.17 & 38.0 \
All Food Chances & 249.5 & 79.5 & 114 & 392 \
All Food Chances per sikm^2 & 40.1 & 12.8 & 18.3 & 63.1 \
midrule
multicolumn5lemphWashington Heights/Inwood \
Healthy Food Chances & 40.3 & 5.06 & 32 & 48 \
Healthy Food Chances per sikm^2 & 5.56 & 0.70 & 4.41 & 6.62 \
Unhealthy Food Chances & 269.3 & 78.5 & 140 & 388 \
Unhealthy Food Chances per sikm^2& 37.1 & 10.8 & 19.3 & 53.5 \
All Food Chances & 453.3 & 114.9 & 268 & 646 \
All Food Chances per sikm^2 & 62.5 & 15.8 & 37.0 & 89.1 \
midrule
multicolumn5lemphAstoria \
Healthy Food Chances & 48.8 & 7.19 & 34 & 58 \
Healthy Food Chances per sikm^2 & 3.04 & 0.45 & 2.12 & 3.61 \
Unhealthy Food Chances & 338 & 72.8 & 202 & 448 \
Unhealthy Food Chances per sikm^2& 21.0 & 4.53 & 12.6 & 27.9 \
All Food Chances & 620.0 & 140.9 & 352 & 858 \
All Food Chances per sikm^2 & 38.6 & 8.78 & 21.9 & 53.4 \
midrule
multicolumn5lemphTotal \
Healthy Food Chances & 32.0 & 14.0 & 8 & 68 \
Healthy Food Chances per sikm^2 & 5.11 & 2.81 & 1.20 & 14.8 \
Unhealthy Food Chances & 200.7 & 90.3 & 43 & 448 \
Unhealthy Food Chances per sikm^2& 30.7 & 14.7 & 6.93 & 92.2 \
All Food Chances & 361.8 & 187.5 & 80 & 1103 \
All Food Chances per sikm^2 & 57.0 & 37.6 & 14.0 & 250.5 \
endlongtable
enddocument
which gives:
(red lines indicate text borders)
Thank you for showing me this Zarko!
– BRB
Apr 27 at 21:05
add a comment |
as i mentioned in my comment, your table has more issues as mentioned error (which is solved by my comment):
- table is to huge that can be fit on one page, actually it is long two and half page, so you need
longtable
orltablex
packages for it - rows are not consistent typed; also in case if you have except the first column all other empty, you should always typed all ampersands which define columns
for numbers in i would use
S
column typedocumentclassreport
usepackagebooktabs, longtable % <---
usepackage[skip=1ex]caption % <---
usepackagesiunitx % <---
%---------------- show page layout. don't use in a real document!
usepackageshowframe
renewcommandShowFrameLinethickness0.15pt
renewcommand*ShowFrameColorcolorred
%---------------------------------------------------------------%
begindocument
beginlongtable@ l *5S[table-format=4.2] @
captionSummary Statistics of Food Chances in New York City Gentrifying Neighborhoods
labeltab:longtable \
toprule
& Mean & Std. Dev. & Min & Max \
midrule
endfirsthead
captionSummary Statistics of Food Chances in New York City Gentrifying Neighborhoods (cont.) \
toprule
& Mean & Std. Dev. & Min & Max \
midrule
endhead
midrule
multicolumn5rfootnotesizeitshapecontinue on the next page
endfoot
midrule[heavyrulewidth]
multicolumn5lfootnotesize emphSource: NETS_ACS_032019.dta.
normalsize
endlastfoot
% table body
multicolumn5lemphMott Haven/Hunts Point \
Healthy Food Chances & 43.5 & 9.67 & 25 & 61 \
Healthy Food Chances per sikm^2 & 3.82 & 0.85 & 2.19 & 5.35 \
Unhealthy Food Chances & 216 & 84.0 & 79 & 354 \
Unhealthy Food Chances per sikm^2& 19.0 & 7.37 & 6.93 & 31.1 \
All Food Chances & 365.5 & 121.2 & 159 & 575 \
All Food Chances per sikm^2 & 32.1 & 10.6 & 14.0 & 50.5 \
midrule
multicolumn5lemphMorrisania/East Tremont \
Healthy Food Chances & 24.8 & 6.46 & 13 & 34 \
Healthy Food Chances per sikm^2 & 3.09 & 0.80 & 1.62 & 4.23 \
Unhealthy Food Chances & 210.8 & 76.4 & 98 & 345 \
Unhealthy Food Chances per sikm^2& 26.3 & 9.52 & 12.2 & 43.0 \
All Food Chances & 325.7 & 107.6 & 163 & 517 \
All Food Chances per sikm^2 & 40.6 & 13.4 & 20.3 & 64.4 \
midrule
multicolumn5lemphWilliamsburg/Greenpoint \
Healthy Food Chances & 53.2 & 9.10 & 35 & 68 \
Healthy Food Chances per sikm^2 & 4.37 & 0.75 & 2.88 & 5.59 \
Unhealthy Food Chances & 279.5 & 59.5 & 166 & 359 \
Unhealthy Food Chances per sikm^2& 23.0 & 4.88 & 13.6 & 29.5 \
All Food Chances & 508.9 & 124.4 & 290 & 711 \
All Food Chances per sikm^2 & 41.8 & 10.2 & 23.8 & 58.4 \
midrule
multicolumn5lemphBedford Stuyvesant \
Healthy Food Chances & 14.3 & 3.23 & 9 & 22 \
Healthy Food Chances per sikm^2 & 1.90 & 0.43 & 1.20 & 2.93 \
Unhealthy Food Chances & 175.8 & 50.8 & 67 & 252 \
Unhealthy Food Chances per sikm^2& 23.4 & 6.77 & 8.92 & 33.6 \
All Food Chances & 260.6 & 70.4 & 110 & 366 \
All Food Chances per sikm^2 & 34.7 & 9.37 & 14.6 & 48.7 \
midrule
multicolumn5lemphBushwick \
Healthy Food Chances & 21.8 & 2.50 & 18 & 27 \
Healthy Food Chances per sikm^2 & 4.21 & 0.48 & 3.47 & 5.21 \
Unhealthy Food Chances & 168.4 & 53.7 & 82 & 259 \
Unhealthy Food Chances per sikm^2& 32.5 & 10.4 & 15.8 & 50.0 \
All Food Chances & 258 & 81.5 & 121 & 398 \
All Food Chances per sikm^2 & 49.8 & 15.7 & 23.4 & 76.8 \
midrule
multicolumn5lemphSunset Park \
Healthy Food Chances & 25.7 & 5.39 & 17 & 35 \
Healthy Food Chances per sikm^2 & 2.68 & 0.56 & 1.77 & 3.65 \
Unhealthy Food Chances & 246.0 & 73.4 & 125 & 369 \
Unhealthy Food Chances per sikm^2& 25.7 & 7.66 & 13.0 & 38.5 \
All Food Chances & 404.9 & 117.9 & 197 & 626 \
All Food Chances per sikm^2 & 42.3 & 12.3 & 20.6 & 65.3 \
midrule
multicolumn5lemphNorth Crown Heights/Prospect Heights \
Healthy Food Chances & 38.5 & 6.08 & 24 & 51 \
Healthy Food Chances per sikm^2 & 9.30 & 1.47 & 5.79 & 12.3 \
Unhealthy Food Chances & 159.2 & 40.1 & 82 & 222 \
Unhealthy Food Chances per sikm^2& 38.4 & 9.68 & 19.8 & 53.6 \
All Food Chances & 298.2 & 68.8 & 159 & 412 \
All Food Chances per sikm^2 & 72.0 & 16.6 & 38.4 & 99.4 \
midrule
multicolumn5lemphSouth Crown Heights \
Healthy Food Chances & 29.9 & 4.41 & 21 & 35 \
Healthy Food Chances per sikm^2 & 7.20 & 1.06 & 5.07 & 8.45 \
Unhealthy Food Chances & 125.4 & 24.1 & 76 & 167 \
Unhealthy Food Chances per sikm^2& 30.3 & 5.81 & 18.3 & 40.3 \
All Food Chances & 229.9 & 45.6 & 130 & 309 \
All Food Chances per sikm^2 & 55.5 & 11.0 & 31.4 & 74.6 \
midrule
multicolumn5lemphBrownsville/Ocean Hill \
Healthy Food Chances & 18.5 & 4.01 & 8 & 23 \
Healthy Food Chances per sikm^2 & 3.75 & 0.81 & 1.63 & 4.67 \
Unhealthy Food Chances & 116.3 & 38.8 & 43 & 183 \
Unhealthy Food Chances per sikm^2& 23.6 & 7.88 & 8.74 & 37.2 \
All Food Chances & 185.8 & 53.2 & 80 & 277 \
All Food Chances per sikm^2 & 37.8 & 10.8 & 16.3 & 56.3 \
midrule
multicolumn5lemphLower East Side/Chinatown \
Healthy Food Chances & 54.4 & 6.15 & 41 & 65 \
Healthy Food Chances per sikm^2 & 12.4 & 1.40 & 9.31 & 14.8 \
Unhealthy Food Chances & 297.3 & 73.4 & 172 & 406 \
Unhealthy Food Chances per sikm^2& 67.5 & 16.7 & 39.1 & 92.2 \
All Food Chances & 767.0 & 179.9 & 478 & 1103 \
All Food Chances per sikm^2 & 174.2 & 40.9 & 108.6 & 250.5 \
midrule
multicolumn5lemphMorningside Heights/Hamilton Heights \
Healthy Food Chances & 22.1 & 2.94 & 16 & 27 \
Healthy Food Chances per sikm^2 & 5.70 & 0.76 & 4.12 & 6.95 \
Unhealthy Food Chances & 124.4 & 38.4 & 60 & 188 \
Unhealthy Food Chances per sikm^2& 32.0 & 9.88 & 15.4 & 48.4 \
All Food Chances & 250.3 & 66.7 & 136 & 363 \
All Food Chances per sikm^2 & 64.4 & 17.2 & 35.0 & 93.4 \
midrule
multicolumn5lemphCentral Harlem \
Healthy Food Chances & 22.2 & 3.11 & 16 & 27 \
Healthy Food Chances per sikm^2 & 6.13 & 0.86 & 4.41 & 7.45 \
Unhealthy Food Chances & 136.8 & 44.7 & 68 & 207 \
Unhealthy Food Chances per sikm^2& 37.7 & 12.3 & 18.8 & 57.1 \
All Food Chances & 249.0 & 71.2 & 130 & 374 \
All Food Chances per sikm^2 & 68.7 & 19.6 & 35.9 & 103.1 \
midrule
multicolumn5lemphEast Harlem \
Healthy Food Chances & 21.9 & 2.79 & 17 & 26 \
Healthy Food Chances per sikm^2 & 3.52 & 0.45 & 2.73 & 4.18 \
Unhealthy Food Chances & 147.1 & 53.5 & 57 & 236 \
Unhealthy Food Chances per sikm^2& 23.7 & 8.60 & 9.17 & 38.0 \
All Food Chances & 249.5 & 79.5 & 114 & 392 \
All Food Chances per sikm^2 & 40.1 & 12.8 & 18.3 & 63.1 \
midrule
multicolumn5lemphWashington Heights/Inwood \
Healthy Food Chances & 40.3 & 5.06 & 32 & 48 \
Healthy Food Chances per sikm^2 & 5.56 & 0.70 & 4.41 & 6.62 \
Unhealthy Food Chances & 269.3 & 78.5 & 140 & 388 \
Unhealthy Food Chances per sikm^2& 37.1 & 10.8 & 19.3 & 53.5 \
All Food Chances & 453.3 & 114.9 & 268 & 646 \
All Food Chances per sikm^2 & 62.5 & 15.8 & 37.0 & 89.1 \
midrule
multicolumn5lemphAstoria \
Healthy Food Chances & 48.8 & 7.19 & 34 & 58 \
Healthy Food Chances per sikm^2 & 3.04 & 0.45 & 2.12 & 3.61 \
Unhealthy Food Chances & 338 & 72.8 & 202 & 448 \
Unhealthy Food Chances per sikm^2& 21.0 & 4.53 & 12.6 & 27.9 \
All Food Chances & 620.0 & 140.9 & 352 & 858 \
All Food Chances per sikm^2 & 38.6 & 8.78 & 21.9 & 53.4 \
midrule
multicolumn5lemphTotal \
Healthy Food Chances & 32.0 & 14.0 & 8 & 68 \
Healthy Food Chances per sikm^2 & 5.11 & 2.81 & 1.20 & 14.8 \
Unhealthy Food Chances & 200.7 & 90.3 & 43 & 448 \
Unhealthy Food Chances per sikm^2& 30.7 & 14.7 & 6.93 & 92.2 \
All Food Chances & 361.8 & 187.5 & 80 & 1103 \
All Food Chances per sikm^2 & 57.0 & 37.6 & 14.0 & 250.5 \
endlongtable
enddocument
which gives:
(red lines indicate text borders)
Thank you for showing me this Zarko!
– BRB
Apr 27 at 21:05
add a comment |
as i mentioned in my comment, your table has more issues as mentioned error (which is solved by my comment):
- table is to huge that can be fit on one page, actually it is long two and half page, so you need
longtable
orltablex
packages for it - rows are not consistent typed; also in case if you have except the first column all other empty, you should always typed all ampersands which define columns
for numbers in i would use
S
column typedocumentclassreport
usepackagebooktabs, longtable % <---
usepackage[skip=1ex]caption % <---
usepackagesiunitx % <---
%---------------- show page layout. don't use in a real document!
usepackageshowframe
renewcommandShowFrameLinethickness0.15pt
renewcommand*ShowFrameColorcolorred
%---------------------------------------------------------------%
begindocument
beginlongtable@ l *5S[table-format=4.2] @
captionSummary Statistics of Food Chances in New York City Gentrifying Neighborhoods
labeltab:longtable \
toprule
& Mean & Std. Dev. & Min & Max \
midrule
endfirsthead
captionSummary Statistics of Food Chances in New York City Gentrifying Neighborhoods (cont.) \
toprule
& Mean & Std. Dev. & Min & Max \
midrule
endhead
midrule
multicolumn5rfootnotesizeitshapecontinue on the next page
endfoot
midrule[heavyrulewidth]
multicolumn5lfootnotesize emphSource: NETS_ACS_032019.dta.
normalsize
endlastfoot
% table body
multicolumn5lemphMott Haven/Hunts Point \
Healthy Food Chances & 43.5 & 9.67 & 25 & 61 \
Healthy Food Chances per sikm^2 & 3.82 & 0.85 & 2.19 & 5.35 \
Unhealthy Food Chances & 216 & 84.0 & 79 & 354 \
Unhealthy Food Chances per sikm^2& 19.0 & 7.37 & 6.93 & 31.1 \
All Food Chances & 365.5 & 121.2 & 159 & 575 \
All Food Chances per sikm^2 & 32.1 & 10.6 & 14.0 & 50.5 \
midrule
multicolumn5lemphMorrisania/East Tremont \
Healthy Food Chances & 24.8 & 6.46 & 13 & 34 \
Healthy Food Chances per sikm^2 & 3.09 & 0.80 & 1.62 & 4.23 \
Unhealthy Food Chances & 210.8 & 76.4 & 98 & 345 \
Unhealthy Food Chances per sikm^2& 26.3 & 9.52 & 12.2 & 43.0 \
All Food Chances & 325.7 & 107.6 & 163 & 517 \
All Food Chances per sikm^2 & 40.6 & 13.4 & 20.3 & 64.4 \
midrule
multicolumn5lemphWilliamsburg/Greenpoint \
Healthy Food Chances & 53.2 & 9.10 & 35 & 68 \
Healthy Food Chances per sikm^2 & 4.37 & 0.75 & 2.88 & 5.59 \
Unhealthy Food Chances & 279.5 & 59.5 & 166 & 359 \
Unhealthy Food Chances per sikm^2& 23.0 & 4.88 & 13.6 & 29.5 \
All Food Chances & 508.9 & 124.4 & 290 & 711 \
All Food Chances per sikm^2 & 41.8 & 10.2 & 23.8 & 58.4 \
midrule
multicolumn5lemphBedford Stuyvesant \
Healthy Food Chances & 14.3 & 3.23 & 9 & 22 \
Healthy Food Chances per sikm^2 & 1.90 & 0.43 & 1.20 & 2.93 \
Unhealthy Food Chances & 175.8 & 50.8 & 67 & 252 \
Unhealthy Food Chances per sikm^2& 23.4 & 6.77 & 8.92 & 33.6 \
All Food Chances & 260.6 & 70.4 & 110 & 366 \
All Food Chances per sikm^2 & 34.7 & 9.37 & 14.6 & 48.7 \
midrule
multicolumn5lemphBushwick \
Healthy Food Chances & 21.8 & 2.50 & 18 & 27 \
Healthy Food Chances per sikm^2 & 4.21 & 0.48 & 3.47 & 5.21 \
Unhealthy Food Chances & 168.4 & 53.7 & 82 & 259 \
Unhealthy Food Chances per sikm^2& 32.5 & 10.4 & 15.8 & 50.0 \
All Food Chances & 258 & 81.5 & 121 & 398 \
All Food Chances per sikm^2 & 49.8 & 15.7 & 23.4 & 76.8 \
midrule
multicolumn5lemphSunset Park \
Healthy Food Chances & 25.7 & 5.39 & 17 & 35 \
Healthy Food Chances per sikm^2 & 2.68 & 0.56 & 1.77 & 3.65 \
Unhealthy Food Chances & 246.0 & 73.4 & 125 & 369 \
Unhealthy Food Chances per sikm^2& 25.7 & 7.66 & 13.0 & 38.5 \
All Food Chances & 404.9 & 117.9 & 197 & 626 \
All Food Chances per sikm^2 & 42.3 & 12.3 & 20.6 & 65.3 \
midrule
multicolumn5lemphNorth Crown Heights/Prospect Heights \
Healthy Food Chances & 38.5 & 6.08 & 24 & 51 \
Healthy Food Chances per sikm^2 & 9.30 & 1.47 & 5.79 & 12.3 \
Unhealthy Food Chances & 159.2 & 40.1 & 82 & 222 \
Unhealthy Food Chances per sikm^2& 38.4 & 9.68 & 19.8 & 53.6 \
All Food Chances & 298.2 & 68.8 & 159 & 412 \
All Food Chances per sikm^2 & 72.0 & 16.6 & 38.4 & 99.4 \
midrule
multicolumn5lemphSouth Crown Heights \
Healthy Food Chances & 29.9 & 4.41 & 21 & 35 \
Healthy Food Chances per sikm^2 & 7.20 & 1.06 & 5.07 & 8.45 \
Unhealthy Food Chances & 125.4 & 24.1 & 76 & 167 \
Unhealthy Food Chances per sikm^2& 30.3 & 5.81 & 18.3 & 40.3 \
All Food Chances & 229.9 & 45.6 & 130 & 309 \
All Food Chances per sikm^2 & 55.5 & 11.0 & 31.4 & 74.6 \
midrule
multicolumn5lemphBrownsville/Ocean Hill \
Healthy Food Chances & 18.5 & 4.01 & 8 & 23 \
Healthy Food Chances per sikm^2 & 3.75 & 0.81 & 1.63 & 4.67 \
Unhealthy Food Chances & 116.3 & 38.8 & 43 & 183 \
Unhealthy Food Chances per sikm^2& 23.6 & 7.88 & 8.74 & 37.2 \
All Food Chances & 185.8 & 53.2 & 80 & 277 \
All Food Chances per sikm^2 & 37.8 & 10.8 & 16.3 & 56.3 \
midrule
multicolumn5lemphLower East Side/Chinatown \
Healthy Food Chances & 54.4 & 6.15 & 41 & 65 \
Healthy Food Chances per sikm^2 & 12.4 & 1.40 & 9.31 & 14.8 \
Unhealthy Food Chances & 297.3 & 73.4 & 172 & 406 \
Unhealthy Food Chances per sikm^2& 67.5 & 16.7 & 39.1 & 92.2 \
All Food Chances & 767.0 & 179.9 & 478 & 1103 \
All Food Chances per sikm^2 & 174.2 & 40.9 & 108.6 & 250.5 \
midrule
multicolumn5lemphMorningside Heights/Hamilton Heights \
Healthy Food Chances & 22.1 & 2.94 & 16 & 27 \
Healthy Food Chances per sikm^2 & 5.70 & 0.76 & 4.12 & 6.95 \
Unhealthy Food Chances & 124.4 & 38.4 & 60 & 188 \
Unhealthy Food Chances per sikm^2& 32.0 & 9.88 & 15.4 & 48.4 \
All Food Chances & 250.3 & 66.7 & 136 & 363 \
All Food Chances per sikm^2 & 64.4 & 17.2 & 35.0 & 93.4 \
midrule
multicolumn5lemphCentral Harlem \
Healthy Food Chances & 22.2 & 3.11 & 16 & 27 \
Healthy Food Chances per sikm^2 & 6.13 & 0.86 & 4.41 & 7.45 \
Unhealthy Food Chances & 136.8 & 44.7 & 68 & 207 \
Unhealthy Food Chances per sikm^2& 37.7 & 12.3 & 18.8 & 57.1 \
All Food Chances & 249.0 & 71.2 & 130 & 374 \
All Food Chances per sikm^2 & 68.7 & 19.6 & 35.9 & 103.1 \
midrule
multicolumn5lemphEast Harlem \
Healthy Food Chances & 21.9 & 2.79 & 17 & 26 \
Healthy Food Chances per sikm^2 & 3.52 & 0.45 & 2.73 & 4.18 \
Unhealthy Food Chances & 147.1 & 53.5 & 57 & 236 \
Unhealthy Food Chances per sikm^2& 23.7 & 8.60 & 9.17 & 38.0 \
All Food Chances & 249.5 & 79.5 & 114 & 392 \
All Food Chances per sikm^2 & 40.1 & 12.8 & 18.3 & 63.1 \
midrule
multicolumn5lemphWashington Heights/Inwood \
Healthy Food Chances & 40.3 & 5.06 & 32 & 48 \
Healthy Food Chances per sikm^2 & 5.56 & 0.70 & 4.41 & 6.62 \
Unhealthy Food Chances & 269.3 & 78.5 & 140 & 388 \
Unhealthy Food Chances per sikm^2& 37.1 & 10.8 & 19.3 & 53.5 \
All Food Chances & 453.3 & 114.9 & 268 & 646 \
All Food Chances per sikm^2 & 62.5 & 15.8 & 37.0 & 89.1 \
midrule
multicolumn5lemphAstoria \
Healthy Food Chances & 48.8 & 7.19 & 34 & 58 \
Healthy Food Chances per sikm^2 & 3.04 & 0.45 & 2.12 & 3.61 \
Unhealthy Food Chances & 338 & 72.8 & 202 & 448 \
Unhealthy Food Chances per sikm^2& 21.0 & 4.53 & 12.6 & 27.9 \
All Food Chances & 620.0 & 140.9 & 352 & 858 \
All Food Chances per sikm^2 & 38.6 & 8.78 & 21.9 & 53.4 \
midrule
multicolumn5lemphTotal \
Healthy Food Chances & 32.0 & 14.0 & 8 & 68 \
Healthy Food Chances per sikm^2 & 5.11 & 2.81 & 1.20 & 14.8 \
Unhealthy Food Chances & 200.7 & 90.3 & 43 & 448 \
Unhealthy Food Chances per sikm^2& 30.7 & 14.7 & 6.93 & 92.2 \
All Food Chances & 361.8 & 187.5 & 80 & 1103 \
All Food Chances per sikm^2 & 57.0 & 37.6 & 14.0 & 250.5 \
endlongtable
enddocument
which gives:
(red lines indicate text borders)
as i mentioned in my comment, your table has more issues as mentioned error (which is solved by my comment):
- table is to huge that can be fit on one page, actually it is long two and half page, so you need
longtable
orltablex
packages for it - rows are not consistent typed; also in case if you have except the first column all other empty, you should always typed all ampersands which define columns
for numbers in i would use
S
column typedocumentclassreport
usepackagebooktabs, longtable % <---
usepackage[skip=1ex]caption % <---
usepackagesiunitx % <---
%---------------- show page layout. don't use in a real document!
usepackageshowframe
renewcommandShowFrameLinethickness0.15pt
renewcommand*ShowFrameColorcolorred
%---------------------------------------------------------------%
begindocument
beginlongtable@ l *5S[table-format=4.2] @
captionSummary Statistics of Food Chances in New York City Gentrifying Neighborhoods
labeltab:longtable \
toprule
& Mean & Std. Dev. & Min & Max \
midrule
endfirsthead
captionSummary Statistics of Food Chances in New York City Gentrifying Neighborhoods (cont.) \
toprule
& Mean & Std. Dev. & Min & Max \
midrule
endhead
midrule
multicolumn5rfootnotesizeitshapecontinue on the next page
endfoot
midrule[heavyrulewidth]
multicolumn5lfootnotesize emphSource: NETS_ACS_032019.dta.
normalsize
endlastfoot
% table body
multicolumn5lemphMott Haven/Hunts Point \
Healthy Food Chances & 43.5 & 9.67 & 25 & 61 \
Healthy Food Chances per sikm^2 & 3.82 & 0.85 & 2.19 & 5.35 \
Unhealthy Food Chances & 216 & 84.0 & 79 & 354 \
Unhealthy Food Chances per sikm^2& 19.0 & 7.37 & 6.93 & 31.1 \
All Food Chances & 365.5 & 121.2 & 159 & 575 \
All Food Chances per sikm^2 & 32.1 & 10.6 & 14.0 & 50.5 \
midrule
multicolumn5lemphMorrisania/East Tremont \
Healthy Food Chances & 24.8 & 6.46 & 13 & 34 \
Healthy Food Chances per sikm^2 & 3.09 & 0.80 & 1.62 & 4.23 \
Unhealthy Food Chances & 210.8 & 76.4 & 98 & 345 \
Unhealthy Food Chances per sikm^2& 26.3 & 9.52 & 12.2 & 43.0 \
All Food Chances & 325.7 & 107.6 & 163 & 517 \
All Food Chances per sikm^2 & 40.6 & 13.4 & 20.3 & 64.4 \
midrule
multicolumn5lemphWilliamsburg/Greenpoint \
Healthy Food Chances & 53.2 & 9.10 & 35 & 68 \
Healthy Food Chances per sikm^2 & 4.37 & 0.75 & 2.88 & 5.59 \
Unhealthy Food Chances & 279.5 & 59.5 & 166 & 359 \
Unhealthy Food Chances per sikm^2& 23.0 & 4.88 & 13.6 & 29.5 \
All Food Chances & 508.9 & 124.4 & 290 & 711 \
All Food Chances per sikm^2 & 41.8 & 10.2 & 23.8 & 58.4 \
midrule
multicolumn5lemphBedford Stuyvesant \
Healthy Food Chances & 14.3 & 3.23 & 9 & 22 \
Healthy Food Chances per sikm^2 & 1.90 & 0.43 & 1.20 & 2.93 \
Unhealthy Food Chances & 175.8 & 50.8 & 67 & 252 \
Unhealthy Food Chances per sikm^2& 23.4 & 6.77 & 8.92 & 33.6 \
All Food Chances & 260.6 & 70.4 & 110 & 366 \
All Food Chances per sikm^2 & 34.7 & 9.37 & 14.6 & 48.7 \
midrule
multicolumn5lemphBushwick \
Healthy Food Chances & 21.8 & 2.50 & 18 & 27 \
Healthy Food Chances per sikm^2 & 4.21 & 0.48 & 3.47 & 5.21 \
Unhealthy Food Chances & 168.4 & 53.7 & 82 & 259 \
Unhealthy Food Chances per sikm^2& 32.5 & 10.4 & 15.8 & 50.0 \
All Food Chances & 258 & 81.5 & 121 & 398 \
All Food Chances per sikm^2 & 49.8 & 15.7 & 23.4 & 76.8 \
midrule
multicolumn5lemphSunset Park \
Healthy Food Chances & 25.7 & 5.39 & 17 & 35 \
Healthy Food Chances per sikm^2 & 2.68 & 0.56 & 1.77 & 3.65 \
Unhealthy Food Chances & 246.0 & 73.4 & 125 & 369 \
Unhealthy Food Chances per sikm^2& 25.7 & 7.66 & 13.0 & 38.5 \
All Food Chances & 404.9 & 117.9 & 197 & 626 \
All Food Chances per sikm^2 & 42.3 & 12.3 & 20.6 & 65.3 \
midrule
multicolumn5lemphNorth Crown Heights/Prospect Heights \
Healthy Food Chances & 38.5 & 6.08 & 24 & 51 \
Healthy Food Chances per sikm^2 & 9.30 & 1.47 & 5.79 & 12.3 \
Unhealthy Food Chances & 159.2 & 40.1 & 82 & 222 \
Unhealthy Food Chances per sikm^2& 38.4 & 9.68 & 19.8 & 53.6 \
All Food Chances & 298.2 & 68.8 & 159 & 412 \
All Food Chances per sikm^2 & 72.0 & 16.6 & 38.4 & 99.4 \
midrule
multicolumn5lemphSouth Crown Heights \
Healthy Food Chances & 29.9 & 4.41 & 21 & 35 \
Healthy Food Chances per sikm^2 & 7.20 & 1.06 & 5.07 & 8.45 \
Unhealthy Food Chances & 125.4 & 24.1 & 76 & 167 \
Unhealthy Food Chances per sikm^2& 30.3 & 5.81 & 18.3 & 40.3 \
All Food Chances & 229.9 & 45.6 & 130 & 309 \
All Food Chances per sikm^2 & 55.5 & 11.0 & 31.4 & 74.6 \
midrule
multicolumn5lemphBrownsville/Ocean Hill \
Healthy Food Chances & 18.5 & 4.01 & 8 & 23 \
Healthy Food Chances per sikm^2 & 3.75 & 0.81 & 1.63 & 4.67 \
Unhealthy Food Chances & 116.3 & 38.8 & 43 & 183 \
Unhealthy Food Chances per sikm^2& 23.6 & 7.88 & 8.74 & 37.2 \
All Food Chances & 185.8 & 53.2 & 80 & 277 \
All Food Chances per sikm^2 & 37.8 & 10.8 & 16.3 & 56.3 \
midrule
multicolumn5lemphLower East Side/Chinatown \
Healthy Food Chances & 54.4 & 6.15 & 41 & 65 \
Healthy Food Chances per sikm^2 & 12.4 & 1.40 & 9.31 & 14.8 \
Unhealthy Food Chances & 297.3 & 73.4 & 172 & 406 \
Unhealthy Food Chances per sikm^2& 67.5 & 16.7 & 39.1 & 92.2 \
All Food Chances & 767.0 & 179.9 & 478 & 1103 \
All Food Chances per sikm^2 & 174.2 & 40.9 & 108.6 & 250.5 \
midrule
multicolumn5lemphMorningside Heights/Hamilton Heights \
Healthy Food Chances & 22.1 & 2.94 & 16 & 27 \
Healthy Food Chances per sikm^2 & 5.70 & 0.76 & 4.12 & 6.95 \
Unhealthy Food Chances & 124.4 & 38.4 & 60 & 188 \
Unhealthy Food Chances per sikm^2& 32.0 & 9.88 & 15.4 & 48.4 \
All Food Chances & 250.3 & 66.7 & 136 & 363 \
All Food Chances per sikm^2 & 64.4 & 17.2 & 35.0 & 93.4 \
midrule
multicolumn5lemphCentral Harlem \
Healthy Food Chances & 22.2 & 3.11 & 16 & 27 \
Healthy Food Chances per sikm^2 & 6.13 & 0.86 & 4.41 & 7.45 \
Unhealthy Food Chances & 136.8 & 44.7 & 68 & 207 \
Unhealthy Food Chances per sikm^2& 37.7 & 12.3 & 18.8 & 57.1 \
All Food Chances & 249.0 & 71.2 & 130 & 374 \
All Food Chances per sikm^2 & 68.7 & 19.6 & 35.9 & 103.1 \
midrule
multicolumn5lemphEast Harlem \
Healthy Food Chances & 21.9 & 2.79 & 17 & 26 \
Healthy Food Chances per sikm^2 & 3.52 & 0.45 & 2.73 & 4.18 \
Unhealthy Food Chances & 147.1 & 53.5 & 57 & 236 \
Unhealthy Food Chances per sikm^2& 23.7 & 8.60 & 9.17 & 38.0 \
All Food Chances & 249.5 & 79.5 & 114 & 392 \
All Food Chances per sikm^2 & 40.1 & 12.8 & 18.3 & 63.1 \
midrule
multicolumn5lemphWashington Heights/Inwood \
Healthy Food Chances & 40.3 & 5.06 & 32 & 48 \
Healthy Food Chances per sikm^2 & 5.56 & 0.70 & 4.41 & 6.62 \
Unhealthy Food Chances & 269.3 & 78.5 & 140 & 388 \
Unhealthy Food Chances per sikm^2& 37.1 & 10.8 & 19.3 & 53.5 \
All Food Chances & 453.3 & 114.9 & 268 & 646 \
All Food Chances per sikm^2 & 62.5 & 15.8 & 37.0 & 89.1 \
midrule
multicolumn5lemphAstoria \
Healthy Food Chances & 48.8 & 7.19 & 34 & 58 \
Healthy Food Chances per sikm^2 & 3.04 & 0.45 & 2.12 & 3.61 \
Unhealthy Food Chances & 338 & 72.8 & 202 & 448 \
Unhealthy Food Chances per sikm^2& 21.0 & 4.53 & 12.6 & 27.9 \
All Food Chances & 620.0 & 140.9 & 352 & 858 \
All Food Chances per sikm^2 & 38.6 & 8.78 & 21.9 & 53.4 \
midrule
multicolumn5lemphTotal \
Healthy Food Chances & 32.0 & 14.0 & 8 & 68 \
Healthy Food Chances per sikm^2 & 5.11 & 2.81 & 1.20 & 14.8 \
Unhealthy Food Chances & 200.7 & 90.3 & 43 & 448 \
Unhealthy Food Chances per sikm^2& 30.7 & 14.7 & 6.93 & 92.2 \
All Food Chances & 361.8 & 187.5 & 80 & 1103 \
All Food Chances per sikm^2 & 57.0 & 37.6 & 14.0 & 250.5 \
endlongtable
enddocument
which gives:
(red lines indicate text borders)
edited Apr 27 at 21:48
answered Apr 27 at 20:35
ZarkoZarko
132k872173
132k872173
Thank you for showing me this Zarko!
– BRB
Apr 27 at 21:05
add a comment |
Thank you for showing me this Zarko!
– BRB
Apr 27 at 21:05
Thank you for showing me this Zarko!
– BRB
Apr 27 at 21:05
Thank you for showing me this Zarko!
– BRB
Apr 27 at 21:05
add a comment |
The first row had a wrong number for one of the multicolumn
. Anyway, you declared 7 coluns and were using 5, so I reduces their number. I set the 1st column as X
type, and used the S
column type for the 4 last columns, to align the numbers by the decimal dot. Also, I added some vertical padding between groups of rows. Last, as the table cannot fit on one page, I loaded ltables
which brings the advantages of longtable
to tabularx
. Note that we don't need the center
environment: by default, longtables are centred.
documentclassreport
usepackagesiunitx
usepackagebooktabs, caption
usepackageltablex
begindocument
footnotesize
captionsetupfont=bf
sisetuptable-format=3.2, table-number-alignment=center, per-mode=symbol
newcolumntypeY>raggedleftarraybackslashX
setlengthdefaultaddspace0.6ex
begintabularx 12cm @X SSSS@
captionTable 3. Summary Statistics of Food Chances in New York City Gentrifying Neighborhoods \
toprule
multicolumn1c(1) & multicolumn4c \
& Mean & Std. Dev & Min & Max \
midrule
endfirsthead
%
midrule
multicolumn1c(1) & multicolumn4c \
& Mean & Std. Dev & Min & Max \
midrule
endhead
midrule
multicolumn5r@em to be continued
endfoot
%\
bottomrule addlinespace[1ex]
scriptsize emphSource: NETS_ACS_032019.dta.
endlastfoot
emphMott Haven/Hunts Pointsmallskip \
Healthy Food Chances & 43.5 & 9.67 & 25 & 61 \
Healthy Food Chances,/,sisquarekm & 3.82 & 0.85 & 2.19 & 5.35 \ addlinespace
Unhealthy Food Chances & 216 & 84.0 & 79 & 354 \
Unhealthy Food Chance,/,sisquarekm & 19.0 & 7.37 & 6.93 & 31.1 \ addlinespace
All Food Chances & 365.5 & 121.2 & 159 & 575 \
All Food Chances,/,sisquarekm & 32.1 & 10.6 & 14.0 & 50.5 \
midrule
emphMorrisania/East Tremontsmallskip \
Healthy Food Chances & 24.8 & 6.46 & 13 & 34 \
Healthy Food Chances,/,sisquarekm & 3.09 & 0.80 & 1.62 & 4.23 \ addlinespace
Unhealthy Food Chances & 210.8 & 76.4 & 98 & 345 \
Unhealthy Food Chances,/,sisquarekm & 26.3 & 9.52 & 12.2 & 43.0 \ addlinespace
All Food Chances & 325.7 & 107.6 & 163 & 517 \
All Food Chances,/,sisquarekm & 40.6 & 13.4 & 20.3 & 64.4 \
midrule
emphWilliamsburg/Greenpointsmallskip \
Healthy Food Chances & 53.2 & 9.10 & 35 & 68 \
Healthy Food Chances,/,sisquarekm & 4.37 & 0.75 & 2.88 & 5.59 \ addlinespace
Unhealthy Food Chances & 279.5 & 59.5 & 166 & 359 \
Unhealthy Food Chances,/,sisquarekm & 23.0 & 4.88 & 13.6 & 29.5 \ addlinespace
All Food Chances & 508.9 & 124.4 & 290 & 711 \
All Food Chances,/,sisquarekm & 41.8 & 10.2 & 23.8 & 58.4 \
midrule
emphBedford Stuyvesant smallskip\
Healthy Food Chances & 14.3 & 3.23 & 9 & 22 \
Healthy Food Chance,/,sisquarekm & 1.90 & 0.43 & 1.20 & 2.93 \ addlinespace
Unhealthy Food Chances & 175.8 & 50.8 & 67 & 252 \
Unhealthy Food Chances,/,sisquarekm & 23.4 & 6.77 & 8.92 & 33.6 \ addlinespace
All Food Chances & 260.6 & 70.4 & 110 & 366 \
All Food Chances,/,sisquarekm & 34.7 & 9.37 & 14.6 & 48.7 \
midrule
emphBushwicksmallskip \
Healthy Food Chances & 21.8 & 2.50 & 18 & 27 \
Healthy Food Chances,/,sisquarekm & 4.21 & 0.48 & 3.47 & 5.21 \ addlinespace
Unhealthy Food Chances & 168.4 & 53.7 & 82 & 259 \
Unhealthy Food Chances,/,sisquarekm & 32.5 & 10.4 & 15.8 & 50.0 \ addlinespace
All Food Chances & 258 & 81.5 & 121 & 398 \
All Food Chances,/,sisquarekm & 49.8 & 15.7 & 23.4 & 76.8 \
midrule
emphSunset Park smallskip \
Healthy Food Chances & 25.7 & 5.39 & 17 & 35 \
Healthy Food Chances,/,sisquarekm & 2.68 & 0.56 & 1.77 & 3.65 \ addlinespace
Unhealthy Food Chances & 246.0 & 73.4 & 125 & 369 \
Unhealthy Food Chances,/,sisquarekm & 25.7 & 7.66 & 13.0 & 38.5 \ addlinespace
All Food Chances & 404.9 & 117.9 & 197 & 626 \
All Food Chances,/,sisquarekm & 42.3 & 12.3 & 20.6 & 65.3 \
%% midrule
pagebreak[4]emphNorth Crown Heights/Prospect Heightssmallskip \
Healthy Food Chances & 38.5 & 6.08 & 24 & 51 \
Healthy Food Chances,/,sisquarekm & 9.30 & 1.47 & 5.79 & 12.3 \ addlinespace
Unhealthy Food Chances & 159.2 & 40.1 & 82 & 222 \
Unhealthy Food Chances,/,sisquarekm & 38.4 & 9.68 & 19.8 & 53.6 \ addlinespace
All Food Chances & 298.2 & 68.8 & 159 & 412 \
All Food Chances,/,sisquarekm & 72.0 & 16.6 & 38.4 & 99.4 \
midrule
emphSouth Crown Heightssmallskip \
Healthy Food Chances & 29.9 & 4.41 & 21 & 35 \
Healthy Food Chances,/,sisquarekm & 7.20 & 1.06 & 5.07 & 8.45 \ addlinespace
Unhealthy Food Chances & 125.4 & 24.1 & 76 & 167 \
Unhealthy Food Chances,/,sisquarekm & 30.3 & 5.81 & 18.3 & 40.3 \ addlinespace
All Food Chances & 229.9 & 45.6 & 130 & 309 \
All Food Chances,/,sisquarekm & 55.5 & 11.0 & 31.4 & 74.6 \
midrule
emphBrownsville/Ocean Hillsmallskip \
Healthy Food Chances & 18.5 & 4.01 & 8 & 23 \
Healthy Food Chances,/,sisquarekm & 3.75 & 0.81 & 1.63 & 4.67 \ addlinespace
Unhealthy Food Chances & 116.3 & 38.8 & 43 & 183 \
Unhealthy Food Chances,/,sisquarekm & 23.6 & 7.88 & 8.74 & 37.2 \ addlinespace
All Food Chances & 185.8 & 53.2 & 80 & 277 \
All Food Chances,/,sisquarekm & 37.8 & 10.8 & 16.3 & 56.3 \
midrule
emphLower East Side/Chinatownsmallskip \
Healthy Food Chances & 54.4 & 6.15 & 41 & 65 \
Healthy Food Chances,/,sisquarekm & 12.4 & 1.40 & 9.31 & 14.8 \ addlinespace
Unhealthy Food Chances & 297.3 & 73.4 & 172 & 406 \
Unhealthy Food Chances,/,sisquarekm & 67.5 & 16.7 & 39.1 & 92.2 \ addlinespace
All Food Chances & 767.0 & 179.9 & 478 & 1103 \
All Food Chances,/,sisquarekm & 174.2 & 40.9 & 108.6 & 250.5 \
midrule
emphMorningside Heights/Hamilton Heightssmallskip \
Healthy Food Chances & 22.1 & 2.94 & 16 & 27 \
Healthy Food Chances,/,sisquarekm & 5.70 & 0.76 & 4.12 & 6.95 \ addlinespace
Unhealthy Food Chances & 124.4 & 38.4 & 60 & 188 \
Unhealthy Food Chances,/,sisquarekm & 32.0 & 9.88 & 15.4 & 48.4 \ addlinespace
All Food Chances & 250.3 & 66.7 & 136 & 363 \
All Food Chances,/,sisquarekm & 64.4 & 17.2 & 35.0 & 93.4 \
midrule
emphCentral Harlemsmallskip \
Healthy Food Chances & 22.2 & 3.11 & 16 & 27 \
Healthy Food Chances,/,sisquarekm & 6.13 & 0.86 & 4.41 & 7.45 \ addlinespace
Unhealthy Food Chances & 136.8 & 44.7 & 68 & 207 \
Unhealthy Food Chances,/,sisquarekm & 37.7 & 12.3 & 18.8 & 57.1 \ addlinespace
All Food Chances & 249.0 & 71.2 & 130 & 374 \
All Food Chances,/,sisquarekm & 68.7 & 19.6 & 35.9 & 103.1 \
midrule
emphEast Harlemsmallskip \
Healthy Food Chances & 21.9 & 2.79 & 17 & 26 \
Healthy Food Chances,/,sisquarekm & 3.52 & 0.45 & 2.73 & 4.18 \ addlinespace
Unhealthy Food Chances & 147.1 & 53.5 & 57 & 236 \
Unhealthy Food Chances,/,sisquarekm & 23.7 & 8.60 & 9.17 & 38.0 \ addlinespace
All Food Chances & 249.5 & 79.5 & 114 & 392 \
All Food Chances,/,sisquarekm & 40.1 & 12.8 & 18.3 & 63.1 \
midrule
emphWashington Heights/Inwoodsmallskip \
Healthy Food Chances & 40.3 & 5.06 & 32 & 48 \
Healthy Food Chances,/,sisquarekm & 5.56 & 0.70 & 4.41 & 6.62 \ addlinespace
Unhealthy Food Chances & 269.3 & 78.5 & 140 & 388 \
Unhealthy Food Chances,/,sisquarekm & 37.1 & 10.8 & 19.3 & 53.5 \ addlinespace
All Food Chances & 453.3 & 114.9 & 268 & 646 \
All Food Chances,/,sisquarekm & 62.5 & 15.8 & 37.0 & 89.1 \
midrule
emphAstoriasmallskip \
Healthy Food Chances & 48.8 & 7.19 & 34 & 58 \
Healthy Food Chances,/,sisquarekm & 3.04 & 0.45 & 2.12 & 3.61 \ addlinespace
Unhealthy Food Chances & 338 & 72.8 & 202 & 448 \
Unhealthy Food Chances,/,sisquarekm & 21.0 & 4.53 & 12.6 & 27.9 \ addlinespace
All Food Chances & 620.0 & 140.9 & 352 & 858 \
All Food Chances,/,sisquarekm & 38.6 & 8.78 & 21.9 & 53.4 \
midrule
emphTotalsmallskip\
Healthy Food Chances & 32.0 & 14.0 & 8 & 68 \
Healthy Food Chances,/,sisquarekm & 5.11 & 2.81 & 1.20 & 14.8 \ addlinespace
Unhealthy Food Chances & 200.7 & 90.3 & 43 & 448 \
Unhealthy Food Chances,/,sisquarekm & 30.7 & 14.7 & 6.93 & 92.2 \ addlinespace
All Food Chances & 361.8 & 187.5 & 80 & 1103 \
All Food Chances,/,sisquarekm & 57.0 & 37.6 & 14.0 & 250.5
endtabularx
%
enddocument
Thank you very much, Bernard! I like this table a lot. Can you please explain, what is the (1) at the top of the table associated with? And is it possible to remove it or replace with different text?
– BRB
Apr 27 at 21:21
Also, when I try the code on my computer the column headers are centered in the middle of the table instead of over the data. How can I fix this? Thank you
– BRB
Apr 27 at 21:30
The $(1)$ was in your code. As I didn't know what it corresponded to, I didn't touch it. Inmulticolumn1c(1)
you can replace it with whatever you want.
– Bernard
Apr 27 at 21:32
Do you mean you don't obtain the same alignment for the column headers?
– Bernard
Apr 27 at 21:34
That is correct. The alignment was centered on the entire table. In your helpful example, it was aligned over the 4 columns of the corresponding data.
– BRB
Apr 28 at 5:15
|
show 1 more comment
The first row had a wrong number for one of the multicolumn
. Anyway, you declared 7 coluns and were using 5, so I reduces their number. I set the 1st column as X
type, and used the S
column type for the 4 last columns, to align the numbers by the decimal dot. Also, I added some vertical padding between groups of rows. Last, as the table cannot fit on one page, I loaded ltables
which brings the advantages of longtable
to tabularx
. Note that we don't need the center
environment: by default, longtables are centred.
documentclassreport
usepackagesiunitx
usepackagebooktabs, caption
usepackageltablex
begindocument
footnotesize
captionsetupfont=bf
sisetuptable-format=3.2, table-number-alignment=center, per-mode=symbol
newcolumntypeY>raggedleftarraybackslashX
setlengthdefaultaddspace0.6ex
begintabularx 12cm @X SSSS@
captionTable 3. Summary Statistics of Food Chances in New York City Gentrifying Neighborhoods \
toprule
multicolumn1c(1) & multicolumn4c \
& Mean & Std. Dev & Min & Max \
midrule
endfirsthead
%
midrule
multicolumn1c(1) & multicolumn4c \
& Mean & Std. Dev & Min & Max \
midrule
endhead
midrule
multicolumn5r@em to be continued
endfoot
%\
bottomrule addlinespace[1ex]
scriptsize emphSource: NETS_ACS_032019.dta.
endlastfoot
emphMott Haven/Hunts Pointsmallskip \
Healthy Food Chances & 43.5 & 9.67 & 25 & 61 \
Healthy Food Chances,/,sisquarekm & 3.82 & 0.85 & 2.19 & 5.35 \ addlinespace
Unhealthy Food Chances & 216 & 84.0 & 79 & 354 \
Unhealthy Food Chance,/,sisquarekm & 19.0 & 7.37 & 6.93 & 31.1 \ addlinespace
All Food Chances & 365.5 & 121.2 & 159 & 575 \
All Food Chances,/,sisquarekm & 32.1 & 10.6 & 14.0 & 50.5 \
midrule
emphMorrisania/East Tremontsmallskip \
Healthy Food Chances & 24.8 & 6.46 & 13 & 34 \
Healthy Food Chances,/,sisquarekm & 3.09 & 0.80 & 1.62 & 4.23 \ addlinespace
Unhealthy Food Chances & 210.8 & 76.4 & 98 & 345 \
Unhealthy Food Chances,/,sisquarekm & 26.3 & 9.52 & 12.2 & 43.0 \ addlinespace
All Food Chances & 325.7 & 107.6 & 163 & 517 \
All Food Chances,/,sisquarekm & 40.6 & 13.4 & 20.3 & 64.4 \
midrule
emphWilliamsburg/Greenpointsmallskip \
Healthy Food Chances & 53.2 & 9.10 & 35 & 68 \
Healthy Food Chances,/,sisquarekm & 4.37 & 0.75 & 2.88 & 5.59 \ addlinespace
Unhealthy Food Chances & 279.5 & 59.5 & 166 & 359 \
Unhealthy Food Chances,/,sisquarekm & 23.0 & 4.88 & 13.6 & 29.5 \ addlinespace
All Food Chances & 508.9 & 124.4 & 290 & 711 \
All Food Chances,/,sisquarekm & 41.8 & 10.2 & 23.8 & 58.4 \
midrule
emphBedford Stuyvesant smallskip\
Healthy Food Chances & 14.3 & 3.23 & 9 & 22 \
Healthy Food Chance,/,sisquarekm & 1.90 & 0.43 & 1.20 & 2.93 \ addlinespace
Unhealthy Food Chances & 175.8 & 50.8 & 67 & 252 \
Unhealthy Food Chances,/,sisquarekm & 23.4 & 6.77 & 8.92 & 33.6 \ addlinespace
All Food Chances & 260.6 & 70.4 & 110 & 366 \
All Food Chances,/,sisquarekm & 34.7 & 9.37 & 14.6 & 48.7 \
midrule
emphBushwicksmallskip \
Healthy Food Chances & 21.8 & 2.50 & 18 & 27 \
Healthy Food Chances,/,sisquarekm & 4.21 & 0.48 & 3.47 & 5.21 \ addlinespace
Unhealthy Food Chances & 168.4 & 53.7 & 82 & 259 \
Unhealthy Food Chances,/,sisquarekm & 32.5 & 10.4 & 15.8 & 50.0 \ addlinespace
All Food Chances & 258 & 81.5 & 121 & 398 \
All Food Chances,/,sisquarekm & 49.8 & 15.7 & 23.4 & 76.8 \
midrule
emphSunset Park smallskip \
Healthy Food Chances & 25.7 & 5.39 & 17 & 35 \
Healthy Food Chances,/,sisquarekm & 2.68 & 0.56 & 1.77 & 3.65 \ addlinespace
Unhealthy Food Chances & 246.0 & 73.4 & 125 & 369 \
Unhealthy Food Chances,/,sisquarekm & 25.7 & 7.66 & 13.0 & 38.5 \ addlinespace
All Food Chances & 404.9 & 117.9 & 197 & 626 \
All Food Chances,/,sisquarekm & 42.3 & 12.3 & 20.6 & 65.3 \
%% midrule
pagebreak[4]emphNorth Crown Heights/Prospect Heightssmallskip \
Healthy Food Chances & 38.5 & 6.08 & 24 & 51 \
Healthy Food Chances,/,sisquarekm & 9.30 & 1.47 & 5.79 & 12.3 \ addlinespace
Unhealthy Food Chances & 159.2 & 40.1 & 82 & 222 \
Unhealthy Food Chances,/,sisquarekm & 38.4 & 9.68 & 19.8 & 53.6 \ addlinespace
All Food Chances & 298.2 & 68.8 & 159 & 412 \
All Food Chances,/,sisquarekm & 72.0 & 16.6 & 38.4 & 99.4 \
midrule
emphSouth Crown Heightssmallskip \
Healthy Food Chances & 29.9 & 4.41 & 21 & 35 \
Healthy Food Chances,/,sisquarekm & 7.20 & 1.06 & 5.07 & 8.45 \ addlinespace
Unhealthy Food Chances & 125.4 & 24.1 & 76 & 167 \
Unhealthy Food Chances,/,sisquarekm & 30.3 & 5.81 & 18.3 & 40.3 \ addlinespace
All Food Chances & 229.9 & 45.6 & 130 & 309 \
All Food Chances,/,sisquarekm & 55.5 & 11.0 & 31.4 & 74.6 \
midrule
emphBrownsville/Ocean Hillsmallskip \
Healthy Food Chances & 18.5 & 4.01 & 8 & 23 \
Healthy Food Chances,/,sisquarekm & 3.75 & 0.81 & 1.63 & 4.67 \ addlinespace
Unhealthy Food Chances & 116.3 & 38.8 & 43 & 183 \
Unhealthy Food Chances,/,sisquarekm & 23.6 & 7.88 & 8.74 & 37.2 \ addlinespace
All Food Chances & 185.8 & 53.2 & 80 & 277 \
All Food Chances,/,sisquarekm & 37.8 & 10.8 & 16.3 & 56.3 \
midrule
emphLower East Side/Chinatownsmallskip \
Healthy Food Chances & 54.4 & 6.15 & 41 & 65 \
Healthy Food Chances,/,sisquarekm & 12.4 & 1.40 & 9.31 & 14.8 \ addlinespace
Unhealthy Food Chances & 297.3 & 73.4 & 172 & 406 \
Unhealthy Food Chances,/,sisquarekm & 67.5 & 16.7 & 39.1 & 92.2 \ addlinespace
All Food Chances & 767.0 & 179.9 & 478 & 1103 \
All Food Chances,/,sisquarekm & 174.2 & 40.9 & 108.6 & 250.5 \
midrule
emphMorningside Heights/Hamilton Heightssmallskip \
Healthy Food Chances & 22.1 & 2.94 & 16 & 27 \
Healthy Food Chances,/,sisquarekm & 5.70 & 0.76 & 4.12 & 6.95 \ addlinespace
Unhealthy Food Chances & 124.4 & 38.4 & 60 & 188 \
Unhealthy Food Chances,/,sisquarekm & 32.0 & 9.88 & 15.4 & 48.4 \ addlinespace
All Food Chances & 250.3 & 66.7 & 136 & 363 \
All Food Chances,/,sisquarekm & 64.4 & 17.2 & 35.0 & 93.4 \
midrule
emphCentral Harlemsmallskip \
Healthy Food Chances & 22.2 & 3.11 & 16 & 27 \
Healthy Food Chances,/,sisquarekm & 6.13 & 0.86 & 4.41 & 7.45 \ addlinespace
Unhealthy Food Chances & 136.8 & 44.7 & 68 & 207 \
Unhealthy Food Chances,/,sisquarekm & 37.7 & 12.3 & 18.8 & 57.1 \ addlinespace
All Food Chances & 249.0 & 71.2 & 130 & 374 \
All Food Chances,/,sisquarekm & 68.7 & 19.6 & 35.9 & 103.1 \
midrule
emphEast Harlemsmallskip \
Healthy Food Chances & 21.9 & 2.79 & 17 & 26 \
Healthy Food Chances,/,sisquarekm & 3.52 & 0.45 & 2.73 & 4.18 \ addlinespace
Unhealthy Food Chances & 147.1 & 53.5 & 57 & 236 \
Unhealthy Food Chances,/,sisquarekm & 23.7 & 8.60 & 9.17 & 38.0 \ addlinespace
All Food Chances & 249.5 & 79.5 & 114 & 392 \
All Food Chances,/,sisquarekm & 40.1 & 12.8 & 18.3 & 63.1 \
midrule
emphWashington Heights/Inwoodsmallskip \
Healthy Food Chances & 40.3 & 5.06 & 32 & 48 \
Healthy Food Chances,/,sisquarekm & 5.56 & 0.70 & 4.41 & 6.62 \ addlinespace
Unhealthy Food Chances & 269.3 & 78.5 & 140 & 388 \
Unhealthy Food Chances,/,sisquarekm & 37.1 & 10.8 & 19.3 & 53.5 \ addlinespace
All Food Chances & 453.3 & 114.9 & 268 & 646 \
All Food Chances,/,sisquarekm & 62.5 & 15.8 & 37.0 & 89.1 \
midrule
emphAstoriasmallskip \
Healthy Food Chances & 48.8 & 7.19 & 34 & 58 \
Healthy Food Chances,/,sisquarekm & 3.04 & 0.45 & 2.12 & 3.61 \ addlinespace
Unhealthy Food Chances & 338 & 72.8 & 202 & 448 \
Unhealthy Food Chances,/,sisquarekm & 21.0 & 4.53 & 12.6 & 27.9 \ addlinespace
All Food Chances & 620.0 & 140.9 & 352 & 858 \
All Food Chances,/,sisquarekm & 38.6 & 8.78 & 21.9 & 53.4 \
midrule
emphTotalsmallskip\
Healthy Food Chances & 32.0 & 14.0 & 8 & 68 \
Healthy Food Chances,/,sisquarekm & 5.11 & 2.81 & 1.20 & 14.8 \ addlinespace
Unhealthy Food Chances & 200.7 & 90.3 & 43 & 448 \
Unhealthy Food Chances,/,sisquarekm & 30.7 & 14.7 & 6.93 & 92.2 \ addlinespace
All Food Chances & 361.8 & 187.5 & 80 & 1103 \
All Food Chances,/,sisquarekm & 57.0 & 37.6 & 14.0 & 250.5
endtabularx
%
enddocument
Thank you very much, Bernard! I like this table a lot. Can you please explain, what is the (1) at the top of the table associated with? And is it possible to remove it or replace with different text?
– BRB
Apr 27 at 21:21
Also, when I try the code on my computer the column headers are centered in the middle of the table instead of over the data. How can I fix this? Thank you
– BRB
Apr 27 at 21:30
The $(1)$ was in your code. As I didn't know what it corresponded to, I didn't touch it. Inmulticolumn1c(1)
you can replace it with whatever you want.
– Bernard
Apr 27 at 21:32
Do you mean you don't obtain the same alignment for the column headers?
– Bernard
Apr 27 at 21:34
That is correct. The alignment was centered on the entire table. In your helpful example, it was aligned over the 4 columns of the corresponding data.
– BRB
Apr 28 at 5:15
|
show 1 more comment
The first row had a wrong number for one of the multicolumn
. Anyway, you declared 7 coluns and were using 5, so I reduces their number. I set the 1st column as X
type, and used the S
column type for the 4 last columns, to align the numbers by the decimal dot. Also, I added some vertical padding between groups of rows. Last, as the table cannot fit on one page, I loaded ltables
which brings the advantages of longtable
to tabularx
. Note that we don't need the center
environment: by default, longtables are centred.
documentclassreport
usepackagesiunitx
usepackagebooktabs, caption
usepackageltablex
begindocument
footnotesize
captionsetupfont=bf
sisetuptable-format=3.2, table-number-alignment=center, per-mode=symbol
newcolumntypeY>raggedleftarraybackslashX
setlengthdefaultaddspace0.6ex
begintabularx 12cm @X SSSS@
captionTable 3. Summary Statistics of Food Chances in New York City Gentrifying Neighborhoods \
toprule
multicolumn1c(1) & multicolumn4c \
& Mean & Std. Dev & Min & Max \
midrule
endfirsthead
%
midrule
multicolumn1c(1) & multicolumn4c \
& Mean & Std. Dev & Min & Max \
midrule
endhead
midrule
multicolumn5r@em to be continued
endfoot
%\
bottomrule addlinespace[1ex]
scriptsize emphSource: NETS_ACS_032019.dta.
endlastfoot
emphMott Haven/Hunts Pointsmallskip \
Healthy Food Chances & 43.5 & 9.67 & 25 & 61 \
Healthy Food Chances,/,sisquarekm & 3.82 & 0.85 & 2.19 & 5.35 \ addlinespace
Unhealthy Food Chances & 216 & 84.0 & 79 & 354 \
Unhealthy Food Chance,/,sisquarekm & 19.0 & 7.37 & 6.93 & 31.1 \ addlinespace
All Food Chances & 365.5 & 121.2 & 159 & 575 \
All Food Chances,/,sisquarekm & 32.1 & 10.6 & 14.0 & 50.5 \
midrule
emphMorrisania/East Tremontsmallskip \
Healthy Food Chances & 24.8 & 6.46 & 13 & 34 \
Healthy Food Chances,/,sisquarekm & 3.09 & 0.80 & 1.62 & 4.23 \ addlinespace
Unhealthy Food Chances & 210.8 & 76.4 & 98 & 345 \
Unhealthy Food Chances,/,sisquarekm & 26.3 & 9.52 & 12.2 & 43.0 \ addlinespace
All Food Chances & 325.7 & 107.6 & 163 & 517 \
All Food Chances,/,sisquarekm & 40.6 & 13.4 & 20.3 & 64.4 \
midrule
emphWilliamsburg/Greenpointsmallskip \
Healthy Food Chances & 53.2 & 9.10 & 35 & 68 \
Healthy Food Chances,/,sisquarekm & 4.37 & 0.75 & 2.88 & 5.59 \ addlinespace
Unhealthy Food Chances & 279.5 & 59.5 & 166 & 359 \
Unhealthy Food Chances,/,sisquarekm & 23.0 & 4.88 & 13.6 & 29.5 \ addlinespace
All Food Chances & 508.9 & 124.4 & 290 & 711 \
All Food Chances,/,sisquarekm & 41.8 & 10.2 & 23.8 & 58.4 \
midrule
emphBedford Stuyvesant smallskip\
Healthy Food Chances & 14.3 & 3.23 & 9 & 22 \
Healthy Food Chance,/,sisquarekm & 1.90 & 0.43 & 1.20 & 2.93 \ addlinespace
Unhealthy Food Chances & 175.8 & 50.8 & 67 & 252 \
Unhealthy Food Chances,/,sisquarekm & 23.4 & 6.77 & 8.92 & 33.6 \ addlinespace
All Food Chances & 260.6 & 70.4 & 110 & 366 \
All Food Chances,/,sisquarekm & 34.7 & 9.37 & 14.6 & 48.7 \
midrule
emphBushwicksmallskip \
Healthy Food Chances & 21.8 & 2.50 & 18 & 27 \
Healthy Food Chances,/,sisquarekm & 4.21 & 0.48 & 3.47 & 5.21 \ addlinespace
Unhealthy Food Chances & 168.4 & 53.7 & 82 & 259 \
Unhealthy Food Chances,/,sisquarekm & 32.5 & 10.4 & 15.8 & 50.0 \ addlinespace
All Food Chances & 258 & 81.5 & 121 & 398 \
All Food Chances,/,sisquarekm & 49.8 & 15.7 & 23.4 & 76.8 \
midrule
emphSunset Park smallskip \
Healthy Food Chances & 25.7 & 5.39 & 17 & 35 \
Healthy Food Chances,/,sisquarekm & 2.68 & 0.56 & 1.77 & 3.65 \ addlinespace
Unhealthy Food Chances & 246.0 & 73.4 & 125 & 369 \
Unhealthy Food Chances,/,sisquarekm & 25.7 & 7.66 & 13.0 & 38.5 \ addlinespace
All Food Chances & 404.9 & 117.9 & 197 & 626 \
All Food Chances,/,sisquarekm & 42.3 & 12.3 & 20.6 & 65.3 \
%% midrule
pagebreak[4]emphNorth Crown Heights/Prospect Heightssmallskip \
Healthy Food Chances & 38.5 & 6.08 & 24 & 51 \
Healthy Food Chances,/,sisquarekm & 9.30 & 1.47 & 5.79 & 12.3 \ addlinespace
Unhealthy Food Chances & 159.2 & 40.1 & 82 & 222 \
Unhealthy Food Chances,/,sisquarekm & 38.4 & 9.68 & 19.8 & 53.6 \ addlinespace
All Food Chances & 298.2 & 68.8 & 159 & 412 \
All Food Chances,/,sisquarekm & 72.0 & 16.6 & 38.4 & 99.4 \
midrule
emphSouth Crown Heightssmallskip \
Healthy Food Chances & 29.9 & 4.41 & 21 & 35 \
Healthy Food Chances,/,sisquarekm & 7.20 & 1.06 & 5.07 & 8.45 \ addlinespace
Unhealthy Food Chances & 125.4 & 24.1 & 76 & 167 \
Unhealthy Food Chances,/,sisquarekm & 30.3 & 5.81 & 18.3 & 40.3 \ addlinespace
All Food Chances & 229.9 & 45.6 & 130 & 309 \
All Food Chances,/,sisquarekm & 55.5 & 11.0 & 31.4 & 74.6 \
midrule
emphBrownsville/Ocean Hillsmallskip \
Healthy Food Chances & 18.5 & 4.01 & 8 & 23 \
Healthy Food Chances,/,sisquarekm & 3.75 & 0.81 & 1.63 & 4.67 \ addlinespace
Unhealthy Food Chances & 116.3 & 38.8 & 43 & 183 \
Unhealthy Food Chances,/,sisquarekm & 23.6 & 7.88 & 8.74 & 37.2 \ addlinespace
All Food Chances & 185.8 & 53.2 & 80 & 277 \
All Food Chances,/,sisquarekm & 37.8 & 10.8 & 16.3 & 56.3 \
midrule
emphLower East Side/Chinatownsmallskip \
Healthy Food Chances & 54.4 & 6.15 & 41 & 65 \
Healthy Food Chances,/,sisquarekm & 12.4 & 1.40 & 9.31 & 14.8 \ addlinespace
Unhealthy Food Chances & 297.3 & 73.4 & 172 & 406 \
Unhealthy Food Chances,/,sisquarekm & 67.5 & 16.7 & 39.1 & 92.2 \ addlinespace
All Food Chances & 767.0 & 179.9 & 478 & 1103 \
All Food Chances,/,sisquarekm & 174.2 & 40.9 & 108.6 & 250.5 \
midrule
emphMorningside Heights/Hamilton Heightssmallskip \
Healthy Food Chances & 22.1 & 2.94 & 16 & 27 \
Healthy Food Chances,/,sisquarekm & 5.70 & 0.76 & 4.12 & 6.95 \ addlinespace
Unhealthy Food Chances & 124.4 & 38.4 & 60 & 188 \
Unhealthy Food Chances,/,sisquarekm & 32.0 & 9.88 & 15.4 & 48.4 \ addlinespace
All Food Chances & 250.3 & 66.7 & 136 & 363 \
All Food Chances,/,sisquarekm & 64.4 & 17.2 & 35.0 & 93.4 \
midrule
emphCentral Harlemsmallskip \
Healthy Food Chances & 22.2 & 3.11 & 16 & 27 \
Healthy Food Chances,/,sisquarekm & 6.13 & 0.86 & 4.41 & 7.45 \ addlinespace
Unhealthy Food Chances & 136.8 & 44.7 & 68 & 207 \
Unhealthy Food Chances,/,sisquarekm & 37.7 & 12.3 & 18.8 & 57.1 \ addlinespace
All Food Chances & 249.0 & 71.2 & 130 & 374 \
All Food Chances,/,sisquarekm & 68.7 & 19.6 & 35.9 & 103.1 \
midrule
emphEast Harlemsmallskip \
Healthy Food Chances & 21.9 & 2.79 & 17 & 26 \
Healthy Food Chances,/,sisquarekm & 3.52 & 0.45 & 2.73 & 4.18 \ addlinespace
Unhealthy Food Chances & 147.1 & 53.5 & 57 & 236 \
Unhealthy Food Chances,/,sisquarekm & 23.7 & 8.60 & 9.17 & 38.0 \ addlinespace
All Food Chances & 249.5 & 79.5 & 114 & 392 \
All Food Chances,/,sisquarekm & 40.1 & 12.8 & 18.3 & 63.1 \
midrule
emphWashington Heights/Inwoodsmallskip \
Healthy Food Chances & 40.3 & 5.06 & 32 & 48 \
Healthy Food Chances,/,sisquarekm & 5.56 & 0.70 & 4.41 & 6.62 \ addlinespace
Unhealthy Food Chances & 269.3 & 78.5 & 140 & 388 \
Unhealthy Food Chances,/,sisquarekm & 37.1 & 10.8 & 19.3 & 53.5 \ addlinespace
All Food Chances & 453.3 & 114.9 & 268 & 646 \
All Food Chances,/,sisquarekm & 62.5 & 15.8 & 37.0 & 89.1 \
midrule
emphAstoriasmallskip \
Healthy Food Chances & 48.8 & 7.19 & 34 & 58 \
Healthy Food Chances,/,sisquarekm & 3.04 & 0.45 & 2.12 & 3.61 \ addlinespace
Unhealthy Food Chances & 338 & 72.8 & 202 & 448 \
Unhealthy Food Chances,/,sisquarekm & 21.0 & 4.53 & 12.6 & 27.9 \ addlinespace
All Food Chances & 620.0 & 140.9 & 352 & 858 \
All Food Chances,/,sisquarekm & 38.6 & 8.78 & 21.9 & 53.4 \
midrule
emphTotalsmallskip\
Healthy Food Chances & 32.0 & 14.0 & 8 & 68 \
Healthy Food Chances,/,sisquarekm & 5.11 & 2.81 & 1.20 & 14.8 \ addlinespace
Unhealthy Food Chances & 200.7 & 90.3 & 43 & 448 \
Unhealthy Food Chances,/,sisquarekm & 30.7 & 14.7 & 6.93 & 92.2 \ addlinespace
All Food Chances & 361.8 & 187.5 & 80 & 1103 \
All Food Chances,/,sisquarekm & 57.0 & 37.6 & 14.0 & 250.5
endtabularx
%
enddocument
The first row had a wrong number for one of the multicolumn
. Anyway, you declared 7 coluns and were using 5, so I reduces their number. I set the 1st column as X
type, and used the S
column type for the 4 last columns, to align the numbers by the decimal dot. Also, I added some vertical padding between groups of rows. Last, as the table cannot fit on one page, I loaded ltables
which brings the advantages of longtable
to tabularx
. Note that we don't need the center
environment: by default, longtables are centred.
documentclassreport
usepackagesiunitx
usepackagebooktabs, caption
usepackageltablex
begindocument
footnotesize
captionsetupfont=bf
sisetuptable-format=3.2, table-number-alignment=center, per-mode=symbol
newcolumntypeY>raggedleftarraybackslashX
setlengthdefaultaddspace0.6ex
begintabularx 12cm @X SSSS@
captionTable 3. Summary Statistics of Food Chances in New York City Gentrifying Neighborhoods \
toprule
multicolumn1c(1) & multicolumn4c \
& Mean & Std. Dev & Min & Max \
midrule
endfirsthead
%
midrule
multicolumn1c(1) & multicolumn4c \
& Mean & Std. Dev & Min & Max \
midrule
endhead
midrule
multicolumn5r@em to be continued
endfoot
%\
bottomrule addlinespace[1ex]
scriptsize emphSource: NETS_ACS_032019.dta.
endlastfoot
emphMott Haven/Hunts Pointsmallskip \
Healthy Food Chances & 43.5 & 9.67 & 25 & 61 \
Healthy Food Chances,/,sisquarekm & 3.82 & 0.85 & 2.19 & 5.35 \ addlinespace
Unhealthy Food Chances & 216 & 84.0 & 79 & 354 \
Unhealthy Food Chance,/,sisquarekm & 19.0 & 7.37 & 6.93 & 31.1 \ addlinespace
All Food Chances & 365.5 & 121.2 & 159 & 575 \
All Food Chances,/,sisquarekm & 32.1 & 10.6 & 14.0 & 50.5 \
midrule
emphMorrisania/East Tremontsmallskip \
Healthy Food Chances & 24.8 & 6.46 & 13 & 34 \
Healthy Food Chances,/,sisquarekm & 3.09 & 0.80 & 1.62 & 4.23 \ addlinespace
Unhealthy Food Chances & 210.8 & 76.4 & 98 & 345 \
Unhealthy Food Chances,/,sisquarekm & 26.3 & 9.52 & 12.2 & 43.0 \ addlinespace
All Food Chances & 325.7 & 107.6 & 163 & 517 \
All Food Chances,/,sisquarekm & 40.6 & 13.4 & 20.3 & 64.4 \
midrule
emphWilliamsburg/Greenpointsmallskip \
Healthy Food Chances & 53.2 & 9.10 & 35 & 68 \
Healthy Food Chances,/,sisquarekm & 4.37 & 0.75 & 2.88 & 5.59 \ addlinespace
Unhealthy Food Chances & 279.5 & 59.5 & 166 & 359 \
Unhealthy Food Chances,/,sisquarekm & 23.0 & 4.88 & 13.6 & 29.5 \ addlinespace
All Food Chances & 508.9 & 124.4 & 290 & 711 \
All Food Chances,/,sisquarekm & 41.8 & 10.2 & 23.8 & 58.4 \
midrule
emphBedford Stuyvesant smallskip\
Healthy Food Chances & 14.3 & 3.23 & 9 & 22 \
Healthy Food Chance,/,sisquarekm & 1.90 & 0.43 & 1.20 & 2.93 \ addlinespace
Unhealthy Food Chances & 175.8 & 50.8 & 67 & 252 \
Unhealthy Food Chances,/,sisquarekm & 23.4 & 6.77 & 8.92 & 33.6 \ addlinespace
All Food Chances & 260.6 & 70.4 & 110 & 366 \
All Food Chances,/,sisquarekm & 34.7 & 9.37 & 14.6 & 48.7 \
midrule
emphBushwicksmallskip \
Healthy Food Chances & 21.8 & 2.50 & 18 & 27 \
Healthy Food Chances,/,sisquarekm & 4.21 & 0.48 & 3.47 & 5.21 \ addlinespace
Unhealthy Food Chances & 168.4 & 53.7 & 82 & 259 \
Unhealthy Food Chances,/,sisquarekm & 32.5 & 10.4 & 15.8 & 50.0 \ addlinespace
All Food Chances & 258 & 81.5 & 121 & 398 \
All Food Chances,/,sisquarekm & 49.8 & 15.7 & 23.4 & 76.8 \
midrule
emphSunset Park smallskip \
Healthy Food Chances & 25.7 & 5.39 & 17 & 35 \
Healthy Food Chances,/,sisquarekm & 2.68 & 0.56 & 1.77 & 3.65 \ addlinespace
Unhealthy Food Chances & 246.0 & 73.4 & 125 & 369 \
Unhealthy Food Chances,/,sisquarekm & 25.7 & 7.66 & 13.0 & 38.5 \ addlinespace
All Food Chances & 404.9 & 117.9 & 197 & 626 \
All Food Chances,/,sisquarekm & 42.3 & 12.3 & 20.6 & 65.3 \
%% midrule
pagebreak[4]emphNorth Crown Heights/Prospect Heightssmallskip \
Healthy Food Chances & 38.5 & 6.08 & 24 & 51 \
Healthy Food Chances,/,sisquarekm & 9.30 & 1.47 & 5.79 & 12.3 \ addlinespace
Unhealthy Food Chances & 159.2 & 40.1 & 82 & 222 \
Unhealthy Food Chances,/,sisquarekm & 38.4 & 9.68 & 19.8 & 53.6 \ addlinespace
All Food Chances & 298.2 & 68.8 & 159 & 412 \
All Food Chances,/,sisquarekm & 72.0 & 16.6 & 38.4 & 99.4 \
midrule
emphSouth Crown Heightssmallskip \
Healthy Food Chances & 29.9 & 4.41 & 21 & 35 \
Healthy Food Chances,/,sisquarekm & 7.20 & 1.06 & 5.07 & 8.45 \ addlinespace
Unhealthy Food Chances & 125.4 & 24.1 & 76 & 167 \
Unhealthy Food Chances,/,sisquarekm & 30.3 & 5.81 & 18.3 & 40.3 \ addlinespace
All Food Chances & 229.9 & 45.6 & 130 & 309 \
All Food Chances,/,sisquarekm & 55.5 & 11.0 & 31.4 & 74.6 \
midrule
emphBrownsville/Ocean Hillsmallskip \
Healthy Food Chances & 18.5 & 4.01 & 8 & 23 \
Healthy Food Chances,/,sisquarekm & 3.75 & 0.81 & 1.63 & 4.67 \ addlinespace
Unhealthy Food Chances & 116.3 & 38.8 & 43 & 183 \
Unhealthy Food Chances,/,sisquarekm & 23.6 & 7.88 & 8.74 & 37.2 \ addlinespace
All Food Chances & 185.8 & 53.2 & 80 & 277 \
All Food Chances,/,sisquarekm & 37.8 & 10.8 & 16.3 & 56.3 \
midrule
emphLower East Side/Chinatownsmallskip \
Healthy Food Chances & 54.4 & 6.15 & 41 & 65 \
Healthy Food Chances,/,sisquarekm & 12.4 & 1.40 & 9.31 & 14.8 \ addlinespace
Unhealthy Food Chances & 297.3 & 73.4 & 172 & 406 \
Unhealthy Food Chances,/,sisquarekm & 67.5 & 16.7 & 39.1 & 92.2 \ addlinespace
All Food Chances & 767.0 & 179.9 & 478 & 1103 \
All Food Chances,/,sisquarekm & 174.2 & 40.9 & 108.6 & 250.5 \
midrule
emphMorningside Heights/Hamilton Heightssmallskip \
Healthy Food Chances & 22.1 & 2.94 & 16 & 27 \
Healthy Food Chances,/,sisquarekm & 5.70 & 0.76 & 4.12 & 6.95 \ addlinespace
Unhealthy Food Chances & 124.4 & 38.4 & 60 & 188 \
Unhealthy Food Chances,/,sisquarekm & 32.0 & 9.88 & 15.4 & 48.4 \ addlinespace
All Food Chances & 250.3 & 66.7 & 136 & 363 \
All Food Chances,/,sisquarekm & 64.4 & 17.2 & 35.0 & 93.4 \
midrule
emphCentral Harlemsmallskip \
Healthy Food Chances & 22.2 & 3.11 & 16 & 27 \
Healthy Food Chances,/,sisquarekm & 6.13 & 0.86 & 4.41 & 7.45 \ addlinespace
Unhealthy Food Chances & 136.8 & 44.7 & 68 & 207 \
Unhealthy Food Chances,/,sisquarekm & 37.7 & 12.3 & 18.8 & 57.1 \ addlinespace
All Food Chances & 249.0 & 71.2 & 130 & 374 \
All Food Chances,/,sisquarekm & 68.7 & 19.6 & 35.9 & 103.1 \
midrule
emphEast Harlemsmallskip \
Healthy Food Chances & 21.9 & 2.79 & 17 & 26 \
Healthy Food Chances,/,sisquarekm & 3.52 & 0.45 & 2.73 & 4.18 \ addlinespace
Unhealthy Food Chances & 147.1 & 53.5 & 57 & 236 \
Unhealthy Food Chances,/,sisquarekm & 23.7 & 8.60 & 9.17 & 38.0 \ addlinespace
All Food Chances & 249.5 & 79.5 & 114 & 392 \
All Food Chances,/,sisquarekm & 40.1 & 12.8 & 18.3 & 63.1 \
midrule
emphWashington Heights/Inwoodsmallskip \
Healthy Food Chances & 40.3 & 5.06 & 32 & 48 \
Healthy Food Chances,/,sisquarekm & 5.56 & 0.70 & 4.41 & 6.62 \ addlinespace
Unhealthy Food Chances & 269.3 & 78.5 & 140 & 388 \
Unhealthy Food Chances,/,sisquarekm & 37.1 & 10.8 & 19.3 & 53.5 \ addlinespace
All Food Chances & 453.3 & 114.9 & 268 & 646 \
All Food Chances,/,sisquarekm & 62.5 & 15.8 & 37.0 & 89.1 \
midrule
emphAstoriasmallskip \
Healthy Food Chances & 48.8 & 7.19 & 34 & 58 \
Healthy Food Chances,/,sisquarekm & 3.04 & 0.45 & 2.12 & 3.61 \ addlinespace
Unhealthy Food Chances & 338 & 72.8 & 202 & 448 \
Unhealthy Food Chances,/,sisquarekm & 21.0 & 4.53 & 12.6 & 27.9 \ addlinespace
All Food Chances & 620.0 & 140.9 & 352 & 858 \
All Food Chances,/,sisquarekm & 38.6 & 8.78 & 21.9 & 53.4 \
midrule
emphTotalsmallskip\
Healthy Food Chances & 32.0 & 14.0 & 8 & 68 \
Healthy Food Chances,/,sisquarekm & 5.11 & 2.81 & 1.20 & 14.8 \ addlinespace
Unhealthy Food Chances & 200.7 & 90.3 & 43 & 448 \
Unhealthy Food Chances,/,sisquarekm & 30.7 & 14.7 & 6.93 & 92.2 \ addlinespace
All Food Chances & 361.8 & 187.5 & 80 & 1103 \
All Food Chances,/,sisquarekm & 57.0 & 37.6 & 14.0 & 250.5
endtabularx
%
enddocument
answered Apr 27 at 21:04
BernardBernard
178k779211
178k779211
Thank you very much, Bernard! I like this table a lot. Can you please explain, what is the (1) at the top of the table associated with? And is it possible to remove it or replace with different text?
– BRB
Apr 27 at 21:21
Also, when I try the code on my computer the column headers are centered in the middle of the table instead of over the data. How can I fix this? Thank you
– BRB
Apr 27 at 21:30
The $(1)$ was in your code. As I didn't know what it corresponded to, I didn't touch it. Inmulticolumn1c(1)
you can replace it with whatever you want.
– Bernard
Apr 27 at 21:32
Do you mean you don't obtain the same alignment for the column headers?
– Bernard
Apr 27 at 21:34
That is correct. The alignment was centered on the entire table. In your helpful example, it was aligned over the 4 columns of the corresponding data.
– BRB
Apr 28 at 5:15
|
show 1 more comment
Thank you very much, Bernard! I like this table a lot. Can you please explain, what is the (1) at the top of the table associated with? And is it possible to remove it or replace with different text?
– BRB
Apr 27 at 21:21
Also, when I try the code on my computer the column headers are centered in the middle of the table instead of over the data. How can I fix this? Thank you
– BRB
Apr 27 at 21:30
The $(1)$ was in your code. As I didn't know what it corresponded to, I didn't touch it. Inmulticolumn1c(1)
you can replace it with whatever you want.
– Bernard
Apr 27 at 21:32
Do you mean you don't obtain the same alignment for the column headers?
– Bernard
Apr 27 at 21:34
That is correct. The alignment was centered on the entire table. In your helpful example, it was aligned over the 4 columns of the corresponding data.
– BRB
Apr 28 at 5:15
Thank you very much, Bernard! I like this table a lot. Can you please explain, what is the (1) at the top of the table associated with? And is it possible to remove it or replace with different text?
– BRB
Apr 27 at 21:21
Thank you very much, Bernard! I like this table a lot. Can you please explain, what is the (1) at the top of the table associated with? And is it possible to remove it or replace with different text?
– BRB
Apr 27 at 21:21
Also, when I try the code on my computer the column headers are centered in the middle of the table instead of over the data. How can I fix this? Thank you
– BRB
Apr 27 at 21:30
Also, when I try the code on my computer the column headers are centered in the middle of the table instead of over the data. How can I fix this? Thank you
– BRB
Apr 27 at 21:30
The $(1)$ was in your code. As I didn't know what it corresponded to, I didn't touch it. In
multicolumn1c(1)
you can replace it with whatever you want.– Bernard
Apr 27 at 21:32
The $(1)$ was in your code. As I didn't know what it corresponded to, I didn't touch it. In
multicolumn1c(1)
you can replace it with whatever you want.– Bernard
Apr 27 at 21:32
Do you mean you don't obtain the same alignment for the column headers?
– Bernard
Apr 27 at 21:34
Do you mean you don't obtain the same alignment for the column headers?
– Bernard
Apr 27 at 21:34
That is correct. The alignment was centered on the entire table. In your helpful example, it was aligned over the 4 columns of the corresponding data.
– BRB
Apr 28 at 5:15
That is correct. The alignment was centered on the entire table. In your helpful example, it was aligned over the 4 columns of the corresponding data.
– BRB
Apr 28 at 5:15
|
show 1 more comment
You have some issues in your given code, for example:
- Use
longtable
insteadtabularx
here.longtable
can span pages,tabularx
not. - In your table you are only using 5 columns, so I reduced it to
@ ldddd @
longtable
needs nocenter
, I deleted it.- to format the numbers in the table I used
dcolumn
withnewcolumntypedD..2
- I added the missing
&
to mark the empty columns in your part header lines likeemphMott Haven/Hunts Point & & & & \
. - I deleted the wrong
&multicolumn4c(1) & multicolumn4c \
because you have only 5 columns and not 9 as you tried to use in this line ...
With the following code
documentclassreport
usepackagebooktabs
usepackagetabularx
usepackagelongtable
usepackagedcolumn
newcolumntypedD..2 % two decimal numbers
begindocument
textbfTable 3. Summary Statistics of Food Chances in New York City Gentrifying Neighborhoods par vspace2ex
footnotesize
beginlongtable@ ldddd @
toprule
& Mean & Std. Dev. & Min & Max \
midrule
endfirsthead
toprule
multicolumn5ctable continued \
midrule
& Mean & Std. Dev. & Min & Max \
midrule
endhead
emphMott 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
emphMorrisania/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
emphWilliamsburg/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
emphBedford 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
emphBushwick & & & & \
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
emphSunset 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
emphNorth 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
emphSouth 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
emphBrownsville/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
emphLower 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
emphMorningside 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
emphCentral 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
emphEast 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
emphWashington 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
emphAstoria & & & & \
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
emphTotal & & & & \
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
endlongtable
parsmallskipnoindentparbox12cmraggedright scriptsize emphSource: NETS_ACS_032019.dta.
normalsize
enddocument
you get the result:
Thank you very much, Kurt.
– BRB
Apr 28 at 5:17
Again, thank you everyone for your helpful insights.
– BRB
Apr 28 at 5:17
add a comment |
You have some issues in your given code, for example:
- Use
longtable
insteadtabularx
here.longtable
can span pages,tabularx
not. - In your table you are only using 5 columns, so I reduced it to
@ ldddd @
longtable
needs nocenter
, I deleted it.- to format the numbers in the table I used
dcolumn
withnewcolumntypedD..2
- I added the missing
&
to mark the empty columns in your part header lines likeemphMott Haven/Hunts Point & & & & \
. - I deleted the wrong
&multicolumn4c(1) & multicolumn4c \
because you have only 5 columns and not 9 as you tried to use in this line ...
With the following code
documentclassreport
usepackagebooktabs
usepackagetabularx
usepackagelongtable
usepackagedcolumn
newcolumntypedD..2 % two decimal numbers
begindocument
textbfTable 3. Summary Statistics of Food Chances in New York City Gentrifying Neighborhoods par vspace2ex
footnotesize
beginlongtable@ ldddd @
toprule
& Mean & Std. Dev. & Min & Max \
midrule
endfirsthead
toprule
multicolumn5ctable continued \
midrule
& Mean & Std. Dev. & Min & Max \
midrule
endhead
emphMott 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
emphMorrisania/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
emphWilliamsburg/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
emphBedford 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
emphBushwick & & & & \
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
emphSunset 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
emphNorth 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
emphSouth 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
emphBrownsville/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
emphLower 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
emphMorningside 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
emphCentral 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
emphEast 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
emphWashington 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
emphAstoria & & & & \
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
emphTotal & & & & \
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
endlongtable
parsmallskipnoindentparbox12cmraggedright scriptsize emphSource: NETS_ACS_032019.dta.
normalsize
enddocument
you get the result:
Thank you very much, Kurt.
– BRB
Apr 28 at 5:17
Again, thank you everyone for your helpful insights.
– BRB
Apr 28 at 5:17
add a comment |
You have some issues in your given code, for example:
- Use
longtable
insteadtabularx
here.longtable
can span pages,tabularx
not. - In your table you are only using 5 columns, so I reduced it to
@ ldddd @
longtable
needs nocenter
, I deleted it.- to format the numbers in the table I used
dcolumn
withnewcolumntypedD..2
- I added the missing
&
to mark the empty columns in your part header lines likeemphMott Haven/Hunts Point & & & & \
. - I deleted the wrong
&multicolumn4c(1) & multicolumn4c \
because you have only 5 columns and not 9 as you tried to use in this line ...
With the following code
documentclassreport
usepackagebooktabs
usepackagetabularx
usepackagelongtable
usepackagedcolumn
newcolumntypedD..2 % two decimal numbers
begindocument
textbfTable 3. Summary Statistics of Food Chances in New York City Gentrifying Neighborhoods par vspace2ex
footnotesize
beginlongtable@ ldddd @
toprule
& Mean & Std. Dev. & Min & Max \
midrule
endfirsthead
toprule
multicolumn5ctable continued \
midrule
& Mean & Std. Dev. & Min & Max \
midrule
endhead
emphMott 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
emphMorrisania/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
emphWilliamsburg/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
emphBedford 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
emphBushwick & & & & \
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
emphSunset 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
emphNorth 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
emphSouth 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
emphBrownsville/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
emphLower 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
emphMorningside 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
emphCentral 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
emphEast 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
emphWashington 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
emphAstoria & & & & \
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
emphTotal & & & & \
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
endlongtable
parsmallskipnoindentparbox12cmraggedright scriptsize emphSource: NETS_ACS_032019.dta.
normalsize
enddocument
you get the result:
You have some issues in your given code, for example:
- Use
longtable
insteadtabularx
here.longtable
can span pages,tabularx
not. - In your table you are only using 5 columns, so I reduced it to
@ ldddd @
longtable
needs nocenter
, I deleted it.- to format the numbers in the table I used
dcolumn
withnewcolumntypedD..2
- I added the missing
&
to mark the empty columns in your part header lines likeemphMott Haven/Hunts Point & & & & \
. - I deleted the wrong
&multicolumn4c(1) & multicolumn4c \
because you have only 5 columns and not 9 as you tried to use in this line ...
With the following code
documentclassreport
usepackagebooktabs
usepackagetabularx
usepackagelongtable
usepackagedcolumn
newcolumntypedD..2 % two decimal numbers
begindocument
textbfTable 3. Summary Statistics of Food Chances in New York City Gentrifying Neighborhoods par vspace2ex
footnotesize
beginlongtable@ ldddd @
toprule
& Mean & Std. Dev. & Min & Max \
midrule
endfirsthead
toprule
multicolumn5ctable continued \
midrule
& Mean & Std. Dev. & Min & Max \
midrule
endhead
emphMott 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
emphMorrisania/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
emphWilliamsburg/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
emphBedford 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
emphBushwick & & & & \
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
emphSunset 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
emphNorth 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
emphSouth 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
emphBrownsville/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
emphLower 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
emphMorningside 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
emphCentral 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
emphEast 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
emphWashington 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
emphAstoria & & & & \
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
emphTotal & & & & \
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
endlongtable
parsmallskipnoindentparbox12cmraggedright scriptsize emphSource: NETS_ACS_032019.dta.
normalsize
enddocument
you get the result:
edited Apr 27 at 22:02
answered Apr 27 at 21:36
KurtKurt
42.9k950167
42.9k950167
Thank you very much, Kurt.
– BRB
Apr 28 at 5:17
Again, thank you everyone for your helpful insights.
– BRB
Apr 28 at 5:17
add a comment |
Thank you very much, Kurt.
– BRB
Apr 28 at 5:17
Again, thank you everyone for your helpful insights.
– BRB
Apr 28 at 5:17
Thank you very much, Kurt.
– BRB
Apr 28 at 5:17
Thank you very much, Kurt.
– BRB
Apr 28 at 5:17
Again, thank you everyone for your helpful insights.
– BRB
Apr 28 at 5:17
Again, thank you everyone for your helpful insights.
– BRB
Apr 28 at 5:17
add a comment |
Here is my suggestion. I have replaced tabularx
by longtable
as you a) don't need automatic line breaks of paragraphs and b) have a table that is a lot longer than a single page. Additionally, I have used the caption
comand for the caption (and used the caption
package in order to control the font of the caption). Lastly, I have also added the missing two columns. If you don't need more columns, you can replace beginlongtable@ l rrrrrrrr@
by beginlongtable@ l rrrr@
and &multicolumn4c(1) & multicolumn4c \
by &multicolumn4c(1)\
. I have also replaced km2
by squarekilometre
from the siunitx
package.
documentclassreport
usepackagebooktabs
usepackagetabularx
usepackagelongtable
usepackage[font=bf]caption
usepackage[load=abbr]siunitx
begindocument
footnotesize
beginlongtable@ l rrrrrrrr@
captionSummary Statistics of Food Chances in New York City Gentrifying Neighborhoods\
toprule
&multicolumn4c(1) & multicolumn4c \
& Mean & Std. Dev. & Min & Max \
midrule
endfirsthead
toprule
&multicolumn4c(1) & multicolumn4c \
& Mean & Std. Dev. & Min & Max \
midrule
endhead
multicolumn9lscriptsize emphSource: NETS_ACS_032019.dta.
endlastfoot
emphMott 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
emphMorrisania/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
emphWilliamsburg/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
emphBedford 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
emphBushwick \*
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
emphSunset 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
emphNorth 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
emphSouth 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
emphBrownsville/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
emphLower 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
emphMorningside 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
emphCentral 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
emphEast 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
emphWashington 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
emphAstoria \*
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
emphTotal \*
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
endlongtable
enddocument
Here is a suggestion on how one could redesign the table. I have removed the repeated information in the first column and combined two rows to one. Additionally, I have used S
type columns from the siunitx
package in order to align the numbers relative to their decimal separator.
documentclassreport
usepackagebooktabs
usepackagelongtable
usepackage[font=bf]caption
usepackage[load=abbr]siunitx
usepackagegeometry
begindocument
footnotesize
beginlongtable p3cm 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]@
captionSummary Statistics of Food Chances in New York City Gentrifying Neighborhoods\
toprule
&multicolumn8c(1) \
Food Chances & multicolumn2cMean & multicolumn2cStd. Dev. & multicolumn2cMin & multicolumn2cMax \
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
&multicolumn8c(1) \
Food Chances & multicolumn2cMean & multicolumn2cStd. Dev. & multicolumn2cMin & multicolumn2cMax \
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
multicolumn9lscriptsize emphSource: NETS_ACS_032019.dta.
endlastfoot
multicolumn9@lemphMott 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
endlongtable
enddocument
As requested in the comments, I have changed the column header of the first column using multirow
:
toprule
multirow2.5=raggedright Food Chances by Neighborhood & multicolumn2cMean & multicolumn2cStd. Dev. & multicolumn2cMin & multicolumn2cMax \
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
So grateful for everyone's insights!
– BRB
Apr 27 at 21:05
Another thought is to change how I'm displaying this information. Following Tufte's suggestion to provide a lot of information I choose this format but maybe you all have another suggestion. I could create 3 separate tables that each show only one type of food chance category. Would that be better?
– BRB
Apr 27 at 21:08
@BRB: How you should present your data heavily depends on how you want to discuss them. I have however edited my answer to also include a suggestion how you could reduce the amount of text in the first column.
– leandriis
Apr 28 at 8:34
Thank you for helping rethink the structure. I have been trying to add the header "Food Chances by Neighborhood" above the column of Mott Haven...but keep failing. What am I doing wrong? multicolumn8@lFood Chances by Neighborhood \ & multicolumn2cMean & multicolumn2cStd. Dev. & multicolumn2cMin & multicolumn2cMax \ 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\
– BRB
Apr 29 at 19:05
@BRB: I have edited my answer to also include the longer column header.
– leandriis
Apr 29 at 19:28
add a comment |
Here is my suggestion. I have replaced tabularx
by longtable
as you a) don't need automatic line breaks of paragraphs and b) have a table that is a lot longer than a single page. Additionally, I have used the caption
comand for the caption (and used the caption
package in order to control the font of the caption). Lastly, I have also added the missing two columns. If you don't need more columns, you can replace beginlongtable@ l rrrrrrrr@
by beginlongtable@ l rrrr@
and &multicolumn4c(1) & multicolumn4c \
by &multicolumn4c(1)\
. I have also replaced km2
by squarekilometre
from the siunitx
package.
documentclassreport
usepackagebooktabs
usepackagetabularx
usepackagelongtable
usepackage[font=bf]caption
usepackage[load=abbr]siunitx
begindocument
footnotesize
beginlongtable@ l rrrrrrrr@
captionSummary Statistics of Food Chances in New York City Gentrifying Neighborhoods\
toprule
&multicolumn4c(1) & multicolumn4c \
& Mean & Std. Dev. & Min & Max \
midrule
endfirsthead
toprule
&multicolumn4c(1) & multicolumn4c \
& Mean & Std. Dev. & Min & Max \
midrule
endhead
multicolumn9lscriptsize emphSource: NETS_ACS_032019.dta.
endlastfoot
emphMott 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
emphMorrisania/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
emphWilliamsburg/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
emphBedford 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
emphBushwick \*
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
emphSunset 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
emphNorth 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
emphSouth 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
emphBrownsville/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
emphLower 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
emphMorningside 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
emphCentral 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
emphEast 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
emphWashington 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
emphAstoria \*
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
emphTotal \*
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
endlongtable
enddocument
Here is a suggestion on how one could redesign the table. I have removed the repeated information in the first column and combined two rows to one. Additionally, I have used S
type columns from the siunitx
package in order to align the numbers relative to their decimal separator.
documentclassreport
usepackagebooktabs
usepackagelongtable
usepackage[font=bf]caption
usepackage[load=abbr]siunitx
usepackagegeometry
begindocument
footnotesize
beginlongtable p3cm 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]@
captionSummary Statistics of Food Chances in New York City Gentrifying Neighborhoods\
toprule
&multicolumn8c(1) \
Food Chances & multicolumn2cMean & multicolumn2cStd. Dev. & multicolumn2cMin & multicolumn2cMax \
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
&multicolumn8c(1) \
Food Chances & multicolumn2cMean & multicolumn2cStd. Dev. & multicolumn2cMin & multicolumn2cMax \
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
multicolumn9lscriptsize emphSource: NETS_ACS_032019.dta.
endlastfoot
multicolumn9@lemphMott 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
endlongtable
enddocument
As requested in the comments, I have changed the column header of the first column using multirow
:
toprule
multirow2.5=raggedright Food Chances by Neighborhood & multicolumn2cMean & multicolumn2cStd. Dev. & multicolumn2cMin & multicolumn2cMax \
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
So grateful for everyone's insights!
– BRB
Apr 27 at 21:05
Another thought is to change how I'm displaying this information. Following Tufte's suggestion to provide a lot of information I choose this format but maybe you all have another suggestion. I could create 3 separate tables that each show only one type of food chance category. Would that be better?
– BRB
Apr 27 at 21:08
@BRB: How you should present your data heavily depends on how you want to discuss them. I have however edited my answer to also include a suggestion how you could reduce the amount of text in the first column.
– leandriis
Apr 28 at 8:34
Thank you for helping rethink the structure. I have been trying to add the header "Food Chances by Neighborhood" above the column of Mott Haven...but keep failing. What am I doing wrong? multicolumn8@lFood Chances by Neighborhood \ & multicolumn2cMean & multicolumn2cStd. Dev. & multicolumn2cMin & multicolumn2cMax \ 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\
– BRB
Apr 29 at 19:05
@BRB: I have edited my answer to also include the longer column header.
– leandriis
Apr 29 at 19:28
add a comment |
Here is my suggestion. I have replaced tabularx
by longtable
as you a) don't need automatic line breaks of paragraphs and b) have a table that is a lot longer than a single page. Additionally, I have used the caption
comand for the caption (and used the caption
package in order to control the font of the caption). Lastly, I have also added the missing two columns. If you don't need more columns, you can replace beginlongtable@ l rrrrrrrr@
by beginlongtable@ l rrrr@
and &multicolumn4c(1) & multicolumn4c \
by &multicolumn4c(1)\
. I have also replaced km2
by squarekilometre
from the siunitx
package.
documentclassreport
usepackagebooktabs
usepackagetabularx
usepackagelongtable
usepackage[font=bf]caption
usepackage[load=abbr]siunitx
begindocument
footnotesize
beginlongtable@ l rrrrrrrr@
captionSummary Statistics of Food Chances in New York City Gentrifying Neighborhoods\
toprule
&multicolumn4c(1) & multicolumn4c \
& Mean & Std. Dev. & Min & Max \
midrule
endfirsthead
toprule
&multicolumn4c(1) & multicolumn4c \
& Mean & Std. Dev. & Min & Max \
midrule
endhead
multicolumn9lscriptsize emphSource: NETS_ACS_032019.dta.
endlastfoot
emphMott 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
emphMorrisania/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
emphWilliamsburg/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
emphBedford 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
emphBushwick \*
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
emphSunset 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
emphNorth 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
emphSouth 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
emphBrownsville/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
emphLower 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
emphMorningside 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
emphCentral 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
emphEast 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
emphWashington 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
emphAstoria \*
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
emphTotal \*
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
endlongtable
enddocument
Here is a suggestion on how one could redesign the table. I have removed the repeated information in the first column and combined two rows to one. Additionally, I have used S
type columns from the siunitx
package in order to align the numbers relative to their decimal separator.
documentclassreport
usepackagebooktabs
usepackagelongtable
usepackage[font=bf]caption
usepackage[load=abbr]siunitx
usepackagegeometry
begindocument
footnotesize
beginlongtable p3cm 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]@
captionSummary Statistics of Food Chances in New York City Gentrifying Neighborhoods\
toprule
&multicolumn8c(1) \
Food Chances & multicolumn2cMean & multicolumn2cStd. Dev. & multicolumn2cMin & multicolumn2cMax \
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
&multicolumn8c(1) \
Food Chances & multicolumn2cMean & multicolumn2cStd. Dev. & multicolumn2cMin & multicolumn2cMax \
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
multicolumn9lscriptsize emphSource: NETS_ACS_032019.dta.
endlastfoot
multicolumn9@lemphMott 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
endlongtable
enddocument
As requested in the comments, I have changed the column header of the first column using multirow
:
toprule
multirow2.5=raggedright Food Chances by Neighborhood & multicolumn2cMean & multicolumn2cStd. Dev. & multicolumn2cMin & multicolumn2cMax \
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
Here is my suggestion. I have replaced tabularx
by longtable
as you a) don't need automatic line breaks of paragraphs and b) have a table that is a lot longer than a single page. Additionally, I have used the caption
comand for the caption (and used the caption
package in order to control the font of the caption). Lastly, I have also added the missing two columns. If you don't need more columns, you can replace beginlongtable@ l rrrrrrrr@
by beginlongtable@ l rrrr@
and &multicolumn4c(1) & multicolumn4c \
by &multicolumn4c(1)\
. I have also replaced km2
by squarekilometre
from the siunitx
package.
documentclassreport
usepackagebooktabs
usepackagetabularx
usepackagelongtable
usepackage[font=bf]caption
usepackage[load=abbr]siunitx
begindocument
footnotesize
beginlongtable@ l rrrrrrrr@
captionSummary Statistics of Food Chances in New York City Gentrifying Neighborhoods\
toprule
&multicolumn4c(1) & multicolumn4c \
& Mean & Std. Dev. & Min & Max \
midrule
endfirsthead
toprule
&multicolumn4c(1) & multicolumn4c \
& Mean & Std. Dev. & Min & Max \
midrule
endhead
multicolumn9lscriptsize emphSource: NETS_ACS_032019.dta.
endlastfoot
emphMott 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
emphMorrisania/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
emphWilliamsburg/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
emphBedford 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
emphBushwick \*
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
emphSunset 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
emphNorth 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
emphSouth 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
emphBrownsville/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
emphLower 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
emphMorningside 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
emphCentral 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
emphEast 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
emphWashington 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
emphAstoria \*
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
emphTotal \*
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
endlongtable
enddocument
Here is a suggestion on how one could redesign the table. I have removed the repeated information in the first column and combined two rows to one. Additionally, I have used S
type columns from the siunitx
package in order to align the numbers relative to their decimal separator.
documentclassreport
usepackagebooktabs
usepackagelongtable
usepackage[font=bf]caption
usepackage[load=abbr]siunitx
usepackagegeometry
begindocument
footnotesize
beginlongtable p3cm 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]@
captionSummary Statistics of Food Chances in New York City Gentrifying Neighborhoods\
toprule
&multicolumn8c(1) \
Food Chances & multicolumn2cMean & multicolumn2cStd. Dev. & multicolumn2cMin & multicolumn2cMax \
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
&multicolumn8c(1) \
Food Chances & multicolumn2cMean & multicolumn2cStd. Dev. & multicolumn2cMin & multicolumn2cMax \
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
multicolumn9lscriptsize emphSource: NETS_ACS_032019.dta.
endlastfoot
multicolumn9@lemphMott 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
endlongtable
enddocument
As requested in the comments, I have changed the column header of the first column using multirow
:
toprule
multirow2.5=raggedright Food Chances by Neighborhood & multicolumn2cMean & multicolumn2cStd. Dev. & multicolumn2cMin & multicolumn2cMax \
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
edited Apr 29 at 19:27
answered Apr 27 at 20:29
leandriisleandriis
12.5k1833
12.5k1833
So grateful for everyone's insights!
– BRB
Apr 27 at 21:05
Another thought is to change how I'm displaying this information. Following Tufte's suggestion to provide a lot of information I choose this format but maybe you all have another suggestion. I could create 3 separate tables that each show only one type of food chance category. Would that be better?
– BRB
Apr 27 at 21:08
@BRB: How you should present your data heavily depends on how you want to discuss them. I have however edited my answer to also include a suggestion how you could reduce the amount of text in the first column.
– leandriis
Apr 28 at 8:34
Thank you for helping rethink the structure. I have been trying to add the header "Food Chances by Neighborhood" above the column of Mott Haven...but keep failing. What am I doing wrong? multicolumn8@lFood Chances by Neighborhood \ & multicolumn2cMean & multicolumn2cStd. Dev. & multicolumn2cMin & multicolumn2cMax \ 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\
– BRB
Apr 29 at 19:05
@BRB: I have edited my answer to also include the longer column header.
– leandriis
Apr 29 at 19:28
add a comment |
So grateful for everyone's insights!
– BRB
Apr 27 at 21:05
Another thought is to change how I'm displaying this information. Following Tufte's suggestion to provide a lot of information I choose this format but maybe you all have another suggestion. I could create 3 separate tables that each show only one type of food chance category. Would that be better?
– BRB
Apr 27 at 21:08
@BRB: How you should present your data heavily depends on how you want to discuss them. I have however edited my answer to also include a suggestion how you could reduce the amount of text in the first column.
– leandriis
Apr 28 at 8:34
Thank you for helping rethink the structure. I have been trying to add the header "Food Chances by Neighborhood" above the column of Mott Haven...but keep failing. What am I doing wrong? multicolumn8@lFood Chances by Neighborhood \ & multicolumn2cMean & multicolumn2cStd. Dev. & multicolumn2cMin & multicolumn2cMax \ 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\
– BRB
Apr 29 at 19:05
@BRB: I have edited my answer to also include the longer column header.
– leandriis
Apr 29 at 19:28
So grateful for everyone's insights!
– BRB
Apr 27 at 21:05
So grateful for everyone's insights!
– BRB
Apr 27 at 21:05
Another thought is to change how I'm displaying this information. Following Tufte's suggestion to provide a lot of information I choose this format but maybe you all have another suggestion. I could create 3 separate tables that each show only one type of food chance category. Would that be better?
– BRB
Apr 27 at 21:08
Another thought is to change how I'm displaying this information. Following Tufte's suggestion to provide a lot of information I choose this format but maybe you all have another suggestion. I could create 3 separate tables that each show only one type of food chance category. Would that be better?
– BRB
Apr 27 at 21:08
@BRB: How you should present your data heavily depends on how you want to discuss them. I have however edited my answer to also include a suggestion how you could reduce the amount of text in the first column.
– leandriis
Apr 28 at 8:34
@BRB: How you should present your data heavily depends on how you want to discuss them. I have however edited my answer to also include a suggestion how you could reduce the amount of text in the first column.
– leandriis
Apr 28 at 8:34
Thank you for helping rethink the structure. I have been trying to add the header "Food Chances by Neighborhood" above the column of Mott Haven...but keep failing. What am I doing wrong? multicolumn8@lFood Chances by Neighborhood \ & multicolumn2cMean & multicolumn2cStd. Dev. & multicolumn2cMin & multicolumn2cMax \ 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\
– BRB
Apr 29 at 19:05
Thank you for helping rethink the structure. I have been trying to add the header "Food Chances by Neighborhood" above the column of Mott Haven...but keep failing. What am I doing wrong? multicolumn8@lFood Chances by Neighborhood \ & multicolumn2cMean & multicolumn2cStd. Dev. & multicolumn2cMin & multicolumn2cMax \ 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\
– BRB
Apr 29 at 19:05
@BRB: I have edited my answer to also include the longer column header.
– leandriis
Apr 29 at 19:28
@BRB: I have edited my answer to also include the longer column header.
– leandriis
Apr 29 at 19:28
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f487959%2ferror-message-with-tabularx%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
delete line
&multicolumn4c(1) & multicolumn4c \
(which require 9 columns, but you define only 7. also this line is empty, so it is not needed in table. welcome to tex.se! However, your table has some other issues. it is to huge for placement ion one page, etc. welcome to tex.se!– Zarko
Apr 27 at 19:48
2
I would never use tabularx for tables of figures (and I wrote it) it is designed to control line breaking of paragraphs of text within tables, and you have no such entries.
– David Carlisle
Apr 27 at 20:06
Thank you both for your comments. I'm so grateful. I have been looking online and trying to teach myself from examples but its not going so well...I'm using Stata's command tabout to create a tex file which i then typeset in TeXShop. David, if I do not use tabularx to create a table then can you please suggest what I should be doing and maybe an example I can follow?
– BRB
Apr 27 at 21:05