sections and chapters (2023)

contents

  • 1 Introduction
  • 2 basic example
  • 3 Splitting documents
  • 4 numbered and unnumbered sections
    • 4.1 Unnumbered Sections in Table of Contents
  • 5 chapters and sections of the book/report document
    • 5.1 The Report Class
    • 5.2 The Book Class
  • 6 Customize chapters and sections
    • 6.1 Titlesec Commands
  • 7 Further reading

introduction

Documents usually have some sort of “logical structure”: division into chapters, sections, subsections, etc. to organize your content. LaTeX supports creating a document structure and also allows for customization of sections and numbering. The commands available to organize a document depend on the type of document you are using, although the simplest form of organization, tiling, is available in all formats.

basic example

Let's start with a simple example to demonstrate this\Section{title section}Command that marks the beginning of a new section with the nametitle section. Section numbering is automatic and can be customized or disabled.

\documentclass{Article}\Use package{Braille text}\Title{sections and chapters}\Author{Behind}\Meeting{\hey}\begin{document}\maketitle\Section{introduction}This is the first section.\ Braille text\Section{second part}this is the second section\ Braille text\Fin{document}

Open this example on the back.


This example produces the following output:

sections and chapters (1)

Document Splitting

LaTeX can organize, number, and index chapters and sections of a document. Depending on the type of document, there are up to 7 levels of depth to define sections:

-1\part{part}
0\chapter{chapter}
1\section{section}
2\subsection{subsection}
3\subsubsection{subsubsection}
4\paragraph{paragraph}
5\subparagraph{Unterabsatz}

Mostly,\Sectionis the top-level document command in most documents. However, in reports or similar long books and documents this would be the case\ChapterÖ\Part.

Numbered and unnumbered sections

Around a chapter, section, subsection, etc. not numbered, add an asterisk (*) at the end of the command before the opening curly bracket. These are not included in the summary. Here's our first example (above), but this time with\Section*rather than\Section:

\documentclass{Article}\Use package{Braille text}\Title{sections and chapters}\Author{Behind}\Meeting{\hey}\begin{document}\maketitle\Section*{introduction}This is the first section.\ Braille text\Section*{second part}this is the second section\ Braille text\Fin{document}

Open this example on the back.


This example produces the following output:

sections and chapters (2)

Unnumbered sections in the table of contents

To add an unnumbered section to the table of contents, use the\addcontentslineCommand like this:

\addcontentsline{toc}{Section}{section heading}

Here is an example with\addcontentslinebut see articleTable of contentsfor more information and examples.

\documentclass{Article}\Title{sections and chapters}\Author{Behind}\Meeting{\hey}\begin{document}\maketitle\Table of contents\nuevocomando\shortlorem{It is important to take care of the patient, to be accompanied by the doctor, but it is a time of great pain and suffering. Because no one should do any work, down to the smallest detail, unless he gets some benefit from it.}\Section{introduction}This is the first (numbered) section.\shortlorem\addcontentsline{toc}{Section}{unnumbered section}\Section*{unnumbered section}An unnumbered section\shortlorem\Section{second part}The second numbered section.\shortlorem\Fin{document}

Open this example on the back.


This example produces the following output:

sections and chapters (3)

Document chapters and sections in a book/report

As mentioned above,\Chaptercan be used in books and reports.

HimreportClass

Below is an examplereportwith text from the article on the backAn Introduction to LuaTeX (Part 1): What is it and what makes it so different?

\documentclass{report}\Title{sections and chapters}\Author{Behind}\Meeting{\hey}\begin{document}\maketitle\Table of contents\Chapter{An Introduction to the Moon\Texas}\Section{What is it and what makes it so different?}Reis\Texas{}It is a\textit{toolbox}— contains sophisticated software components and tools that allow you to create (compose) a variety of documents. The subtitle of this article also raises two questions about Lua\Texas: What is it and what makes it so different? The answer to "What is this?" It may seem obvious: “It's a\Texas{}Compositing Engine!” Indeed it is, but a broader view, and one that this author subscribes to, is that Lua\Texas{}it is extremely versatile\Texasbased on a document creation and construction system.\subsection{explain moon\Texas: Where to start?}The purpose of this first article about Lua\Texas{}is to provide a context to understand what this TeX engine offers and why/how its design enables users to build/design/create a wide range of solutions to complex typesetting and layout problems, and maybe also offers a certain degree of "future security".\Chapter{Reis\Texas: background and history}\Section{introduction}Reis\Texas{}is on\Texas{}Conceptually "the new kid on the block" although in active development for over 10 years.\subsection{Reis\Texas: opening\Texasthe "black box"}Original by Knut\Texas{}Program is the common ancestor of all modern ones\Texas{}engines used today and Lua\Texas{}is in fact the last evolutionary step: derived from the pdf\Texas{}but with the addition of some powerful software components that offer a variety of additional features.\Fin{document}

Open this example on the back (with lualatex)

This example produces the following output: Here we are displaying pages 2 through 4 with the page images overlaid for easier viewing:

sections and chapters (4)

HimBookClass

The following example returns the text of thereportexample but with\documentclass{Buch}, which contains parts, chapters, sections, paragraphs, and subsections. If you open the example on the back, you will see that the subsections are generated by\subsubsectionthey areNotnumbered. This is intentionalBookclass: If you want to change this behavior, add the following command to the preamble of your document:

\setcounter{second number depth}{3}
\documentclass{Book}\Title{sections and chapters}\Author{Behind}\Meeting{\hey}\begin{document}\maketitle\Table of contents\Part{moon story\Texas}\Chapter{An Introduction to the Moon\Texas}\Section{What is it and what makes it so different?}Reis\Texas{}It is a\textit{toolbox}— contains sophisticated software components and tools that allow you to create (compose) a variety of documents. The subtitle of this article also raises two questions about Lua\Texas: What is it and what makes it so different? The answer to "What is this?" It may seem obvious: “It's a\Texas{}Compositing Engine!” Indeed it is, but a broader view, and one that this author subscribes to, is that Lua\Texas{}it is extremely versatile\Texasbased on a document creation and construction system.\subsection{explain moon\Texas: Where to start?}The purpose of this first article about Lua\Texas{}is to provide a context to understand what this TeX engine offers and why/how its design enables users to build/design/create a wide range of solutions to complex typesetting and layout problems, and maybe also offers a certain degree of "future security".\Chapter{Reis\Texas: background and history}\Section{introduction}Reis\Texas{}is on\Texas{}Conceptually "the new kid on the block" although in active development for over 10 years.\subsection{Reis\Texas: opening\Texasthe "black box"}Original by Knut\Texas{}Program is the common ancestor of all modern ones\Texas{}engines used today and Lua\Texas{}is in fact the last evolutionary step: derived from the pdf\Texas{}but with the addition of some powerful software components that offer a variety of additional features.\subsubsection{who Mouth\Texas{}Complain\texttt{\string\directlua}: A first look}The intended ⟨code⟩\Verb|\directlua{<Code>}| it is first tokenized using the processes and calculations described above; this token sequence is stored in a token list.\Fin{document}

To see the result, open this example on the back (uses Lualatex)

Customize chapters and sections

you can use the...Title sexPack to easily customize the style of chapters, sections and subsections.

\documentclass[A4 paper, 12 points]{Book}\Use package[T1]{Those}\Use package{Title sex}\Title format{\Chapter} %-Domain[Show]% the image{\bfseries\Large\itshape} % Format{not history.\ \ the chapter} % Label{0.5x} % September{ \Rule{\Text width}{1 point} \vspace{1 Bsp} \centered} % before code[\vspace{-0,5 Bsp}%\Rule{\Text width}{0,3pt}]% Postal code\Title format{\Section}[Envelope]{\normalfont\bfseries}{\a section.}{0,5em}{}\titlespacing{\Section}{12 pieces}{1,5ex plus 0,1ex minus 0,2ex}{1 PC}\begin{document}\Chapter{Let us begin}\Section{First try}It is important to take care of the patient, to be accompanied by the doctor, but it is a time of great pain and suffering. To put it in the smallest detail: If you don't do any work...\Section{second try}It is important to take care of the patient, to be accompanied by the doctor, but it is a time of great pain and suffering. To put it in the smallest detail: If you don't do any work...\Fin{document}

Open this example title in verse.

This example produces the following output:

sections and chapters (5)

Title sexcommands

There are two general commands:

 \Title format{<command>}[<Form>]{<Format>}{<Tag>}{<set>}{<alter Code>}[<zip code>]

Where from[<Form>]j[<zip code>]are optional parameters and:

  • <command>is the cut command to reset:\Part,\Chapter,\Section,\subsection,\subsubsection,\Unit volumeÖ\subparagraph.
  • <Form>it is partitioned paragraph form; possible values ​​are:switch off,Block,Show,shrink,left edge,right bank,release,envelopejMarco.
  • <Format>is the format applied to the title, label, and body; for example\normalfont\Large\bfseries
  • <Tag>Specify the cut label.
  • <set>is the horizontal space between the tag and the body of the title and must have a length and cannot be empty.
  • <alter Code>is the code that precedes the body of the title.
  • <zip code>is the code that follows the body of the title.

j

 \titlespacing{<command>}{<links>}{<before September>}{<after September>}

Where from:

  • <links>increases the left margin.
  • <before September>is the vertical space before the title.
  • <after September>It is the separation between the title and the text that is not divided.

The highlighted version of this command (\titlespace*) removes the indentation of the paragraph following the heading.

read another

For more information, see:

  • Create a document in LaTeX
  • Bold, italic and underlined
  • Table of contents
  • Cross Reference Sections and Equations
  • Management of a large project
  • Multi-file LaTeX projects
  • Hyperlinks
  • pagination
  • Single and double sided documents
  • multiple columns
  • Accountant
  • Font sizes, families and styles
  • Title sexpackage manual
Top Articles
Latest Posts
Article information

Author: Sen. Emmett Berge

Last Updated: 04/03/2023

Views: 6047

Rating: 5 / 5 (80 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Sen. Emmett Berge

Birthday: 1993-06-17

Address: 787 Elvis Divide, Port Brice, OH 24507-6802

Phone: +9779049645255

Job: Senior Healthcare Specialist

Hobby: Cycling, Model building, Kitesurfing, Origami, Lapidary, Dance, Basketball

Introduction: My name is Sen. Emmett Berge, I am a funny, vast, charming, courageous, enthusiastic, jolly, famous person who loves writing and wants to share my knowledge and understanding with you.