帮助进行简单的书籍布局

帮助进行简单的书籍布局

我是乳胶新手,我只需要一点关于我的书籍布局的帮助,这可能是一个很容易解决的问题。

我需要修复三件事:

  1. 章节格式
  • 当我这样做时\chapter{name},章节页面显示“第十章(新行)[章节名称]。我只需要它是[章节名称],上面没有“第十章”。我可以使用 ```\chapter*{name} 来做到这一点,尽管它会弄乱我的页面标题,并且如果我这样做,似乎不会将该章节注册为实际章节。
  1. 章节和部分标题及页码
  • 我只需要它,这样页码和页眉就不会出现在章节和部分页面上。我尝试使用\pagestyle{empty},但当我尝试使用它时,它会从多个页面中删除页眉和页码。
  1. 标题设置
  • 对于页眉,我需要将页码放在页面的对角上角(它们已经是了),将书名放在左页,将章节标题放在页面的右侧,两者均居中。目前,我在左页页眉上只有这个:“第 X 章:名称”,它与页面的右侧对齐。

以下是我当前的序言:

\documentclass[11pt]{book}
\usepackage{setspace}
\usepackage{palatino}
\usepackage[T1]{fontenc}
\usepackage[paperwidth=450pt, paperheight=666pt]{geometry}
\onehalfspacing

\title{title}
\author{author}
\date{2024}

\begin{document}

\frontmatter
\maketitle
\tableofcontents

答案1

类似这样吗?或者,titlesec如果你愿意,你也可以使用。我不会,但人们会。

请注意,您的使用setspace会导致坏盒子,有些甚至是无限坏的。

\documentclass[11pt]{book}
\usepackage{setspace}
\usepackage{palatino}
\usepackage[T1]{fontenc}
\usepackage[paperwidth=450pt, paperheight=666pt,headheight=14pt]{geometry}
\usepackage{fancyhdr}
\usepackage{kantlipsum}

\onehalfspacing
\fancypagestyle{plain}{%
  \fancyhf{}%
  \renewcommand \headrulewidth {0pt}%
  \renewcommand \footrulewidth {0pt}%
}
\fancypagestyle{main}{%
  \fancyhf{}%
  \fancyhf[ohr,ehl]{\thepage}%
  \fancyhf[ohc]{\slshape\leftmark}%
  \fancyhf[ehc]{title}%
  \renewcommand \headrulewidth {0pt}%
  \renewcommand \footrulewidth {0pt}%
}
\makeatletter
\def\@makechapterhead#1{% modified from book.cls
  \vspace*{50\p@}%
  {\parindent \z@ \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
      \if@mainmatter
        \huge\bfseries %\@chapapp\space \thechapter
        \par\nobreak
        \vskip 20\p@
      \fi
    \fi
    \interlinepenalty\@M
    \Huge \bfseries #1\par\nobreak
    \vskip 40\p@
  }}
\makeatother

\title{title}
\author{author}
\date{2024}

\begin{document}

\frontmatter
\maketitle
\tableofcontents

\mainmatter
\pagestyle{main}
\part{First}
\chapter{One}
\kant[1-3]
\part{Second}
\chapter{Two}
\kant[4-6]
\end{document}

除了要求的之外,我保留了内容和标题,尽管这对我来说似乎有点奇怪,因为您表示您只想要指定的更改。如果不是,您可能需要调整\leftmarkfancyhdr有关如何更改的详细信息,请参阅 的文档。

答案2

我认为,有了更多可配置的类,这些事情就会变得更容易实现,比如memoir或者scrbook而不是标准类。下面是一个例子scrbook

\documentclass[paper=450pt:666pt,sfdefaults=false]{scrbook}

\usepackage[onehalfspacing]{setspace}
%\usepackage{palatino}
\usepackage{tgpagella}% IMHO the better Palatino clone for PDFLaTeX
\recalctypearea% to avoid bad boxes using setspace
\usepackage[T1]{fontenc}
\usepackage[automark]{scrlayer-scrpage}

\usepackage{blindtext}% only for demonstration

\title{book title}
\author{author}
\date{2024}

% don't show the chapter numbers
\renewcommand*{\chapterformat}{}% used in the title
\renewcommand*{\chaptermarkformat}{}% used in the page header

% don't show page header or footer at part or chapter pages
\renewcommand*{\partpagestyle}{empty}
\renewcommand*{\chapterpagestyle}{empty}

% page style
\clearpairofpagestyles% start with empty page style
\cehead{\csname @title\endcsname}% Book title centered on the left=even page
\cohead{\leftmark}% chapter title centered on the right=odd page
\ohead*{\pagemark}% page number near the outer margin in the head (also on
                  % plain pages)

\begin{document}

\frontmatter
\maketitle
\tableofcontents

\mainmatter
\blinddocument

\end{document}

带页眉的四页

除了使用页面样式empty来设置部分和章节页面外,您还可以使用 pagestyle 来省略页码plain

\documentclass[paper=450pt:666pt,sfdefaults=false]{scrbook}

\usepackage[onehalfspacing]{setspace}
%\usepackage{palatino}
\usepackage{tgpagella}% IMHO the better Palatino clone for PDFLaTeX
\recalctypearea% to avoid bad boxes using setspace
\usepackage[T1]{fontenc}
\usepackage[automark]{scrlayer-scrpage}

\usepackage{blindtext}% only for demonstration

\title{book title}
\author{author}
\date{2024}

% don't show the chapter numbers
\renewcommand*{\chapterformat}{}% used in the title
\renewcommand*{\chaptermarkformat}{}% used in the page header

% page style
\clearpairofpagestyles% start with empty page style
\cehead{\csname @title\endcsname}% Book title centered on the left=even page
\cohead{\leftmark}% chapter title centered on the right=odd page
\ohead{\pagemark}% page number near the outer margin in the head (but not on
                  % plain pages)

\begin{document}

\frontmatter
\maketitle
\tableofcontents

\mainmatter
\blinddocument

\end{document}

只要plain没有在其他地方使用,结果就是一样的。

这也可以(经过一些调整)与标准类一起使用book

\documentclass[11pt]{book}
\usepackage[onehalfspacing]{setspace}
%\usepackage{palatino}
\usepackage{tgpagella}% IMHO the better Palatino clone for PDFLaTeX
\usepackage[T1]{fontenc}
\usepackage[papersize={450pt,666pt},headheight=16.5pt,heightrounded]{geometry}
\usepackage[automark]{scrlayer-scrpage}

\usepackage{blindtext}% only for demonstration

\title{book title}
\author{author}
\date{2024}

% don't show the chapter numbers
\renewcommand*{\chaptermarkformat}{}% used in the page header
\makeatletter\let\@makechapterhead\@makeschapterhead\makeatother% use output
                                % of the star form also for the non-star form

% page style
\clearpairofpagestyles% start with empty page style
\cehead{book title}% Book title centered on the left=even page
\cohead{\leftmark}% chapter title centered on the right=odd page
\ohead{\pagemark}% page number near the outer margin in the head (but not on
                  % plain pages)

\begin{document}

\frontmatter
\maketitle
\tableofcontents

\mainmatter
\blinddocument

\end{document}

使用 book 代替 scrbook

本例中使用了选项heightrounded来减少坏盒setspace

如果你想geometryscrbook示例结合,你可以用相同的选项替换 来加载它。应始终使用\recalctypearea加载geometry或使用\recalctypearea更改字体之后设置行距。

相关内容