Brighton Sikarskie
Brighton Sikarskie

Reputation: 235

Latex Showing up on 2 pages, but the second page is correct

\documentclass{article}
\usepackage{makecell,multirow,tabularx}
\usepackage{graphicx}
\usepackage{xcolor,colortbl}
\usepackage{booktabs}

\usepackage[includefoot,margin=0.30in,headsep=0.0in,bottom=2.3in]{geometry}
\setlength{\headheight}{110pt}

\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}

\definecolor{tamu}{HTML}{500000}
\definecolor{lightgray}{HTML}{e9e7e8}

\usepackage{nicematrix}
\usepackage{booktabs}

\fancyhead[C]{

    \begin{NiceTabularX}{\textwidth}{| l | X | l |}[rules/color=tamu,rules/width=1mm]
    \CodeBefore
        \rowlistcolors{1}{red!15}
    \Body
    
    \toprule[1mm]
    Experiment Number       &       Experiment      &   Date                            \\[5pt]
                            &                       & \qquad  / \qquad  / \qquad\qquad\qquad  \\[5pt]
    \midrule[1mm]
    Name                    &       Lab Partners    &   CRN                             \\[5pt]
                            &                       &   \\[5pt]
    \bottomrule[1mm]
    \end{NiceTabularX}

}

\fancyfoot[c]{

    \begin{NiceTabularX}{\textwidth}{| X | X | X | X |}[rules/color=tamu,rules/width=1mm]
    \CodeBefore
        \rowlistcolors{1}{red!15}
    \Body
    
    \midrule[1mm]
    Signature               & Date                              & TA                & Date          \\[5pt]
                            &\qquad\qquad  / \qquad\qquad  / \qquad\qquad   &                   & \qquad\qquad  / \qquad\qquad  / \qquad\qquad \\[5pt]
    \bottomrule[1mm]
    \end{NiceTabularX}

}

\usepackage[T1]{fontenc}    
\usepackage[most]{tcolorbox}
\usepackage{lmodern} 
\usepackage{lipsum}

\begin{document}

\begin{tcolorbox}[enhanced,fit to height=8.25in,colframe=tamu,arc=0pt,outer arc=0pt,boxrule=1mm]

\end{tcolorbox}

\end{document}

The output of this code makes a 2 paged pdf, but I only want the second page. The first page is unneeded and I was wondering what I'm doing wrong since I think its making a second page since its overflowing, but I am not sure. I think the way I'm making the footer is a bit weird, but maybe I am doing it right, please let me know.

Output (Page 1): enter image description here

Output (Page 2): enter image description here

Also, if anyone can answer this I would be very happy. I have no clue why, but the borders seem to be drawn too far? What I mean is the top of the borders and maybe some other spots in the header and maybe footer are too long/bleed over where they should (see image below).

Weird borders: enter image description here

Upvotes: 1

Views: 181

Answers (1)

If you'll look into the .log file, you'll find the following warning

Overfull \vbox (19.15993pt too high) has occurred while \output is active []

This warning is caused by the tcolorbox which is taller than the available space on this page. Latex tries to fix this by moving it to the next page, hoping that if it'll be the very first thing on the page, it might fit.

You can avoid this by making your box a bit smaller, so that it's height is smaller (or equal) to the \textheight:

\documentclass{article}
\usepackage{makecell,multirow,tabularx}
\usepackage{graphicx}
\usepackage{xcolor,colortbl}
\usepackage{booktabs}

\usepackage[includefoot,margin=0.30in,headsep=0.0in,bottom=2.3in,showframe]{geometry}
\setlength{\headheight}{110pt}

\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}

\definecolor{tamu}{HTML}{500000}
\definecolor{lightgray}{HTML}{e9e7e8}

\usepackage{nicematrix}
\usepackage{booktabs}

\fancyhead[C]{

    \begin{NiceTabularX}{\textwidth}{| l | X | l |}[rules/color=tamu,rules/width=1mm]
    \CodeBefore
        \rowlistcolors{1}{red!15}
    \Body
    
    \toprule[1mm]
    Experiment Number       &       Experiment      &   Date                            \\[5pt]
                            &                       & \qquad  / \qquad  / \qquad\qquad\qquad  \\[5pt]
    \midrule[1mm]
    Name                    &       Lab Partners    &   CRN                             \\[5pt]
                            &                       &   \\[5pt]
    \bottomrule[1mm]
    \end{NiceTabularX}

}

\fancyfoot[c]{

    \begin{NiceTabularX}{\textwidth}{| X | X | X | X |}[rules/color=tamu,rules/width=1mm]
    \CodeBefore
        \rowlistcolors{1}{red!15}
    \Body
    
    \midrule[1mm]
    Signature               & Date                              & TA                & Date          \\[5pt]
                            &\qquad\qquad  / \qquad\qquad  / \qquad\qquad   &                   & \qquad\qquad  / \qquad\qquad  / \qquad\qquad \\[5pt]
    \bottomrule[1mm]
    \end{NiceTabularX}

}

\usepackage[T1]{fontenc}    
\usepackage[most]{tcolorbox}
\usepackage{lmodern} 
\usepackage{lipsum}

\begin{document}

\begin{tcolorbox}[enhanced,fit to height=\textheight,colframe=tamu,arc=0pt,outer arc=0pt,boxrule=1mm]

\end{tcolorbox}

\end{document}

Upvotes: 1

Related Questions