Page LayoutPage prints larger than it is

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
pawhan11
Posts: 9
Joined: Mon Sep 22, 2014 10:27 am

Page prints larger than it is

Post by pawhan11 »

Hello,

I have strange problem. I create table with fixed width.

Code: Select all

documentclass[10pt,a4paper]{article}
\usepackage{array}
\usepackage{geometry}

 \geometry{
 a4paper,
 total={210mm,297mm},
 left=20mm,
 right=15mm,
 top=20mm,
 bottom=20mm,
 }

\begin{document}

\begin{center}
\begin{table}
\begin{tabular}{ | m{28mm} | m{30mm}| m{25mm}| m{25mm}| m{20mm}| m{30mm} } 
\hline
Nr katalogowy: & 2 & Nr seryjny: & 4 &Wynik: & Pass \\ 
\end{tabular}
\end{table}
\end{center}

\end{document}
And result is something like that
2r5rkao.png
2r5rkao.png (5.53 KiB) Viewed 2928 times
Why doesn't it fit in my page?? Page width is 210mm - margins it is 175mm of free space. Total table width should be 158mm so it should fit into that space.
Another problem is when I generate PDF and print it ( size as oryginal ) table columns are larger than I typed.

Thanks for any suggestions
Last edited by Johannes_B on Mon Sep 22, 2014 10:41 am, edited 1 time in total.

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

Page prints larger than it is

Post by Johannes_B »

You are missing out on the space between the columns called tabcolsep.

Code: Select all

\documentclass[10pt,a4paper]{article}
\usepackage{array}
\usepackage{showframe}
\usepackage{geometry}

\geometry{
	a4paper,
%	total={210mm,297mm},%You are giving this by a4paper
	left=20mm,
	right=15mm,
	top=20mm,
	bottom=20mm,
}

\begin{document}
Hello
\vspace{1cm}
%\begin{center}%No need for that
\begin{table}[!h]
		\setlength{\tabcolsep}{0pt}%<- This is added
%		between all columns
		\begin{tabular}{ | m{28mm} | m{30mm}| m{25mm}| m{25mm}| m{20mm}| m{30mm} }
			\hline
			Nr katalogowy: & 2 & Nr seryjny: & 4 &Wynik: & Pass \\
		\end{tabular}
	\end{table}
%\end{center}

\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.
pawhan11
Posts: 9
Joined: Mon Sep 22, 2014 10:27 am

Re: Page prints larger than it is

Post by pawhan11 »

Thanks! It solved my problem :)
Post Reply