Graphics, Figures & Tableslongtable overwrites bottom margin

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
peppefiore86
Posts: 4
Joined: Fri Jun 19, 2015 10:35 am

longtable overwrites bottom margin

Post by peppefiore86 »

Hi all,
I'm a newer Latex programmer.
I'm working on an existing project (I must fix some problems) and I have a problem with a longtable.
It overwrites the bottom margin and i lose one rows (in this case 1.14).
Please, could you help me with this issue?
Thanks.
Best regards,
Giuseppe
Attachments
001_Preview_Step_di_Produzione_29042015-105323.tex
main file
(263 Bytes) Downloaded 197 times
000_Setup.tex
setup
(2.91 KiB) Downloaded 219 times
020_Header.tex
header
(883 Bytes) Downloaded 204 times
060_Step_Produzione.tex
longtable
(5.85 KiB) Downloaded 210 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

longtable overwrites bottom margin

Post by Johannes_B »

Hi and welcome,

you need to do many things here.
Your head is too high, you get a warning, instead of setting the length manually, give it as option to geometry. There is other stuff going on, i tried to fix it.

Code: Select all

\documentclass[a4paper,12pt,landscape,pagesize]{scrartcl} 

\usepackage[a4paper,landscape]{geometry}
\geometry{
	top=1.5cm,
	bottom=1.5cm,
	left=2.0cm,
	headheight=95pt,
	includehead,
	right=1.5cm,
}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}% my editor uses the modern utf8 encoding

\usepackage[table]{xcolor} 

\usepackage{longtable}
\usepackage{tabularx}
\usepackage{multirow}
\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\arraybackslash}m{#1}}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}m{#1}}

\usepackage{booktabs}
\usepackage{scrlayer-scrpage}
\clearpairofpagestyles
\chead{\begin{tabularx}{\textwidth}{l>{\centering\arraybackslash}Xr}
\toprule 
	XXXXXXX & \textbf{TEST}  & 
		\begin{tabular}[c]{@{}l@{}}
			XXXXX\\ 
			{Pagina: \thepage \hspace{1pt} di \pageref{LastPage}}\\ 
		\end{tabular} 
	\\ 
\hline
\multicolumn{3}{|@{}X@{}|}{
		\begin{tabularx} {\textwidth} { L{4cm} L{5cm} L{2.7cm} L{5cm} L{2.7cm}  >{\raggedright\arraybackslash}X }
			\textbf{XXXXX} & XXXXX & \textbf{XXXXX} &  XXXXX & \textbf{XXXXX} & XXXXX	\\ 
			\textbf{XXXXX} & XXXXX & \textbf{XXXXX} &  XXXXX &   &  	\\ 
			\textbf{XXXXX} & XXXXX & \textbf{XXXXX} &    &   &  	\\ 
		\end{tabularx}
} \\
\hline
\end{tabularx}
}

\newcommand\invisiblesection[1]{%
  \refstepcounter{section}%
  \addcontentsline{toc}{section}{\protect\numberline{\thesection}#1}%
  \sectionmark{#1}}


%\usepackage{showframe}
\usepackage[italian]{babel}
\usepackage{hyperref}
\newcolumntype{A}[1]{>{\fontsize{6pt}{8pt}\selectfont\scshape}m{#1}}
\begin{document}

\section{Step di Produzione}

\begin{longtable}{|p{0.7cm}|p{13cm}|A{1cm}|A{1cm}|A{1cm}|A{1cm}|A{1cm}|A{1cm}|A{1cm}|A{1cm}| }
\hline
 \multicolumn{2}{|r|}{Data}  &  \multicolumn{2}{c|}{\rule{0pt}{1.5cm}}   &  \multicolumn{2}{c|}{\rule{0pt}{1.5cm}}   &  \multicolumn{2}{c|}{\rule{0pt}{1.5cm}}   &  \multicolumn{2}{c|}{\rule{0pt}{1.5cm}}  \\ 
 \hline 
\multicolumn{2}{|r|}{ISTRUZIONI }  &  Sigla &  Contro\-sigla   & Sigla &  Contro\-sigla   &  Sigla &  Contro\-sigla   &  Sigla & Contro\-sigla\\ 
 \hline 
\endhead


1.1 & Verificare il lancio e riportarne il numero:  &  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}\\ 
 \hline 
 1.2 & Verificare la corrispondenza dei dati variabili e delle condizioni di conservazione riportati sulle etichette imballo e pallet  ed allegare le etichette. &  &  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}\\ 
 \hline 
 1.3 & Verificare la pulizia del locale  ed accertarsi che non siano presenti materiali estranei alla lavorazione. &  &  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}\\ 
 \hline 
 1.4 & Verificare per i materiali di confezionamento la corrispondenza tra quanto riportato in etichetta e quanto previsto nella &  &  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}\\ 
 \hline 
 1.5 & Verificare lo stato e la presenza dell'etichetta ed allegarla sotto. &  &  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}\\ 
 \hline 
 1.6 & Apporre sulla macchina etichetta di lavorazione in corso riportante i dati identificativi del prodotto e della partita in lavorazione $10\,^{\circ}\mathrm{C}$ &  &  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}\\ 
 \hline
 1.7 & Apporre sulla macchina etichetta di lavorazione in corso riportante i dati identificativi del prodotto e della partita in lavorazione $10\,^{\circ}\mathrm{C}$ &  &  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}\\ 
 \hline
 1.8 & Apporre sulla macchina etichetta di lavorazione in corso riportante i dati identificativi del prodotto e della partita in lavorazione $10\,^{\circ}\mathrm{C}$ &  &  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}\\ 
 \hline
 1.9 & Apporre sulla macchina etichetta di lavorazione in corso riportante i dati identificativi del prodotto e della partita in lavorazione $10\,^{\circ}\mathrm{C}$ &  &  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}\\ 
 \hline
 1.10 & Apporre sulla macchina etichetta di lavorazione in corso riportante i dati identificativi del prodotto e della partita in lavorazione $10\,^{\circ}\mathrm{C}$ &  &  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}\\ 
 \hline
 1.11 & Apporre sulla macchina etichetta di lavorazione in corso riportante i dati identificativi del prodotto e della partita in lavorazione $10\,^{\circ}\mathrm{C}$ &  &  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}\\ 
 \hline
 1.12 & Apporre sulla macchina etichetta di lavorazione in corso riportante i dati identificativi del prodotto e della partita in lavorazione $10\,^{\circ}\mathrm{C}$ &  &  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}\\ 
 \hline
 1.13 & Apporre sulla macchina etichetta di lavorazione in corso riportante i dati identificativi del prodotto e della partita in lavorazione $10\,^{\circ}\mathrm{C}$ &  &  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}\\ 
\hline
1.14 & Apporre sulla macchina etichetta di lavorazione in corso riportante i dati identificativi del prodotto e della partita in lavorazione $10\,^{\circ}\mathrm{C}$ &  &  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}\\ 
\hline
1.15 & Apporre sulla macchina etichetta di lavorazione in corso riportante i dati identificativi del prodotto e della partita in lavorazione $10\,^{\circ}\mathrm{C}$ &  &  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}\\ 
\hline
1.16 & Apporre sulla macchina etichetta di lavorazione in corso riportante i dati identificativi del prodotto e della partita in lavorazione $10\,^{\circ}\mathrm{C}$ &  &  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}\\ 
\hline
1.17 & Apporre sulla macchina etichetta di lavorazione in corso riportante i dati identificativi del prodotto e della partita in lavorazione $10\,^{\circ}\mathrm{C}$ &  &  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}  & \cellcolor{gray!25}\\ 
\hline
\end{longtable} 


\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
peppefiore86
Posts: 4
Joined: Fri Jun 19, 2015 10:35 am

Re: longtable overwrites bottom margin

Post by peppefiore86 »

Hi Johannes_B,
thank you so much for your reply.
Unfortunately the page header and table header can't be modified :(.
Furthermore width of the table header must be the same of the table.
Have you other ideas?

Now I'm studying your attachment to find some indications.

Best regards,
Giuseppe
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

longtable overwrites bottom margin

Post by Johannes_B »

You need to set the headheight correct, otherwise the document will not come out directly. Period.

All other changes i made are optional.

Crosspost to TeX.SX
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
peppefiore86
Posts: 4
Joined: Fri Jun 19, 2015 10:35 am

Re: longtable overwrites bottom margin

Post by peppefiore86 »

It works!!! :D :D :D
I have added only "headheight=95pt,includehead" in \geometry options.
Thanks thanks thanks.
Now I hope that the remaining parts of document don't change :)

Bye and thanks,
Giuseppe
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: longtable overwrites bottom margin

Post by Johannes_B »

the 95 pt was the value needed for my example, your needed value should be a bit larger, as the table in the header is larger. Have a look at the log-file, the real value will be reported in there.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
peppefiore86
Posts: 4
Joined: Fri Jun 19, 2015 10:35 am

longtable overwrites bottom margin

Post by peppefiore86 »

Should be 110pt.
I've another question for you. is "\newgeometry{} ... \restoregeometry" a good option to use?
Because the final document is compose by more "\input" that use the same "000_Setup.tex".

For example:

Code: Select all

*********************************
\input{000_Setup.tex}
\begin{document}
\pagenumbering{arabic}
\pagestyle{empty}

% HEADER STAMP
\setlength{\headheight}{110pt}
\pagestyle{fancy}
% HEADER STAMP
\invisiblesection{Cover}
\input{AggTemp/Cover.tex}
\newpage
\tableofcontents
\section{XXX}
\input{AggTemp/XXX.tex}
\newpage
\section{YYY}
\input{AggTemp/YYY.tex}
\newpage
\section{ZZZ}
\input{AggTemp/ZZZ.tex}
\newpage
\section{KKK}
\input{AggTemp/KKK.tex}
\newpage

\end{document}
******************************
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

longtable overwrites bottom margin

Post by Johannes_B »

That is not enough information to say something useful. PLease open another topic, and add some explanations, best also to include a compilable minimal working example.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply