我正在设计一本用户手册的封面,尽管使用包将左右边距设置为 1cm geometry
,但左边距比要求的大约大 4mm。我运行的代码如下:
\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}
下面显示了我使用 gimp 编辑的结果,以清楚地显示我的意思:正如您所见,绿色框内的文本也以接近 6pt 的水平偏移开始。
总结一下,我的问题很简单:为什么我在绿色框内的文本上得到更大的左边距和水平偏移?
答案1
TeX 在日志中给出明确的警告,指出标题框不适合该行。
%
您在行尾添加了缺失的单词空格,但没有考虑到\fboxsep
周围的填充\colorbox
。
删除颜色框填充后,您可能至少想要添加一些垂直填充,但左边距现在与左齐平:
\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}