1

I am using the page layout headings in Memoir. It is only displaying the page number, but not the chapter name or title

the folio at the outer side of the page; on verso pages the chapter name, number and title, in slanted uppercase is set at the spine margin and on recto pages the section number and uppercase title is set by the spine margin.

My understanding, from the above, is that page number, chapter name, and book title all autopopulate in headings, but need to be defined in myheadings. If this is so, what could be suppressing the chapter name and title from the page heading?

Edited to add:

What I am trying to accomplish is a header layout with page numbers in outside corners and the title of the book & chapter in the inside corners:

Title Of Book (on left)

and Chapter Title # (on right)

But what I get is:

!enter image description here]1]]1]

I am using the page style "myheadings" in the Document>Settings>Page Layout, and I have changed my chapters to \chapter instead of \chapter*.

For page styling I have the following in the preamble, adapted from the answer of this question]]2]:

\makepagestyle{myheading}
\makeevenhead{myheading}{\thepage}{}{\mytitle}
\makeoddhead{myheading}{\leftmark}{}{\thepage}
\def\mytitle {Title Of Book}
\pagestyle{myheading}

The header is now correctly displaying the title (sometimes), and the page numbers where I want them. However, I am getting a blank space where \leftmark should go. Do I need to either a) define \leftmark so it knows I want the chapter title, or b) reset \leftmark to so that it pulls it's default value? Or something else entirely?

Using the most minimal example (stripping all of my previous custom styling, except the heading) still gets me only the page numbers, assigned title, and no chapter title.

% Preview source code

%% LyX 2.2.3 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclassenglish,oldfontcommands]{memoir}
\usepackageT1]{fontenc}
\usepackagelatin9]{inputenc}
\usepackagepaperwidth=5in,paperheight=8in]{geometry}
\geometry{verbose}
\pagestyle{myheadings}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}

\makeatletter
\@ifundefined{date}{}{\date{}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage {lipsum}

\makepagestyle{myheadings}
\makeevenhead{myheadings}{\thepage}{}{\mytitle}
\makeoddhead{myheadings}{\leftmark}{}{\thepage}
\def\mytitle {Title Of Book}
\pagestyle{myheadings}

\makeatother

\usepackage{babel}
\begin{document}

\title{Title of Book}


\author{Author}
\maketitle

\chapter{Lorem Ipsum}

\lipsum[1-5]

\chapter*{Ipsum Lorem}

\lipsum[1-6]
\end{document}

1]: https://i.stack.imgur.com/gQErb.png 2]: include document title in memoir class header

4
  • (1) welcome, (2) as always on this site please provide a full but minimal example that others can copy and test as is. That makes it a lot easier to diagnose problems. So please help us help you.
    – daleif
    Feb 14, 2018 at 10:16
  • I am not sure what a full example would be in this case. I set headings in Document > Settings > Page Layouts, which inserted '\pagestyle{headings}' into the preamble. In the exported document, this moved page numbering from the default (center of the footer) to the outside left/right of the header, but did not add chapter & title.
    – Kitty
    Feb 14, 2018 at 10:30
  • Make a small document, you mean ought to have the chapter name in the header, export it to LaTeX, then post that LaTeX file here. Hardly any of us here is using Lyx. We need to see what options and packages you might be using.
    – daleif
    Feb 14, 2018 at 10:42
  • You see the code in Peter's answer, that is called a minimal working example, you can compile it and see the final result. Replacing the pagestyle line with your snippet and compiling, the header is as you want it. So ... something is going on in your document and you have to find it. -> wiki.lyx.org/FAQ/MinimalExample <- Should help you find the cause faster.
    – Johannes_B
    Feb 18, 2018 at 7:18

2 Answers 2

0
Don't use the name `myheadings`, use your own. `myheadings` is predefined to do stuff you don't want.


%% LyX 2.2.3 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english,oldfontcommands]{memoir}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{babel}
\usepackage[paperwidth=5in,paperheight=8in]{geometry}
\geometry{verbose}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}

\makeatletter
\@ifundefined{date}{}{\date{}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage {lipsum}

\makepagestyle{kitty}
\makeevenhead{kitty}{\thepage}{}{\mytitle}
\makeoddhead{kitty}{\leftmark}{}{\thepage}
\def\mytitle {Title Of Book}
\pagestyle{kitty}

\makeatother

\begin{document}

\title{Title of Book}


\author{Author}
\maketitle

\chapter{Wombat}

\lipsum[1-5]

\end{document}
3
  • Unfortunately, this has not helped to autogenerate the chapter title in the header. '\leftmark' (and '\rightmark')still produces a blank space.
    – Kitty
    Feb 24, 2018 at 9:22
  • @Kitty Can you import my example into LyX? What do you get?
    – Johannes_B
    Feb 24, 2018 at 9:23
  • Ok, I think I got somewhere. In Lyx you can define the pagestyle in Document>Settings>Page Layouts, with customizations in the preamble. By setting the style in Document>Settings>Page Layouts to "Default," the custom pagestyle in Preamble recognized '\leftmark.'
    – Kitty
    Feb 25, 2018 at 5:19
0

In the memoir class the default pagestyle is \pagestyle{headings} where a \chapter*{...} does not produce a header although \chapter{...} does. With the oneside class option \section{...} does not add anything to the header.

Play around with this:

\documentclass%
%[oneside]%
{memoir}
\usepackage{lipsum}
\pagestyle{headings}
\begin{document}
\chapter{Lorem Ipsum}
 %% \chapter*{Lorem Ipsum}
\lipsum[1-5]
\section{Section}
\lipsum[6-15]
\end{document}

If you use the twoside option and unstarred \chapter then I think that you get what you want. Otherwise you need to define your own \pagestyle.

None of the memoir \pagestyle know anything about your book title, so that is up to you.

1
  • Thank you for the explanation of the difference between starred and unstarred \chapter. This has helped to narrow down the issue, but has not fully resolved the problem.
    – Kitty
    Feb 18, 2018 at 5:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .