7

I have a problem that I can't seem to solve. Basically, I want my chapter headings to be at the same position relative to top of the page as the rest of the text. I've looked at numerous resources online, but the problem is still not solved... :(

I tried using the titlesec package, but no results:

\usepackage{titlesec}
\titleformat{\chapter}[hang]
{\normalfont\Large\bfseries}{\thechapter}{1em}{\Large}
\titleformat{\section}
{\normalfont\Large\bfseries}{\thesection}{1em}{}
\titlespacing*{\chapter} {0pt}{\baselineskip}{0pt}
\titlespacing*{\section} {0pt}{\baselineskip}{0pt}

Here is what I get in the output:

Chapter Heading:

chapter heading

Other text (sections):

section heding

Also, the headings of TOC LoF and LoT are a little off from normal Chapter heading spacing...

Please help!

2
  • please identify the document class you are using. May 3, 2011 at 20:36
  • @barbara beeton Sorry, I should've mentioned it initially. I am using the report doc class.
    – ravil
    May 3, 2011 at 23:23

2 Answers 2

10

It is unfortunately not possible without redefining some internals of titlesec. It uses the command

\vspace*{<before vspace>}

before the chapter command. This is an absolute distance even after a page break. Before sections headers it uses

\addvspace{<before vspace>}

There are a lot of rules regarding \addvspace, such as adding only the maximum of two sequencial \addvspace's, no spacing after a page break, etc.

To get what you are asking for you can try the following redefinition

\usepackage{titlesec}
\makeatletter
\def\ttl@mkchap@i#1#2#3#4#5#6#7{%
    \ttl@assign\@tempskipa#3\relax\beforetitleunit
    \vspace{\@tempskipa}%<<<<<< REMOVE THE * AFTER \vspace
    \global\@afterindenttrue
    \ifcase#5 \global\@afterindentfalse\fi
    \ttl@assign\@tempskipb#4\relax\aftertitleunit
    \ttl@topmode{\@tempskipb}{%
        \ttl@select{#6}{#1}{#2}{#7}}%
    \ttl@finmarks  % Outside the box!
    \@ifundefined{ttlp@#6}{}{\ttlp@write{#6}}}
\makeatother
1
  • This is excellent, that you very much for your help! I still have a lot to lean in LaTeX :)
    – ravil
    May 4, 2011 at 16:35
6

in most document classes, the chapter heading starts with \vspace*{<sink amount>}. in the report class, this is the first part of the definitions \@makechapterhead (for numbered chapters) and \@makeschapterhead (for unnumbered chapters).

since the titlesec package apparently doesn't have a straightforward way to omit this space, it seems easier to redefine the two relevant commands from report.cls. just copy the two definitions into your preamble, comment out the unwanted \vspace lines, wrap the whole block between \makeatletter ... \makeatother and go on your way. put in a comment to say why you did what you did; you'll be glad for this later.

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.