1

I'm using Pandoc. I found this answer but it works on first-level headers only.

How can I offset second-level headers so that they are:

1

1.0

1.1

instead of

1

1.1

1.2

?

\setcounter{subsection}{-1}

doesn't seem to be working.

Edited to add code:

---
title: My title
date: 01/01/1970
author:
 - John Doe
header-includes:
 - \usepackage{fancyhdr}
 - \pagestyle{fancy}
 - \fancyhead[LO,LE]{This is my header}
 - \fancyfoot[LO,LE]{This is my footer}
 - \fancyfoot[CE,CO]{\thepage}
 - \usepackage[owncaptions,tablegrid]{vhistory}
numbersections: true
mainfont: Helvetica
mainfontoptions: BoldFont=Helvetica Bold
mainfontoptions: ItalicFont=Helvetica Oblique
mainfontoptions: BoldItalicFont=Helvetica Bold Oblique
---

\begin{versionhistory}
\vhEntry{1.1}{13.05.04}{JW|AK|KL}{Typos corrected.}
\vhEntry{1.0}{22.01.04}{JPW|KW}{created}
\vhEntry{1.1}{23.01.04}{DP|JPW}{correction}
\vhEntry{1.2}{03.02.04}{DP|JPW}{revised after review}
\end{versionhistory}

<!--- TOC -->
\setcounter{tocdepth}{4}
\tableofcontents

\setcounter{section}{-1}
\setcounter{subsection}{-1}

#Scope
asdfghj fghjkl

##Applicability
asdfgh fghjkl fghjkl fvghjkl hjklnjk
  • It would be easier to help you if you will provide (non)Working Minimal Example ... – Zarko Nov 1 '16 at 0:12
  • @Zarko Added my code – Barbara Nov 1 '16 at 0:17
  • A minimal example is something we can compile. Many potential helpers will not be able to compile that. You will stand a better chance of getting answers if you paste code for a minimal document in a format everyone can work with i.e. a .tex file e.g. TeX or LaTeX or ConTeXt or whatever. – cfr Nov 1 '16 at 2:45
  • Each time you say \section, the subsection counter is reset to zero. If you just wanted continuous numbering from zero, that would be fairly straightforward. But for this you'll need to change the reset code rather than eliminating it. This depends on class etc., too. I've no idea what the code produced by pandoc looks like in general or in your environment in particular. – cfr Nov 1 '16 at 2:47
2

Instead of

\setcounter{subsection}{-1}

you can add to your preamble (or elsewhere)

\renewcommand{\thesubsection}{\thesection.\number\numexpr\value{subsection}-1}

This changes only the representation of the \subsection counter to be one less than it actually is. This would also work with references, if needed.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.