In short:
- Prerequisite: Need to emulate book-class for
\partand\chapterusingtitlesec - Change both to hang, start on same page
- Add
titleruleto\chapter
I want to optimize my rather hacked template.
First, as it isn't possible to do the changes below using titlesec without defining the sectioning title/head as a whole, I need it to be exactly like predefined by the standard book-class. That needs to be the starting point.
Then I want to use titlesec to make \part and \chapter "hanged" (like \titleformat{\part}[hang]) and on the same page with the following chaptertext:
Not this:
Part A
Parttitle
-------newpage--------
Chapter 1
Chaptertitle
but this:
A Parttitle
1 Chaptertitle
At last I need to replace the following newcommand
\newcommand{\addchapterunderline}{\vspace{-4ex}\hrule height 1.5pt \vspace{7ex}\thispagestyle{empty}}
for \chapter AND \chapter*, wich I utilized like this until now:
\chapter[Test]{Test}
\addchapterunderline
The final structure should look like this using \titlerule[1.5pt]:
A Parttitle
B Chaptertitle
________________________
Lorem ipsum ...
In this example I already tried my best (<-- still beginner). But I cannot prove whether this is book-class-like with only my changes above, as I could not find the heading-definitions in the book.cls:
\documentclass{book}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[ansinew]{inputenc}
\usepackage{tgheros}
\usepackage[expert]{mathdesign}
\usepackage{amssymb}
\usepackage{ae,aecompl}
\usepackage{charter}
%\newcommand{\addchapterunderline}{\vspace{-4ex}\hrule height 1.5pt \vspace{7ex}\thispagestyle{empty}} %I don't want to use this
\usepackage{titlesec}
\titleclass{\part}{top}
\titleformat{\part}[hang]
{\usefont{T1}{qhv}{b}{n}\selectfont\huge} % global formatting (number and title)
{\thepart}
{20pt} %spacing between number and title
{\huge}
\titlespacing*{\part}
{0pt}% left
{1cm}% before
{1.2em}% after
\titleclass{\chapter}{straight}
\titleformat{\chapter}[hang]
{\usefont{T1}{qhv}{b}{n}\selectfont\huge} % global formatting (number and title)
{\thechapter} % label: number and its formatting
{20pt} %spacing between number and title
{\huge}[\vspace{2ex}{\titlerule[1.5pt]}]
\titlespacing*{\chapter}
{0pt}% left
{1cm}% before
{6.2em}% after
\begin{document}
\part{This is a Testpart}
\chapter{This is a Testchapter}
\chapter*{This is a unnumbered Testchapter}
\end{document}


titlesecmanual shows how to emulate the sectioning commands of the standard classes. – lockstep Mar 7 at 20:13\partis missing. Where can I find this? – FLW Mar 7 at 20:52\cleardoublepage? – Gonzalo Medina Mar 7 at 21:45\newpage{\thispagestyle{plain}\cleardoublepage}after every chapter. – FLW Mar 7 at 21:52