0

I'm using chapters in my thesis. Within chapters I'm using sections for structuring. Most sections are rather short however, so I don't want them to have/display a number.

Basically what I want should look like the following:

1 Chapter

Section A

Def 1.1

...

Proposition 1.5

Section B

Def 1.6

I tried using

\makeatletter \def\@seccntformat#1{% \expandafter\ifx\csname c@#1\endcsname\c@section\else \csname the#1\endcsname\quad \fi} \makeatother

The output however looks like

1 Chapter

Section A

Def 1.2

How can I tell LaTeX to number the code the way I tried above? Thanks in advance!

6
  • Why not a simple \renewcommand{\thesection}{}?
    – Bernard
    Jun 10, 2019 at 9:59
  • Welcome to TeX.SX! Could you please add a minimal working example (MWE) that allows others to reproduce the issue you describe?
    – leandriis
    Jun 10, 2019 at 9:59
  • @Bernard: I don't know how.. Could you give me an example that should produce the output I'd like?
    – user190728
    Jun 10, 2019 at 12:06
  • Yes, but could you post a minimal (yet complete) code that we can play with?
    – Bernard
    Jun 10, 2019 at 12:08
  • Of course, one second.
    – user190728
    Jun 10, 2019 at 12:26

1 Answer 1

1

How can I tell LaTeX to number the code the way I tried above? Thanks in advance!

Some nitpicking:

You can't "tell" LaTeX to number (in whatsoever ways) the code because LaTeX must not modify (in whatsoever ways) the .tex-source code of a document while "numbering code" can be subsumed under "modifying code".

But you can "tell" LaTeX to number in the way you exhibited above some items of sectioning that may be represented by portions of .tex-source-code and that appear when viewing/displaying/printing the .pdf-file which comes into being as one of the results of compiling the .tex-source-code. ;-)

With most document classes for LaTeX you have sectioning commands like \chapter, \section, etc.
With most document classes for LaTeX for each of these sectioning commands a so-called "starred" variant exists which does produce the item of sectioning without a sectioning number (and without an entry in the table of contents, and without a bookmark in case of using hyperref, and without changing the page headings).

\documentclass{report}
\usepackage{hyperref}
\newtheorem{Definition}{Def}[chapter]
\newtheorem{Proposition}[Definition]{Proposition}

\begin{document}
\tableofcontents
\chapter{Chapter}
\section*{Section A}\addcontentsline{toc}{section}{Section A}
\begin{Definition}...\end{Definition}
\begin{Definition}...\end{Definition}
\begin{Definition}...\end{Definition}
\begin{Definition}...\end{Definition}
\begin{Proposition}...\end{Proposition}
\section*{Section B}
\begin{Definition}...\end{Definition}

\end{document}

Page 1:

enter image description here

Page 2:

enter image description here

2
  • Ah, sorry I was kind of sloppy there: I'd like Section A to get listed in the table of contents if possible. I just don't want it to have a number (displayed). Also: Thanks a lot for the technical correction as well as your time and effort.
    – user190728
    Jun 10, 2019 at 12:05
  • @user190728 I just added an \addcontentsline which will cause creation of the corresponding entry within the table of contents... Jun 10, 2019 at 18:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .