GeneralInsert Title on Top of First Chapter

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
AleCes
Posts: 286
Joined: Sat Nov 13, 2010 9:54 pm

Insert Title on Top of First Chapter

Post by AleCes »

Hello everybody, I'd like the book title to be printed on top of the title of the first chapter.

Please notice I'm not talking about \maketitle, I just want the name of the book to appear on top of the first chapter, as I said.

Code: Select all

\documentclass{book}

\begin{document}

%I want the title to be right here

\chapter{Blah}

\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Insert Title on Top of First Chapter

Post by Johannes_B »

Have a look at the following:

Code: Select all

\documentclass{book}
\newcommand{\mytitle}{Coffee and other hot drinks}
\author{Ale Ces}
\title{\mytitle}%JB: This approach seems to be more easy, tough
%not more natural or comfy
\usepackage{showframe}
\usepackage{textpos}
\usepackage{etoolbox}
\begin{document}
\maketitle
\tableofcontents
    %I want the title to be right here
%JB: ^^ this is not a very specific location marker ;-)

\chapter{coffee}
\begingroup
\vspace{-15\baselineskip}
\mytitle \par
\endgroup




\chapter{cocoa}
\begin{textblock}{8}(0,-3)%Found by trial and error
	\mytitle
\end{textblock}




\begingroup
\makeatletter
\patchcmd{\@makechapterhead}{\vspace*{50\p@}}{\noindent\mytitle \par%
	\vspace*{50\p@}}{\typeout{success}}{\typeout{sorry}}
\makeatother
\chapter{tea}
\endgroup



\begingroup
\makeatletter
\pretocmd{\@makechapterhead}{\noindent\mytitle\par%
}{\typeout{success}}{\typeout{sorry}}
\makeatother
\chapter{mulled wine}
\endgroup

\chapter{Gravy}

\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply