Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am using LyX to create a document and don't know how to add page numbers to my document.

This is what the TEX code part of my document looks like:

\fancyhf{}
\pagenumbering{arabic}
\makeatletter 
\@addtoreset{section}{part} 
\makeatother
\chead{nickecarlo}

I know I can get the page numbers back if I get rid of fancyhf{} but when I do that, my header which should only display "nickecarlo" also displays section titles and makes a mess out of everything.

Here's the initial code when I open the document in a text editor:

#LyX 2.0 created this file. For more info see http://www.lyx.org/
\lyxformat 413
\begin_document
\begin_header
\textclass article
\use_default_options true
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman default
\font_sans default
\font_typewriter default
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100

\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\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
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\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 Standard
\begin_inset ERT
status open

\begin_layout Plain Layout


\backslash
fancyhf{}
\end_layout

\begin_layout Plain Layout


\backslash
pagenumbering{arabic}
\end_layout

\begin_layout Plain Layout


\backslash
makeatletter 
\end_layout

\begin_layout Plain Layout


\backslash
@addtoreset{section}{part} 
\end_layout

\begin_layout Plain Layout


\backslash
makeatother
\end_layout

\begin_layout Plain Layout

I of course don't know what any of this means since I only use LyX to write out my college assignments. I'd appreciate a quick and easy fix. I just want page numbers to show on each and every page.

Sorry about my noob skills.

share|improve this question
    
My LyX said this is a corrupt file. Please upload the LaTeX export or take the LaTeX complete source from menu Edit. On the other hand, in this way you can receive also the help of non LyX users. –  Fran Jan 8 '13 at 20:48
    
@Fran Thanks for trying to help. The answer below did the trick. Apparently I was just missing the \cfoot{\thepage} part. –  Nicolás Carlo Jan 8 '13 at 21:04

1 Answer 1

up vote 3 down vote accepted

You do not say where you want to display the page numbers, but assuming you want to have them centered, in the footer, adding \cfoot{\thepage} will do.

\chead (centered, in header) and \cfoot (centered, in footer) is from the fancyhdr package, which is added when you choose the advanced (fancy) header style in Document --> Settings --> Page style. fancyhdrs manual will describe how that works in more detail. Replace the c with l or r for left and right respectively. \thepage prints the number of the current page.

share|improve this answer
    
That was all I needed. Thanks for your help. Again! :D –  Nicolás Carlo Jan 8 '13 at 21:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.