I was working with pdfLaTeX, and I set the size of the A4 paper; but for some reasons I have to change to XeLaTeX. And I realize that it isn't the same size of the paper, because the header and foot aren't in the correct place.
Can you explain or help me to fix it?
My code is:
\documentclass[10pt, a4paper]{article}
\usepackage{fontspec}
\setmainfont{Arial}
\usepackage{lipsum}
\usepackage[ampersand]{easylist}
\usepackage{tikz}
\setlength{\hoffset}{.46cm}
\setlength{\oddsidemargin}{0cm}
\setlength{\evensidemargin}{0cm}
\setlength{\marginparwidth}{0cm}
\setlength{\topmargin}{0cm}
\setlength{\marginparsep}{0cm}
\setlength{\headheight}{.46cm}
\setlength{\headsep}{0cm}
\setlength{\textheight}{24.2cm}
\setlength{\footskip}{.96cm}
\setlength{\textwidth}{15cm}
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{}%
\chead{}%Vac
\rhead{
\parbox[c]{12.6cm}{\footnotesize{TEXT\newline Text}}\parbox[t]{2cm}{\footnotesize{Text}}
}
\lfoot{}%
\cfoot{}
\rfoot{
\parbox[c]{7.35cm}{\footnotesize{Text \newline Text}}\parbox[c]{5.4cm} {\footnotesize{\thepage}}\parbox[t]{4cm}{\footnotesize{Text}}
}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
\begin{document}
\begin{titlepage}
\begin{center}
\begin{huge} \textbf{TEXT}\end{huge}\\
\vspace*{.4cm}
\begin{Large} \textbf{TEXT}\end{Large}\\
\vspace*{.4cm}
\begin{LARGE} \textbf{TEXT}\end{LARGE}\\
\vspace*{1.5cm}
\begin{tikzpicture}[scale=2.5]
\definecolor{rucv}{rgb}{.88,0.077,.1}
\definecolor{bucv}{rgb}{.001,.086,.55}
\draw(2.6,.58)node[color=bucv][font=\fontsize{20}{20}\sffamily\bfseries]{TEXT};
\draw(2.6,.3)node[color=bucv][font=\fontsize{20}{20}\sffamily\bfseries]{T\Large{EXT} \huge{T}\Large{EXT}};
\end{tikzpicture}
\vspace*{1cm}
\begin{LARGE} \textbf{"TEXT}\end{LARGE}\\
\vspace*{.5cm}
\begin{LARGE} \textbf{
TEXT"}\end{LARGE}\\
\vspace*{1cm}
\begin{large} TEXT:\end{large}\\
\vspace*{.6cm}
\begin{LARGE} \textbf{TEXT}\end{LARGE}\\
\vspace*{.8cm}
\begin{large}Elaborado por:\end{large}\\
\vspace*{.4cm}
\begin{Large} \textbf{Text}\end{Large}\\
\vspace*{.8cm}
\begin{large}Text:\end{large}\\
\vspace*{.4cm}
\vspace*{2cm}
\begin{Large} \textbf{TEXT}\end{Large}\\
\vspace*{.4cm}
\begin{Large} \textbf{2013}\end{Large}\\
\vspace*{.4cm}
\end{center}
\end{titlepage}
\tableofcontents
\newpage
\section{TITLE}
\section{TITLE}
\subsection{Subtitle}
\subsection{Subtitle}
\section{TITLE}
\lipsum
\subsection{Subtitle}
\subsection{Subtitle}
\subsubsection{Title}
\begin{easylist}
& Title
& Title
&& Subtitle
&&& Title
& Title
\end{easylist}
\subsubsection{Title}
\subsection{Subtitle}
\section{TITLE}
\subsection{Subtitle}
\subsubsection{Title}
\end{document}
Best Answer
\headheight
/packagefancyhdr
\headheight
is set to0.46cm
=13.08846pt
. But the header set in page style fancy needs14.96666pt
. See the warning of packagefancyhdr
:As an emergency measure, package
fancyhdr
changes\headheight
and "distroys" your page layout in the process. Therefore increase the\headheight
to15pt
(or14.96666pt
) and correct the layout (smaller height of the text body to get room for the header, ...), e.g.:Paper size for the output driver
LaTeX holds the paper size in the dimen registers
\paperwidth
and\paperheight
. It can be set by a document class option or packages likegeometry
. Since the default for the standard classes (article
,report
,book
) isletterpaper
, specifyinga4paper
is correct.However, the LaTeX kernel does not tell the paper size to the output driver, it does not deal with output drivers at all. :-(
Then it depends on the default of the output driver (pdfTeX, XeTeX, ...), which paper size is choosen.
Some packages like
geometry
,typearea
,hyperref
,pdftex.def
fill the gap that the LaTeX kernel leaves and tell the paper size to the output driver.The minimal example sets the layout manually without any of the packages above. For example package
geometry
, which can also be used for the page layout, can be used after the layout assignments at the end of the preamble:Option
pass
prevents that packagegeometry
does change the page layout. But it tells the output driver the paper size. Thus you should also get A4 with XeTeX.