我有一张必须放在一页中的表格,但很难以任何美观的方式做到这一点。下面粘贴了一个 MWE。有什么建议可以改进这一点吗?遗憾的是我不知道从哪里开始。
%----------------------------------------------------------------------------------------
% DOCUMENT TYPE
%----------------------------------------------------------------------------------------
\documentclass[9pt]{article}
%----------------------------------------------------------------------------------------
% PACKAGES
%----------------------------------------------------------------------------------------
\usepackage[T1]{fontenc} %Font
\usepackage{libertine}
%\usepackage{lmodern}
\usepackage{slantsc}
\usepackage{amsmath,amssymb,amsfonts,amsthm,textcomp,nicefrac} %Math
\usepackage{graphicx, subfigure} %graphics & nested graphics
\usepackage{float} %place graphics exactly where you desire with [H]
\usepackage[font=footnotesize]{caption}
\usepackage[usenames]{color}
\definecolor{Blue}{rgb}{0,0.08,0.8}
\usepackage{tikz} %graphs
\usetikzlibrary{arrows, shapes, calc, positioning}
\usepackage{array}
\usepackage{hyperref} %References
\usepackage{lscape} %for landscape orientation
\usepackage{titletoc} %Table of contents
\usepackage{titlesec}
\titleformat{\section}{\bfseries}{\thesection}{1em}{} %Section format
\titleformat{\subsection}{\bfseries}{\thesubsection}{1em}{} %Subsection format
\titleformat*{\subsubsection}{\bfseries\em} %Subsubsection format
\renewcommand*\footnoterule{} %Remove footnote separator line
\usepackage[bottom=0.1in]{geometry} %Margins
\usepackage{setspace}%Spacing
\usepackage{fancyhdr}%Header and footer
\pagestyle{fancy}
\lhead{}
\rhead{}
\cfoot{\thepage}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\renewcommand*\footnoterule{} %Remove footnote separator line
\usepackage{booktabs}
%----------------------------------------------------------------------------------------
% Document
%----------------------------------------------------------------------------------------
\begin{document}
\thispagestyle{empty}
\begin{landscape}
{\bf \scshape Personal Record Table}
\begin{table}[H]
\centering
\begin{tabular}{|c|p{1.5cm}|p{1.5cm}|p{1.5cm}|p{1.5cm}|p{1.5cm}|p{1.5cm}|p{1.5cm}|p{1.5cm}|p{1.5cm}|p{1.5cm}|p{1.5cm}|p{1.5cm}|p{1.5cm}|p{1.5cm}|} \hline
& {\bf Your Investment}
& {\bf Total Investment}
& {\bf Group 1 Invesment}
& {\bf Group2 Investment}
& {\bf Total payoffs from The Account}
& {\bf Your payoffs from The Account}
& {\bf Your private payoffs}
& {\bf Your initial payoffs}
& {\bf Cost of deduction points assigned}
& {\bf Number of deduction points received}
& {\bf Cost of deduction points received}
& {\bf Losses from deductions}
& {\bf Final payoffs for this period}
& {\bf Total payoffs for all periods}\\
\hline\hline
{\bf 1} & & & & & & & & & & & & & &\\[2ex]\hline
{\bf 2} & & & & & & & & & & & & & &\\[2ex]\hline
{\bf 3} & & & & & & & & & & & & & &\\[2ex]\hline
{\bf 4} & & & & & & & & & & & & & &\\[2ex]\hline
{\bf 5} & & & & & & & & & & & & & &\\[2ex]\hline
{\bf 6} & & & & & & & & & & & & & &\\[2ex]\hline
{\bf 7} & & & & & & & & & & & & & &\\[2ex]\hline
{\bf 8} & & & & & & & & & & & & & &\\[2ex]\hline
{\bf 9} & & & & & & & & & & & & & &\\[2ex]\hline
{\bf 10} & & & & & & & & & & & & & &\\[2ex]\hline
\hline
\end{tabular}
\end{table}
\end{landscape}
%----------------------------------------------------------------------------------------
% END
%----------------------------------------------------------------------------------------
\end{document}
答案1
也许是这样的。标题看起来仍然很差,您可以使用较小的字体,这样它们就不会占用太多行,或者也许??您可以重新措辞以使其更短。
我添加了内联评论。
%----------------------------------------------------------------------------------------
% DOCUMENT TYPE
%----------------------------------------------------------------------------------------
% article doesn't have a 9pt opttion, deleted.
\documentclass{article}
%----------------------------------------------------------------------------------------
% PACKAGES
%----------------------------------------------------------------------------------------
\usepackage[T1]{fontenc} %Font
\usepackage{libertine}
%\usepackage{lmodern}
\usepackage{slantsc}
\usepackage{amsmath,amssymb,amsfonts,amsthm,textcomp,nicefrac} %Math
\usepackage{graphicx, subfigure} %graphics & nested graphics
\usepackage{float} %place graphics exactly where you desire with [H]
\usepackage[font=footnotesize]{caption}
\usepackage[usenames]{color}
\definecolor{Blue}{rgb}{0,0.08,0.8}
% not for MWE, speeds thing sup:-)
%\usepackage{tikz} %graphs
%\usetikzlibrary{arrows, shapes, calc, positioning}
\usepackage{array}
\usepackage{hyperref} %References
\usepackage{lscape} %for landscape orientation
\usepackage{titletoc} %Table of contents
\usepackage{titlesec}
\titleformat{\section}{\bfseries}{\thesection}{1em}{} %Section format
\titleformat{\subsection}{\bfseries}{\thesubsection}{1em}{} %Subsection format
\titleformat*{\subsubsection}{\bfseries\em} %Subsubsection format
\renewcommand*\footnoterule{} %Remove footnote separator line
\usepackage[bottom=0.1in]{geometry} %Margins
\usepackage{setspace}%Spacing
\usepackage{fancyhdr}%Header and footer
\pagestyle{fancy}
\lhead{}
\rhead{}
\cfoot{\thepage}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\renewcommand*\footnoterule{} %Remove footnote separator line
\usepackage{booktabs}
%----------------------------------------------------------------------------------------
% Document
%----------------------------------------------------------------------------------------
\begin{document}
\thispagestyle{empty}
\begin{landscape}
%\bf obsolete in latex2e, and anyway looks like a heading to me.
\section*{Personal Record Table}
%\begin{table}[H] % table not needed here (and H not defined unless you load float package)
\centering
\setlength\extrarowheight{2pt}% keep letters off the lines.
% using r not c for numeric column,
% make p columns narrower, so they fit on page
\begin{tabular}{|>{\bfseries}r|*{14}{>{\bfseries\centering\arraybackslash}p{1.2cm}|}}
\hline
& Your Investment
& Total Investment
& Group 1 Invesment
& Group2 Investment
& Total payoffs from The Account
& Your payoffs from The Account
& Your private payoffs
& Your initial payoffs
& Cost of deduction points assigned
& Number of deduction points received
& Cost of deduction points received
& Losses from deductions
& Final payoffs for this period
& Total payoffs for all periods\\
\hline\hline
1 & & & & & & & & & & & & & &\\[2ex]\hline
2 & & & & & & & & & & & & & &\\[2ex]\hline
3 & & & & & & & & & & & & & &\\[2ex]\hline
4 & & & & & & & & & & & & & &\\[2ex]\hline
5 & & & & & & & & & & & & & &\\[2ex]\hline
6 & & & & & & & & & & & & & &\\[2ex]\hline
7 & & & & & & & & & & & & & &\\[2ex]\hline
8 & & & & & & & & & & & & & &\\[2ex]\hline
9 & & & & & & & & & & & & & &\\[2ex]\hline
10 & & & & & & & & & & & & & &\\[2ex]\hline
\end{tabular}
\end{landscape}
%----------------------------------------------------------------------------------------
% END
%----------------------------------------------------------------------------------------
\end{document}
答案2
我有一些建议:
使用该
rotating
包及其sidewaystable
环境将表格放置在横向模式中。使用类似的东西
\usepackage[vmargin=0.5in]{geometry}
来为表提供最大的空间。使用
tabularx
包及其同名环境,宽度为\textwidth
;让包自动计算 14 [!] 数据列的宽度。由于环境tabularx
设置为占用,因此表\textwidth
中不需要(或没有意义) 。\centering
使用
\raggedright
它来代替数据列的默认完全对齐。我不清楚字符串的作用
Personal Record Table
是什么。我假设它属于\caption
命令;然而,我可能错了。发出指令
\small
里面环境sidewaystable
将字体大小减小 10%,并通过设置 来减少列间空白量\setlength\tabcolsep{2pt}
。 (此参数的默认值为6pt
。)这两个更改成功地将标题所需的行数减少到 4。
进一步说明:
该选项
9pt
无法识别,因此被article
文档类忽略。因此,我已将其从下面的代码中删除。article
文档类仅识别10pt
(默认)、11pt
和12pt
作为与字体大小相关的选项。该宏
{\bf ...}
是 PlainTeX;对于 LaTeX 文档,最好使用\textbf{...}
。您的示例代码包含大量与当前表格无关的材料;我擅自将代码精简为排版表格所必需的内容。
\documentclass{article}
\usepackage{libertine}
\usepackage[vmargin=0.5in]{geometry}
\usepackage{rotating} % for sidewaystable environment
\usepackage{tabularx} % for tabularx environment
\newcolumntype{Y}{>{\raggedright\arraybackslash}X}
\begin{document}
\thispagestyle{empty}
\begin{sidewaystable}
\small % 10% reduction of fontsize, i.e., from 10pt to 9pt
\setlength\tabcolsep{2pt} % default value: 6pt
\caption{Personal Record Table}
\medskip
\begin{tabularx}{\textwidth}{|c|*{14}{Y|}}
\hline
& \textbf{Your Investment}
& \textbf{Total Investment}
& \textbf{Group1 Investment}
& \textbf{Group2 Investment}
& \textbf{Total payoffs from The Account}
& \textbf{Your payoffs from The Account}
& \textbf{Your private payoffs}
& \textbf{Your initial payoffs}
& \textbf{Cost of deduction points assigned}
& \textbf{Number of deduction points received}
& \textbf{Cost of deduction points received}
& \textbf{Losses from deductions}
& \textbf{Final payoffs for this period}
& \textbf{Total payoffs for all periods}\\
\hline\hline
\textbf{1} & & & & & & & & & & & & & &\\[2ex]\hline
\textbf{2} & & & & & & & & & & & & & &\\[2ex]\hline
\textbf{3} & & & & & & & & & & & & & &\\[2ex]\hline
\textbf{4} & & & & & & & & & & & & & &\\[2ex]\hline
\textbf{5} & & & & & & & & & & & & & &\\[2ex]\hline
\textbf{6} & & & & & & & & & & & & & &\\[2ex]\hline
\textbf{7} & & & & & & & & & & & & & &\\[2ex]\hline
\textbf{8} & & & & & & & & & & & & & &\\[2ex]\hline
\textbf{9} & & & & & & & & & & & & & &\\[2ex]\hline
\textbf{10} & & & & & & & & & & & & & &\\[2ex]\hline
\end{tabularx}
\end{sidewaystable}
\end{document}