TeXnik - Tips TeX and LaTeX


Welcome to the TeXnik website (under construction)

Chapter/Section Title Examples
TUG logo

Main page

Index
UK FAQ
Documentation
Software
CTAN
Search CTAN:

Statistics

Google c.t.t.

Google d.c.t.t.

 


 


Links for Examples
http://www.math.jussieu.fr/~zoonek/LaTeX/LaTeX_samples_title/0.html


Colored example environment
example0


New Chapter on odd and even pages
If the documentclass option openany is not available, then write in the LaTeX preamble
\makeatletter
\renewcommand*{\cleardoublepage}{%
  % original definition, see latex.ltx
  \clearpage
  \if@twoside
    \ifodd\c@page
    \else
      \thispagestyle{empty}% added
      \hbox{}\newpage
      \if@twocolumn
        \hbox{}\newpage
      \fi
    \fi
  \fi
}
\makeatother


Chapter without a leading "Chapter"
The book-class has the chapter layout which looks like

IF you want this titles without a leading "Chapter" than use the koma class with the option
nochapterprefix
or write in preamble:
\makeatletter
\renewcommand\thechapter{\arabic{chapter}}
\def\@makechapterhead#1{%
%  \vspace*{50\p@}%
  {\parindent \z@ \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
      \if@mainmatter
        \par\nobreak
        \vskip 20\p@
      \fi
    \fi
    \interlinepenalty\@M
    \Huge \bfseries \thechapter\ #1\par\nobreak
    \vskip 40\p@
  }}
\makeatother

With this redefinition you always get a contents entry! If you like some more vertical space above the chapter title than delete the "%" in the third line of the preamble.

Another solution is the following one:

The code now looks like:

\newfont{\scaledfont}{cmr12 scaled 7000}
\renewcommand\thechapter{\arabic{chapter}}
\makeatletter
\def\@makechapterhead#1{%
%  \vspace*{50\p@}%
  {\parindent \z@ \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
      \if@mainmatter
        \par\nobreak
        \vskip 20\p@
      \fi
    \fi
    \interlinepenalty\@M
    \parbox{0.8\textwidth}{\Huge \bfseries #1}\ %
    \hfill\scaledfont\thechapter\par\normalsize%
    \rule{\textwidth}{1pt}%  <--- the rule
    \nobreak
    \vskip 40\p@
  }%
}
\makeatother
A special numbering of chapter/section/... is also possible.

for this example the section has a uppercase roman number and the subsections have always three digits.
\usepackage{ifthen}
\renewcommand*{\thesection}{\Roman{section}}
\newcommand\myNumber[1]{%
  \ifthenelse{\value{subsection} < 9}{00}{0}%
}
\renewcommand*{\thesubsection}{%
  \protect\myNumber{}\arabic{subsection}%
}
\usepackage{remreset}
\makeatletter
\@removefromreset{subsection}{section}
\makeatother
It's easy to change this for chapters and subsubsections and so on. If you use one of the Komascript-classes add pointlessnumbers to the class option.


Indentation of Chapter/Sections
To get something like this:
Section
    ...........................
    Subsection
        .......................................
        .....................
        Subsubsection
            .............................
            ............................
    Subsection
        ........................
        .............
Section
    ..................................
    ..................
insert in Layout->Preamble
\newdimen\sectskip
\newdimen\subsectskip
\newdimen\saveskip
\saveskip=\leftskip
\sectskip=1cm
\subsectskip=2cm
%% etc.
\let\oldsection\section
\let\oldsubsection\subsection
%% etc.
\def\section#1{\leftskip=\saveskip\oldsection{#1}\leftskip=\sectskip}
\def\subsection#1{\leftskip=\sectskip\oldsubsection{#1}\leftskip=\subsectskip}
%% etc.
%%


chapter3.png

local time: Sat Apr 20 11:44:20 CEST 2024 ; file is: 1763.04194444444 days old
contact webmaster _at_ TeXnik.de