git.iko.soy/typeable/pandoc
on master help sign in
LaTeX template: Render \subtitle (#5213)

Addresses closed issues #4675, #3896, #1327. This renders `\subtitle` using the `etoolbox` package if `\subtitle` is not already defined by the documentclass (as it is in beamer, KOMA, memoir classes). Based on an example from Enrico Gregorio, <https://tex.stackexchange.com/a/50186>. Update list of LaTeX packages. Note that `etoolbox` must be loaded outside the command definition. Putting it inside causes an error if `\title` is placed after `\begin{document}`. It's already loaded on LuaLaTeX/XeLaTeX in any case.

commitfd222b811b584df31651b3b4657941fc8a44eb62 authorAndrew Dunning <adunning@users.noreply.github.com> dateFri 11 Jan 2019, 14:17 (8 years ago) parent24a0d61
2 files changed+37−42
MANUAL.txt+28−41 data/templates/default.latex+9−1
MANUAL.txt+28−41
@@ -166,47 +166,46 @@ pandoc does not require them to be present:
166166[`parskip`] (for better inter-paragraph spaces),
167167[`xurl`] (for better line breaks in URLs),
168168[`bookmark`] (for better PDF bookmarks),
169−[`footnote`] (to fix footnotes in tables).
169+and [`footnote`] (to fix footnotes in tables).
170170
171+[TeX Live]: http://www.tug.org/texlive/
171172[`amsfonts`]: https://ctan.org/pkg/amsfonts
172173[`amsmath`]: https://ctan.org/pkg/amsmath
173−[`lm`]: https://ctan.org/pkg/lm
174−[`ifxetex`]: https://ctan.org/pkg/ifxetex
175−[`ifluatex`]: https://ctan.org/pkg/ifluatex
176−[`listings`]: https://ctan.org/pkg/listings
177−[`fancyvrb`]: https://ctan.org/pkg/fancyvrb
178−[`longtable`]: https://ctan.org/pkg/longtable
174+[`babel`]: https://ctan.org/pkg/babel
175+[`biber`]: https://ctan.org/pkg/biber
176+[`biblatex`]: https://ctan.org/pkg/biblatex
177+[`bibtex`]: https://ctan.org/pkg/bibtex
178+[`bidi`]: https://ctan.org/pkg/bidi
179+[`bookmark`]: https://ctan.org/pkg/bookmark
179180[`booktabs`]: https://ctan.org/pkg/booktabs
181+[`csquotes`]: https://ctan.org/pkg/csquotes
182+[`fancyvrb`]: https://ctan.org/pkg/fancyvrb
183+[`fontspec`]: https://ctan.org/pkg/fontspec
184+[`footnote`]: https://ctan.org/pkg/footnote
185+[`geometry`]: https://ctan.org/pkg/geometry
180186[`graphicx`]: https://ctan.org/pkg/graphicx
181187[`grffile`]: https://ctan.org/pkg/grffile
182−[`geometry`]: https://ctan.org/pkg/geometry
183−[`setspace`]: https://ctan.org/pkg/setspace
184−[`xecjk`]: https://ctan.org/pkg/xecjk
185188[`hyperref`]: https://ctan.org/pkg/hyperref
186−[`ulem`]: https://ctan.org/pkg/ulem
187−[`babel`]: https://ctan.org/pkg/babel
188−[`bidi`]: https://ctan.org/pkg/bidi
189+[`ifluatex`]: https://ctan.org/pkg/ifluatex
190+[`ifxetex`]: https://ctan.org/pkg/ifxetex
191+[`listings`]: https://ctan.org/pkg/listings
192+[`lm`]: https://ctan.org/pkg/lm
193+[`longtable`]: https://ctan.org/pkg/longtable
189194[`mathspec`]: https://ctan.org/pkg/mathspec
190−[`unicode-math`]: https://ctan.org/pkg/unicode-math
191−[`polyglossia`]: https://ctan.org/pkg/polyglossia
192−[`fontspec`]: https://ctan.org/pkg/fontspec
193−[`upquote`]: https://ctan.org/pkg/upquote
194195[`microtype`]: https://ctan.org/pkg/microtype
195−[`csquotes`]: https://ctan.org/pkg/csquotes
196196[`natbib`]: https://ctan.org/pkg/natbib
197−[`biblatex`]: https://ctan.org/pkg/biblatex
198−[`bibtex`]: https://ctan.org/pkg/bibtex
199−[`biber`]: https://ctan.org/pkg/biber
200−[TeX Live]: http://www.tug.org/texlive/
201−[`wkhtmltopdf`]: https://wkhtmltopdf.org
202−[`weasyprint`]: http://weasyprint.org
197+[`parskip`]: https://ctan.org/pkg/parskip
198+[`polyglossia`]: https://ctan.org/pkg/polyglossia
203199[`prince`]: https://www.princexml.com/
200+[`setspace`]: https://ctan.org/pkg/setspace
201+[`ulem`]: https://ctan.org/pkg/ulem
202+[`unicode-math`]: https://ctan.org/pkg/unicode-math
204203[`upquote`]: https://ctan.org/pkg/upquote
205−[`microtype`]: https://ctan.org/pkg/microtype
206−[`parskip`]: https://ctan.org/pkg/parskip
204+[`weasyprint`]: http://weasyprint.org
205+[`wkhtmltopdf`]: https://wkhtmltopdf.org
206+[`xecjk`]: https://ctan.org/pkg/xecjk
207207[`xurl`]: https://ctan.org/pkg/xurl
208−[`bookmark`]: https://ctan.org/pkg/bookmark
209−[`footnote`]: https://ctan.org/pkg/footnote
208+
210209
211210
212211Reading from the Web
@@ -1361,10 +1360,7 @@ depending on the output format, but include the following:
13611360 ...
13621361
13631362`subtitle`
1364−: document subtitle, included in HTML, EPUB, LaTeX, ConTeXt, and Word docx;
1365− renders in LaTeX only when using a document class that supports
1366− `\subtitle`, such as `beamer` or the [KOMA-Script] series (`scrartcl`,
1367− `scrreprt`, `scrbook`).[^subtitle]
1363+: document subtitle, included in HTML, EPUB, LaTeX, ConTeXt, and Word docx
13681364
13691365`institute`
13701366: author affiliations (in LaTeX and Beamer only). Can be a
@@ -1403,15 +1399,6 @@ depending on the output format, but include the following:
14031399: JSON representation of all of the document's metadata. Field
14041400 values are transformed to the selected output format.
14051401
1406−[^subtitle]: To make `subtitle` work with other LaTeX
1407− document classes, you can add the following to `header-includes`:
1408−
1409− \providecommand{\subtitle}[1]{%
1410− \usepackage{titling}
1411− \posttitle{%
1412− \par\large#1\end{center}}
1413− }
1414−
14151402Language variables
14161403------------------
14171404
data/templates/default.latex+9−1
@@ -350,7 +350,15 @@ $if(title)$
350350\title{$title$$if(thanks)$\thanks{$thanks$}$endif$}
351351$endif$
352352$if(subtitle)$
353−\providecommand{\subtitle}[1]{}
353+$if(beamer)$
354+$else$
355+\usepackage{etoolbox}
356+\makeatletter
357+\providecommand{\subtitle}[1]{% add subtitle to \maketitle
358+ \apptocmd{\@title}{\par {\large #1}}{}{}
359+}
360+\makeatother
361+$endif$
354362\subtitle{$subtitle$}
355363$endif$
356364$if(author)$