6

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}

page

  • \setlength{\headsep}{0pt} looks a little odd. – Heiko Oberdiek Jun 26 '13 at 0:14
7

\headheight/package fancyhdr

\headheight is set to 0.46cm = 13.08846pt. But the header set in page style fancy needs 14.96666pt. See the warning of package fancyhdr:

Package Fancyhdr Warning: \headheight is too small (13.08846pt): 
 Make it at least 14.96666pt.
 We now make it that large for the rest of the document.
 This may cause the page layout to be inconsistent, however.

As an emergency measure, package fancyhdr changes \headheight and "distroys" your page layout in the process. Therefore increase the \headheight to 15pt (or 14.96666pt) and correct the layout (smaller height of the text body to get room for the header, ...), e.g.:

\setlength{\headheight}{15pt}
\addtolength{\textheight}{0.46cm}% old \headheight
\addtolength{\textheight}{-15pt}% new \headheight

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 like geometry. Since the default for the standard classes (article, report, book) is letterpaper, specifying a4paper 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:

\usepackage[pass]{geometry}

Option pass prevents that package geometry does change the page layout. But it tells the output driver the paper size. Thus you should also get A4 with XeTeX.

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.