TeX - LaTeX Asked on January 20, 2021
Good evening to anyone. I’m trying desperately to fit this table into an horizontal page. As I’ve used excel2latex to import it, I’m using the array
environment, and I don’t really know what to do to make it fit… I tried to use tabularx
, but I LaTeX cannot compile… The table seems too large and too tall…
documentclass{article}
usepackage[utf8]{inputenc}
linespread{1.3}
usepackage[margin=1.2in]{geometry}
usepackage{eurosym}
usepackage{makeidx}
usepackage{amsfonts}
usepackage{amssymb}
usepackage{graphicx}
usepackage{amsmath}
usepackage{cases}
usepackage[titletoc]{appendix}
usepackage{color,soul}
usepackage{amsthm}
usepackage{thmtools}
usepackage{mathrsfs}
usepackage{enumerate}
usepackage{hyperref}
usepackage[hyphens]{url}
usepackage{pgfplots}
usetikzlibrary{patterns}
usepgfplotslibrary{groupplots}
usepackage{lscape}
usepackage{caption}
usepackage{subfigure}
usepackage{tabularx}
begin{document}
begin{landscape}
begin{array}{l l l l l l l l l l l l}
& & & & & & & & & & &
Economic Analysis & Unit of Measure & BAU & & & & textbf{PROJECT} & & & & & hline
& & 2024-2029** & & 2030-2041 & & 2024-2025 & & 2026-2029** & & 2030-2041 & hline
& & Peak & Off-Peak & Peak & Off-Peak & Peak & Off-Peak & Peak & Off-Peak & Peak & Off-Peak
Investment & € & 0 & & 0 & & 175 & & 0 & & 0 & hline
VOT & €/h & 10 & 10 & 10 & 10 & 10 & 10 & 10 & 10 & 10 & 10 hline
Extra Delay & h & 0.67 & 0.33 & 0.67 & 0.33 & 0.67 & 0.33 & 0.33 & 0.17 & 0.33 & 0.17 hline
Delay costs & € & 6.67 & 3.33 & 6.67 & 3.33 & 6.67 & 3.33 & 3.33 & 1.67 & 3.33 & 1.67 hline
A&D Tourist & mln / year & 8 & 2 & 5.5 & 1.17 & 8 & 2 & 8.33 & 2.06 & 5.83 & 1.22 hline
A&D Locals & mln / year & 2 & 3 & 1.875 & 2.75 & 2 & 3 & 2.07 & 3.07 & 1.89 & 2.77 hline
TOTAL & mln / year & 10 & 5 & 7.36 & 3.92 & 10 & 5 & 10.4 & 5.12 & 7.72 & 3.99 hline
Price Tourist & €/trip & 160 & 120 & 185 & 145 & 160 & 120 & 160 & 120 & 185 & 145 hline
Elasticity (Tourist) & & 2 & 2 & 2 & 2 & 2 & 2 & 2 & 2 & 2 & 2 hline
Res. Price (Tourist) & €/trip & 240 & 180 & 240 & 180 & 240 & 180 & 240 & 180 & 240 & 180 hline
Price Locals & €/trip & 40 & 30 & 65 & 55 & 40 & 30 & 40 & 30 & 65 & 55 hline
Elasticity (Locals) & & 0.4 & 0.4 & 0.4 & 0.4 & 0.4 & 0.4 & 0.4 & 0.4 & 0.4 & 0.4 hline
Res. Price (Locals) & €/trip & 560 & 420 & 560 & 420 & 560 & 420 & 560 & 420 & 560 & 420 hline
Subsidy (€/trip) & €/trip & 120 & 90 & 120 & 90 & 120 & 90 & 120 & 90 & 120 & 90 hline
Revenues (Tourist) & mln € & 1280 & 240 & 880 & 140 & 1280 & 240 & 1333.33 & 246.67 & 933.33 & 146.67 hline
Revenues (Locals) & mln € & 80 & 90 & 75 & 82.5 & 80 & 90 & 82.67 & 92 & 75.67 & 83 hline
TOTAL REVENUES & mln € & 1690 & & 1177.5 & & 1690 & & 1754.67 & & 1238.67 & hline
CS (Tourist) & mln € & 320 & 60 & 151.25 & 20.42 & 320 & 60 & 347.22 & 63.38 & 170.14 & 22.41 hline
CS (Locals) & mln € & 640 & 720 & 576.5625 & 625.625 & 640 & 720 & 664.78 & 738.56 & 584.84 & 631.72 hline
TOTAL CS & mln € & 1740 & & 1373.85 & & 1740 & & 1813.94 & & 1409.11 & hline
GROSS WELFARE & mln € & 3430 & & 2551.35 & & 3430 & & 3568.6 & & 2647.76 & hline
Permits 2030 & (€ / ton CO2 pas trip) & 50 & & & & 50 & & & & 50 & hline
Social Discount Rate & & 0.05 & & & & 0.05 & & & & 0.05 & hline
Actual Permit Prices & / ton CO2 pas trip) & 37.31 & & & & 37.31 & & & & 37.31 & hline
Emissions & text{ton $CO_2$ / pas trip} & 0.5 & & & & 0.5 & & & & 0.5 & hline
TOTAL EXTERNAL COSTS* & (€) (year) & 279.83 & & 0 & & 279.83 & & 289.57 & & 0 & hline
FLOW EXTERNAL COSTS* & (€) & 1678.98 & & 0 & & 559.66 & & 1158.29 & & 0 & hline
NPV & (€) & 31544.88 & & & & 32223.96 & & & & & hline
& & & & & & & & & & & hline
NET BENEFIT & & & 679.072 & & & & & & & & hline
& & & & & & & & & & & hline
IRR & & & 0.29 & #NUM! & & & & & & & hline
end{array}
end{landscape}
end{document}
Overfull hbox (307.39384pt too wide) in paragraph at lines 154--193
Overfull vbox (129.3531pt too high) has occurred while output is active []
Here's a solution that employs a tabular
environment (actually, a tabular*
environment) instead of an array
environment, embeds the tabular material in a sidewaystable
environment, takes some care to structure the header material, and uses few but well-spaced horizontal rules. No need to reduce the font size.
documentclass{article}
usepackage[utf8]{inputenc}
%linespread{1.3} % don't use the low-level macro 'linespread' directly
usepackage{setspace}setstretch{1.3}
usepackage[margin=1.2in]{geometry}
usepackage{eurosym}
usepackage{makeidx}
%%usepackage{amsfonts} % is loaded automatically by 'amssymb'
usepackage{amssymb}
usepackage{graphicx}
usepackage{amsmath}
usepackage{cases}
usepackage[titletoc]{appendix}
usepackage{color,soul}
usepackage{amsthm}
usepackage{thmtools}
usepackage{mathrsfs}
usepackage{enumerate} % 'enumitem' package would be a better choice
usepackage{pgfplots}
usetikzlibrary{patterns}
usepgfplotslibrary{groupplots}
%%usepackage{lscape}
usepackage{pdflscape}
usepackage{caption}
%%usepackage{subfigure} % 'subfigure' is deprecated!
usepackage{subcaption}
usepackage{tabularx}
usepackage{booktabs,mhchem,rotating} % <-- new
%%usepackage[hyphens]{url}
usepackage{xurl}
usepackage{hyperref} % load this package _last_
begin{document}
begin{sidewaystable}
setlengthtabcolsep{0pt}
begin{tabular*}{textwidth}{@{extracolsep{fill}} *{12}{l} }
toprule
Economic variable & Unit & multicolumn{4}{c}{BAU} & multicolumn{6}{c}{PROJECT}
cmidrule{3-6} cmidrule{7-12}
& & multicolumn{2}{c}{2024--2029**} &
multicolumn{2}{c}{2030--2041} &
multicolumn{2}{c}{2024--2025} &
multicolumn{2}{c}{2026--2029**} &
multicolumn{2}{c}{2030--2041}
cmidrule{3-4} cmidrule{5-6} cmidrule{7-8} cmidrule{9-10} cmidrule{11-12}
& & Peak & O/P & Peak & O/P & Peak & O/P & Peak & O/P & Peak & O/P
midrule
Investment & € & 0 & & 0 & & 175 & & 0 & & 0 &
VOT & €/h & 10 & 10 & 10 & 10 & 10 & 10 & 10 & 10 & 10 & 10
Extra Delay & h & 0.67 & 0.33 & 0.67 & 0.33 & 0.67 & 0.33 & 0.33 & 0.17 & 0.33 & 0.17
Delay costs & € & 6.67 & 3.33 & 6.67 & 3.33 & 6.67 & 3.33 & 3.33 & 1.67 & 3.33 & 1.67
A&D Tourist & mln/year & 8 & 2 & 5.5 & 1.17 & 8 & 2 & 8.33 & 2.06 & 5.83 & 1.22
A&D Locals & mln/year & 2 & 3 & 1.875 & 2.75 & 2 & 3 & 2.07 & 3.07 & 1.89 & 2.77
TOTAL & mln/year & 10 & 5 & 7.36 & 3.92 & 10 & 5 & 10.4 & 5.12 & 7.72 & 3.99
Price Tourist& €/trip & 160 & 120 & 185 & 145 & 160 & 120 & 160 & 120 & 185 & 145
Elasticity (Tourist) & -- & 2 & 2 & 2 & 2 & 2 & 2 & 2 & 2 & 2 & 2
Res. Price (Tourist) & €/trip & 240 & 180 & 240 & 180 & 240 & 180 & 240 & 180 & 240 & 180
Price Locals & €/trip & 40 & 30 & 65 & 55 & 40 & 30 & 40 & 30 & 65 & 55
Elasticity (Locals) & -- & 0.4 & 0.4 & 0.4 & 0.4 & 0.4 & 0.4 & 0.4 & 0.4 & 0.4 & 0.4
Res. Price (Locals) & €/trip & 560 & 420 & 560 & 420 & 560 & 420 & 560 & 420 & 560 & 420
Subsidy (€/trip) & €/trip & 120 & 90 & 120 & 90 & 120 & 90 & 120 & 90 & 120 & 90
Revenues (Tourist) & mln € & 1280 & 240 & 880 & 140 & 1280 & 240 & 1333.33 & 246.67 & 933.33 & 146.67
Revenues (Locals) & mln € & 80 & 90 & 75 & 82.5 & 80 & 90 & 82.67 & 92 & 75.67 & 83
TOTAL REVENUES & mln € & 1690 & & 1177.5 & & 1690 & & 1754.67 & & 1238.67 &
CS (Tourist) & mln € & 320 & 60 & 151.25 & 20.42 & 320 & 60 & 347.22 & 63.38 & 170.14 & 22.41
CS (Locals) & mln € & 640 & 720 & 576.5625 & 625.625 & 640 & 720 & 664.78 & 738.56 & 584.84 & 631.72
TOTAL CS & mln € & 1740 & & 1373.85 & & 1740 & & 1813.94 & & 1409.11 &
GROSS WELFARE & mln € & 3430 & & 2551.35 & & 3430 & & 3568.6 & & 2647.76 &
Permits 2030 & €/ton ce{CO2} pas trip & 50 & & & & 50 & & & & 50 &
Social Discount Rate & & 0.05 & & & & 0.05 & & & & 0.05 &
Actual Permit Prices &/ton ce{CO2} pas trip & 37.31 & & & & 37.31 & & & & 37.31 &
Emissions & ton ce{CO2}/pas trip & 0.5 & & & & 0.5 & & & & 0.5 &
addlinespace
TOTAL EXT. COSTS* & € (year) & 279.83 & & 0 & & 279.83 & & 289.57 & & 0 &
FLOW EXT. COSTS* & € & 1678.98 & & 0 & & 559.66 & & 1158.29 & & 0 &
NPV & € & 31544.88 & & & & 32223.96
NET BENEFIT & & & 679.072
IRR & & & 0.29 & #NUM!
bottomrule
end{tabular*}
end{sidewaystable}
end{document}
Correct answer by Mico on January 20, 2021
You were using the array
environment outside math mode. Also, there was a conflict concerning the url
package. I have also reduced the font size. This will work:
documentclass{article}
usepackage[utf8]{inputenc}
linespread{1.3}
usepackage[margin=1.2in]{geometry}
usepackage{eurosym}
usepackage{makeidx}
usepackage{amsfonts}
usepackage{amssymb}
usepackage{graphicx}
usepackage{amsmath}
usepackage{cases}
usepackage[titletoc]{appendix}
usepackage{color,soul}
usepackage{amsthm}
usepackage{thmtools}
usepackage{mathrsfs}
usepackage{enumerate}
usepackage{hyperref}
usepackage{pgfplots}
usetikzlibrary{patterns}
usepgfplotslibrary{groupplots}
usepackage{lscape}
usepackage{caption}
usepackage{subfigure}
usepackage{tabularx}
begin{document}
begin{landscape}tiny
begin{tabular}{l l l l l l l l l l l l}
& & & & & & & & & & &
Economic Analysis & Unit of Measure & BAU & & & & textbf{PROJECT} & & & & & hline
& & 2024-2029** & & 2030-2041 & & 2024-2025 & & 2026-2029** & & 2030-2041 & hline
& & Peak & Off-Peak & Peak & Off-Peak & Peak & Off-Peak & Peak & Off-Peak & Peak & Off-Peak
Investment & € & 0 & & 0 & & 175 & & 0 & & 0 & hline
VOT & €/h & 10 & 10 & 10 & 10 & 10 & 10 & 10 & 10 & 10 & 10 hline
Extra Delay & h & 0.67 & 0.33 & 0.67 & 0.33 & 0.67 & 0.33 & 0.33 & 0.17 & 0.33 & 0.17 hline
Delay costs & € & 6.67 & 3.33 & 6.67 & 3.33 & 6.67 & 3.33 & 3.33 & 1.67 & 3.33 & 1.67 hline
A&D Tourist & mln / year & 8 & 2 & 5.5 & 1.17 & 8 & 2 & 8.33 & 2.06 & 5.83 & 1.22 hline
A&D Locals & mln / year & 2 & 3 & 1.875 & 2.75 & 2 & 3 & 2.07 & 3.07 & 1.89 & 2.77 hline
TOTAL & mln / year & 10 & 5 & 7.36 & 3.92 & 10 & 5 & 10.4 & 5.12 & 7.72 & 3.99 hline
Price Tourist & €/trip & 160 & 120 & 185 & 145 & 160 & 120 & 160 & 120 & 185 & 145 hline
Elasticity (Tourist) & & 2 & 2 & 2 & 2 & 2 & 2 & 2 & 2 & 2 & 2 hline
Res. Price (Tourist) & €/trip & 240 & 180 & 240 & 180 & 240 & 180 & 240 & 180 & 240 & 180 hline
Price Locals & €/trip & 40 & 30 & 65 & 55 & 40 & 30 & 40 & 30 & 65 & 55 hline
Elasticity (Locals) & & 0.4 & 0.4 & 0.4 & 0.4 & 0.4 & 0.4 & 0.4 & 0.4 & 0.4 & 0.4 hline
Res. Price (Locals) & €/trip & 560 & 420 & 560 & 420 & 560 & 420 & 560 & 420 & 560 & 420 hline
Subsidy (€/trip) & €/trip & 120 & 90 & 120 & 90 & 120 & 90 & 120 & 90 & 120 & 90 hline
Revenues (Tourist) & mln € & 1280 & 240 & 880 & 140 & 1280 & 240 & 1333.33 & 246.67 & 933.33 & 146.67 hline
Revenues (Locals) & mln € & 80 & 90 & 75 & 82.5 & 80 & 90 & 82.67 & 92 & 75.67 & 83 hline
TOTAL REVENUES & mln € & 1690 & & 1177.5 & & 1690 & & 1754.67 & & 1238.67 & hline
CS (Tourist) & mln € & 320 & 60 & 151.25 & 20.42 & 320 & 60 & 347.22 & 63.38 & 170.14 & 22.41 hline
CS (Locals) & mln € & 640 & 720 & 576.5625 & 625.625 & 640 & 720 & 664.78 & 738.56 & 584.84 & 631.72 hline
TOTAL CS & mln € & 1740 & & 1373.85 & & 1740 & & 1813.94 & & 1409.11 & hline
GROSS WELFARE & mln € & 3430 & & 2551.35 & & 3430 & & 3568.6 & & 2647.76 & hline
Permits 2030 & (€ / ton CO2 pas trip) & 50 & & & & 50 & & & & 50 & hline
Social Discount Rate & & 0.05 & & & & 0.05 & & & & 0.05 & hline
Actual Permit Prices & / ton CO2 pas trip) & 37.31 & & & & 37.31 & & & & 37.31 & hline
Emissions & text{ton $CO_2$ / pas trip} & 0.5 & & & & 0.5 & & & & 0.5 & hline
TOTAL EXTERNAL COSTS* & (€) (year) & 279.83 & & 0 & & 279.83 & & 289.57 & & 0 & hline
FLOW EXTERNAL COSTS* & (€) & 1678.98 & & 0 & & 559.66 & & 1158.29 & & 0 & hline
NPV & (€) & 31544.88 & & & & 32223.96 & & & & & hline
& & & & & & & & & & & hline
NET BENEFIT & & & 679.072 & & & & & & & & hline
& & & & & & & & & & & hline
IRR & & & 0.29 & #NUM! & & & & & & & hline
end{tabular}
end{landscape}
end{document}
Answered by José Carlos Santos on January 20, 2021
First I added booktabs
, always useful for better row spacing and rules, and pdflscape
to be able to see the landscape table horizontally in the monitor, for easier debugging. The font size is small
, the rows stretched by arraystretch
from the array
package. I added some multicolumns
to center the second row over Peak / Off-Peack and centered most columns for better viewing.
documentclass{article}
usepackage[utf8]{inputenc}
%linespread{1.3}
usepackage[margin=1.2cm]{geometry}
usepackage{eurosym}
usepackage{makeidx}
usepackage{amsfonts}
usepackage{amssymb}
usepackage{graphicx}
usepackage{amsmath}
usepackage{cases}
usepackage[titletoc]{appendix}
usepackage{color,soul}
usepackage{amsthm}
usepackage{thmtools}
usepackage{mathrsfs}
usepackage{enumerate}
usepackage{hyperref}
usepackage{pgfplots}
usetikzlibrary{patterns}
usepgfplotslibrary{groupplots}
usepackage{lscape}
usepackage{caption}
usepackage{subfigure}
usepackage{tabularx}
RequirePackage{pdflscape} % added
RequirePackage{booktabs} % added
begin{document}
begin{landscape}
small
renewcommand{arraystretch}{1.3} %% added
begin{tabular}{l c c c c c c c c c c c}
% & & & & & & & & & & &
toprule
Economic Analysis & Unit of Measure BAU &multicolumn{10}{c}{textbf{PROJECT}}
toprule
& & multicolumn{2}{c}{2024-2029**} & multicolumn{2}{c}{2030-2041 } & multicolumn{2}{c}{2024-2025} & multicolumn{2}{c}{2026-2029**} & multicolumn{2}{c}{2030-2041} hline
& & Peak & Off-Peak & Peak & Off-Peak & Peak & Off-Peak & Peak & Off-Peak & Peak & Off-Peak midrule
Investment & € & 0 & & 0 & & 175 & & 0 & & 0 & hline
VOT & €/h & 10 & 10 & 10 & 10 & 10 & 10 & 10 & 10 & 10 & 10 hline
Extra Delay & h & 0.67 & 0.33 & 0.67 & 0.33 & 0.67 & 0.33 & 0.33 & 0.17 & 0.33 & 0.17 hline
Delay costs & € & 6.67 & 3.33 & 6.67 & 3.33 & 6.67 & 3.33 & 3.33 & 1.67 & 3.33 & 1.67 hline
A&D Tourist & mln / year & 8 & 2 & 5.5 & 1.17 & 8 & 2 & 8.33 & 2.06 & 5.83 & 1.22 hline
A&D Locals & mln / year & 2 & 3 & 1.875 & 2.75 & 2 & 3 & 2.07 & 3.07 & 1.89 & 2.77 hline
TOTAL & mln / year & 10 & 5 & 7.36 & 3.92 & 10 & 5 & 10.4 & 5.12 & 7.72 & 3.99 hline
Price Tourist & €/trip & 160 & 120 & 185 & 145 & 160 & 120 & 160 & 120 & 185 & 145 hline
Elasticity (Tourist) & & 2 & 2 & 2 & 2 & 2 & 2 & 2 & 2 & 2 & 2 hline
Res. Price (Tourist) & €/trip & 240 & 180 & 240 & 180 & 240 & 180 & 240 & 180 & 240 & 180 hline
Price Locals & €/trip & 40 & 30 & 65 & 55 & 40 & 30 & 40 & 30 & 65 & 55 hline
Elasticity (Locals) & & 0.4 & 0.4 & 0.4 & 0.4 & 0.4 & 0.4 & 0.4 & 0.4 & 0.4 & 0.4 hline
Res. Price (Locals) & €/trip & 560 & 420 & 560 & 420 & 560 & 420 & 560 & 420 & 560 & 420 hline
Subsidy (€/trip) & €/trip & 120 & 90 & 120 & 90 & 120 & 90 & 120 & 90 & 120 & 90 hline
Revenues (Tourist) & mln € & 1280 & 240 & 880 & 140 & 1280 & 240 & 1333.33 & 246.67 & 933.33 & 146.67 hline
Revenues (Locals) & mln € & 80 & 90 & 75 & 82.5 & 80 & 90 & 82.67 & 92 & 75.67 & 83 hline
TOTAL REVENUES & mln € & 1690 & & 1177.5 & & 1690 & & 1754.67 & & 1238.67 & hline
CS (Tourist) & mln € & 320 & 60 & 151.25 & 20.42 & 320 & 60 & 347.22 & 63.38 & 170.14 & 22.41 hline
CS (Locals) & mln € & 640 & 720 & 576.5625 & 625.625 & 640 & 720 & 664.78 & 738.56 & 584.84 & 631.72 hline
TOTAL CS & mln € & 1740 & & 1373.85 & & 1740 & & 1813.94 & & 1409.11 & hline
GROSS WELFARE & mln € & 3430 & & 2551.35 & & 3430 & & 3568.6 & & 2647.76 & hline
Permits 2030 & (€ / ton CO2 pas trip) & 50 & & & & 50 & & & & 50 & hline
Social Discount Rate & & 0.05 & & & & 0.05 & & & & 0.05 & hline
Actual Permit Prices & / ton CO2 pas trip) & 37.31 & & & & 37.31 & & & & 37.31 & hline
Emissions & text{ton $CO_2$ / pas trip} & 0.5 & & & & 0.5 & & & & 0.5 & hline
TOTAL EXTERNAL COSTS* & (€) (year) & 279.83 & & 0 & & 279.83 & & 289.57 & & 0 & hline
FLOW EXTERNAL COSTS* & (€) & 1678.98 & & 0 & & 559.66 & & 1158.29 & & 0 & hline
NPV & (€) & 31544.88 & & & & 32223.96 & & & & & hline
& & & & & & & & & & & hline
NET BENEFIT & & & 679.072 & & & & & & & & hline
& & & & & & & & & & & hline
IRR & & & 0.29 & #NUM! & & & & & & & bottomrule
end{tabular}
end{landscape}
end{document}
Answered by Simon Dispa on January 20, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP