From 6436be8597e8c6f8bf1588dbf7d537947ef95369 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 18 Jan 2023 13:23:48 -0800 Subject: [PATCH] Updated templates for pandoc 3.0 --- default.chunkedhtml | 99 +++++++++++++++++++++++++++++++++++++++++++ default.context | 6 +++ default.epub2 | 5 ++- default.epub3 | 5 ++- default.latex | 82 +++++++++++++++++++++-------------- default.revealjs | 10 ++--- styles.citations.html | 23 ++++++++++ styles.html | 52 +++++++++-------------- 8 files changed, 213 insertions(+), 69 deletions(-) create mode 100644 default.chunkedhtml create mode 100644 styles.citations.html diff --git a/default.chunkedhtml b/default.chunkedhtml new file mode 100644 index 00000000..7101c958 --- /dev/null +++ b/default.chunkedhtml @@ -0,0 +1,99 @@ + + + + + + +$for(author-meta)$ + +$endfor$ +$if(date-meta)$ + +$endif$ +$if(keywords)$ + +$endif$ +$if(description-meta)$ + +$endif$ + $if(title-prefix)$$title-prefix$ – $endif$$pagetitle$ + +$for(css)$ + +$endfor$ +$for(header-includes)$ + $header-includes$ +$endfor$ +$if(math)$ + $math$ +$endif$ + + +$for(include-before)$ +$include-before$ +$endfor$ + +$if(title)$ +
+

$title$

+$if(subtitle)$ +

$subtitle$

+$endif$ +$for(author)$ +

$author$

+$endfor$ +$if(date)$ +

$date$

+$endif$ +$if(abstract)$ +
+
$abstract-title$
+$abstract$ +
+$endif$ +
+$endif$ +$if(toc)$ + +$endif$ +$body$ +$for(include-after)$ +$include-after$ +$endfor$ + + diff --git a/default.context b/default.context index c7aca89c..b0c90b4a 100644 --- a/default.context +++ b/default.context @@ -114,6 +114,12 @@ $endif$ \setupxtable[foot][] \setupxtable[lastrow][bottomframe=on] +$if(emphasis-commands)$ +$emphasis-commands$ +$endif$ +$if(highlighting-commands)$ +$highlighting-commands$ +$endif$ $if(csl-refs)$ \definemeasure[cslhangindent][1.5em] \definenarrower[hangingreferences][left=\measure{cslhangindent}] diff --git a/default.epub2 b/default.epub2 index 28de9c11..b1070511 100644 --- a/default.epub2 +++ b/default.epub2 @@ -7,8 +7,11 @@ $pagetitle$ diff --git a/default.epub3 b/default.epub3 index 19961ab1..0fac2e11 100644 --- a/default.epub3 +++ b/default.epub3 @@ -6,8 +6,11 @@ $pagetitle$ diff --git a/default.latex b/default.latex index e3b54ec4..16ea51e0 100644 --- a/default.latex +++ b/default.latex @@ -82,11 +82,6 @@ $if(beamerarticle)$ \usepackage{beamerarticle} % needs to be loaded first $endif$ \usepackage{amsmath,amssymb} -$if(fontfamily)$ -\usepackage[$for(fontfamilyoptions)$$fontfamilyoptions$$sep$,$endfor$]{$fontfamily$} -$else$ -\usepackage{lmodern} -$endif$ $if(linestretch)$ \usepackage{setspace} $endif$ @@ -98,15 +93,48 @@ $endif$ \else % if luatex or xetex $if(mathspec)$ \ifXeTeX - \usepackage{mathspec} + \usepackage{mathspec} % this also loads fontspec \else - \usepackage{unicode-math} + \usepackage{unicode-math} % this also loads fontspec \fi $else$ - \usepackage{unicode-math} + \usepackage{unicode-math} % this also loads fontspec $endif$ - \defaultfontfeatures{Scale=MatchLowercase} + \defaultfontfeatures{Scale=MatchLowercase}$-- must come before Beamer theme \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1} +\fi +$if(fontfamily)$ +$else$ +$-- Set default font before Beamer theme so the theme can override it +\usepackage{lmodern} +$endif$ +$-- Set Beamer theme before user font settings so they can override theme +$if(beamer)$ +$if(theme)$ +\usetheme[$for(themeoptions)$$themeoptions$$sep$,$endfor$]{$theme$} +$endif$ +$if(colortheme)$ +\usecolortheme{$colortheme$} +$endif$ +$if(fonttheme)$ +\usefonttheme{$fonttheme$} +$endif$ +$if(mainfont)$ +\usefonttheme{serif} % use mainfont rather than sansfont for slide text +$endif$ +$if(innertheme)$ +\useinnertheme{$innertheme$} +$endif$ +$if(outertheme)$ +\useoutertheme{$outertheme$} +$endif$ +$endif$ +$-- User font settings (must come after default font and Beamer theme) +$if(fontfamily)$ +\usepackage[$for(fontfamilyoptions)$$fontfamilyoptions$$sep$,$endfor$]{$fontfamily$} +$endif$ +\ifPDFTeX\else + % xetex/luatex font selection $if(mainfont)$ \setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$} $endif$ @@ -167,26 +195,6 @@ $if(zero-width-non-joiner)$ \fi %% End of ZWNJ support $endif$ -$if(beamer)$ -$if(theme)$ -\usetheme[$for(themeoptions)$$themeoptions$$sep$,$endfor$]{$theme$} -$endif$ -$if(colortheme)$ -\usecolortheme{$colortheme$} -$endif$ -$if(fonttheme)$ -\usefonttheme{$fonttheme$} -$endif$ -$if(mainfont)$ -\usefonttheme{serif} % use mainfont rather than sansfont for slide text -$endif$ -$if(innertheme)$ -\useinnertheme{$innertheme$} -$endif$ -$if(outertheme)$ -\useoutertheme{$outertheme$} -$endif$ -$endif$ % Use upquote if available, for straight quotes in verbatim environments \IfFileExists{upquote.sty}{\usepackage{upquote}}{} \IfFileExists{microtype.sty}{% use microtype if available @@ -270,9 +278,12 @@ $if(graphics)$ \def\fps@figure{htbp} \makeatother $endif$ +$if(svg)$ +\usepackage{svg} +$endif$ $if(strikeout)$ $-- also used for underline -\usepackage[normalem]{ulem} +\usepackage{soul} $endif$ \setlength{\emergencystretch}{3em} % prevent overfull lines \providecommand{\tightlist}{% @@ -282,6 +293,9 @@ $if(numbersections)$ $else$ \setcounter{secnumdepth}{-\maxdimen} % remove section numbering $endif$ +$if(subfigure)$ +\usepackage{subcaption} +$endif$ $if(beamer)$ $else$ $if(block-headings)$ @@ -332,6 +346,12 @@ $if(lang)$ \fi $if(babel-lang)$ \babelprovide[main,import]{$babel-lang$} +$if(mainfont)$ +\ifPDFTeX +\else +\babelfont[$babel-lang$]{rm}{$mainfont$} +\fi +$endif$ $endif$ $for(babel-otherlangs)$ \babelprovide[import]{$babel-otherlangs$} @@ -373,7 +393,7 @@ $if(csquotes)$ $endif$ \IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}} \IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available -\urlstyle{same} % disable monospaced font for URLs +\urlstyle{$if(urlstyle)$$urlstyle$$else$same$endif$} $if(links-as-notes)$ % Make links footnotes instead of hotlinks: \DeclareRobustCommand{\href}[2]{#2\footnote{\url{#1}}} diff --git a/default.revealjs b/default.revealjs index e1ca8b82..78edbae7 100644 --- a/default.revealjs +++ b/default.revealjs @@ -235,28 +235,28 @@ $endif$ $if(parallaxBackgroundImage)$ // Parallax background image - parallaxBackgroundImage: '$parallaxBackgroundImage$', // e.g. "'https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg'" + parallaxBackgroundImage: '$parallaxBackgroundImage/nowrap$', // e.g. "'https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg'" $else$ $if(background-image)$ // Parallax background image - parallaxBackgroundImage: '$background-image$', // e.g. "'https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg'" + parallaxBackgroundImage: '$background-image/nowrap$', // e.g. "'https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg'" $endif$ $endif$ $if(parallaxBackgroundSize)$ // Parallax background size - parallaxBackgroundSize: '$parallaxBackgroundSize$', // CSS syntax, e.g. "2100px 900px" + parallaxBackgroundSize: '$parallaxBackgroundSize/nowrap$', // CSS syntax, e.g. "2100px 900px" $endif$ $if(parallaxBackgroundHorizontal)$ // Amount to move parallax background (horizontal and vertical) on slide change // Number, e.g. 100 - parallaxBackgroundHorizontal: $parallaxBackgroundHorizontal$, + parallaxBackgroundHorizontal: $parallaxBackgroundHorizontal/nowrap$, $endif$ $if(parallaxBackgroundVertical)$ - parallaxBackgroundVertical: $parallaxBackgroundVertical$, + parallaxBackgroundVertical: $parallaxBackgroundVertical/nowrap$, $endif$ $if(width)$ diff --git a/styles.citations.html b/styles.citations.html new file mode 100644 index 00000000..979d8397 --- /dev/null +++ b/styles.citations.html @@ -0,0 +1,23 @@ +/* CSS for citations */ +div.csl-bib-body { } +div.csl-entry { + clear: both; +$if(csl-entry-spacing)$ + margin-bottom: $csl-entry-spacing$; +$endif$ +} +.hanging-indent div.csl-entry { + margin-left:2em; + text-indent:-2em; +} +div.csl-left-margin { + min-width:2em; + float:left; +} +div.csl-right-inline { + margin-left:2em; + padding-left:1em; +} +div.csl-indent { + margin-left: 2em; +} diff --git a/styles.html b/styles.html index 776d6a87..5e70a7bb 100644 --- a/styles.html +++ b/styles.html @@ -1,14 +1,20 @@ $if(document-css)$ html { - line-height: $if(linestretch)$$linestretch$$else$1.5$endif$; - font-family: $if(mainfont)$$mainfont$$else$Georgia, serif$endif$; - font-size: $if(fontsize)$$fontsize$$else$20px$endif$; +$if(mainfont)$ + font-family: $mainfont$; +$endif$ +$if(fontsize)$ + font-size: $fontsize$; +$endif$ +$if(linestretch)$ + line-height: $linestretch$; +$endif$ color: $if(fontcolor)$$fontcolor$$else$#1a1a1a$endif$; background-color: $if(backgroundcolor)$$backgroundcolor$$else$#fdfdfd$endif$; } body { margin: 0 auto; - max-width: 36em; + max-width: $if(maxwidth)$$maxwidth$$else$36em$endif$; padding-left: $if(margin-left)$$margin-left$$else$50px$endif$; padding-right: $if(margin-right)$$margin-right$$else$50px$endif$; padding-top: $if(margin-top)$$margin-top$$else$50px$endif$; @@ -21,13 +27,16 @@ @media (max-width: 600px) { body { font-size: 0.9em; - padding: 1em; + padding: 12px; } h1 { font-size: 1.8em; } } @media print { + html { + background-color: $if(backgroundcolor)$$backgroundcolor$$else$white$endif$; + } body { background-color: transparent; color: black; @@ -90,13 +99,14 @@ } $endif$ code { - font-family: $if(monofont)$$monofont$$else$Menlo, Monaco, 'Lucida Console', Consolas, monospace$endif$; + font-family: $if(monofont)$$monofont$$else$Menlo, Monaco, Consolas, 'Lucida Console', monospace$endif$; $if(monobackgroundcolor)$ background-color: $monobackgroundcolor$; padding: .2em .4em; $endif$ font-size: 85%; margin: 0; + hyphens: manual; } pre { margin: 1em 0; @@ -175,33 +185,13 @@ $if(quotes)$ q { quotes: "“" "”" "‘" "’"; } $endif$ -$if(highlighting-css)$ -$highlighting-css$ -$endif$ $if(displaymath-css)$ .display.math{display: block; text-align: center; margin: 0.5rem auto;} $endif$ -$if(csl-css)$ -div.csl-bib-body { } -div.csl-entry { - clear: both; -$if(csl-entry-spacing)$ - margin-bottom: $csl-entry-spacing$; +$if(highlighting-css)$ +/* CSS for syntax highlighting */ +$highlighting-css$ $endif$ -} -.hanging div.csl-entry { - margin-left:2em; - text-indent:-2em; -} -div.csl-left-margin { - min-width:2em; - float:left; -} -div.csl-right-inline { - margin-left:2em; - padding-left:1em; -} -div.csl-indent { - margin-left: 2em; -} +$if(csl-css)$ +$styles.citations.html()$ $endif$