Text FormattingSubsection starting with "1"

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
Andreas Knafl
Posts: 11
Joined: Mon Jun 20, 2016 11:28 pm

Subsection starting with "1"

Post by Andreas Knafl »

Hey Guys!
I'd like to start my subsection at "1". So when I would start a section and ask for \thesubsection , the output should be "1". And when I start a subsection and ask again , then \thesubsection should be "2"

I've tried to solve this problem by including a new, independent counter enumi. I added it into the titlesec but it won't work
And the way to use \setcounter just works for the first section

Code: Select all

\documentclass[a5paper]{scrbook}

%% Language and font encodings
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[a5paper,top=1cm,bottom=1cm,left=1cm,right=1cm,marginparwidth=1.75cm]{geometry}
\usepackage{amsmath}


\begin{document}
\setcounter{chapter}{1}
\setcounter{subsection}{1}
\thesubsection
\section{Introduction}
\section{Some examples to get started}
\thesubsection
\subsection{How to add Comments}
\end{document}

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Subsection starting with "1"

Post by Johannes_B »

\chapter{Introduction}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10330
Joined: Mon Mar 10, 2008 9:44 pm

Subsection starting with "1"

Post by Stefan Kottwitz »

We should use \chapter and \section before \subsection, otherwise the logic is broken. Even though it can be made with LaTeX. Did you ever see a serious book starting with a subsection? Perhaps with an abstract though or any other non-sectioning environment.

Stefan
LaTeX.org admin
Andreas Knafl
Posts: 11
Joined: Mon Jun 20, 2016 11:28 pm

Subsection starting with "1"

Post by Andreas Knafl »

Stefan Kottwitz wrote:We should use \chapter and \section before \subsection, otherwise the logic is broken. Even though it can be made with LaTeX. Did you ever see a serious book starting with a subsection? Perhaps with an abstract though or any other non-sectioning environment.

Stefan
Thank you Stephan ! I'll try it
User avatar
Stefan Kottwitz
Site Admin
Posts: 10330
Joined: Mon Mar 10, 2008 9:44 pm

Subsection starting with "1"

Post by Stefan Kottwitz »

For example:

Code: Select all

\begin{abstract}
...
\end{abstract}
The abstract name (heading) can be customized. Such an introductional thing doesn't need to be numbered. Numbers make sense when an object (section, equation etc.) may be referenced. But also unnumbered things can be added to the table of contents.

Stefan
LaTeX.org admin
Post Reply