mirror of
https://github.com/Kaffesky/kaffesky-markdown-templates.git
synced 2026-04-18 12:37:30 +02:00
updates
This commit is contained in:
parent
db70d3f46d
commit
9cee929317
2 changed files with 110 additions and 12 deletions
|
|
@ -129,7 +129,45 @@ Then compile with:
|
|||
```bash
|
||||
pandoc input.md -o output.pdf \
|
||||
--pdf-engine=xelatex \
|
||||
--template=template_first-skyfritt-example.tex
|
||||
--template=template_first-skyfritt-example.tex \
|
||||
--shift-heading-level-by=-1
|
||||
```
|
||||
|
||||
### Why `--shift-heading-level-by=-1`?
|
||||
|
||||
Pandoc's `article` class maps `#` → `\section`, `##` → `\subsection`, and so on. If your Markdown has a single `# Document Title` at the top followed by `## 1. Introduction`, `## 2. …`, etc., the title ends up as "Section 1" in the TOC and all real sections become subsections 1.1, 1.2, …
|
||||
|
||||
Passing `--shift-heading-level-by=-1` shifts every heading up one level before rendering:
|
||||
|
||||
| Markdown | Without flag | With flag |
|
||||
|----------|-------------|-----------|
|
||||
| `#` | `\section` (appears in TOC) | promotes to document title — invisible in body |
|
||||
| `##` | `\subsection` | `\section` |
|
||||
| `###` | `\subsubsection` | `\subsection` |
|
||||
|
||||
The `#` heading is absorbed as the top-level title and removed from the body, so your real sections (`##`) become proper `\section` entries.
|
||||
|
||||
### Section numbering
|
||||
|
||||
By default the template **suppresses LaTeX auto-numbering** (`secnumdepth = 0`), because headings written as `## 1. Introduction` already carry their own numbers. Letting LaTeX add its own would produce double-numbering like `1 1. Introduction`.
|
||||
|
||||
If you prefer LaTeX to number sections automatically (and write headings without embedded numbers, e.g. `## Introduction`), pass `--number-sections`:
|
||||
|
||||
```bash
|
||||
pandoc input.md -o output.pdf \
|
||||
--pdf-engine=xelatex \
|
||||
--template=template_first-skyfritt-example.tex \
|
||||
--shift-heading-level-by=-1 \
|
||||
--number-sections
|
||||
```
|
||||
|
||||
You can also control the depth of numbering with the `secnumdepth` metadata variable:
|
||||
|
||||
```yaml
|
||||
---
|
||||
title: "My Document"
|
||||
secnumdepth: 2 # number sections and subsections only
|
||||
---
|
||||
```
|
||||
|
||||
---
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue