LaTeX forum ⇒ LyXError 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

Postby diazdeus » Fri Sep 28, 2018 9:44 pm

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:

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

User avatar
Stefan Kottwitz
Site Admin
Posts: 9229
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Fri Sep 28, 2018 10:31 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
Site admin

diazdeus
Posts: 5
Joined: Fri Sep 28, 2018 9:34 pm

Postby diazdeus » Fri Sep 28, 2018 11:19 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):

  1. \setlength{\headheight}{15pt}
  2. \fancyhf{}
  3. \fancyhead[LE,RO]{\fancyplain{}{\bfseries\thepage}}
  4. \fancyhead[RE,LO]{\fancyplain{}{{\bfseries\chaptername \,\thechapter}-\,\itshape\thesection}}
  5. \renewcommand{\headrulewidth}{0.4pt}
  6. \renewcommand{\footrulewidth}{0.4pt}
Last edited by Stefan Kottwitz on Fri Sep 28, 2018 11:20 pm, edited 1 time in total.
Reason: code marked

User avatar
Stefan Kottwitz
Site Admin
Posts: 9229
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Sat Sep 29, 2018 4:10 pm

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

Stefan
Site admin


Return to “LyX”

Who is online

Users browsing this forum: No registered users and 4 guests