Page LayoutSection Heading vertically centered on its own Page

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
eelkefolmer
Posts: 1
Joined: Sat Oct 01, 2011 1:05 am

Section Heading vertically centered on its own Page

Post by eelkefolmer »

I'm trying to vertically center headers on their own page using the following code.

Code: Select all

\titleformat{\section}[display]
{\Huge \bfseries}
{}
{0.4\textheight}
{\thesection.}
This does the trick. Just found it by randomly trying. I wish someone would write some better documentation for titlesec.

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and many kinds of documents

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Section Heading vertically centered on its own Page

Post by localghost »

eelkefolmer wrote:[…] I wish someone would write some better documentation for titlesec.
You just need to learn how to read manuals. Your code does not exactly do what you plan. The heading is neither properly centered nor on its own page.

Code: Select all

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{titlesec}

\titleformat{\section}
{\clearpage\null\vfil\bfseries\Huge}
{\filright\thesection}
{1em}
{\filright\Huge}
[\vfil\newpage]

\begin{document}
  \section{Foo}
    The quick brown for jumps over the lazy dog.

  \section{Bar}
    The quick brown for jumps over the lazy dog.
\end{document}
And by the way, full examples are more helpful than some code snippets to comprehend a problem.


Best regards and welcome to the board
Thorsten
Post Reply