数学论文中的表格

数学论文中的表格

我为一门课程写了一篇论文,但在表格方面遇到了一些问题。如您所见,表格与文档的契合度并不好:

在此处输入图片描述

如果有人能告诉我如何解决这个问题,我将不胜感激。以下是测试代码:

% /usr/local/doc/tex-inputs/latex/notes/paper.tex

% An example showing how to prepare an article using AMSLaTeX.
% Stephen G. Simpson, Fall 1995.
% Please send any comments or questions to [email protected].

% Lines beginning with a percent sign are comments.  LaTeX ignores them.

% Begin by declaring a document class and options.

\documentclass[12pt,oneside]{amsart}

% \documentclass{amsart} says to use the AMS article document class.
% [12pt,oneside] says to use the 12pt and oneside options.
% If you don't want these options, just say \documentstyle{amsart}.

% After the document class declaration comes the preamble.
% The preamble begins here.

   % First we activate any packages that we may need.
   %
   % The amssymb package provides \mathbb and other
   % math symbols.  The amsmath package provides sophisticated math
   % constructions.  The amsthm package provides \theoremstyle and
   % the \proof environment.
   %
   % The amsmath and amsthm packages are automatically activated by
   % \documentclass{amsart}, so there is no need to activate them here.

      \usepackage{amssymb}
      \usepackage{graphicx}   % if you want to include graphics files
      \usepackage{amsmath}
      \usepackage{amsthm}
      \usepackage{amsfonts}
      \usepackage[english]{babel}
      \usepackage[utf8]{inputenc}
      \usepackage{enumerate}
      \usepackage{color}
      \usepackage[pdftex,citecolor=green,linkcolor=red]{hyperref}
      \usepackage{aliascnt}
      \usepackage{tikz}



   % Next we use \newtheorem to specify our theorem-like environments
   % (theorem, definition, etc.) and how to display and number them.
   %
   % Note: The \theoremstyle declarations affect the appearance of the
   % Theorems, Definitions, etc.

      \theoremstyle{plain}
      \newtheorem{theorem}{Theorem}[section]
      \newtheorem{lemma}[theorem]{Lemma}
      \newtheorem{corollary}[theorem]{Corollary}

      \theoremstyle{definition}
      \newtheorem{definition}[theorem]{Definition}
       \theoremstyle{proposition}
      \newtheorem{proposition}[theorem]{Proposition}

      \theoremstyle{remark}
      \newtheorem{remark}[theorem]{Remark}

   % The preamble is also a good place to define new commands and macros.
   % This part of the preamble is strictly optional according to your taste.

      \newcommand{\R}{{\mathbb R}}
      \newcommand{\nil}{\varnothing}

   % The following mysterious maneuver gets rid of AMS junk at the top
   % and bottom of the first page.

      \makeatletter
      \def\@setcopyright{}
      \def\serieslogo@{}
      \makeatother

% This ends the preamble.  We now proceed to the document itself.

\begin{document}




   \section{Test code}



\begin{proof}

 Together with the inductive result of Lemma \ref{induction} this implies in all cases that $\mathcal{P}$ is one of optimal, unbounded, or feasible:
\begin{table}[htbp]
\begin{tabular}{|cc|p{2cm}cccp{2cm}|}
\hline
\textbf{}               &            &                                                 & $\mathcal{P}/e$              & \multicolumn{1}{c|}{}                                                   \\
                        &            & optimal                                         & \multicolumn{1}{|c|}{unbonuded}      & \multicolumn{1}{|c|}{infeasible}                                        \\ \hline
                        & optimal    & optimal Lemma \ref{induction} i)                & \multicolumn{1}{|c|}{(not possible)} & \multicolumn{1}{|c|}{optimal or infeasible Lemma \ref{induction} ii)}   \\ \cline{2-5} 
$\mathcal{P}\backslash e$ & unbounded  & unbounded or optimal Lemma \ref{induction} iii) & \multicolumn{1}{|c|}{unbounded}      & \multicolumn{1}{|c|}{unbounded or infeasible Lemma \ref{induction} iv)} \\ \cline{2-5} 
                        & infeasible & (not possible)                                  & \multicolumn{1}{|c|}{(not possible)} & \multicolumn{1}{|c|}{infeasible}                                        \\ \hline
\end{tabular}
\end{table}
\end{proof}
 \bibliographystyle{plain}
   \bibliography{references}

\end{document}

您将收到无关紧要的未解决的引用。

答案1

我建议您简化表结构如下:

  • 仅提供四列:最左边的一列应以 为标题$\mathcal{P}\backslash e$,第 2 至第 4 列应以 为标题$\mathcal{P}/e$
  • 不要使用tabularbut,而要tabularx使用环境,并利用X此包提供的列类型。X列类型允许文本换行。换句话说,不要将其用作c列对齐说明符。
  • 不要使用完全(左和右)对齐;而应使用左对齐。
  • 您可能无论如何都会这样做,但我仍然建议您\captiontable环境提供一个。

在此处输入图片描述

\documentclass[12pt,oneside]{amsart}
\usepackage{tabularx,ragged2e}
\newcolumntype{Y}{>{\RaggedRight}X} % left-justified version of X column type
\begin{document}
\section{Test code}

Together with the inductive result of Lemma \ref{induction} this implies in all cases that $\mathcal{P}$ is one of optimal, unbounded, or feasible:
\begin{table}[htbp]
\begin{tabularx}{\textwidth}{|X|*{3}{Y|}}
\hline
$\mathcal{P}\backslash e$ 
&\multicolumn{3}{c|}{$\mathcal{P}/e$}\\
\cline{2-4}
& optimal  &unbounded & infeasible \\ 
\hline
optimal 
& optimal Lemma \ref{induction} i) 
& (not possible)
& optimal or infeasible Lemma \ref{induction} ii)   \\ 
\hline
unbounded
& unbounded or optimal Lemma \ref{induction} iii) 
& unbounded
& unbounded or infeasible Lemma \ref{induction} iv) \\ 
\hline
infeasible 
& (not possible)                                  
& (not possible)
& infeasible \\ 
\hline
\end{tabularx}
\end{table}
\end{document}

附录:我将再提出一个与表格整体设计相关的建议:根本不要使用任何垂直线,而要使用包booktabs及其命令来绘制间距适当的水平线(“规则”):

在此处输入图片描述

\documentclass[12pt,oneside]{amsart}
\usepackage{tabularx,ragged2e,booktabs}
\newcolumntype{Y}{>{\RaggedRight}X} % left-justified version of X column type
\begin{document}
\section{Test code}

Together with the inductive result of Lemma \ref{induction} this implies in all cases that $\mathcal{P}$ is one of optimal, unbounded, or feasible:
\begin{table}[htbp]
\begin{tabularx}{\textwidth}{@{}X*{3}{Y}@{}}
\toprule
$\mathcal{P}\backslash e$ 
&\multicolumn{3}{c}{$\mathcal{P}/e$}\\
\cmidrule(l){2-4}
& optimal  &unbounded & infeasible \\
\midrule
optimal 
& optimal Lemma \ref{induction} i) 
& (not possible)
& optimal or infeasible Lemma \ref{induction} ii)   \\[1ex]
unbounded
& unbounded or optimal Lemma \ref{induction} iii) 
& unbounded
& unbounded or infeasible Lemma \ref{induction} iv) \\[1ex]
infeasible 
& (not possible)                                  
& (not possible)
& infeasible \\ 
\bottomrule
\end{tabularx}
\end{table}
\end{document}

第二附录:原帖者要求表格的一个版本,该版本$\mathcal{P}\backslash e$在最左侧的新列中单独显示。下面是实现此功能的一个尝试。

在此处输入图片描述

\documentclass[12pt,oneside]{amsart}
\usepackage{tabularx,ragged2e}
\newcolumntype{Y}{>{\RaggedRight}X} % left-justified version of X column type
\begin{document}
\section{Test code}

Together with the inductive result of Lemma \ref{induction} this implies in all cases that $\mathcal{P}$ is one of optimal, unbounded, or feasible:
\begin{table}[htbp]
\begin{tabularx}{\textwidth}{|l|l|*{3}{Y|}}
\hline 
& &\multicolumn{3}{c|}{$\mathcal{P}/e$}\\
\cline{3-5}
& & optimal  &unbounded & infeasible \\ 
\hline
& optimal 
& optimal Lemma \ref{induction} i) 
& (not possible)
& optimal or infeasible Lemma \ref{induction} ii)   \\ 
\cline{2-5}
$\mathcal{P}\backslash e$
& unbounded
& unbounded or optimal Lemma \ref{induction} iii) 
& unbounded
& unbounded or infeasible Lemma \ref{induction} iv) \\ 
\cline{2-5}
& infeasible 
& (not possible)                                  
& (not possible)
& infeasible \\ 
\hline
\end{tabularx}
\end{table}
\end{document}

答案2

\documentclass{article}
\usepackage{tabularx}
\usepackage{array}
\usepackage[showframe]{geometry}

\begin{document}
\noindent
\begin{tabularx}{\textwidth}{|cc|XcccX|}
\hline
A & B & CCC CCC CCC CCC CCC CCC & D & E & F & HHH HHH \\
A & B & CCC CCC CCC CCC CCC CCC & D & E & F & HHH HHH \\
\hline
\end{tabularx}
\end{document}

相关内容