[Tex/LaTex] Why the left margin in is bigger than the one set by using the “geometry” package

horizontal alignmentmargins

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
                          % in headers and footers

% Numbering of \subsubsection and appearance in TOC
\addtocounter{secnumdepth}{1}  % section numbering (add 1 to standard secnumdepth)
\addtocounter{tocdepth}{1}     % TOC numbering (add 1 to standard tocnumdepth)

% 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}
\thispagestyle{empty} % Remove page numbering on this page
\clearpage
\titleSEA\
\clearpage
Copyright\copyright\ 2016 Cimbria S.r.l.
\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.
Cover page with larger left margin

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

Best Answer

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:

enter image description here

\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
                          % in headers and footers

% Numbering of \subsubsection and appearance in TOC
\addtocounter{secnumdepth}{1}  % section numbering (add 1 to standard secnumdepth)
\addtocounter{tocdepth}{1}     % TOC numbering (add 1 to standard tocnumdepth)

% 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}
\thispagestyle{empty} % Remove page numbering on this page
\clearpage
\titleSEA
\clearpage
Copyright\copyright\ 2016 Cimbria S.r.l.
\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}