Generaltitlesec | Custom Headings

LaTeX specific issues not fitting into one of the other forums of this category.
epicurea
Posts: 11
Joined: Mon May 12, 2008 8:11 pm

Re: titlesec | Custom Headings

Post by epicurea »

Ah - yes, that works - thanks a ton!

Recommended reading 2024:

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

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

jaykemper
Posts: 22
Joined: Wed Apr 15, 2009 12:11 am

titlesec | Custom Headings

Post by jaykemper »

You can also define the new counter with an optional argument to reset at increment.

Code: Select all

\newcounter{Taskr}[WP]
Have you seen what this section definition does to the table of contents? It smashes all the WP and Taskr sections on one line. Does anyone know how to fix this?

MWE

Code: Select all

\documentclass{article}
\usepackage{titlesec}

\titleclass{\WP}{straight}[\section]
\titleformat{\WP}[hang]{\normalfont\scshape}
    {\S\,Work Package\,\oldstylenums{WP}.}{.5em}{}[]
\titlespacing{\WP}{0pt}{*1.5}{*0}
\newcounter{WP}
\renewcommand\theWP{\thesection.\arabic{WP}}

\titleclass{\Taskr}{straight}[\WP]
\titleformat{\Taskr}[hang]{\normalfont}
    {Bingo\,\arabic{Taskr}.}{.5em}{}[]
\titlespacing{\Taskr}{0pt}{*1.5}{*0}
\newcounter{Taskr}[WP]
\renewcommand\theTaskr{\theWP.\arabic{Taskr}}

\begin{document}

\tableofcontents

\section{section}
\WP{wp}
\Taskr{taskr}
\Taskr{taskr}
\Taskr{taskr}
\Taskr{taskr}
\WP{wp}
\Taskr{taskr}
\Taskr{taskr}
\Taskr{taskr}
\Taskr{taskr}

\end{document}
Post Reply