如何将章节标题与回忆录一起定位在边缘处?

如何将章节标题与回忆录一起定位在边缘处?

我想将章​​节标题放在页边距中,就像示例中那样。我使用的是 Memoir。我没有 MWE,因为我真的不知道如何将章节放在页边距中。

提前致谢!

在此处输入图片描述

答案1

更新评论之后。

memoir可以定义自定义章节样式。

由于您没有提供 MWE,因此此示例模仿了该图。调用的样式ChapinMargin将在页边距中打印章节标题(奇数页的左边距,偶数页的右边距),但不打印章节编号(尽管它将在目录中打印其编号)。

为了使页码与文本底部对齐(如图所示),需要定义一般页面样式以及plain章节第一页使用的样式。

您应该提供足够的左边距以适合章节标题。

笔记。为了准确检测偶数页和奇数页,至少需要运行两次 LaTeX 才能稳定下来。

瓦

\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} 

相关内容