1

Writing a thesis with Lyx, I had only page number on even pages. Here is where this seems to be configured in the page

\lfoot[\thepage]{}
\cfoot{}
\rfoot[]{\thepage}

In the master document I fixed this by changing the third line to \rfoot[]{\thepage}̀.

But in another document I don't manage to change page numbering on unevenpages. I would like to number uneven pages on the right side. This answer explains how to insert Custom Header/Footerines, but it doesn't explain how to add the Even header elements I see in the screenshot below of the thesis template. How to insert these red on grey background elements I see in the screenshot below?

enter image description here

I posted an example file as a gist testpagenumber.lyx (and also the tex version testpagenumber.tex). You can see that the compiled PDF document has no page number on page 3.

%% LyX 2.1.2 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[12pt,a4paper,british]{scrbook}
\usepackage{lmodern}
\renewcommand{\sfdefault}{lmss}
\renewcommand{\ttdefault}{lmtt}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{fancyhdr}
\pagestyle{fancy}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\setlength{\parskip}{\medskipamount}
\setlength{\parindent}{0pt}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[authoryear]{natbib}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\pdfpageheight\paperheight
\pdfpagewidth\paperwidth


\makeatother

\usepackage{babel}
\begin{document}

\lhead[\chaptername~\thechapter]{\rightmark}


\rhead[\leftmark]{}


\lfoot[\thepage]{}


\cfoot{}


\rfoot[\thepage]{}


\chapter{testant}

bla

\pagebreak{}

bla

bla

\pagebreak{}

bla

bla

\pagebreak{}

bla
\end{document}
4
  • 1
    A minimal working example would be great. I am not sure if your document is twosided. I am not sure if you are using fancyhdr since your commands suggest otherwise. The setup right now is really strange, to be honest.
    – Johannes_B
    Jan 15, 2017 at 14:10
  • I posted an example here gist.github.com/paul4forest/7671132f19412a0cac2f6ecb99955add, it's not really minimal because I kept all of the formatting of my original document. Jan 15, 2017 at 14:22
  • Now removed most of the formatting from the gist example. The issue is the page number missing on page 3. Jan 15, 2017 at 14:51
  • 1
    If you now convert that to pdflatex and post it within the question, even more people will be able to help you.
    – Johannes_B
    Jan 15, 2017 at 14:54

2 Answers 2

2

You might want the following, but i am not sure.

%% LyX 2.1.2 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
%% JB edited the LyX code
\documentclass[12pt,a4paper,british]{scrbook}
\usepackage{lmodern}
\renewcommand{\sfdefault}{lmss}
\renewcommand{\ttdefault}{lmtt}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\setlength{\parskip}{\medskipamount}
\setlength{\parindent}{0pt}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[authoryear]{natbib}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\pdfpageheight\paperheight
\pdfpagewidth\paperwidth


\makeatother

\usepackage{babel}
\usepackage{scrlayer-scrpage}
\renewcommand{\chaptermarkformat}{\chapapp\ \thechapter\autodot\enskip}
\ofoot{\pagemark}
\ohead{\leftmark}
\usepackage{blindtext}
\begin{document}



\blinddocument
\addchap{Wombat}\blindtext[30]
\end{document}
1

The solution is to insert \thepage after the square brackets in the curly braces. Change from

\lfoot[\thepage]{}
\cfoot{}
\rfoot[\thepage]{}

to

\lfoot[\thepage]{}
\cfoot{}
\rfoot[]{\thepage}

Or in Lyx to change from : enter image description here to : enter image description here

This is a strange behaviour. I wonder why it is not called "uneven header" in Lyx.

2
  • I am a bit confused, because i don't see why there are brackets in there. Or why you are doing it the way you are doing. That stuff should best go to the preamble. Or be done within the LyX interface (don't know if LyX supports KOMA-packages over the interface).
    – Johannes_B
    Jan 15, 2017 at 15:26
  • Yes I'm confused too and this does not seem to be documented on the Lyx wiki. Jan 15, 2017 at 15:35

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.