Page numbers not showing in place

Steve Litt slitt at troubleshooters.com
Tue Nov 30 19:15:41 UTC 2021


Melvin Bolton said on Tue, 30 Nov 2021 10:00:54 +1000

>I have in the past completed a lengthy book, using Lyx,  without
>needing to trouble anybody for help,  but I'm now baffled by what
>should be a simple, basic task and I have no idea what to try next.
>
>My problem is that the pagestyle settings that should place page
>numbers in the footer, are showing them in the output only on the
>first page of each chapter, which the User Guide says is treated by
>Lyx as a special environment.
>I began with KOMA-Script ( scrbook) with pagestyle set to 'plain' as
>I'd done previously. This places page numbers in the outer end of the
>footer as I prefer them. When I found them only appearing on the first
>page of each chapter I searched online and tried pasting a few
>commands in the preamble but nothing helped and mostly I got
>compilation errors. I've cleared the preamble.
>
>I tried Lyx Standard Class (Book) with pagestyle set to 'plain', which 
>centred the page numbers as it should, but still only on first pages
>of chapters. Neither was there any improvement after I tried pagestyle
>set to 'fancy' and tried to customize that. It's as though chapter
>footers are not accessible, except for first page.

Hmm, on my book fancy produces the page number in the footer of new
chapter pages, and the header on all other pages. So at least for
Standard Class (Book), it's behaving as designed.

Sometimes changing Document Class isn't enough, or is a bad move[1].
Sometimes you need to use a layout file to develop your own Document
Class, based on an existing one (I always base mine on LyX Standard
Class (Book) because less unpleasant surprises).

I wrote an article about making your headers and footers do *whatever*
you want. If you want page numbers at the bottom, you can do so with
your layout file. Here's the article:

http://troubleshooters.com/lpm/200210/200210.htm#_HeadersandFooters

Before going to all that trouble, make sure there's not a CTAN package
(not a document class, just a package) you can download to put the page
numbers on the bottom without further side effects. There are three
times more CTAN packages than stars in the universe, so it's likely
such a thing exists, *if* you can find it. But if you can't find it,
don't despair; you can always strongarm it as shown in the preceding
link.


>In my document, immediately before the first chapter, I have the 
>following ERT:  \mainmatter\pagestyle{plain} \setcounter{page}{1}

Anything's possible, but that shouldn't matter.

>
>The frontmatter is fine because I have don't want page numbers there
>and have pagestyle set to 'empty.' That, at least, has worked; there
>were Roman numerals there to begin with.

You might or might not need to tweak your layout file to *prevent* the
page numbers from printing at the bottom of your \frontmatter pages
after making the changes.

[1] Much too often, people recommend changing your document class to
    achieve one feature. Invariably, that new class lacks some needed
    features of the first one. I'm not sure if it's Koma or Memoir, but
    one of them clashes with \hyperref, requiring all sorts of hoop
    jumping. In my opinion, the document class should be chosen based
    on the overall look you want to achieve, and then tweak the rest of
    the features you absolutely need "your way". Also, if you intend to
    write multiple books, I'd suggest choosing one and becoming an
    expert at it.


SteveT

Steve Litt 
Spring 2021 featured book: Troubleshooting Techniques of the Successful
Technologist http://www.troubleshooters.com/techniques


More information about the lyx-users mailing list