如何在 A4 上放置包含方程式/参考文献的大型侧向表格?

如何在 A4 上放置包含方程式/参考文献的大型侧向表格?

我有一个很大的表格,其中有些条目包含很长的公式和参考资料,超出了页边距。我想减小表格的列宽,让表格在页面上更合适。我减小了字体大小以减少复杂性,但这是无法持续的。伪代码

  1. 正常大小的字体。
  2. 表格中留有更多的垂直空间。
  3. 减小列宽。
  4. 每个单元格条目有更多行。
  5. 额外的间距。

图 1 .tex 文件,图 2 带有长方程式的大表格,我希望表格占用更多的垂直空间并更好地适应页面,图 3 Masi 的第一个代码的输出和我对长方程式的编辑,图 4 Zarko 的第一个代码的输出和我对长方程式的编辑。

在此处输入图片描述 在此处输入图片描述 在此处输入图片描述

MWE1 的病例更易于管理

\documentclass[english]{article}
\usepackage{amsmath, amsfonts,rotating}
\begin{document}
\begin{sidewaystable}
\centering
\caption{Ideals computed with basis and lexicographic}
\label{GroebnerRHR}
\hspace*{-2cm}
\begin{tabular}{| l | l | l | l | l |}
    \hline
    CountVars & Description                 &   Basis           &   Count of elements   &   Count of Monomials      \\
    \hline
    1       &   system 1                    &   0           &   0               &   0           \\
    2       &   system 2                    &   0       &   0               &   0           \\
    2       &   system 3                    &   1       &   1               &   2           \\
    3       &   series system with 3 vertices   &   1+3     &   1               &   6           \\
    5       &   See Figure 15.              &   medium size equation            &   0               &   0           \\
    7       &   See Figure 28.              &   $long equation+ long long- long long long long- long* long long= long equation$         &   9               &   20          \\  
    36      &   PP                      &   $very long =equation 1+2 stereo aloe nag rouen haosteu +saohu natoehs untaose thaoetu saothe staehosun haotnh saonthe + snatohu snthaosun thaosnth oanteuh+ snoathu sntoahe - snthoasen thoastn hosatnh soah sntohaent hoasnu hsonatheu * toha snahous$     &   899             &   2222    \\
    \hline
\end{tabular}
\end{sidewaystable}
\end{document} 

Masi 的 MWE2

\documentclass[english]{article}
\usepackage{amsmath, amsfonts,rotating}
\begin{document}
\begin{sidewaystable}
\centering
\caption{Ideals computed with basis and lexicographic}
\label{GroebnerRHR}
\hspace*{-2cm}
% http://tex.stackexchange.com/a/31681/13173
\bgroup
\def\arraystretch{1.5}%  1 is the default, change whatever you need
\begin{tabular}{| l | p{3cm} | p{3cm} | p{3cm} | p{3cm} |}
    \hline
    CountVars & Description                       &   Basis   &   Count of elements   &   Count of Monomials      \\ \hline
    1         &   system 1                        &   0       &   0                   &   0           \\ \hline
    2         &   system 2                        &   0       &   0                   &   0           \\ \hline
    2         &   system 3                        &   1       &   1                   &   2           \\ \hline
    3         &   series system with 3 vertices   &   1+3     &   1                   &   6           \\ \hline
    5         &   See Figure 15.                  &   medium size equation            &   0               &   0           \\ \hline
    7         &   See Figure 28.                  &   $long equation = long long +long long- long long *long long *long+long$         &   9               &   20          \\ \hline
    36        &   PP                              &   $very long equation = stereo- aloe+nag - rouen *haosteu saohu natoehs -untaose thaoetu +saothe staehosun haotnh saonthe snatohu +snthaosun thaosnth oanteuh snoathu sntoahe +snthoasen thoastn hosatnh soah sntohaent hoasnu hsonatheu -toha snahous$      &   899             &   2222    \\ \hline
\end{tabular}
\egroup
\end{sidewaystable}
\end{document}

方程式条目没有在列中很好地呈现,而是覆盖了其他列,如何通过使方程式继续在下一行来解决这个问题?

MWE3 与 Zarko

\documentclass[english]{article}
\usepackage{amsmath, amsfonts,rotating}
\usepackage{makecell,tabularx}

\usepackage[showframe]{geometry}


\begin{document}
    \begin{sidewaystable}
    \centering
    \renewcommand\arraystretch{1.2}
    \setlength\tabcolsep{3pt}%  1 is the default, change whatever you need
\caption{Ideals computed with basis and lexicographic}
    \label{GroebnerRHR}
\begin{tabularx}{\textwidth}{| r |p{8em} | X | l | l |}
    \hline
\thead[b]{Count\\Vars} 
        &   \thead[b]{Description}
            &   \thead[b]{Basis}   
                &   \thead[b]{Count of\\ elements} 
                    &   \thead[b]{Count of\\ Monomials}    \\ \hline
1       &   system 1                        
            & 0 & 0 & 0                                 \\ \hline
2       &   system 2                        
            & 0 & 0 & 0                                 \\ \hline
2       &   system 3                        
            & 1 & 1 & 2                                 \\ \hline 
3       &   series system with 3 vertices   
            & 1+3   & 1 & 6                             \\ \hline
5       &   See Figure 15.                  
            &   medium size equation            
                & 0 & 0                                 \\ \hline
7       &   See Figure 28.                  
            &   $long equation = if *it is longer +than is column width - then it hed to be set * as multi line equation + with help of `asmmath` or `mathtool` math environments$
                & 9  & 20                               \\ \hline
36      &   PP                              
            &   $very long equation = stereo +aloe nag rouen haosteu - saohu natoehs untaose thaoetu +saothe staehosun haotnh saonthe snatohu - snthaosun thaosnth -oanteuh snoathu sntoahe snthoasen thoastn hosatnh soah sntohaent +hoasnu hsonatheu toha snahous$   
                & 899   & 2222                          \\ \hline
\end{tabularx}
    \end{sidewaystable}
\end{document}

答案1

图 1 不带长方程的输出,图 2 带长方程的输出

在此处输入图片描述 在此处输入图片描述

代码

代码 1 不含长方程式

\documentclass[english]{article}
\usepackage{amsmath, amsfonts,rotating}
\begin{document}
\begin{sidewaystable}
\centering
\caption{Ideals computed with basis and lexicographic}
\label{GroebnerRHR}
\hspace*{-2cm}
% https://tex.stackexchange.com/a/31681/13173
\bgroup
\def\arraystretch{1.5}%  1 is the default, change whatever you need
\begin{tabular}{| l | p{3cm} | p{3cm} | p{3cm} | p{3cm} |}
    \hline
    CountVars & Description                       &   Basis   &   Count of elements   &   Count of Monomials      \\ \hline
    1         &   system 1                        &   0       &   0                   &   0           \\ \hline
    2         &   system 2                        &   0       &   0                   &   0           \\ \hline
    2         &   system 3                        &   1       &   1                   &   2           \\ \hline
    3         &   series system with 3 vertices   &   1+3     &   1                   &   6           \\ \hline
    5         &   See Figure 15.                  &   medium size equation            &   0               &   0           \\ \hline
    7         &   See Figure 28.                  &   long equation long long long long long long long long long long         &   9               &   20          \\ \hline
    36        &   PP                              &   very stereo aloe nag rouen haosteu saohu natoehs untaose thaoetu saothe staehosun haotnh saonthe snatohu snthaosun thaosnth oanteuh snoathu sntoahe snthoasen thoastn hosatnh soah sntohaent hoasnu hsonatheu toha snahous      &   899             &   2222    \\ \hline
\end{tabular}
\egroup
\end{sidewaystable}
\end{document}

带有长方程式和 Andrew 修复的代码 2这里关于环境

\documentclass[english]{article}
\usepackage{amsmath, amsfonts,rotating}

% https://tex.stackexchange.com/a/139450/13173
% https://tex.stackexchange.com/a/324197/13173
\newcommand{\eqbreak}[1][2]{\\&\hskip#1em}
\begin{document}
\begin{sidewaystable}
\centering
\caption{Ideals computed with basis and lexicographic}
\label{GroebnerRHR}
\hspace*{-2cm}
% https://tex.stackexchange.com/a/31681/13173
\bgroup
\def\arraystretch{1.5}%  1 is the default, change whatever you need
\renewcommand{\eqbreak}[1][1]{\\&\hskip#1em} % to save horizontal space as requested by OP so from 2 to 1; arraystretch just affects vertical spacing so it has nothing to do here
\begin{tabular}{| l | p{3cm} | p{5cm} | p{2cm} | p{2cm} |}
    \hline
    CountVars & Description                       &   Basis   &   Count of elements   &   Count of Monomials      \\ \hline
    1         &   system 1                        &   0       &   0                   &   0           \\ \hline
    2         &   system 2                        &   0       &   0                   &   0           \\ \hline
    2         &   system 3                        &   1       &   1                   &   2           \\ \hline
    3         &   series system with 3 vertices   &   1+3     &   1                   &   6           \\ \hline
    5         &   See Figure 15.                  &   medium size equation            &   0               &   0           \\ \hline
    7         &   See Figure 28.                  &
                                                $\begin{aligned}
                                                   long equation long long 
                                                     \eqbreak[-5] \times long long long \\ 
                                                   =long long long long long         
                                                \end{aligned}$
                                                  &   9       &   20          \\ \hline
    36        &   PP                              &
                                                $\begin{aligned}
                                                        very stereo aloe nag rouen 
                                                        \eqbreak[-11] \times haosteu saohu natoehs \eqbreak[-11] \times untaose thaoetu staehosun \eqbreak[-11] \times saonthe snthaosun thaosnth \eqbreak[-11] \times oanteuh snoathu sntoahe \eqbreak[-11] \times thoastn hosatnh soah sntohaent \eqbreak[-11] \times hoasnu hsonatheu toha snahous \end{aligned}$                           
                                                  &   81111   &   2222    \\ \hline
\end{tabular}
\egroup
\end{sidewaystable}
\end{document}

可选备注

  • 更好的例子,具有更具挑战性的数学符号和积分这里关于表格中的数学
  • 您可能可以删除它,\hspace*{-2cm}因为负间距可能不再需要,至少我认为图 1 中的第三列看起来很奇怪。参见这里关于一般\hspace间距

答案2

在您的代码 2 示例中,您在表达式中缺少对齐点aligned。如果您没有将 a 放在&an 的第一行,aligned它将隐式地位于右端。因此,您应该编写类似

$\begin{aligned}
  &long equation long long
  \eqbreak
  \times long long long \\
  &=long long long long long
\end{aligned}$

将其放入表格的基本示例中可得出

示例输出

\documentclass[english]{article}

\usepackage{amsmath,booktabs}
\usepackage{amsfonts,rotating}

% http://tex.stackexchange.com/a/139450/13173
\newcommand{\eqbreak}[1][2]{\\&\hskip#1em}

\begin{document}

\begin{sidewaystable}
  \centering
  \caption{Ideals computed with basis and lexicographic}
  \label{GroebnerRHR}
  % http://tex.stackexchange.com/a/31681/13173
  \def\arraystretch{1.5}% 1 is the default, change whatever you need
  \renewcommand{\eqbreak}[1][1]{\\&\hskip#1em}
  \begin{tabular}{ p{3cm} p{6cm} p{2cm}}
    \toprule
    Description & Basis &   Count of elements \\ \midrule
    See Figure 28. & $\begin{aligned}
      &long equation long long
      \eqbreak
      \times long long long \\
      &=long long long long long
    \end{aligned}$ & 9 \\ \midrule
    PP & $\begin{aligned}
      &very stereo aloe nag rouen \eqbreak
      \times haosteu saohu natoehs \eqbreak
      \times untaose thaoetu staehosun \eqbreak
      \times saonthe snthaosun thaosnth \eqbreak
      \times oanteuh snoathu sntoahe \eqbreak
      \times thoastn hosatnh soah sntohaent \eqbreak
      \times hoasnu hsonatheu toha snahous
    \end{aligned}$ & 81111 \\
    \bottomrule
  \end{tabular}
\end{sidewaystable}

\end{document}

我已经更新了\eqbreak此表的命令,因此它的默认缩进是1em而不是2em

答案3

看看以下重新格式化是否能达到您想要的效果:

在此处输入图片描述

在创建此表格时,我使用了两个包:makecell我使用(默认设置)宏thead将列标题设置为两行,并tabularx使用包将表格扩展到整个文本宽度sidewaystable(等于普通页面中的文本高度),并在必要时使用单元格进行多行方程式。我还假设,您希望在长方程式的第三列中拥有最大可能的宽度,并且第二列(更窄)中需要多行文本。

正如下面的 MWE 所述,如果长方程式无法适合可用的列宽,我建议使用amsmathmathtool数学环境之一,最好是multilined来自mathtools(更具指示性,我需要有关您的方程式的更多信息)。

geometry我使用带有选项的包showframe来显示页面布局,并定义其更常见的大小。

\documentclass[english]{article}
\usepackage{amsmath, amsfonts,rotating}
\usepackage{makecell,tabularx}

\usepackage[showframe]{geometry}

\begin{document}
    \begin{sidewaystable}
    \centering
    \renewcommand\arraystretch{1.2}
    \setlength\tabcolsep{3pt}%  1 is the default, change whatever you need
\caption{Ideals computed with basis and lexicographic}
    \label{GroebnerRHR}
\begin{tabularx}{\textwidth}{| r |p{8em} | >{\raggedright\arraybackslash}X | l | l |}
    \hline
\thead[b]{Count\\Vars} 
        &   \thead[b]{Description}
            &   \thead[b]{Basis}   
                &   \thead[b]{Count of\\ elements} 
                    &   \thead[b]{Count of\\ Monomials}    \\ \hline
1       &   system 1                        
            & 0 & 0 & 0                                 \\ \hline
2       &   system 2                        
            & 0 & 0 & 0                                 \\ \hline
2       &   system 3                        
            & 1 & 1 & 2                                 \\ \hline 
3       &   series system with 3 vertices   
            & 1+3   & 1 & 6                             \\ \hline
5       &   See Figure 15.                  
            &   medium size equation            
                & 0 & 0                                 \\ \hline
7       &   See Figure 28.                  
            &   long equation, if it is longer than is column width then it hed to be set as multi line equation with help of `asmmath` or `mathtool` math environments
                & 9  & 20                               \\ \hline
% alternatively for above row (added as described in addendum)
7       &   See Figure 28.
            &   $
                 a_0 + a_1x + a_2x^2 + a_3^3 + a_4x^4 + a_5x^5 + a_6x^6 + a_7x^7 + a_8x^8 + a_9x^9 + a_{10} + a_{11}x^{11} + a_{12}x^{12} + a^{13}x{13} + a^{14}x^{14} + a_{15}x^{15} + a_{16}x^{16} + a_{17}x^{17} + a_{18}x^{18} + a_{19}x^{19} + a_{20}x^{20} + a_{21}x^{21}
                $
                & 9  & 20                               \\ \hline
%
36      &   PP                              
            &   very stereo aloe nag rouen haosteu saohu natoehs untaose thaoetu saothe staehosun haotnh saonthe snatohu snthaosun thaosnth oanteuh snoathu sntoahe snthoasen thoastn hosatnh soah sntohaent hoasnu hsonatheu toha snahous      
                & 899   & 2222                          \\ \hline
\end{tabularx}
    \end{sidewaystable}
\end{document}

附录: 到目前为止,我还没有见过变量集$long equation, if it is longer than is column width then it had to be set as multi line equation with help ofasmmath ormathtools math environments$!这个“文本”数学被视为一个长变量序列。看看你的结果,所有字符都绑在一起,它们之间没有空间来制动方程。在正常情况下,长方程的行可能如下所示:

7       &   See Figure 28.
            &   $
                 a_0 + a_1x + a_2x^2 + a_3^3 + a_4x^4 + a_5x^5 + a_6x^6 + a_7x^7 + a_8x^8 + a_9x^9 + a_{10} + a_{11}x^{11} + a_{12}x^{12} + a^{13}x{13} + a^{14}x^{14} + a_{15}x^{15} + a_{16}x^{16} + a_{17}x^{17} + a_{18}x^{18} + a_{19}x^{19} + a_{20}x^{20} + a_{21}x^{21}
                $
                & 9  & 20                               \\ \hline

我在我的 MWE 中考虑了上面的行,并且还回答了表格的新图像。由于您仍然没有给出任何迹象表明您的真正方程式是什么,因此我没有使用任何其他数学环境来以其他方式构建方程式(手动调整断点)。

编辑: 为了更好地对齐第三列单元格中的内容 - 正如 David Carlisle 在下面的评论中所建议的那样 - 将列类型更改X

>{\raggedright\arraybackslash}X

或者

>{\RraggedRight\arraybackslash}X

需要ragged2e在文档前言中加载包。我根据上述解释改进了我的第一个建议,并相应地替换了所获表格的图像。

相关内容