1

I want to put the chapter title in the margin, like in the example. I am using Memoir. I have no MWE since I really don´t know how to position the chapter in the margin.

Thanks in advance!

enter image description here

1 Answer 1

2

UPDATED after comment.

With memoir you can define a custom chapter style.

Since you didn't provide an MWE, this example mimics the figure. The style called ChapinMargin will print the chapter title in the margin (left margin on odd pages, right margin on even pages) without the chapter number (although it will print in the TOC with its number).

In order for the page number to align with the bottom of the text as shown in the figure, it is necessary to define the general page style and also the plain style, used on the first page of a chapter.

You should provide adequate left margin to fit the chapter titles.

Note. To accurately detect even and odd pages, at least two runs of LaTeX are required to stabilize.

w

\documentclass[a5paper, openany]{memoir}

\strictpagecheck % needed for \ifoodpage <<<

\usepackage{picture}% added <<<<<<<<

\usepackage{lipsum}% dummy text

%\usepackage{showframe}% use to show the margins

%% ******* set the page layout, change at will <<<<<
\setlrmarginsandblock{1.5cm}{5cm}{*} %
\setlength{\uppermargin}{50pt}
\setlength{\textheight}{500pt}
\setmarginnotes{0.5cm}{3.5cm}{0pt}% wide margin space to fit the chapter title
\checkandfixthelayout[nearest]
%% ****************************************
\makechapterstyle{ChapinMargin}{%   
    \chapterstyle{default}
    \setlength{\afterchapskip}{-\baselineskip}
    \renewcommand*{\chapterheadstart}{}
    \renewcommand*{\printchaptername}{}
    \renewcommand*{\printchapternum}{}
    \renewcommand*{\chaptitlefont}{\normalfont\Large\sffamily\bfseries}
    \renewcommand*{\printchaptertitle}[1]{% chapter title in the margin <<<<
    \checkoddpage%      
    \ifoddpage \begin{picture}(0,0){\put(\dimexpr\textwidth+\marginparsep,0pt){\parbox[t]{\marginparwidth}{\raggedleft\chaptitlefont ##1}}}\end{picture}%
    \else%
    \begin{picture}(0,0){\put(\dimexpr-\marginparwidth-\marginparsep,0pt){\parbox[t]{\marginparwidth}{\raggedright\chaptitlefont ##1}}}\end{picture}
    \fi%
    }
}

% chapter style with title in margin
\chapterstyle{ChapinMargin} % use this style <<<<<<<<<

%% define a new page style
\makepagestyle{pagenumberInmargin}
\makeevenfoot{pagenumberInmargin}{\begin{picture}(0,0){\put(\dimexpr-\marginparwidth-\marginparsep,\footskip){\normalfont\small\sffamily\thepage}}\end{picture}}{}{}
\makeoddfoot{pagenumberInmargin}{}{}{\begin{picture}(2.0ex,0){\put(\dimexpr\marginparwidth+\marginparsep,\footskip){\normalfont\small\sffamily\thepage}}\end{picture}}
\pagestyle{pagenumberInmargin}

%% define a plain page style for first page of chapters
\makeevenfoot{plain}{\begin{picture}(0,0){\put(\dimexpr-\marginparwidth-\marginparsep,\footskip){\normalfont\small\sffamily\thepage}}\end{picture}}{}{}
\makeoddfoot{plain}{}{}{\begin{picture}(2.0ex,0){\put(\dimexpr\marginparwidth+\marginparsep,\footskip){\normalfont\small\sffamily\thepage}}\end{picture}}

\begin{document}
    \tableofcontents*
    
    \chapter{Design Is One}
    \lipsum[1-3]
    
    \chapter{Design Is Two and  much more}
    \lipsum[1-15]
        
\end{document} 
2
  • 1
    +1 Trickier is how to get the page numbers on the left margin aligned with the bottom of the text. (Not specifically in the question, but in the image provided). Any ideas on how to do that too?
    – Alan Munn
    Commented May 2, 2023 at 20:15
  • 1
    @Alan Munn Thank you for your feedback! I added some code to include the page numbers at the bottom. Commented May 3, 2023 at 20:42

You must log in to answer this question.

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