|
|
Welcome to the TeXnik web site Chapter/Section Title |
![]() |
||||||||||
|
Chaptername |
Chaptertitle |
Chapterstart on left Side |
Detecting if \chapter exists | Examples | Indentation of Sections | New Chapter on odd and even pages | No "Chapter" | Pictures on Chapterpage | Renew the Chapter Definition | Start Chapter on left Side | Unnumbered Chapters/Sections into TOC | Vertical Space for Chapter Title | Detecting ChapterIf you want to know if your documentclass supports chapter then use the following code:\begingroup\expandafter\expandafter\expandafter\endgroup\expandafter% \ifx\csname chapter\endcsname\relax %%% \chapter is undefined or \relax \else %%% \chapter is defined and not \relax \fi Unnumbered Chapters/Sections into TOC \addcontentsline{toc}{chapter}{My unnumbered Chapter}
just after the beginning of the chapter.
Chaptertitle If you want to use the chapternumber and/or title for a header/footer write into the preamble: \newcommand{\ChapName}[1]{}
\newcommand*{\oldChapter}{}
\let\oldChapter\chapter
\renewcommand*{\chapter}{%
\@ifstar{%
\starchapter
}{%
\@dblarg\nostarchapter
}%
}
\newcommand*{\starchapter}[1]{%
\renewcommand{\ChapName}{#1}%
\oldChapter*{#1}%
}
\newcommand{\nostarchapter}{}
\def\nostarchapter[#1]#2{%
% #1: toc entry
% #2: main entry
\renewcommand{\ChapName}{#2}%
\oldChapter[{#1}]{#2}%
}
now you have the commands \thechapter for the number
and \ChapName for the title, which you can place anywhere
in the header/footer. You can get the same for section/subsection a.s.o.
Chaptername If you use babel than you can't change the name "Chapter" with a \renewcommand ... because babel overwrites this change. Write as very first command in your doc in TeX
\def\chaptername{MyChapter}
or write into the preamble f.ex. for the german language
\addto\captionsgerman{%
\renewcommand{\chaptername}%
{insert your chaptername}%
}
Look here if you do not want any
leading name for the chapter.
Start Chapter on Left Side In some cases it may be useful to start a new chapter on the left side instead the default right side. Put the following in the preamble: % Definition from latex.ltx modified
\makeatletter
\renewcommand*{\cleardoublepage}{%
\clearpage
\if@twoside
\ifodd\c@page
\hbox{}%
\newpage
\if@twocolumn
\hbox{}%
\newpage
\fi
\fi
\fi
}
\makeatother
|
|||||||||||