git.iko.soy/typeable/pandoc
on master help sign in
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.

commit3d1409347a221ee79de568627892eab16c5198d4 authorAndrew Dunning <adunning@users.noreply.github.com> dateTue 2 Apr 2019, 20:18 (8 years ago) parent40b60a9
6 files changed+54−61
MANUAL.txt+40−10 data/templates/default.latex+9−6 test/lhs-test.latex+1−11 test/lhs-test.latex+lhs+1−11 test/writer.latex+2−12 test/writers-lang-and-dir.latex+1−11
MANUAL.txt+40−10
@@ -437,7 +437,7 @@ General options {.options}
437437[XHTML]: http://www.w3.org/TR/xhtml1/
438438[LaTeX]: http://latex-project.org
439439[`beamer`]: https://ctan.org/pkg/beamer
440−[Beamer User's Guide]: http://ctan.math.utah.edu/ctan/tex-archive/macros/latex/contrib/beamer/doc/beameruserguide.pdf
440+[Beamer User's Guide]: http://mirrors.ctan.org/macros/latex/contrib/beamer/doc/beameruserguide.pdf
441441[ConTeXt]: http://www.contextgarden.net/
442442[Rich Text Format]: http://en.wikipedia.org/wiki/Rich_Text_Format
443443[DocBook]: http://docbook.org
@@ -1550,17 +1550,51 @@ Pandoc uses these variables when [creating a PDF] with a LaTeX engine.
15501550
15511551### Layout
15521552
1553+`block-headings`
1554+: make `\paragraph` and `\subparagraph` (fourth- and fifth-level headings, or
1555+ fifth- and sixth-level with book classes) free-standing rather than run-in;
1556+ requires further formatting to distinguish from `\subsubsection` (third- or
1557+ fourth-level headings). Instead of using this option, [KOMA-Script] can adjust
1558+ headings more extensively:
1559+
1560+ ---
1561+ documentclass: scrartcl
1562+ header-includes: |
1563+ \RedeclareSectionCommand[
1564+ beforeskip=-10pt plus -2pt minus -1pt,
1565+ afterskip=1sp plus -1sp minus 1sp,
1566+ font=\normalfont\itshape]{paragraph}
1567+ \RedeclareSectionCommand[
1568+ beforeskip=-10pt plus -2pt minus -1pt,
1569+ afterskip=1sp plus -1sp minus 1sp,
1570+ font=\normalfont\scshape,
1571+ indent=0pt]{subparagraph}
1572+ ...
1573+
15531574`classoption`
1554−: option for document class, e.g. `oneside`; repeat for multiple options
1575+: option for document class, e.g. `oneside`; repeat for multiple options:
1576+
1577+ ---
1578+ classoption:
1579+ - twocolumn
1580+ - landscape
1581+ ...
15551582
15561583`documentclass`
1557−: document class: usually one of the standard classes, [`article`], [`report`],
1558− and [`book`]; the [KOMA-Script] equivalents, `scrartcl`, `scrreprt`,
1559− and `scrbook`, which default to smaller margins; or [`memoir`]
1584+: document class: usually one of the standard classes, [`article`], [`book`],
1585+ and [`report`]; the [KOMA-Script] equivalents, `scrartcl`, `scrbook`,
1586+ and `scrreprt`, which default to smaller margins; or [`memoir`]
15601587
15611588`geometry`
15621589: option for [`geometry`] package, e.g. `margin=1in`;
1563− repeat for multiple options
1590+ repeat for multiple options:
1591+
1592+ ---
1593+ geometry:
1594+ - top=30mm
1595+ - left=20mm
1596+ - heightrounded
1597+ ...
15641598
15651599`indent`
15661600: 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.
15861620: numbering depth for sections (with `--number-sections` option
15871621 or `numbersections` variable)
15881622
1589−`subparagraph`
1590−: disables default behavior of LaTeX template that redefines (sub)paragraphs
1591− as sections, changing the appearance of nested headings in some classes
1592−
15931623### Fonts
15941624
15951625`fontenc`
data/templates/default.latex+9−6
@@ -99,7 +99,7 @@ $endif$
9999\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
100100 \usepackage[$if(fontenc)$$fontenc$$else$T1$endif$]{fontenc}
101101 \usepackage[utf8]{inputenc}
102− \usepackage{textcomp} % provides euro and other symbols
102+ \usepackage{textcomp} % provide euro and other symbols
103103\else % if luatex or xetex
104104$if(mathspec)$
105105 \ifxetex
@@ -223,7 +223,7 @@ $endif$
223223 pdfcreator={LaTeX via pandoc}}
224224\urlstyle{same} % disable monospaced font for URLs
225225$if(verbatim-in-note)$
226−\VerbatimFootnotes % allows verbatim text in footnotes
226+\VerbatimFootnotes % allow verbatim text in footnotes
227227$endif$
228228$if(geometry)$
229229\usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry}
@@ -252,6 +252,11 @@ $if(beamer)$
252252\def\fnum@table{\tablename~\thetable}
253253\makeatother
254254$else$
255+% Correct order of tables after \paragraph or \subparagraph
256+\usepackage{etoolbox}
257+\makeatletter
258+\patchcmd\longtable{\par}{\if@noskipsec\mbox{}\fi\par}{}{}
259+\makeatother
255260% Allow footnotes in longtable head/foot
256261\IfFileExists{footnotehyper.sty}{\usepackage{footnotehyper}}{\usepackage{footnote}}
257262\makesavenoteenv{longtable}
@@ -291,9 +296,8 @@ $else$
291296$endif$
292297$if(beamer)$
293298$else$
294−$if(subparagraph)$
295−$else$
296−% Redefines (sub)paragraphs to behave more like sections
299+$if(block-headings)$
300+% Make \paragraph and \subparagraph free-standing
297301\ifx\paragraph\undefined\else
298302 \let\oldparagraph\paragraph
299303 \renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
@@ -307,7 +311,6 @@ $endif$
307311$if(pagestyle)$
308312\pagestyle{$pagestyle$}
309313$endif$
310−
311314$for(header-includes)$
312315$header-includes$
313316$endfor$
test/lhs-test.latex+1−11
@@ -10,7 +10,7 @@
1010\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
1111 \usepackage[T1]{fontenc}
1212 \usepackage[utf8]{inputenc}
13− \usepackage{textcomp} % provides euro and other symbols
13+ \usepackage{textcomp} % provide euro and other symbols
1414\else % if luatex or xetex
1515 \usepackage{unicode-math}
1616 \defaultfontfeatures{Scale=MatchLowercase}
@@ -81,16 +81,6 @@
8181\providecommand{\tightlist}{%
8282 \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
8383\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
84−% Redefines (sub)paragraphs to behave more like sections
85−\ifx\paragraph\undefined\else
86− \let\oldparagraph\paragraph
87− \renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
88−\fi
89−\ifx\subparagraph\undefined\else
90− \let\oldsubparagraph\subparagraph
91− \renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
92−\fi
93−
9484
9585\date{}
9686
test/lhs-test.latex+lhs+1−11
@@ -10,7 +10,7 @@
1010\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
1111 \usepackage[T1]{fontenc}
1212 \usepackage[utf8]{inputenc}
13− \usepackage{textcomp} % provides euro and other symbols
13+ \usepackage{textcomp} % provide euro and other symbols
1414\else % if luatex or xetex
1515 \usepackage{unicode-math}
1616 \defaultfontfeatures{Scale=MatchLowercase}
@@ -48,16 +48,6 @@
4848\providecommand{\tightlist}{%
4949 \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
5050\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
51−% Redefines (sub)paragraphs to behave more like sections
52−\ifx\paragraph\undefined\else
53− \let\oldparagraph\paragraph
54− \renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
55−\fi
56−\ifx\subparagraph\undefined\else
57− \let\oldsubparagraph\subparagraph
58− \renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
59−\fi
60−
6151
6252\date{}
6353
test/writer.latex+2−12
@@ -10,7 +10,7 @@
1010\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
1111 \usepackage[T1]{fontenc}
1212 \usepackage[utf8]{inputenc}
13− \usepackage{textcomp} % provides euro and other symbols
13+ \usepackage{textcomp} % provide euro and other symbols
1414\else % if luatex or xetex
1515 \usepackage{unicode-math}
1616 \defaultfontfeatures{Scale=MatchLowercase}
@@ -42,7 +42,7 @@
4242 hidelinks,
4343 pdfcreator={LaTeX via pandoc}}
4444\urlstyle{same} % disable monospaced font for URLs
45−\VerbatimFootnotes % allows verbatim text in footnotes
45+\VerbatimFootnotes % allow verbatim text in footnotes
4646\usepackage{graphicx,grffile}
4747\makeatletter
4848\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
@@ -63,16 +63,6 @@
6363\providecommand{\tightlist}{%
6464 \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
6565\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
66−% Redefines (sub)paragraphs to behave more like sections
67−\ifx\paragraph\undefined\else
68− \let\oldparagraph\paragraph
69− \renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
70−\fi
71−\ifx\subparagraph\undefined\else
72− \let\oldsubparagraph\subparagraph
73− \renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
74−\fi
75−
7666
7767\title{Pandoc Test Suite}
7868\author{John MacFarlane \and Anonymous}
test/writers-lang-and-dir.latex+1−11
@@ -11,7 +11,7 @@
1111\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
1212 \usepackage[T1]{fontenc}
1313 \usepackage[utf8]{inputenc}
14− \usepackage{textcomp} % provides euro and other symbols
14+ \usepackage{textcomp} % provide euro and other symbols
1515\else % if luatex or xetex
1616 \usepackage{unicode-math}
1717 \defaultfontfeatures{Scale=MatchLowercase}
@@ -44,16 +44,6 @@
4444\providecommand{\tightlist}{%
4545 \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
4646\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
47−% Redefines (sub)paragraphs to behave more like sections
48−\ifx\paragraph\undefined\else
49− \let\oldparagraph\paragraph
50− \renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
51−\fi
52−\ifx\subparagraph\undefined\else
53− \let\oldsubparagraph\subparagraph
54− \renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
55−\fi
56−
5747\ifxetex
5848 % Load polyglossia as late as possible: uses bidi with RTL langages (e.g. Hebrew, Arabic)
5949 \usepackage{polyglossia}