使用多列和长表时文本溢出页面底部

使用多列和长表时文本溢出页面底部

尽管我使用几何包进行设置,但仍然遇到文本溢出页面长度的问题,如下所示:

在此处输入图片描述

我可以通过向几何图形添加更大的 bmargin 参数来克服这个问题,但我想这里可能存在一个需要修复的潜在问题。

这种怀疑在某种程度上得到了加强,因为一些文本和 tikz 表格/图表之间的间隙似乎在最终文档的不同位置大小有所不同,例如:

在此处输入图片描述

我想知道这是否与一些 vbox 代码有关,这些代码包装了 longtable,使其在多列中正常工作?这是从在多列中平衡表的环境恐怕这远远超出了我的理解范围。

演示问题的代码:

\documentclass[a4paper]{article}
\usepackage[a4paper, margin=5mm]{geometry}
\pagenumbering{gobble} 

\usepackage[T1]{fontenc}
\usepackage{tgadventor}
\renewcommand{\familydefault}{\sfdefault}

\usepackage[english]{babel}
\usepackage{ragged2e}
%\setlength\parindent{0pt}
\usepackage[parfill]{parskip}

\newcommand{\veryshortdummytext}{short dummy text.}
\newcommand{\shortdummytext}{short dummy text short dummy text short dummy text short dummy text short dummy text.}

\usepackage[x11names]{xcolor}
\usepackage{tikz} 
\usetikzlibrary{positioning, shapes.misc, shapes,arrows,chains, arrows.meta, calc, decorations.pathmorphing}
\usepackage{multirow}
\usepackage{array}
\usepackage{makecell}
\renewcommand{\cellalign}{cl}
\usepackage{lipsum}
\usepackage{layout}
\usepackage{longtable} 
\usepackage{multicol}
\usepackage{ifthen}
\usepackage{textcomp}
\usepackage{xkeyval}
\usepackage{xkvview}

\setlength\parindent{0pt}
 
\colorlet{ColIn1}{Blue1}  
\colorlet{ColIgnored1}{Blue1!20}   
\colorlet{ColIn2}{Red1}   
\colorlet{ColIgnored2}{Red1!20}   
\colorlet{ColOut}{Magenta3}   
\colorlet{ColIgnored3}{Magenta3!20}  

\tikzset{ 
    operation/.style={
        rounded rectangle, minimum size=6mm, 
        thick, draw=black, 
        font=\ttfamily 
    },
    Register/.style={
        rectangle,
        minimum height = 1cm,
        minimum width = 8cm,    
    },
    point/.style={circle, inner sep=0pt, minimum size=2pt, fill=red},
    sizenode/.style = {font=\fontsize{20}{20}\selectfont\bfseries\sffamily, white},
    node distance = 5mm and 10mm, 
    >=Kite, 
    every node/.style={transform shape}, 
}
    
\newcommand\Register[2]{ % location, caption
    \draw [thick]         
        (#1) +(0cm,0cm) -- +(8cm,0cm)  -- +(8cm,1cm)  -- +(0cm,1cm) -- cycle;
        
    \draw [thick]         
        (#1) +(0,0)  +(4,0) -- +(4,1);
        
    \draw [thin, dashed]  
        (#1) +(0,0)  +(2,0) -- +(2,1)  +(6,0) -- +(6,1); 
        
    \draw [very thin, dotted]  
        (#1) +(0,0)  +(1,0) -- +(1,1)  +(3,0) -- +(3,1)
             +(5,0) -- +(5,1)  +(7,0) -- +(7,1);
             
    \path (#1) +(0,1) node [above right] {#2};         
}


\newcommand\RegisterFull[5][32]{
    \fill [#3] (#2.south west) +(0,0) rectangle +(4,1);   
    \fill [#4] (#2.south west) +(4,0) rectangle +(8,1);
    
    \Register{#2.south west}{#5}
    \node [sizenode] at ($ (#2.south west) + (60mm, 5mm) $) {#1};
}


\newcommand\RRFullFull[2][]{
    \node (r1before) [Register] {};
    \RegisterFull{r1before}{ColIgnored1}{ColIn1}{};
    
    \node [Register, below=of r1before] (r1after) {};
    \RegisterFull{r1after}{ColIgnored1}{ColOut}{}
    
    \draw [black, dotted, rounded corners] 
        ($ (r1after.south west) - (0.2,0.2) $) rectangle  ($ (r1before.north east) + (0.2,0.2) $);
    \path (r1before.south west) ++(0,1.0) +(0,0.2) node [above right] {R\textsubscript{1}};  
    
    \node (op) [operation, right=of r1before]   {#2};
    
    \node [Register, right= of op] (r2) {};
    \RegisterFull{r2}{ColIgnored2}{ColIn2}{R\textsubscript{2}}
    
    \draw [->,thick,ColIn1]   (r1before.east) -- (op);
    \draw [->,thick,ColIn2] (r2.west) -- (op);
    \draw [->,thick,rounded corners,ColOut]  (op) |- (r1after.east);    

    \ifthenelse{\equal{#1}{}}{}{
        \node (bit) [ccbit, below right = 10mm and 10mm of op]  {#1};
        \draw [->,thick,black] (bit.north west) -- (op);
    }
}

\def\add{\raisebox{-1.2em}{\LARGE{+}}}
 
\newcommand{\inst}[1]{\textbf{#1}} 

\newcommand\Wrap[1]{
    \scalebox{0.3}{
        \begin{tikzpicture}[ scale=1.0, baseline=(current bounding box.center)]  % .north
            #1
            \useasboundingbox 
                ([shift={(0mm,2mm)}]current bounding box.north east) 
                rectangle 
                ([shift={(0mm,-2mm)}]current bounding box.south west);
        \end{tikzpicture}
    }
}


\newsavebox\ltmcbox

\setlength{\columnsep}{3.5mm}   
\begin{document}

\section*{xxx}

\begin{FlushLeft}

\begin{multicols*}{2}
\textbf{Author:} \shortdummytext

\textbf{Version:} \shortdummytext

\subsection*{Notes}
\shortdummytext
    
    \textbf{Notation:} \shortdummytext \shortdummytext \shortdummytext
    
    \begin{itemize}
        \item \shortdummytext \shortdummytext \shortdummytext
        
        \item \shortdummytext \shortdummytext 
        
        \item \shortdummytext \shortdummytext 
        
        \item \shortdummytext \shortdummytext  
        
        \item\shortdummytext \shortdummytext 
        
        \item \shortdummytext \shortdummytext 
        
        \item \shortdummytext 
        
        \item \shortdummytext 
    \end{itemize}
    
    \textbf{Program exceptions:} \shortdummytext 

\section*{xxx}
 
\subsection*{xxx}
\setlength{\columnsep}{2mm} 
    \begin{list}{}{}
        \item \veryshortdummytext
        \item \veryshortdummytext
                
            \begin{tabular}[t]{@{}l@{\hspace{1mm}}l@{}}
                0 & \veryshortdummytext \\
                1 & \veryshortdummytext \\
                2 & \veryshortdummytext \\
                3 & \veryshortdummytext \\
            \end{tabular}
        \item This line is missing
        \begin{itemize}
            \item \veryshortdummytext
        \end{itemize}
    \end{list}

    \setbox\ltmcbox\vbox{
        \makeatletter\col@number\@ne
        \small
        \begin{longtable}[t]{@{}l@{\hspace{1mm}}l@{\hspace{1mm}}c@{}}
            \inst{AR} & 
            R\textsubscript{1},R\textsubscript{2} &
            \Wrap{\RRFullFull{\add}} \\
            
            \inst{AR} & 
            R\textsubscript{1},R\textsubscript{2} &
            \Wrap{\RRFullFull{\add}} \\         
            
            \inst{AR} & 
            R\textsubscript{1},R\textsubscript{2} &
            \Wrap{\RRFullFull{\add}} \\         
            
            \inst{AR} & 
            R\textsubscript{1},R\textsubscript{2} &
            \Wrap{\RRFullFull{\add}} \\         
            
            \inst{AR} & 
            R\textsubscript{1},R\textsubscript{2} &
            \Wrap{\RRFullFull{\add}} \\         
            
            \inst{AR} & 
            R\textsubscript{1},R\textsubscript{2} &
            \Wrap{\RRFullFull{\add}} \\         
            
            \inst{AR} & 
            R\textsubscript{1},R\textsubscript{2} &
            \Wrap{\RRFullFull{\add}} \\         
            
            \inst{AR} & 
            R\textsubscript{1},R\textsubscript{2} &
            \Wrap{\RRFullFull{\add}} \\         
            
            \inst{AR} & 
            R\textsubscript{1},R\textsubscript{2} &
            \Wrap{\RRFullFull{\add}} \\         
            
            \inst{AR} & 
            R\textsubscript{1},R\textsubscript{2} &
            \Wrap{\RRFullFull{\add}} \\         
            
            \inst{AR} & 
            R\textsubscript{1},R\textsubscript{2} &
            \Wrap{\RRFullFull{\add}} \\         
            
            \inst{AR} & 
            R\textsubscript{1},R\textsubscript{2} &
            \Wrap{\RRFullFull{\add}} \\         
            
            \inst{AR} & 
            R\textsubscript{1},R\textsubscript{2} &
            \Wrap{\RRFullFull{\add}} \\         
            
            \inst{AR} & 
            R\textsubscript{1},R\textsubscript{2} &
            \Wrap{\RRFullFull{\add}} \\         
            
            \inst{AR} & 
            R\textsubscript{1},R\textsubscript{2} &
            \Wrap{\RRFullFull{\add}} \\         
            
            \inst{AR} & 
            R\textsubscript{1},R\textsubscript{2} &
            \Wrap{\RRFullFull{\add}} \\         
            
            \inst{AR} & 
            R\textsubscript{1},R\textsubscript{2} &
            \Wrap{\RRFullFull{\add}} \\         
            
            \inst{AR} & 
            R\textsubscript{1},R\textsubscript{2} &
            \Wrap{\RRFullFull{\add}} \\         
            
            \inst{AR} & 
            R\textsubscript{1},R\textsubscript{2} &
            \Wrap{\RRFullFull{\add}} \\         
            
            \inst{AR} & 
            R\textsubscript{1},R\textsubscript{2} &
            \Wrap{\RRFullFull{\add}} \\         
            
            \inst{AR} & 
            R\textsubscript{1},R\textsubscript{2} &
            \Wrap{\RRFullFull{\add}} \\         
 
        \end{longtable}
        \unskip
        \unpenalty
        \unpenalty
        }
    
    \unvbox\ltmcbox
    
\subsection*{xxx}
\setlength{\columnsep}{2mm} 
\begin{list}{}{}
    \item This line is missing too
    \item \veryshortdummytext 222
    
    \begin{tabular}[t]{@{}l@{\hspace{1mm}}l@{}}
        0 & \veryshortdummytext \\
        1 & \veryshortdummytext \\
        2 & \veryshortdummytext \\
        3 & \veryshortdummytext \\
    \end{tabular}
    \item \veryshortdummytext
    \begin{itemize}
        \item \veryshortdummytext
    \end{itemize}
\end{list}
     
\end{multicols*}
\end{FlushLeft} 
\end{document}

(我暂时用 longtable 和 multicol 标记了这个,因为我要选择一些东西,但这只是一个猜测!请随意根据需要进行更改。)

相关内容