2

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?

7

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}
| improve this answer | |
  • @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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.