为什么我的桌子太宽?

为什么我的桌子太宽?

我有下表

$\label{Table}
 \begin{tabularx}{\textwidth}{@{} c>{\hsize=0.5\hsize}C
{\hsize=1.5\hsize}C
                              @{} }
 \toprule
     Name  & Symmetry group & Generators of the group \\
 \midrule
 P1     &   Cyclic group $ C_{5} $ & $(1,2,3,4,5)$ \\
   \midrule
P2 &  Primitive group (15,2) & $ (1,15,7,5,12)$  $(2,9,13,14,8)$  $(3,6,10,11,4), $  $ (1,4,5)$  $(2,8,10$  $)(3,12,15)$  $(6,13,11)$  $(7,9,14)$ \\
 \midrule
P3 &   Primitive group (21,2) & $(1,7,12,16,19,21,6)$, $(2,8,13,17,20,5,11)$, $(3,9,14,18,4,10,15)$,
 $(4,6,5)$, $(9,11,10)$, $(13,15,14)$, $(16,18,17)$, $(19,20,21)$  \\
 \midrule

P4 & Primitive group (45,2) & $ ( 1, 2, 7)$  $( 3,11,27)$  $( 4,14,31)$  $( 5,18,32)$ $( 6,20,36)$  $( 8,24,39)$  $( 9,25,28)$  $(10,26,42)$  $(12,15,16)$  $(13,30,40)$  $(17,19,21)$ $(22,35,44)$  $(23,33,29)$  $(34,43,37)$  $(38,45,41)$,$ ( 1, 3, 5, 6, 7,22,13,23)$  $( 2, 8, 9,10)$ $( 4,15,16,17,14,21,19,12
    )$  $(11,28,29,38,44,25,20,37)$  $(18,33,34,24,40,36,41,39)$ $(26,43,35,32,42,45,27,
    30)$, $( 1, 4)$  $( 3,12)$  $( 5,19)$  $( 6,21)$  $( 7,14)$  $( 8,10)$  $(11,20)$  $(13,16)$  $(15,23)$ $
   (17,22)$  $(18,33)$  $(24,41)$  $(25,28)$  $(26,43)$  $(27,32)$  $(29,44)$  $(30,35)$  $(34,39)$  $(36,40)$  $(42,45) $  \\
 \bottomrule
 \end{tabularx}
\end{table}$

在我的pdf中是这样的:

在此处输入图片描述

怎么了?

答案1

周围的$符号肯定是错误的。

这是一种可能更简单的排版表格的方法,无需猜测列宽。

\documentclass{article}
\usepackage{amsmath}
\usepackage{tabularx,booktabs}

\begin{document}

\begin{table}[htp]

% shorthand for easing input in this particular table
\newcommand{\desc}[1]{\begin{tabular}[t]{@{}l@{}}#1\end{tabular}}

\caption{ILP-feasibility problems}\label{Table-ILP}

\begin{tabularx}{\textwidth}{@{} l l >{\raggedright\arraybackslash}X @{}}
\toprule
Name & \desc{Symmetry \\ group} & Generators of the group \\
\midrule
P1 & \desc{Cyclic \\ group \\ $C_{5}$} &
  $(1,2,3,4,5)$ \\
\midrule
P2 & \desc{Primitive \\ group \\ $(15,2)$} & 
  $(1,15,7,5,12)$  $(2,9,13,14,8)$  $(3,6,10,11,4)$,
  $(1,4,5)$  $(2,8,10)$ $(3,12,15)$  $(6,13,11)$  $(7,9,14)$ \\
\midrule
P3 & \desc{Primitive \\ group \\ $(21,2)$} &
  $(1,7,12,16,19,21,6)$, $(2,8,13,17,20,5,11)$, $(3,9,14,18,4,10,15)$,
  $(4,6,5)$, $(9,11,10)$, $(13,15,14)$, $(16,18,17)$, $(19,20,21)$  \\
\midrule
P4 & \desc{Primitive \\ group \\ $(45,2)$} &
  $(1,2,7)$  $(3,11,27)$  $(4,14,31)$  $(5,18,32)$ $( 6,20,36)$  $(8,24,39)$
  $(9,25,28)$  $(10,26,42)$  $(12,15,16)$  $(13,30,40)$  $(17,19,21)$ $(22,35,44)$
  $(23,33,29)$  $(34,43,37)$  $(38,45,41)$,
  $(1,3,5,6,7,22,13,23)$  $(2,8,9,10)$  $(4,15,16,17,14,21,19,12)$
  $(11,28,29,38,44,25,20,37)$  $(18,33,34,24,40,36,41,39)$ $(26,43,35,32,42,45,27,30)$,
  $(1,4)$  $(3,12)$  $(5,19)$  $(6,21)$  $(7,14)$  $(8,10)$  $(11,20)$  $(13,16)$  $(15,23)$
  $(17,22)$  $(18,33)$  $(24,41)$  $(25,28)$  $(26,43)$  $(27,32)$  $(29,44)$  $(30,35)$
  $(34,39)$  $(36,40)$  $(42,45)$  \\
\bottomrule
\end{tabularx}

\end{table}

\end{document}

在生成器之间放置逗号没有明显的一致性,因此请修复它。

在此处输入图片描述

答案2

为了多样化,这里还有另一个tabularx基于 的解决方案,它(a)设置第二列的宽度,以便标题(“对称组”)只是适合,并且 (b) 取消了\midrule有利于 的内部指令\addlinespace。哦,我假设您希望生成器列表是一个逗号分隔的列表。

\documentclass{article}
\usepackage{tabularx,booktabs}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\newlength\mylen
\settowidth\mylen{Symmetry Group} % determine width of 2nd column

\begin{document}
\begin{table}[htbp]
\setlength\tabcolsep{4pt} % default value: 6pt
\caption{A caption}
\label{Table}
\begin{tabularx}{\textwidth}{@{} l >{\raggedright}p{\mylen} L @{}}
\toprule
Name & Symmetry group & Generators of the group \\
\midrule
P1 & Cyclic group $ C_{5} $ 
& $(1,2,3,4,5)$ \\
\addlinespace
P2 & Primitive group (15,2) 
& $(1,15,7,5,12)$, $(2,9,13,14,8)$, $(3,6,10,11,4)$, $(1,4,5)$, 
  $(2,8,10)$, $(3,12,15)$, $(6,13,11)$, $(7,9,14)$ \\
\addlinespace
P3 & Primitive group (21,2) 
& $(1,7,12,16,19,21,6)$, $(2,8,13,17,20,5,11)$, $(3,9,14,18,4,10,15)$, 
  $(4,6,5)$, $(9,11,10)$, $(13,15,14)$, $(16,18,17)$, $(19,20,21)$  \\
\addlinespace
P4 & Primitive group (45,2) 
& $(1, 2, 7)$, $(3,11,27)$, $(4,14,31)$, $(5,18,32)$, $(6,20,36)$, 
  $(8,24,39)$, $(9,25,28)$, $(10,26,42)$, $(12,15,16)$, $(13,30,40)$, 
  $(17,19,21)$, $(22,35,44)$, $(23,33,29)$, $(34,43,37)$, $(38,45,41)$, 
  $(1, 3, 5, 6, 7,22,13,23)$, $(2, 8, 9,10)$, $(4,15,16,17,14,21,19,12)$,  
  $(11,28,29,38,44,25,20,37)$, $(18,33,34,24,40,36,41,39)$, 
  $(26,43,35,32,42,45,27, 30)$, $(1, 4)$, $(3,12)$, $(5,19)$, $(6,21)$, 
  $(7,14)$, $(8,10)$, $(11,20)$, $(13,16)$, $(15,23)$ $(17,22)$, $(18,33)$, 
  $(24,41)$, $(25,28)$, $(26,43)$, $(27,32)$, $(29,44)$, $(30,35)$, 
  $(34,39)$, $(36,40)$, $(42,45)$  \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}

相关内容