长表格不适合页面宽度 - 左边距较大

长表格不适合页面宽度 - 左边距较大

我想通过删除左侧的空白来为我的表格腾出更多空间,但我找不到好的解决方案。有人可以帮忙吗?如果可能的话,我会保留单元格和字体大小。

\documentclass[a4paper,11pt,twoside,onecolumn]{extbook}
\usepackage[english,italian]{babel}
\usepackage{unitsdef}
\usepackage{microtype}
\usepackage{parskip}
\usepackage{xcolor}
\usepackage{amsmath}
\usepackage{latexsym}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{multicol}
\usepackage{graphicx}
\graphicspath{{./images/}}
\usepackage{hyperref}
\setlength\parindent{0pt}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{float}
\usepackage{geometry}
\usepackage{multirow}
\usepackage{multicol}
\begin{document}
\subsubsection{SEQUENZE}
\begin{table}[H]
    \centering
    \renewcommand{\arraystretch}{1.5}
    \caption{abc}
    \begin{longtable}{>{\centering\footnotesize\bfseries}m{3cm}>{\centering\footnotesize}m{2cm}>{\centering\footnotesize}m{2cm}>{\centering\footnotesize}m{2cm}>{\centering\footnotesize}m{2cm}>{\centering\footnotesize}m{2cm}>{\centering\footnotesize}m{2cm}>{\centering\footnotesize}m{2cm}>{\centering\footnotesize}m{2cm}>{\centering\footnotesize\arraybackslash}m{2cm}}
        \toprule
        TIPOLOGIA & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880\\
        \midrule
        PESATURA & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880\\
        \midrule
        PIANO & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880\\
        \midrule
        \# STRATI & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880\\
        \midrule
        SPESSORI (mm) & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880\\
        \midrule
        GAP (mm) & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880\\
        \midrule
        RIEMPIMENTO & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880\\
        \midrule
        COD AX & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880\\
        \midrule
        COD SAG & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880\\
        \midrule
        COD COR & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880\\
        \midrule
        FOV (mm) & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880\\
        \midrule
        RFOV (\%) & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880\\
        \midrule
        \# ECHI & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880\\
        \midrule
        GAP ECHI (ms) & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880\\
        \midrule
        NSA & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880\\
        \midrule
        TE (ms) & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880\\
        \midrule
        TI (ms) & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880\\
        \midrule
        MATRICE & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880\\
        \midrule
        AA & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880\\
        \midrule
        DE & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880\\
        \midrule
        REPHASE & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880\\
        \midrule
        ECHO SHIFT & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880 & 880x880\\
        \bottomrule
    \end{longtable}
\end{table}
\end{document}

这是我目前所取得的成就

答案1

如果表格不适合你的页面,那么你的表格很可能是错误的,你不应该更改页面,而应该更改表格。我的第一个建议是切换到横向格式或使用旋转框仅旋转内容。

尽管如此,这里有一个我绝对不推荐的丑陋解决方案:

.... 
\begin{longtable}{>{\hspace*{-150pt}\centering\footnotesize\bfseries}m{0.01cm}>{\centering\footnotesize}m{2cm}>{\centering\footnotesize}m{2cm}>{\centering\footnotesize}m{2cm}>{\centering
.....

您应该能够以与 hspace* 类似的方式调整 hlines。

答案2

  • 您的表格太宽,无法放入纵向页面。
  • 要在同一页面上显示表格,只需使用包中定义的环境\subsubsection将表格旋转 90 度sidewaysrotating
  • 对于表格我将使用“tabularray package withbooktabs library (which loadbooktabs”包):
\documentclass[a4paper,11pt,twoside]{extbook}
%---------------- Show page layout. Don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\usepackage[english,italian]{babel}
\usepackage{microtype}
\usepackage{xcolor}
%---------------------------------------------------------------%
\usepackage{tabularray}                % <--- new
\UseTblrLibrary{booktabs}
  \ExplSyntaxOn
\NewChildSelector{eachtwo}
  {
    \int_step_inline:nnnn {4}{2}{\l_tblr_childs_total_tl}
      { \clist_put_right:Nn \l_tblr_childs_clist {##1} }
  }
\ExplSyntaxOff
%---------------------------------------------------------------%
\usepackage{rotating}                  % <--- new
\renewcommand{\textfraction}{.05}      % <--- new
\renewcommand{\floatpagefraction}{.95} % <--- new
 
\usepackage{hyperref}
\setlength\parindent{0pt}

\begin{document}
\subsubsection{SEQUENZE}

    \begin{table}[htp]
    \centering
    
    \begin{sideways}
\begin{talltblr}[
caption={abc},
  label={tab:sequence}
                ]{%
        colspec = {@{} Q[l,font=\bfseries] *{9}{c} @{}},
        row{2-Z} = {rowsep=0pt},
        row{eachtwo} = {abovesep=0.8ex},
                }
    \toprule
TIPOLOGIA   & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
    \midrule
PESATURA    & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
PIANO       & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\

\# STRATI   & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
SPESSORI (mm) 
            & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
GAP (mm)    & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
RIEMPIMENTO & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
COD AX      & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
COD SAG     & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
COD COR     & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
FOV (mm)    & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
RFOV (\%)   & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
\# ECHI     & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
GAP ECHI (ms) 
            & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
NSA& 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
TE (ms)     & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
TI (ms)     & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
MATRICE     & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
AA          & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
DE          & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
REPHASE     & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
ECHO SHIFT  & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
    \bottomrule
\end{talltblr}
    \end{sideways}
\end{table}
\end{document}

在此处输入图片描述

(红线显示页面布局)

顺便说一句:包hyperref应该(除极少数例外)在序言中最后加载。

附录: 如果允许使用\small字体大小并且表格可以突出到外部页面边框,那么使用该changepage包可以按如下方式编写表格:

\documentclass[a4paper,11pt,twoside]{extbook}
%---------------- Show page layout. Don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}

\usepackage[english,italian]{babel}
\usepackage{microtype}
\usepackage{xcolor}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
  \ExplSyntaxOn
\NewChildSelector{eachtwo}
  {
    \int_step_inline:nnnn {4}{2}{\l_tblr_childs_total_tl}
      { \clist_put_right:Nn \l_tblr_childs_clist {##1} }
  }
\ExplSyntaxOff

\usepackage[strict]{changepage}
\usepackage[skip=1ex, 
            font=small, labelfont=bf]{caption}
 
\usepackage{hyperref}
\setlength\parindent{0pt}

\begin{document}
\subsubsection{SEQUENZE}

    \begin{table}[htp]
    \centering
    \small
caption{abc},
  label{tab:sequence}
    
    \begin{adjustwidth*}{}{-\dimexpr\marginparwidth+\marginparsep}
\begin{tblr}{%
        colsep = 3.3pt,
        colspec = {@{} Q[l,font=\bfseries] *{9}{X[c]} @{}},
        row{2-Z} = {rowsep=0pt},
        row{eachtwo} = {abovesep=0.8ex},
                }
    \toprule
TIPOLOGIA   & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
    \midrule
PESATURA    & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
PIANO       & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\

\# STRATI   & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
SPESSORI (mm) 
            & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
GAP (mm)    & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
RIEMPIMENTO & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
COD AX      & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
COD SAG     & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
COD COR     & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
FOV (mm)    & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
RFOV (\%)   & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
\# ECHI     & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
GAP ECHI (ms) 
            & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
NSA& 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
TE (ms)     & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
TI (ms)     & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
MATRICE     & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
AA          & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
DE          & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
REPHASE     & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
ECHO SHIFT  & 880x880   & 880x880   & 880x880   & 880x880
            & 880x880   & 880x880   & 880x880   & 880x880 & 880x880 \\
    \bottomrule
\end{tblr}
    \end{adjustwidth*}
\end{table}
\lipsum[66]
\end{document}

在此处输入图片描述

相关内容