# Why the left margin in is bigger than the one set by using the “geometry” package?

I am working to the design of a book cover to be used on a user manual, and despite having set the right and left margins to 1cm by use of the geometry package, the left margin is approximately 4mm larger than required. The code I run is the following one:

\documentclass[a4paper,12pt]{book}
% Preamble

% Language settings
\usepackage[italian]{babel}

% Layout settings
\usepackage[a4paper, %
xetex, %
asymmetric, %
left=1.0cm, %
right=1.0cm, %
top=1.2cm, %
bottom=2cm, %
includefoot,centering]{geometry}  % cover page layout
\usepackage{fontspec}   % ttf font inclusion
\setmainfont{Arial}     % choice of main font

% Special commands
\newcommand{\subtitle}{Istruzioni originali} % Sottotitolo
\newcommand{\machineclass}{Partizionatrice scenica} % Classe di macchine
\newcommand{\machinename}{PEA} % Nome macchina
\newcommand{\ATEXclass}{Non-zona} % Classe ATEX
\newcommand{\hstep}{\hspace*{0.5cm}}

% Last page identifier package
\usepackage[]{pageslts}   % Needed for current page to total number of   pages calculation

% Numbering of \subsubsection and appearance in TOC

% Debug settings
\usepackage{checkend}

% General packages
\usepackage{color}
\definecolor{CIMBRIA_green}{rgb}{0,0.254901961,0.211764706}
\definecolor{CIMBRIA_sort}{rgb}{0,0.392156863,0.654901961}
\definecolor{CIMBRIA_red}{rgb}{0.909803922,0.266666667,0.152941176}
\usepackage[allbordercolors={1 1 1}]{hyperref}
\usepackage[code=Code39,H=0.8cm]{makebarcode}
\usepackage{siunitx}

% Preamble commands
\usepackage{makeidx}
\makeindex   % Index creation
\title{\machinename}  % Title

% Title
\newcommand*{\titleSEA}{\begingroup% Title page CIMBRIA
\raggedright
\colorbox{CIMBRIA_green}{
\parbox[t]{1.0\textwidth}{
\raggedright
{\textcolor{CIMBRIA_red}{CIMBRIA.COM | MI0003-IT}}\\[3\baselineskip]
{\textcolor{CIMBRIA_red}{\MakeUppercase{\subtitle}}}\\[0.5\baselineskip]
{\Huge\bfseries\textcolor{CIMBRIA_red}{\MakeUppercase{\machineclass}}}\\[3.0\baselineskip]
{\Large\bfseries\textcolor{CIMBRIA_sort}{\MakeUppercase{\machinename}}}\\[0.5\baselineskip]
{\textcolor{CIMBRIA_sort}{\MakeUppercase{\ATEXclass}}}
\par
}
}
\vfill
\endgroup}

% Body of the document
\begin{document}
\mainmatter
\pagenumbering{arabic}
\clearpage
\titleSEA\
\clearpage
\bigskip
\bigskip

\textbf{Istruzioni originali}
\bigskip

Numero identificativo: MI0004-IT

Data rilascio: 2016-02-02
\bigskip

Queste istruzioni sono in Italiano.

\barcode{MI0004-IT-02-2016}

\backmatter

\end{document}


Shown below the result I got edited with gimp to show clearly what I mean: as you can see, also the text inside the green box starts with an horizontal offset of nearly 6pt.

Summing up, my question is simple: why I get a larger left margin and a horizontal offset on the text inside the green box?

TeX gives clear warnings in the log that your title box did not fit in the line.

You had added word spaces from missing % at the end of the lines and not accounted for the \fboxsep padding around \colorbox.

Having removed the colorbox padding you might want to add some vertical padding at least but your left margin is now flush left:

\documentclass[a4paper,12pt]{book}
% Preamble

% Language settings
\usepackage[italian]{babel}

% Layout settings
\usepackage[a4paper, %
xetex, %
asymmetric, %
left=1.0cm, %
right=1.0cm, %
top=1.2cm, %
bottom=2cm, %
includefoot,centering]{geometry}  % cover page layout
\usepackage{fontspec}   % ttf font inclusion
\setmainfont{Arial}     % choice of main font

% Special commands
\newcommand{\subtitle}{Istruzioni originali} % Sottotitolo
\newcommand{\machineclass}{Partizionatrice scenica} % Classe di macchine
\newcommand{\machinename}{PEA} % Nome macchina
\newcommand{\ATEXclass}{Non-zona} % Classe ATEX
\newcommand{\hstep}{\hspace*{0.5cm}}

% Last page identifier package
\usepackage[]{pageslts}   % Needed for current page to total number of   pages calculation

% Numbering of \subsubsection and appearance in TOC

% Debug settings
\usepackage{checkend}

% General packages
\usepackage{color}
\definecolor{CIMBRIA_green}{rgb}{0,0.254901961,0.211764706}
\definecolor{CIMBRIA_sort}{rgb}{0,0.392156863,0.654901961}
\definecolor{CIMBRIA_red}{rgb}{0.909803922,0.266666667,0.152941176}
\usepackage[allbordercolors={1 1 1}]{hyperref}
\usepackage[code=Code39,H=0.8cm]{makebarcode}
\usepackage{siunitx}

% Preamble commands
\usepackage{makeidx}
\makeindex   % Index creation
\title{\machinename}  % Title

% Title
\newcommand*{\titleSEA}{\begingroup% Title page CIMBRIA
\raggedright
\setlength\fboxsep{0pt}%
\colorbox{CIMBRIA_green}{%%%%%
\parbox[t]{1.0\textwidth}{%%%%%(not as bad as the one above
\raggedright
{\textcolor{CIMBRIA_red}{CIMBRIA.COM | MI0003-IT}}\\[3\baselineskip]
{\textcolor{CIMBRIA_red}{\MakeUppercase{\subtitle}}}\\[0.5\baselineskip]
{\Huge\bfseries\textcolor{CIMBRIA_red}{\MakeUppercase{\machineclass}}}\\[3.0\baselineskip]
{\Large\bfseries\textcolor{CIMBRIA_sort}{\MakeUppercase{\machinename}}}\\[0.5\baselineskip]
{\textcolor{CIMBRIA_sort}{\MakeUppercase{\ATEXclass}}}%%%%
\par
}%%%%%
}%%%
\vfill
\endgroup}

% Body of the document
\begin{document}
\mainmatter
\pagenumbering{arabic}
\clearpage
\titleSEA
\clearpage
\bigskip
\bigskip

\textbf{Istruzioni originali}
\bigskip

Numero identificativo: MI0004-IT

Data rilascio: 2016-02-02
\bigskip

Queste istruzioni sono in Italiano.

\barcode{MI0004-IT-02-2016}

\backmatter

\end{document}

• @DavidCarlise. Thank you very much: your suggestion helped me a lot. I must also add that, apart from trying your suggestion, I removed also a vestigial (however harmless) centering parameter in geometry. – Daniele Tampieri Jul 29 '16 at 13:14
• @DavidCarlise. After a few try of your suggestion I decided to change my original parbox statement in the following one \parbox[b]{\dimexpr\textwidth - 2\fboxsep\relax}, in order to have the correct box length for every choice of \fboxsep. Also, in order to make the green box fill the space up to the upper margin of 1.2cm (top=1.2cm in the geometry package), changed the t position parameter to b. Regarding this latter choice I haven't seen any warning in the log file, but I'd like to know your opinion on this way of doing things. Thanks in advance – Daniele Tampieri Aug 3 '16 at 8:35