章节标题位于特定两侧边距位置

章节标题位于特定两侧边距位置

我有一份具有奇偶规则(twoside类)的文档,因此奇数页的右侧边距有较宽的空间,偶数页的左侧边距有较宽的空间。我想将章节标题(右对齐)放在偶数页的右侧边距上,如下所示

                                      chapter title*
odd page  [left margin][content][wide right margin]
even page [wide left margin][content][right margin]*

而不是将章节标题(右对齐)放在奇数页的右边距

                   chapter title*
odd page  [left margin][content]*[wide right margin]
even page [wide left margin][content][right margin]

其中 * 用于显示章节标题到特定边距的位置。有没有办法使用 来修改章节标题格式titlesec

\documentclass[twoside]{book}

\usepackage[paperheight=9.72in,paperwidth=6.85in,left=0.5in,right=1.5in,top=0.5in,bottom=1.05in,headheight=17pt,includehead,includefoot,heightrounded,]{geometry}

\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{mathpazo}
\linespread{1.05}
\usepackage{titlesec, linegoal}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[symbolmax,defaultmathsizes]{mathastext}

\renewcommand{\thechapter}{\Roman{chapter}}

\titleformat{\chapter}[display]{\huge\bfseries\vspace{0.45in}}{\huge\bfseries\thechapter\vspace{-0.2in}\hspace{1ex}\rule[0.1pt]{\linegoal}{1pt}}{2ex}{\filleft}
\titlespacing*{\chapter}{0pt}{0.05in}{0.45in}

\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{\bfseries#1}{}}

\makeatletter
% modified from book.cls - don't use \def unless you **know** it is safe!
\def\@schapter#1{\if@twocolumn
  \@topnewpage[\@makeschapterhead{#1}]%
  \else
  \@makeschapterhead{#1}%
  \@afterheading
  \fi}
\makeatother

\addtolength{\headwidth}{0.95in}
\fancyhf{}%
\fancyhead[LO]{\leftmark}
\fancyhead[RE]{\bfseries\nouppercase{\rightmark}}
\cfoot{\bfseries\thepage}

\begin{document}

\chapter{Chapter title}

\end{document}

答案1

您可以\cleardoublepage按照描述重新定义这里

\makeatletter
\renewcommand*\cleardoublepage{\clearpage\if@twoside
    \ifodd\c@page \hbox{}\newpage\if@twocolumn\hbox{}%
    \newpage\fi\fi\fi}
\makeatother

正如链接中解释的那样,book课程在每章末尾都使用此命令。

\documentclass[twoside]{book}

\usepackage[paperheight=9.72in,paperwidth=6.85in,left=0.5in,right=1.5in,top=0.5in,bottom=1.05in,headheight=17pt,includehead,includefoot,heightrounded,]{geometry}

\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{mathpazo}
\usepackage{blindtext}
\linespread{1.05}
\usepackage{titlesec, linegoal}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[symbolmax,defaultmathsizes]{mathastext}

\renewcommand{\thechapter}{\Roman{chapter}}

\titleformat{\chapter}[display]{\huge\bfseries\vspace{0.45in}}{\huge\bfseries\thechapter\vspace{-0.2in}\hspace{1ex}\rule[0.1pt]{\linegoal}{1pt}}{2ex}{\filleft}
\titlespacing*{\chapter}{0pt}{0.05in}{0.45in}

\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{\bfseries#1}{}}

\makeatletter
% modified from book.cls - don't use \def unless you **know** it is safe!
\def\@schapter#1{\if@twocolumn
    \@topnewpage[\@makeschapterhead{#1}]%
    \else
    \@makeschapterhead{#1}%
    \@afterheading
    \fi}
\makeatother

\addtolength{\headwidth}{0.95in}
\fancyhf{}%
\fancyhead[LO]{\leftmark}
\fancyhead[RE]{\bfseries\nouppercase{\rightmark}}
\cfoot{\bfseries\thepage}

\makeatletter
\renewcommand*\cleardoublepage{\clearpage\if@twoside
    \ifodd\c@page \hbox{}\newpage\if@twocolumn\hbox{}%
    \newpage\fi\fi\fi}
\makeatother

\begin{document}

    \chapter{Chapter title}

    \blindtext[2]

\end{document}

章节从偶数页开始的书

相关内容