I've started using LyX to write technical specification documents. As a result of numerous hasty Google searches (many ending at this site) I have cobbled together a LyX file that mostly delivers what I'm after.
However, I've found that when I render it to PDF using xetex my first page after the title (a Part) seems to always be vertically misaligned relative to the other pages.
Question: what have I overlooked / mangled ?
Note that I've got some stuff in my preamble to make Parts look like Chapters (can't remember why anymore).
My MWE is below, if you process it to PDF using XeTeX you'll find that the heading for "Document Control" is vertically misaligned relative to "Background Information". All my other Parts (not in the MWE) align with the "Background Information" part. My tests indicate that it doesn't matter which is the first Part - it will always misalign (viewed in OSX Preview.app with 2-page view):
The mis-alignment extends as far as the footer. So it's like the entire page body has been vertically bumped up a number of pixels
I've found that changing the size of the header image (logo.png) causes the scale of the mis-alignment to change.
Being a total newbie to TeX I am at a loss to explain it.
MWE
logo.png is 464px x 60px
The documentclass is report
#LyX 2.0 created this file. For more info see http://www.lyx.org/
\lyxformat 413
\begin_document
\begin_header
\textclass report
\begin_preamble
\usepackage[a4paper]{geometry}
\usepackage[table]{xcolor}
\usepackage{background}
\usepackage{lastpage}
\usetikzlibrary{calc,shapes,arrows}
%tables
\arrayrulecolor[RGB]{127,127,127}
\setlength{\arrayrulewidth}{0.25mm}
\usepackage[explicit]{titlesec}
% make part like a chapter
\titleclass{\part}{top}
\titleformat{\part}
[display]
{\normalfont\Huge\bfseries}
{\titlerule[5pt]\vspace{3pt}\titlerule[2pt]\vspace{3pt}\MakeUppercase{\partname} \thepart}
{0pt}
{\titlerule[2pt]\vspace{1pc}\huge\MakeUppercase{#1}}
\titlespacing*{\part}{0pt}{0pt}{20pt}
% make chapter like a section (no newpage)
\titleclass{\chapter}{straight}
\titleformat{\chapter}
[display]
{\centering\normalfont\Huge\bfseries}
{\titlerule[5pt]\vspace{3pt}\titlerule[2pt]\vspace{3pt}\MakeUppercase{\chaptertitlename} \thechapter}
{0pt}
{\titlerule[2pt]\vspace{6pt}\huge\MakeUppercase}
\titlespacing*{\chapter}{0pt}{0pt}{40pt}
% make section have a background
\titleformat{\section}
[display]
{\normalfont\Large\bfseries}
{\thesection}
{0pt}
{\colorbox{blue!20}{\parbox{\dimexpr\textwidth-2\fboxsep}{#1}}}
%
% make subsubsection italicised
\titleformat{\subsubsection}
[display]
{\normalfont\bfseries}
{\thesubsubsection}
{0pt}
{\textit{#1}}
%
%Document variables
\newcommand*{\customer}{Foo}
\newcommand*{\customerlong}{Bar}
\newcommand*{\docversion}{Draft Version 0.0.1}
%Page footer - horiz line
\def\footrule{{
\vskip-\footruleskip\vskip-\footrulewidth
\color{\footrulecolor}
\hrule\@width\headwidth\@height
\footrulewidth\vskip\footruleskip
}}
%page borders
\pagestyle{fancy}
\fancyhf{}
\setlength\headheight{12pt}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{1pt}
\newcommand{\footrulecolor}{blue}
%page candy
\fancypagestyle{plain}{%
\fancyhf{} % clear all header and footer fields
\fancyhead[C]{\includegraphics{logo.png}}
%\fancyfoot[C]{\bfseries \thepage} % except the center
\fancyfoot[L]{\textbf{\textcolor{orange}{\scriptsize Confidential}}}
\fancyfoot[C]{\textbf{\textcolor{blue}{\Large website.com}} }
\fancyfoot[R]{\textbf{\textcolor{orange}{\scriptsize Page \thepage\ of \pageref{LastPage} }} }
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{1pt}
\renewcommand{\footrulecolor}{blue}
}
\end_preamble
\options demo
\use_default_options true
\begin_modules
theorems-ams
eqs-within-sections
figs-within-sections
customHeadersFooters
\end_modules
\maintain_unincluded_children false
\begin_local_layout
\end_local_layout
\language british
\language_package default
\inputencoding auto
\fontencoding global
\font_roman lmodern
\font_sans lmss
\font_typewriter lmtt
\font_default_family sfdefault
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100
\graphics xetex
\default_output_format pdf4
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize 12
\spacing single
\use_hyperref false
\papersize a4paper
\use_geometry true
\use_amsmath 1
\use_esint 1
\use_mhchem 1
\use_mathdots 1
\cite_engine basic
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\use_refstyle 1
\index Index
\shortcut idx
\color #008000
\end_index
\leftmargin 2cm
\topmargin 2cm
\rightmargin 2cm
\bottommargin 4.75cm
\headsep 1cm
\footskip 2.5cm
\secnumdepth -1
\tocdepth 0
\paragraph_separation skip
\defskip 16pt
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle fancy
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header
\begin_body
\begin_layout Center Header
\begin_inset Graphics
filename logo.png
\end_inset
\end_layout
\begin_layout Center Footer
\begin_inset ERT
status open
\begin_layout Plain Layout
\backslash
textbf{
\backslash
textcolor{blue}{
\backslash
Large website.com}}
\end_layout
\end_inset
\end_layout
\begin_layout Left Footer
\begin_inset ERT
status open
\begin_layout Plain Layout
\backslash
textbf{
\backslash
textcolor{orange}{
\backslash
scriptsize Confidential}}
\end_layout
\end_inset
\end_layout
\begin_layout Right Footer
\begin_inset ERT
status open
\begin_layout Plain Layout
\backslash
textbf{
\backslash
textcolor{orange}{
\backslash
scriptsize Page
\backslash
thepage
\backslash
of
\backslash
pageref{LastPage} }}
\end_layout
\end_inset
\end_layout
\begin_layout Title
\begin_inset Graphics
filename logo.png
\end_inset
\begin_inset Newline newline
\end_inset
Specification
\begin_inset Newline newline
\end_inset
\begin_inset ERT
status open
\begin_layout Plain Layout
\backslash
docversion
\end_layout
\end_inset
\begin_inset Newline newline
\end_inset
\begin_inset ERT
status open
\begin_layout Plain Layout
\backslash
\end_layout
\end_inset
\begin_inset Newline newline
\end_inset
\begin_inset ERT
status open
\begin_layout Plain Layout
\backslash
customerlong
\end_layout
\end_inset
\begin_inset Newline newline
\end_inset
A Title
\end_layout
\begin_layout Part*
\lang english
Document Control
\end_layout
\begin_layout Section*
\lang english
Copyright
\end_layout
\begin_layout Standard
\lang english
Generic blurb
\end_layout
\begin_layout Section*
\lang english
Document Version History
\end_layout
\begin_layout Standard
a table
\end_layout
\begin_layout Part*
Background Information
\end_layout
\begin_layout Section*
Project Taxonomy
\end_layout
\begin_layout Standard
a table
\end_layout
\begin_layout Section*
Stakeholders
\end_layout
\begin_layout Itemize
List of direct project stakeholders
\end_layout
\begin_layout Section*
Other Parties
\end_layout
\begin_layout Itemize
List of ancialliary parties
\end_layout
\begin_layout Section*
Exclusions
\end_layout
\begin_layout Standard
Generic stuff
\end_layout
\begin_layout Section*
Another Heading
\end_layout
\begin_layout Standard
Some useful information
\end_layout
\begin_layout Section*
Another Heading
\end_layout
\begin_layout Standard
Some useful information
\end_layout
\begin_layout Section*
Another Heading
\end_layout
\begin_layout Standard
Some useful information
\end_layout
\end_body
\end_document
Update
Further testing has indicated that simply having some plain text after the title will produce the same offset effect - so it's not the Part definitions that are having the problem.
\documentclass
is used. Thelyx
output is not really helpful, in my point of view.\begin_preamble
and insert\documentclass{report}
something.lyx
and open it in LyX. Now it's not valid anything! One can export LaTeX source code from LyX, request that instead.