嗨,有人能帮我整理一下这张桌子吗?它超出了页面的范围,我想让它漂亮一点。
\documentclass[12pt]{article} % You can set font size here
\usepackage
[
a4paper,% other options: a3paper, a5paper, etc
% left=2.54cm,
% right=2.54cm,
% top=2.54cm,
% bottom=2.54cm,
margin = 2.54cm
% use vmargin=2cm to make vertical margins equal to 2cm.
% us hmargin=3cm to make horizontal margins equal to 3cm.
% use margin=3cm to make all margins equal to 3cm.
]
{geometry}
\usepackage[utf8]{inputenc}
%% Useful packages
\usepackage{amsmath,amsthm,amssymb,amsfonts}
\usepackage{graphicx}
\usepackage{subfigure}
%\usepackage[colorinlistoftodos]{todonotes}
\usepackage[colorlinks=true, allcolors=blue]{hyperref}
\usepackage{float}
\usepackage[title]{appendix}
\usepackage{multirow}
\usepackage{pgfgantt}
\usepackage{setspace}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}
\renewcommand{\familydefault}{\sfdefault}
\usepackage[square,numbers]{natbib}
\bibliographystyle{agsm} %harvard referencing style
\usepackage[none]{hyphenat}
\title{\vspace{-2cm} Simulation Project Report}
\author{\textbf{Authors: Jing Ting Chong, Ishaan Singh Jolly}}
\date{}
\begin{document}
\begin{table}[h]\small
\vspace{0.5cm}
\caption{Parameter Estimation}
\centering
{
\begin{tabular}{|c| c |c |c| c|}
\hline
Parameters & Inter arrival Times & Service times for Initial Phase & Service Times for Placing Keyboard and Mouse & Service Times for Assembling the Case \\
\hline
Distribution & Exponential & Lognormal & Uniform & Uniform\\
\hline
Parameter Estimation & $Lambda: 0.174883079$ & $Mean: 0.932845171$ & $Min(a): 13.4587$ & $Min(a): 4.91495$ \\
\hline
Parameter Estimation & $Average: 5.718106099$ & $ Deviation: 0.375378955$ & $Min(b): 6.00524$ & $Min(b) 3.78655$ \\
\hline
\end{tabular}}
\end{table}
\end{document}
答案1
起点:
\documentclass[12pt]{article}
\usepackage[a4paper, margin = 2.54cm]{geometry}
\usepackage{booktabs}
\usepackage{caption}
\renewcommand{\familydefault}{\sfdefault}
\usepackage{showframe}
\usepackage{makecell}
\renewcommand{\theadfont}{\normalsize}
\begin{document}
\begin{table}
\caption{Parameter Estimation}
\centering
\begin{tabular}{l c c c c}
\toprule
& & \multicolumn{3}{c}{Service times for}\\\cmidrule{3-5}
Parameters & \thead{Inter arrival\\ Times} & \thead{Initial\\ Phase} & \thead{Placing Keyboard\\ \& Mouse} & \thead{Assembling\\ the Case} \\
\midrule
Distribution & Exponential & Lognormal & Uniform & Uniform\\ \addlinespace
Parameter & Lambda: & Mean: & Min(a): & Min(a): \\
Estimation & 0.174883079 & 0.932845171 & 13.4587 & 4.91495 \\ \addlinespace
Parameter & Average: & Deviation: & Min(b): & Min(b): \\
Estimation & 5.718106099 & 0.375378955 & 6.00524 & 3.78655 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
答案2
对代码的最小更改是定义一个新列类型,所有列的宽度相同,以适合页面上的表格。
该软件包array
不仅提供了这样的功能,而且还能够垂直扩展单元格以提高可读性。
不需要数学,因此最好在所有单元格中使用相同的字体。
在技术出版物中,建议尽可能避免表格中的垂直线。如果您选择这样做,则必须更改文档中所有表格的样式。
这是代码
\documentclass[12pt]{article} % You can set font size here
\usepackage[
a4paper,% other options: a3paper, a5paper, etc
% left=2.54cm,
% right=2.54cm,
% top=2.54cm,
% bottom=2.54cm,
margin = 2.54cm
% use vmargin=2cm to make vertical margins equal to 2cm.
% us hmargin=3cm to make horizontal margins equal to 3cm.
% use margin=3cm to make all margins equal to 3cm.
]
{geometry}
\usepackage[utf8]{inputenc}
%% Useful packages
\usepackage{amsmath,amsthm,amssymb,amsfonts}
\usepackage{graphicx}
\usepackage{subfigure}
%\usepackage[colorinlistoftodos]{todonotes}
\usepackage[colorlinks=true, allcolors=blue]{hyperref}
\usepackage{float}
\usepackage[title]{appendix}
\usepackage{multirow}
\usepackage{pgfgantt}
\usepackage{setspace}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}
\renewcommand{\familydefault}{\sfdefault}
\usepackage[square,numbers]{natbib}
\bibliographystyle{agsm} %harvard referencing style
\usepackage[none]{hyphenat}
\title{\vspace{-2cm} Simulation Project Report}
\author{\textbf{Authors: Jing Ting Chong, Ishaan Singh Jolly}}
%% *************************
\usepackage{array} % for newcolumntype and arraystretch <<<<< added
\newcolumntype{C}{>{\centering\arraybackslash}m{0.16\textwidth}}
\renewcommand{\arraystretch}{1.5} % expand the cell vertically
\usepackage{showframe}% show the margins <<<<<<<<
\renewcommand\ShowFrameColor{\color{red}}
%% *************************
\date{}
\begin{document}
\begin{table}[h]
\small
\centering
\caption{Parameter Estimation}
\vspace{1em}
\begin{tabular}{|C| C |C |C| C|} % changed <<<<<<
\hline
Parameters & Inter arrival Times & Service times for Initial Phase & Service Times for Placing Keyboard and Mouse & Service Times for Assembling the Case \\
\hline
Distribution & Exponential & Lognormal & Uniform & Uniform\\
\hline
Parameter Estimation & Lambda: 0.174883079 & Mean: 0.932845171 & Min(a): 13.4587 & Min(a): 4.91495 \\
\hline
Parameter Estimation & Average: 5.718106099 & Deviation: 0.375378955 & Min(b): 6.00524 & Min(b): 3.78655 \\
\hline
\end{tabular}
\end{table}
\end{document}
个人评论,与问题无关:
引用具有如此多有效数字的估计结果有点小题大做。
计算的标准差是多少?