0

I'm new to latex and I just need a bit of help with my book layout, should probably be an easy question to solve.

I need to fix three things:

  1. Chapter format
  • When I do \chapter{name}, the chapter page gives me "Chapter X (new line) [Chapter Name]. I just need it to be [Chapter Name] only, no "Chapter X" above it. I can do this with ```\chapter*{name}, though it messes up my page headings and doesn't register that chapter as being an actual chapter if I do that it seems.
  1. Chapter and Part headings and page numbers
  • I just need it so that page numbers and page headers don't appear on Chapter and Part pages. I try and use \pagestyle{empty}, but that removes headers and page numbers from more than one page when I try and use it.
  1. Header setup
  • For the headers, I need the page numbers in the opposite top corners of the pages (which they already are), and the book title on the left page, with the chapter title on the right side of the page, both centered. Currently I just have this on the left page header: "Chapter X: Name", and it is aligned to the right side of the page.

Here is my current preamble:

\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
2
  • 3
    Welcome to TeX.SE. Generally on Stack sites, we prefer that a question focuses on one aspect. It would be fine to split this into three questions (and maybe add a bit more of your code to each question to show your best attempt).
    – Teepeemm
    Commented Feb 19 at 23:22
  • Could you make your code so it compiles to demonstrate the problem? Page headers don't appear on chapter and part pages by default, so it's not clear what you are doing here.
    – cfr
    Commented Feb 20 at 0:35

2 Answers 2

3

Something like this? Or you could use titlesec, if you liked. I wouldn't, but people do.

Note that your use of setspace is causing bad boxes, some infinitely so.

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

I've left the contents and headers as is except as requested, even though that seems a bit odd to me, because you indicated you only wanted the changes specified. If not, you probably want to adjust \leftmark. See fancyhdr's documentation for details of how to change this.

0

IMHO things like these are easier with more configurable classes like memoir or scrbook instead of the standard classes. Here an example with 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}

four pages with header

Instead of using page style empty for part and chapter pages, you could alternatively omit the page number with 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}

The result would be the same, as long as plain is not used elsewhere.

This can (with some adaptions) also be used with the standard book class:

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

using book instead of scrbook

Option heightrounded is used in this example to reduce bad boxes with setspace.

If you'd like to combine geometry with the scrbook example, you can load it with the same options replacing \recalctypearea. Loading geometry or using \recalctypearea should always be used after changing the font and after setting up the line spacing.

You must log in to answer this question.

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