aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dunning <adunning@users.noreply.github.com>2019-01-11 14:17:53 -0500
committerJohn MacFarlane <jgm@berkeley.edu>2019-01-11 11:17:53 -0800
commitfd222b811b584df31651b3b4657941fc8a44eb62 (patch)
tree3201b906fb11b9c277ebefc9b56ef37323a67bec
parent24a0d613a87245c193f7cc3b4a6bf1391a7eb6a8 (diff)
downloadpandoc-fd222b811b584df31651b3b4657941fc8a44eb62.tar.gz
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.
-rw-r--r--MANUAL.txt69
-rw-r--r--data/templates/default.latex10
2 files changed, 37 insertions, 42 deletions
diff --git a/MANUAL.txt b/MANUAL.txt
index 8273447de..bfe35edfc 100644
--- a/MANUAL.txt
+++ b/MANUAL.txt
@@ -166,47 +166,46 @@ pandoc does not require them to be present:
[`parskip`] (for better inter-paragraph spaces),
[`xurl`] (for better line breaks in URLs),
[`bookmark`] (for better PDF bookmarks),
-[`footnote`] (to fix footnotes in tables).
+and [`footnote`] (to fix footnotes in tables).
+[TeX Live]: http://www.tug.org/texlive/
[`amsfonts`]: https://ctan.org/pkg/amsfonts
[`amsmath`]: https://ctan.org/pkg/amsmath
-[`lm`]: https://ctan.org/pkg/lm
-[`ifxetex`]: https://ctan.org/pkg/ifxetex
-[`ifluatex`]: https://ctan.org/pkg/ifluatex
-[`listings`]: https://ctan.org/pkg/listings
-[`fancyvrb`]: https://ctan.org/pkg/fancyvrb
-[`longtable`]: https://ctan.org/pkg/longtable
+[`babel`]: https://ctan.org/pkg/babel
+[`biber`]: https://ctan.org/pkg/biber
+[`biblatex`]: https://ctan.org/pkg/biblatex
+[`bibtex`]: https://ctan.org/pkg/bibtex
+[`bidi`]: https://ctan.org/pkg/bidi
+[`bookmark`]: https://ctan.org/pkg/bookmark
[`booktabs`]: https://ctan.org/pkg/booktabs
+[`csquotes`]: https://ctan.org/pkg/csquotes
+[`fancyvrb`]: https://ctan.org/pkg/fancyvrb
+[`fontspec`]: https://ctan.org/pkg/fontspec
+[`footnote`]: https://ctan.org/pkg/footnote
+[`geometry`]: https://ctan.org/pkg/geometry
[`graphicx`]: https://ctan.org/pkg/graphicx
[`grffile`]: https://ctan.org/pkg/grffile
-[`geometry`]: https://ctan.org/pkg/geometry
-[`setspace`]: https://ctan.org/pkg/setspace
-[`xecjk`]: https://ctan.org/pkg/xecjk
[`hyperref`]: https://ctan.org/pkg/hyperref
-[`ulem`]: https://ctan.org/pkg/ulem
-[`babel`]: https://ctan.org/pkg/babel
-[`bidi`]: https://ctan.org/pkg/bidi
+[`ifluatex`]: https://ctan.org/pkg/ifluatex
+[`ifxetex`]: https://ctan.org/pkg/ifxetex
+[`listings`]: https://ctan.org/pkg/listings
+[`lm`]: https://ctan.org/pkg/lm
+[`longtable`]: https://ctan.org/pkg/longtable
[`mathspec`]: https://ctan.org/pkg/mathspec
-[`unicode-math`]: https://ctan.org/pkg/unicode-math
-[`polyglossia`]: https://ctan.org/pkg/polyglossia
-[`fontspec`]: https://ctan.org/pkg/fontspec
-[`upquote`]: https://ctan.org/pkg/upquote
[`microtype`]: https://ctan.org/pkg/microtype
-[`csquotes`]: https://ctan.org/pkg/csquotes
[`natbib`]: https://ctan.org/pkg/natbib
-[`biblatex`]: https://ctan.org/pkg/biblatex
-[`bibtex`]: https://ctan.org/pkg/bibtex
-[`biber`]: https://ctan.org/pkg/biber
-[TeX Live]: http://www.tug.org/texlive/
-[`wkhtmltopdf`]: https://wkhtmltopdf.org
-[`weasyprint`]: http://weasyprint.org
+[`parskip`]: https://ctan.org/pkg/parskip
+[`polyglossia`]: https://ctan.org/pkg/polyglossia
[`prince`]: https://www.princexml.com/
+[`setspace`]: https://ctan.org/pkg/setspace
+[`ulem`]: https://ctan.org/pkg/ulem
+[`unicode-math`]: https://ctan.org/pkg/unicode-math
[`upquote`]: https://ctan.org/pkg/upquote
-[`microtype`]: https://ctan.org/pkg/microtype
-[`parskip`]: https://ctan.org/pkg/parskip
+[`weasyprint`]: http://weasyprint.org
+[`wkhtmltopdf`]: https://wkhtmltopdf.org
+[`xecjk`]: https://ctan.org/pkg/xecjk
[`xurl`]: https://ctan.org/pkg/xurl
-[`bookmark`]: https://ctan.org/pkg/bookmark
-[`footnote`]: https://ctan.org/pkg/footnote
+
Reading from the Web
@@ -1361,10 +1360,7 @@ depending on the output format, but include the following:
...
`subtitle`
-: document subtitle, included in HTML, EPUB, LaTeX, ConTeXt, and Word docx;
- renders in LaTeX only when using a document class that supports
- `\subtitle`, such as `beamer` or the [KOMA-Script] series (`scrartcl`,
- `scrreprt`, `scrbook`).[^subtitle]
+: document subtitle, included in HTML, EPUB, LaTeX, ConTeXt, and Word docx
`institute`
: author affiliations (in LaTeX and Beamer only). Can be a
@@ -1403,15 +1399,6 @@ depending on the output format, but include the following:
: JSON representation of all of the document's metadata. Field
values are transformed to the selected output format.
-[^subtitle]: To make `subtitle` work with other LaTeX
- document classes, you can add the following to `header-includes`:
-
- \providecommand{\subtitle}[1]{%
- \usepackage{titling}
- \posttitle{%
- \par\large#1\end{center}}
- }
-
Language variables
------------------
diff --git a/data/templates/default.latex b/data/templates/default.latex
index 0701054c0..1691f3a21 100644
--- a/data/templates/default.latex
+++ b/data/templates/default.latex
@@ -350,7 +350,15 @@ $if(title)$
\title{$title$$if(thanks)$\thanks{$thanks$}$endif$}
$endif$
$if(subtitle)$
-\providecommand{\subtitle}[1]{}
+$if(beamer)$
+$else$
+\usepackage{etoolbox}
+\makeatletter
+\providecommand{\subtitle}[1]{% add subtitle to \maketitle
+ \apptocmd{\@title}{\par {\large #1}}{}{}
+}
+\makeatother
+$endif$
\subtitle{$subtitle$}
$endif$
$if(author)$