## LaTeX forum ⇒ LyX ⇒ Error in pdf generation, commands \headrule and \footrule

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
diazdeus
Posts: 5
Joined: Fri Sep 28, 2018 9:34 pm

### Error in pdf generation, commands \headrule and \footrule

I have an error when I try to generate the pdf archive (ps2pdf) of my document. This is the error:

LaTeX error: Command \headrule already defined.LaTeX error: Command \footrule already defined

This is the error description:

\newcommand\headrule{\setheadrule{.4\p@}}

This is the preamble:

\date{}\usepackage{fancyhdr}\usepackage{ifthen}\usepackage{graphicx}\usepackage{float}\usepackage{wrapfig}\usepackage{ccaption}\usepackage[labelsep=endash,font={small,it},labelformat=simple,labelfont=bf,figurewithin=none,justification=centering]{caption}\usepackage{textcomp}\usepackage{nccparskip}\usepackage{titlesec,titletoc,titleps} \titleformat{\chapter}[display]{\Large\bfseries\fillast\vspace{-25pt}}{\normalfont\bfseries\chaptername\hspace{5pt}\thechapter}{.5ex minus .1ex}{\Large}[\vspace{-15pt}] \makeatletter\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else\vspace*{\fill}\thispagestyle{empty}\newpage \if@twocolumn\hbox{}\newpage\fi\fi\fi}\makeatother
Last edited by Stefan Kottwitz on Fri Sep 28, 2018 10:26 pm, edited 1 time in total.
Reason: code marked

Stefan Kottwitz
Posts: 9316
Joined: Mon Mar 10, 2008 9:44 pm
Hi,

welcome to the forum!

The packages fancyhdr and titleps cause a conflict. Remove one of then in your preamble. If you don't need titleps, don't load it via \usepackage.

Stefan

diazdeus
Posts: 5
Joined: Fri Sep 28, 2018 9:34 pm
¡Thank you! Now, I can generate the final pdf archive. But I don't have the headers that I want; no header, it's blank. This is the code that I have used, just after of the \mainmatter command, to generate the headers. Is an even an odd document (two pages, side by side):

Last edited by Stefan Kottwitz on Fri Sep 28, 2018 11:20 pm, edited 1 time in total.
Reason: code marked

Stefan Kottwitz
I get headers with that code. Perhaps you did not set the twoside option to the document class. The headings are in twoside mode.