![在回忆录中的章节名称上方包括书名和章节名称](https://linux22.com/image/309177/%E5%9C%A8%E5%9B%9E%E5%BF%86%E5%BD%95%E4%B8%AD%E7%9A%84%E7%AB%A0%E8%8A%82%E5%90%8D%E7%A7%B0%E4%B8%8A%E6%96%B9%E5%8C%85%E6%8B%AC%E4%B9%A6%E5%90%8D%E5%92%8C%E7%AB%A0%E8%8A%82%E5%90%8D%E7%A7%B0.png)
我正在使用 xelatex 和 memoir 排版一本包含多个章节和部分的书。我想在每个部分的标题上方包含书名(或部分名称)和章节名称,如下所示。我该怎么做?
箭头和英文文字用于突出显示不同的风格。
按照给出的技术Daleif1 主题:如何获取章节上方部分的标题?我已经能够让它部分工作,
-
* 书 * 部分 * 章节
我使用 psvectorian 包来制作装饰品。
下面是我使用的代码:
\documentclass[a5paper,11pt,twoside,onecolumn,openany,final]{memoir}
\usepackage[a5paper,hmargin=0.7in,vmargin=0.75in]{geometry}
\usepackage{multicol,polyglossia,etoolbox,fontspec}
\usepackage{psvectorian}
%
\defaultfontfeatures{Mapping=tex-text}
\setmainlanguage{english}
\setotherlanguage{sanskrit}
\setmainfont{FreeSerif}
\newfontfamily{\englishfont}{FreeSerif}
\newfontfamily{\devanagarifont}[Script=Devanagari]{Sanskrit 2003}
% https://tex.stackexchange.com/questions/237695/how-to-specify-font-for-superscripts-using-ucharclasses-with-xelatex
\usepackage[Latin, Devanagari, SuperscriptsAndSubscripts]{ucharclasses}
\setTransitionTo{SuperscriptsAndSubscripts}{\englishfont}
\setTransitionFrom{SuperscriptsAndSubscripts}{}
%
\setTransitionTo{Devanagari}{\devanagarifont}
\setTransitionFrom{Devanagari}{\englishfont}
\setTransitionsFor{Latin}
{\hyphenrules{english}\englishfont}
{\hyphenrules{sanskrit}\devanagarifont}
\setTransitionsFor{Devanagari}
{\hyphenrules{sanskrit}\devanagarifont}
{\hyphenrules{english}\englishfont}
%
\setcounter{secnumdepth}{-1}
\renewcommand\secheadstyle{\centering\large\noindent}
\newcommand{\itibig}{\centerline{\psvectorian[height=2mm,width=4cm]{88}}}
\newcommand{\itimedium}{\centerline{\psvectorian[width=3cm]{84}}}
\newcommand{\itismall}{\centerline{\psvectorian[width=2cm]{49}}}
%
% https://tex.stackexchange.com/questions/199949/daleif1-theme-how-to-get-parts-title-above-chapter
\makeatletter
\makechapterstyle{mysection}{
\chapterstyle{verville}
\setlength\beforechapskip{-1cm}
\setlength{\afterchapskip}{20pt}
\renewcommand\printchaptertitle[1]{%
{\centering\huge\noindent\currentbooktitle\itibig}
{\centering\LARGE\noindent\currentparttitle}
{\centering\Large\noindent##1\par\smallskip\itismall}
}
}
\newcommand{\resetparttitle}{\gdef\currentparttitle{\strut}}
\resetparttitle
\makeatother
\chapterstyle{mysection}
\newcommand\newpart[1]{%
%\phantomsection % if you use hyperref uncomment this line
\addcontentsline{toc}{part}{#1}%
\gdef\currentparttitle{#1\\}%
}
\newcommand\newbook[1]{%
%\phantomsection % if you use hyperref uncomment this line
\addcontentsline{toc}{book}{#1}%
\gdef\currentbooktitle{#1\\}%
}
% https://groups.google.com/forum/#!topic/comp.text.tex/iIt_qxzTX5k
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\makeactive#1{\catcode`#1 = \active \ignorespaces}%
\chardef\letter = 11
\chardef\other = 12
\def\uncatcodespecials{%
\def\do##1{\catcode`##1 = \other}%
\dospecials
}%
\def\gobble#1{}%
%
\catcode`@ = \letter % So we can have private control sequences.
% ^^L (=formfeed,<FF>)
\def^^L{\par}%
%
\begingroup
\makeactive\^^M \makeactive\ %No spaces or ^^M's from here on. ^^M = linefeed
\gdef\obeywhitespace{%
\makeactive\^^M\def^^M{\par\futurelet\next\@finishobeyedreturn}%
\makeactive\ \def {\ }%
%
\aftergroup\@removebox%
\futurelet\next\@finishobeywhitespace%
}%
%
\gdef\@finishobeywhitespace{{%
\ifx\next %
\aftergroup\@obeywhitespaceloop%
\else\ifx\next^^M%
\aftergroup\gobble%
\fi\fi}}%
%
\gdef\@finishobeyedreturn{%
\ifx\next^^M\vskip\blanklineskipamount\fi%
\indent%
}%
\endgroup
%
\def\@obeywhitespaceloop#1{\futurelet\next\@finishobeywhitespace}%
%
\def\@removebox{%
\setbox0 = \lastbox
\ifdim\wd0=\parindent
\setbox2 = \hbox{\unhbox0}%
\ifdim\wd2=0pt
\ignorespaces
\else
\box2 % Put it back: it wasn't empty.
\fi
\else
\box0 % Put it back: it wasn't the right width.
\fi
}%
\newskip\blanklineskipamount
%\blanklineskipamount = 0pt
\blanklineskipamount = -.8\baselineskip
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newenvironment{linewise}{\begingroup\obeywhitespace}{\endgroup}%
\RequirePackage{calc}
\newcommand{\setblankskip}[1]{\setlength{\blanklineskipamount}{-\baselineskip+#1}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 1 - indented to be in center of page - straight on left, right is ragged
\newfontfamily{\devanagarifont}[Script=Devanagari]{Sanskrit 2003}
\newcommand{\stotra}{\setlength{\leftskip}{0em}\setblankskip{5pt}\obeywhitespace}
\newcommand{\bsanskrit}{\begin{stotra}}
\newcommand{\esanskrit}{\end{stotra}}
\begin{document}
\newbook{अध्यात्मरामायण}
\newpart{सुन्दरकाण्ड}
\bsanskrit
\chapter{प्रथम सर्ग}
श्रीमहादेव उवाच ।
शतयोजनविस्तीर्णं समुद्रं मकरालयम् ।
लिलङ्घयिषुरानन्दसन्दोहो मारुतात्मजः ॥ १॥
ध्यात्वा रामं परात्मानमिदं वचनमब्रवीत् ।
पश्यन्तु वानराः सर्वे गच्छन्तं मां विहायसा ॥ २॥
अमोघं रामनिर्मुक्तं महाबाणमिवाखिलाः ।
पश्याम्यद्यैव रामस्य पत्नीं जनकनन्दिनीम् ॥ ३॥
कृतार्थोऽहं कृतार्थोऽहं पुनः पश्यामि राघवम् ।
प्राणप्रयाणसमये यस्य नाम सकृत्स्मरन् ॥ ४॥
नरस्तीर्त्वा भवाम्भोधिमपारं याति तत्पदम् ।
किं पुनस्तस्य दूतोऽहं तदङ्गाङ्गुलिमुद्रिकः ॥ ५॥
\chapter{द्वितीयः सर्गः}
\section{This is a section }
\esanskrit
\resetparttitle
\chapter*{PPP} % emulate the back matter such as the bibliography
\end{document}
该文档的第一页之前现在有一个空白页,我想将其删除。 第 2 页的输出如下: