0

I'm having an issue with text overflowing the page length even though I'm using the geometry package to do my setup, as shown in:

enter image description here

I can overcome this by adding a increased bmargin parameter to geometry, but I'm thinking there might be an underlying problem here that needs fixing.

This suspicion is reinforced, somewhat, by a gap between some text and tikz table/diagrams which seems to vary in size in different places in the final document, for example:

enter image description here

I wonder if this might have something to do with some vbox code that wraps a longtable to make it work properly in a multicolumn? That was copied from environment to balance a table in a multicol and it is way beyond my ken, I'm afraid.

Code to demonstrate problem:

\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}

(I've provisionally tagged this with longtable and multicol as I've got use choose something, but that's only a guess! Do feel free to change as required.)

4
  • longtable basically does not support multicols The unvbox you show is a quick hack for simple cases but not very robust. You can help by adding \pagebreak or \newcolumn at suitable points Commented Nov 24, 2022 at 14:31
  • @DavidCarlisle: Many thanks. Is there a better way I should be doing long tables in multiple columns?
    – Ian
    Commented Nov 24, 2022 at 14:53
  • er you could ask that the maintainers of longtable and multicol talk to each other, but we've only known each other for 30 years... Alternatively you could use supertab/xtab which will work but doesn't preserve column widths across breaks, not sure about newer packages such as longtblr from tabularray package Commented Nov 24, 2022 at 14:59
  • Note that multicols works by making one very long column then splitting it, which confuses longtable to no end. Commented Nov 24, 2022 at 19:18

0

You must log in to answer this question.

Browse other questions tagged .