LaTeX template: Ensure correct heading/table order (#5421)

Improve the workaround for #1658, adapting a solution by @u-fischer in
<https://github.com/latex3/latex2e/issues/131> that works whether or not
the `indent` variable is enabled.

Remove `subparagraph` variable in LaTeX template.  The default is now
to use run-in style for level 4 and 5 headings (`\paragraph` and `\subparagraph`).
To get the previous default behavior (where these were formatted as blocks,
like `\subsubsection`), set the `block-headings` variable.

An example is given in the manual of reformatting the appearance of headings
more thoroughly using KOMA-Script.

Closes #5365.
This commit is contained in:
Andrew Dunning 2019-04-02 20:18:36 -04:00 committed by John MacFarlane
parent 40b60a911c
commit 3d1409347a
6 changed files with 54 additions and 61 deletions

View file

@ -437,7 +437,7 @@ General options {.options}
[XHTML]: http://www.w3.org/TR/xhtml1/ [XHTML]: http://www.w3.org/TR/xhtml1/
[LaTeX]: http://latex-project.org [LaTeX]: http://latex-project.org
[`beamer`]: https://ctan.org/pkg/beamer [`beamer`]: https://ctan.org/pkg/beamer
[Beamer User's Guide]: http://ctan.math.utah.edu/ctan/tex-archive/macros/latex/contrib/beamer/doc/beameruserguide.pdf [Beamer User's Guide]: http://mirrors.ctan.org/macros/latex/contrib/beamer/doc/beameruserguide.pdf
[ConTeXt]: http://www.contextgarden.net/ [ConTeXt]: http://www.contextgarden.net/
[Rich Text Format]: http://en.wikipedia.org/wiki/Rich_Text_Format [Rich Text Format]: http://en.wikipedia.org/wiki/Rich_Text_Format
[DocBook]: http://docbook.org [DocBook]: http://docbook.org
@ -1550,17 +1550,51 @@ Pandoc uses these variables when [creating a PDF] with a LaTeX engine.
### Layout ### Layout
`block-headings`
: make `\paragraph` and `\subparagraph` (fourth- and fifth-level headings, or
fifth- and sixth-level with book classes) free-standing rather than run-in;
requires further formatting to distinguish from `\subsubsection` (third- or
fourth-level headings). Instead of using this option, [KOMA-Script] can adjust
headings more extensively:
---
documentclass: scrartcl
header-includes: |
\RedeclareSectionCommand[
beforeskip=-10pt plus -2pt minus -1pt,
afterskip=1sp plus -1sp minus 1sp,
font=\normalfont\itshape]{paragraph}
\RedeclareSectionCommand[
beforeskip=-10pt plus -2pt minus -1pt,
afterskip=1sp plus -1sp minus 1sp,
font=\normalfont\scshape,
indent=0pt]{subparagraph}
...
`classoption` `classoption`
: option for document class, e.g. `oneside`; repeat for multiple options : option for document class, e.g. `oneside`; repeat for multiple options:
---
classoption:
- twocolumn
- landscape
...
`documentclass` `documentclass`
: document class: usually one of the standard classes, [`article`], [`report`], : document class: usually one of the standard classes, [`article`], [`book`],
and [`book`]; the [KOMA-Script] equivalents, `scrartcl`, `scrreprt`, and [`report`]; the [KOMA-Script] equivalents, `scrartcl`, `scrbook`,
and `scrbook`, which default to smaller margins; or [`memoir`] and `scrreprt`, which default to smaller margins; or [`memoir`]
`geometry` `geometry`
: option for [`geometry`] package, e.g. `margin=1in`; : option for [`geometry`] package, e.g. `margin=1in`;
repeat for multiple options repeat for multiple options:
---
geometry:
- top=30mm
- left=20mm
- heightrounded
...
`indent` `indent`
: uses document class settings for indentation (the default LaTeX template : uses document class settings for indentation (the default LaTeX template
@ -1586,10 +1620,6 @@ Pandoc uses these variables when [creating a PDF] with a LaTeX engine.
: numbering depth for sections (with `--number-sections` option : numbering depth for sections (with `--number-sections` option
or `numbersections` variable) or `numbersections` variable)
`subparagraph`
: disables default behavior of LaTeX template that redefines (sub)paragraphs
as sections, changing the appearance of nested headings in some classes
### Fonts ### Fonts
`fontenc` `fontenc`

View file

@ -99,7 +99,7 @@ $endif$
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\usepackage[$if(fontenc)$$fontenc$$else$T1$endif$]{fontenc} \usepackage[$if(fontenc)$$fontenc$$else$T1$endif$]{fontenc}
\usepackage[utf8]{inputenc} \usepackage[utf8]{inputenc}
\usepackage{textcomp} % provides euro and other symbols \usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex \else % if luatex or xetex
$if(mathspec)$ $if(mathspec)$
\ifxetex \ifxetex
@ -223,7 +223,7 @@ $endif$
pdfcreator={LaTeX via pandoc}} pdfcreator={LaTeX via pandoc}}
\urlstyle{same} % disable monospaced font for URLs \urlstyle{same} % disable monospaced font for URLs
$if(verbatim-in-note)$ $if(verbatim-in-note)$
\VerbatimFootnotes % allows verbatim text in footnotes \VerbatimFootnotes % allow verbatim text in footnotes
$endif$ $endif$
$if(geometry)$ $if(geometry)$
\usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry} \usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry}
@ -252,6 +252,11 @@ $if(beamer)$
\def\fnum@table{\tablename~\thetable} \def\fnum@table{\tablename~\thetable}
\makeatother \makeatother
$else$ $else$
% Correct order of tables after \paragraph or \subparagraph
\usepackage{etoolbox}
\makeatletter
\patchcmd\longtable{\par}{\if@noskipsec\mbox{}\fi\par}{}{}
\makeatother
% Allow footnotes in longtable head/foot % Allow footnotes in longtable head/foot
\IfFileExists{footnotehyper.sty}{\usepackage{footnotehyper}}{\usepackage{footnote}} \IfFileExists{footnotehyper.sty}{\usepackage{footnotehyper}}{\usepackage{footnote}}
\makesavenoteenv{longtable} \makesavenoteenv{longtable}
@ -291,9 +296,8 @@ $else$
$endif$ $endif$
$if(beamer)$ $if(beamer)$
$else$ $else$
$if(subparagraph)$ $if(block-headings)$
$else$ % Make \paragraph and \subparagraph free-standing
% Redefines (sub)paragraphs to behave more like sections
\ifx\paragraph\undefined\else \ifx\paragraph\undefined\else
\let\oldparagraph\paragraph \let\oldparagraph\paragraph
\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}} \renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
@ -307,7 +311,6 @@ $endif$
$if(pagestyle)$ $if(pagestyle)$
\pagestyle{$pagestyle$} \pagestyle{$pagestyle$}
$endif$ $endif$
$for(header-includes)$ $for(header-includes)$
$header-includes$ $header-includes$
$endfor$ $endfor$

View file

@ -10,7 +10,7 @@
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\usepackage[T1]{fontenc} \usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc} \usepackage[utf8]{inputenc}
\usepackage{textcomp} % provides euro and other symbols \usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex \else % if luatex or xetex
\usepackage{unicode-math} \usepackage{unicode-math}
\defaultfontfeatures{Scale=MatchLowercase} \defaultfontfeatures{Scale=MatchLowercase}
@ -81,16 +81,6 @@
\providecommand{\tightlist}{% \providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering \setcounter{secnumdepth}{-\maxdimen} % remove section numbering
% Redefines (sub)paragraphs to behave more like sections
\ifx\paragraph\undefined\else
\let\oldparagraph\paragraph
\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
\fi
\ifx\subparagraph\undefined\else
\let\oldsubparagraph\subparagraph
\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
\fi
\date{} \date{}

View file

@ -10,7 +10,7 @@
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\usepackage[T1]{fontenc} \usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc} \usepackage[utf8]{inputenc}
\usepackage{textcomp} % provides euro and other symbols \usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex \else % if luatex or xetex
\usepackage{unicode-math} \usepackage{unicode-math}
\defaultfontfeatures{Scale=MatchLowercase} \defaultfontfeatures{Scale=MatchLowercase}
@ -48,16 +48,6 @@
\providecommand{\tightlist}{% \providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering \setcounter{secnumdepth}{-\maxdimen} % remove section numbering
% Redefines (sub)paragraphs to behave more like sections
\ifx\paragraph\undefined\else
\let\oldparagraph\paragraph
\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
\fi
\ifx\subparagraph\undefined\else
\let\oldsubparagraph\subparagraph
\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
\fi
\date{} \date{}

View file

@ -10,7 +10,7 @@
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\usepackage[T1]{fontenc} \usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc} \usepackage[utf8]{inputenc}
\usepackage{textcomp} % provides euro and other symbols \usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex \else % if luatex or xetex
\usepackage{unicode-math} \usepackage{unicode-math}
\defaultfontfeatures{Scale=MatchLowercase} \defaultfontfeatures{Scale=MatchLowercase}
@ -42,7 +42,7 @@
hidelinks, hidelinks,
pdfcreator={LaTeX via pandoc}} pdfcreator={LaTeX via pandoc}}
\urlstyle{same} % disable monospaced font for URLs \urlstyle{same} % disable monospaced font for URLs
\VerbatimFootnotes % allows verbatim text in footnotes \VerbatimFootnotes % allow verbatim text in footnotes
\usepackage{graphicx,grffile} \usepackage{graphicx,grffile}
\makeatletter \makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi} \def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
@ -63,16 +63,6 @@
\providecommand{\tightlist}{% \providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering \setcounter{secnumdepth}{-\maxdimen} % remove section numbering
% Redefines (sub)paragraphs to behave more like sections
\ifx\paragraph\undefined\else
\let\oldparagraph\paragraph
\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
\fi
\ifx\subparagraph\undefined\else
\let\oldsubparagraph\subparagraph
\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
\fi
\title{Pandoc Test Suite} \title{Pandoc Test Suite}
\author{John MacFarlane \and Anonymous} \author{John MacFarlane \and Anonymous}

View file

@ -11,7 +11,7 @@
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\usepackage[T1]{fontenc} \usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc} \usepackage[utf8]{inputenc}
\usepackage{textcomp} % provides euro and other symbols \usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex \else % if luatex or xetex
\usepackage{unicode-math} \usepackage{unicode-math}
\defaultfontfeatures{Scale=MatchLowercase} \defaultfontfeatures{Scale=MatchLowercase}
@ -44,16 +44,6 @@
\providecommand{\tightlist}{% \providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering \setcounter{secnumdepth}{-\maxdimen} % remove section numbering
% Redefines (sub)paragraphs to behave more like sections
\ifx\paragraph\undefined\else
\let\oldparagraph\paragraph
\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
\fi
\ifx\subparagraph\undefined\else
\let\oldsubparagraph\subparagraph
\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
\fi
\ifxetex \ifxetex
% Load polyglossia as late as possible: uses bidi with RTL langages (e.g. Hebrew, Arabic) % Load polyglossia as late as possible: uses bidi with RTL langages (e.g. Hebrew, Arabic)
\usepackage{polyglossia} \usepackage{polyglossia}