几何包中的“showframe”是否有等效项来查看垂直空间来自何处?

几何包中的“showframe”是否有等效项来查看垂直空间来自何处?

我正在制作一个有点复杂的自动报告,该报告结合了各种不同的浮点数等。例如,我有一个案例:

\documentclass{article}
\usepackage{fancyhdr}
\usepackage[scaled]{helvet}
\usepackage{amsmath}
\allowdisplaybreaks

\renewcommand\familydefault{\sfdefault}
\makeatletter
\makeatother

\usepackage[T1]{fontenc}
\usepackage[letterpaper,top=3cm,left=2.2cm,right=2.2cm]{geometry}
\usepackage{calc}
\usepackage{setspace}
\singlespacing

\usepackage[export]{adjustbox}
\setlength{\footskip}{50pt}
\setlength{\headheight}{35pt}
\renewcommand\headrulewidth{0pt}
\renewcommand\footrulewidth{0pt}
\fancyhfoffset[LH]{\oddsidemargin + \hoffset + 0.5in}
\fancyhfoffset[RH]{\oddsidemargin + \hoffset}
\geometry{headsep=10pt}

\usepackage{multirow}
\usepackage[table,xcdraw]{xcolor}

\usepackage{xspace}

\usepackage{hhline}
\usepackage{adjustbox}
\usepackage{amssymb}

\usepackage{titlesec}
\titlespacing\subsection{0pt}{12pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}
\titlespacing\subsubsection{0pt}{12pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}  % reduce the space after subsubsections
\begin{document}
\section{Section}
\subsection{Subsec}

\begin{table}[h]
\centering
\caption{summary table}\label{table:RM0}
\begin{tabular}{|c|c|c|c|c|}
\hline
Index & $test1$ & $test2$ & $test3$ & $test4$ \\
\hline
Value & 0.50 & 0.07 & 0.07 & 0.15 \\
\hline
\end{tabular}
\end{table}


\setlength{\arrayrulewidth}{1pt}
\begin{table}[h]
\caption{Big table}\label{table:RM0TP1}
\begin{adjustbox}{max width=\textwidth}
\centering
\begin{tabular}{|c|ll|c|c|c|c|c|c|}
\hline
\multicolumn{3}{|c|}{}& \textbf{test1}   & \multicolumn{2}{c|}{\textbf{test2}}& \multicolumn{2}{c|}{\textbf{test3}}& \textbf{test4}  \\ \cline{4-9}
\multicolumn{3}{|c|}{\multirow{-2}{*}{\textbf{Index label}}}   & \textbf{}& \textbf{\begin{tabular}[c]{@{}c@{}}longer\\ title\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}longer\\ title\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}longer\\ title\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}longer\\ title\end{tabular}} & \textbf{}\\ \hline
\multicolumn{3}{|c|}{Max} & 0.50 & \multicolumn{2}{c|}{ 4.78E-02 }& \multicolumn{2}{c|}{ 4.78E-02 }& 0.11 \\ \hline
\multicolumn{3}{|c|}{Index}& \cellcolor[HTML]{656565} & 4.78E-02  & 4.78E-02 & 4.78E-02 & 4.78E-02 & \cellcolor[HTML]{656565} \\ \hline
& xxx at xxx& (xxx)& 1.35 & \cellcolor[HTML]{656565} & \cellcolor[HTML]{656565}& \cellcolor[HTML]{656565} & \cellcolor[HTML]{656565}& \cellcolor[HTML]{656565} \\ \hhline{|~|--------}
& xxx& (xX)& \cellcolor[HTML]{656565} & \multicolumn{2}{c|}{ 1.38 }& \multicolumn{2}{c|}{ 1.38 }& 1.38  \\ \hhline{|~|--------}
& xxx& (xX)& \cellcolor[HTML]{656565} & \multicolumn{2}{c|}{ 1.38 } & \multicolumn{2}{c|}{ 1.38 } & \cellcolor[HTML]{656565} \\ \hhline{|~|--------}
& xxx   & (xy)& \cellcolor[HTML]{656565} & \cellcolor[HTML]{656565} & 1.73  & \cellcolor[HTML]{656565} & \cellcolor[HTML]{656565}& \cellcolor[HTML]{656565} \\ \hhline{|~|--------}
& xxx   & (xy)& \cellcolor[HTML]{656565} & \cellcolor[HTML]{656565} & \cellcolor[HTML]{656565}& \cellcolor[HTML]{656565} & 1.73 & \cellcolor[HTML]{656565} \\ \hhline{|~|--------}
& xxx & (xy)& 1.73 & \cellcolor[HTML]{656565} & \cellcolor[HTML]{656565}& \cellcolor[HTML]{656565} & \cellcolor[HTML]{656565}& \cellcolor[HTML]{656565} \\ \hhline{|~|--------}
& xxx& (xy)& 1.73 & \cellcolor[HTML]{656565} & \cellcolor[HTML]{656565}& \cellcolor[HTML]{656565} & \cellcolor[HTML]{656565}& \cellcolor[HTML]{656565} \\ \hhline{|~|--------}
\multirow{-8}{*}{\begin{tabular}[c]{@{}c@{}}blah\\ blah \end{tabular}} & xxx & (MAB)& 7.30 & \multicolumn{2}{c|}{ 7.30 } & \multicolumn{2}{c|}{ 7.30 } & 7.30 \\ \hline
& xxx& (AB)& 2560 & \cellcolor[HTML]{656565} & \cellcolor[HTML]{656565}& \cellcolor[HTML]{656565} & \cellcolor[HTML]{656565}& \cellcolor[HTML]{656565} \\ \hhline{|~|--------}
& xxx& (AB)& 20 & \cellcolor[HTML]{656565} & \cellcolor[HTML]{656565}& \cellcolor[HTML]{656565} & \cellcolor[HTML]{656565}& \cellcolor[HTML]{656565} \\ \hhline{|~|--------}
& xxx&& 1 & \cellcolor[HTML]{656565} & \cellcolor[HTML]{656565}& \cellcolor[HTML]{656565} & \cellcolor[HTML]{656565}& \cellcolor[HTML]{656565} \\ \hhline{|~|--------}
& xxx at xxx & (xyz)  & 110.3 & \cellcolor[HTML]{656565} & \cellcolor[HTML]{656565}& \cellcolor[HTML]{656565} & \cellcolor[HTML]{656565}& \cellcolor[HTML]{656565} \\ \hhline{|~|--------}
& xxx at xxx or xxx & (xX/yy) & 1.6 & \cellcolor[HTML]{656565} & \cellcolor[HTML]{656565}& \cellcolor[HTML]{656565} & \cellcolor[HTML]{656565}& \cellcolor[HTML]{656565} \\ \hhline{|~|--------}
& xxx at xxx or xxx& (xX/yy) & 3.9 & \cellcolor[HTML]{656565} & \cellcolor[HTML]{656565}& \cellcolor[HTML]{656565} & \cellcolor[HTML]{656565}& \cellcolor[HTML]{656565} \\ \hhline{|~|--------}
\multirow{-7}{*}{\begin{tabular}[c]{@{}c@{}}blah\\ blah\end{tabular}} & xxx at xxx & (xyz)& 2.10 & \cellcolor[HTML]{656565} & \cellcolor[HTML]{656565}& \cellcolor[HTML]{656565} & \cellcolor[HTML]{656565}& \cellcolor[HTML]{656565} \\ \hline
\rowcolor[HTML]{656565} 
 & \multicolumn{2}{c|}{\cellcolor[HTML]{656565}} & &   & &   & & \\ \hline
\multirow{3}{*}{\begin{tabular}[c]{@{}c@{}}blah\\ blah\\ blah\end{tabular}} & \multicolumn{2}{l|}{ Something } & \multicolumn{1}{c|}{ \checkmark } & \multicolumn{1}{c|}{ \checkmark } & \multicolumn{1}{c|}{ \checkmark } & \multicolumn{1}{c|}{ \checkmark } & \multicolumn{1}{c|}{ \checkmark } & \multicolumn{1}{c|}{ \checkmark }\\ \hhline{|~|--------}
 & \multicolumn{2}{c|}{}& &   & &   & & \\ \hhline{|~|--------}
 & \multicolumn{2}{c|}{}& &   & &   & & \\ \hline
\multicolumn{9}{|l|}{NOTE 1   blah blah blah.}  \\
\multicolumn{9}{|l|}{NOTE 2   blah blah balh.}\\
\multicolumn{9}{|l|}{\begin{tabular}[c]{@{}l@{}}NOTE 3   blah blah\\ blah blah.\end{tabular}}\\
\multicolumn{9}{|l|}{\begin{tabular}[c]{@{}l@{}}NOTE 4   blah \\ blah.\end{tabular}}\\
\multicolumn{9}{|l|}{\begin{tabular}[c]{@{}l@{}}NOTE 5   blah \\ blah.\end{tabular}}\\
\multicolumn{9}{|l|}{\begin{tabular}[c]{@{}l@{}}NOTE 6   blah\\ blah\end{tabular}}\\
\multicolumn{9}{|l|}{\begin{tabular}[c]{@{}l@{}}NOTE 7   blah\\ blah.\end{tabular}}\\ \hline
\end{tabular}
\end{adjustbox}
\end{table}



\end{document}

我希望它们能放在同一页上(而且有足够的空间),但如果不在小表\vspace{-5mm}之间\end{tabular}和大表的末尾添加,我就无法做到这一点。这有点不雅,我担心当我以编程方式向报告模板添加部分时,它可能无法很好地扩展。\end{table}\vspace{-10mm}

我尝试弄乱浮动分隔和部分间距的定义,但都没有奏效。我很想能够看到浮动的“边距”,就像你可以通过几何的“showframe”看到边距一样。

有什么想法吗?

编辑:使示例可行,尽管绝对不小/最小。我希望这样没问题。

答案1

请尝试以下操作:

\documentclass{article}
\usepackage{fancyhdr}
\usepackage[scaled]{helvet}
\usepackage{amsmath}
\allowdisplaybreaks

\renewcommand\familydefault{\sfdefault}
\makeatletter
\makeatother

\usepackage[T1]{fontenc}
\usepackage[letterpaper,top=3cm,left=2.2cm,right=2.2cm]{geometry}
\usepackage{calc}
\usepackage{setspace}
\singlespacing

\usepackage[export]{adjustbox}
\renewcommand{\textfraction}{0.07}  % allow minimal text w. figs

\setlength{\footskip}{50pt}
\setlength{\headheight}{35pt}
\renewcommand\headrulewidth{0pt}
\renewcommand\footrulewidth{0pt}
\fancyhfoffset[LH]{\oddsidemargin + \hoffset + 0.5in}
\fancyhfoffset[RH]{\oddsidemargin + \hoffset}
\geometry{headsep=10pt}

\usepackage{hhline}
\usepackage{makecell, multirow}
\renewcommand\theadfont{\normalsize\bfseries}
\renewcommand\theadgape{}

\usepackage[table,xcdraw]{xcolor}
\newcommand\ccg{\cellcolor[HTML]{656565}}

\usepackage{xspace}

\usepackage{adjustbox}
\usepackage{amssymb}

\usepackage{titlesec}
\titlespacing\subsection{0pt}{12pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}
\titlespacing\subsubsection{0pt}{12pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}  % reduce the space after subsubsections

%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
\section{Section}
\subsection{Subsec}

\begin{table}[ht]
\centering
\caption{summary table}\label{table:RM0}
\begin{tabular}{|c|c|c|c|c|}
\hline
Index & $test1$ & $test2$ & $test3$ & $test4$ \\
\hline
Value & 0.50 & 0.07 & 0.07 & 0.15 \\
\hline
\end{tabular}
\end{table}

\setlength{\arrayrulewidth}{1pt}
\begin{table}[ht]
\caption{Big table}\label{table:RM0TP1}
\centering
\begin{tabular}{|c|ll|c|c|c|c|c|c|}
\hline
\multicolumn{3}{|c|}{}& \textbf{test1}   & \multicolumn{2}{c|}{\textbf{test2}}& \multicolumn{2}{c|}{\textbf{test3}}& \textbf{test4}  \\ \cline{4-9}
\multicolumn{3}{|c|}{\multirow{-2}{*}{\textbf{Index label}}}   
    &   & \thead{longer\\ title} & \thead{longer\\ title} 
        & \thead{longer\\ title} & \thead{longer\\ title} 
        &       \\  \hline
\multicolumn{3}{|c|}{Max} & 0.50 & \multicolumn{2}{c|}{ 4.78E-02 }& \multicolumn{2}{c|}{ 4.78E-02 }& 0.11 \\ \hline
\multicolumn{3}{|c|}{Index}& \ccg & 4.78E-02  & 4.78E-02 & 4.78E-02 & 4.78E-02 & \ccg \\ \hline
& xxx at xxx& (xxx)& 1.35 & \ccg & \ccg& \ccg & \ccg& \ccg \\ \hhline{|~|--------}
& xxx& (xX)& \ccg & \multicolumn{2}{c|}{ 1.38 }& \multicolumn{2}{c|}{ 1.38 }& 1.38  \\ \hhline{|~|--------}
& xxx& (xX)& \ccg & \multicolumn{2}{c|}{ 1.38 } & \multicolumn{2}{c|}{ 1.38 } & \ccg \\ \hhline{|~|--------}
& xxx   & (xy)& \ccg & \ccg & 1.73  & \ccg & \ccg& \ccg \\ \hhline{|~|--------}
& xxx   & (xy)& \ccg & \ccg & \ccg& \ccg & 1.73 & \ccg \\ \hhline{|~|--------}
& xxx & (xy)& 1.73 & \ccg & \ccg& \ccg & \ccg& \ccg \\ \hhline{|~|--------}
& xxx& (xy)& 1.73 & \ccg & \ccg& \ccg & \ccg& \ccg \\ \hhline{|~|--------}
\multirow{-8}{*}{\begin{tabular}[c]{@{}c@{}}blah\\ blah \end{tabular}} & xxx & (MAB)& 7.30 & \multicolumn{2}{c|}{ 7.30 } & \multicolumn{2}{c|}{ 7.30 } & 7.30 \\ \hline
& xxx& (AB)& 2560 & \ccg & \ccg& \ccg & \ccg& \ccg \\ \hhline{|~|--------}
& xxx& (AB)& 20 & \ccg & \ccg& \ccg & \ccg& \ccg \\ \hhline{|~|--------}
& xxx&& 1 & \ccg & \ccg& \ccg & \ccg& \ccg \\ \hhline{|~|--------}
& xxx at xxx & (xyz)  & 110.3 & \ccg & \ccg& \ccg & \ccg& \ccg \\ \hhline{|~|--------}
& xxx at xxx or xxx & (xX/yy) & 1.6 & \ccg & \ccg& \ccg & \ccg& \ccg \\ \hhline{|~|--------}
& xxx at xxx or xxx& (xX/yy) & 3.9 & \ccg & \ccg& \ccg & \ccg& \ccg \\ \hhline{|~|--------}
\multirow{-7}{*}{\begin{tabular}[c]{@{}c@{}}blah\\ blah\end{tabular}} & xxx at xxx & (xyz)& 2.10 & \ccg & \ccg& \ccg & \ccg& \ccg \\ \hline
\rowcolor[HTML]{656565}
    & & & & & & & & \\ \hline
\multirow{3}{*}{\begin{tabular}[c]{@{}c@{}}blah\\ blah\\ blah\end{tabular}} & \multicolumn{2}{l|}{ Something } & \checkmark & \checkmark & \checkmark & \checkmark & \checkmark & \checkmark \\ 
    \hhline{|~|--------}
 & \multicolumn{2}{c|}{}& &   & &   & & \\ \hhline{|~|--------}
 & \multicolumn{2}{c|}{}& &   & &   & & \\ \hline
\multicolumn{9}{|l|}{NOTE 1   blah blah blah.}  \\
\multicolumn{9}{|l|}{NOTE 2   blah blah balh.}\\
\multicolumn{9}{|l|}{\begin{tabular}[c]{@{}l@{}}NOTE 3   blah blah\\ blah blah.\end{tabular}}\\
\multicolumn{9}{|l|}{\begin{tabular}[c]{@{}l@{}}NOTE 4   blah \\ blah.\end{tabular}}\\
\multicolumn{9}{|l|}{\begin{tabular}[c]{@{}l@{}}NOTE 5   blah \\ blah.\end{tabular}}\\
\multicolumn{9}{|l|}{\begin{tabular}[c]{@{}l@{}}NOTE 6   blah\\ blah\end{tabular}}\\
\multicolumn{9}{|l|}{\begin{tabular}[c]{@{}l@{}}NOTE 7   blah\\ blah.\end{tabular}}\\ \hline
\end{tabular}
\end{table}
\end{document}

这使:

在此处输入图片描述

问题出现是因为大部分页面占用了浮动table(我将两个表格合并为一个)。我用 更改了文本和浮动之间的比例\renewcommand{\textfraction}{0.07}。我还使用makecell包部分简化了您的代码。对于下面的注释,大表格也可以简化,但暂时我没有足够的空闲时间 :-(

相关内容