Sonntag, 1. Juni 2014

Latex define new "section-type"

To define a new section-type you need to use the titlesec Package:
\usepackage{titlesec}

to define a new section-type you use the titleclass command with name NAME and copy the properties of \PART (e.g. \section)
\titleclass{\NAME}{option}[\PART]

additionally you need a new counter and a command that gives back the counter:
\newcounter{NAME}
\renewcommand{\theNAME}{\arabic{NAME}} 

finally you can define the titleformat and titlespacings:
\titleformat{\NAME}[hang]
  {\normalfont }                      % format of titletext
  {{\bf Task \theNAME:} }      % command before titletext
  {0pt}                                      % spacing after titletext
  {}                                           % before code
  []                                           % after code
\titlespacing{\NAME}{0pt}{*4}{*2}

With options explained here:
\titlespacing*{command}{left}{before-sep}{after-sep}
For a more detailed description look into the titlesec documentatio, but these are the most important points.

Keine Kommentare:

Kommentar veröffentlichen