Skip to content

Commit

Permalink
Updated templates for pandoc 3.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jgm committed Jun 24, 2024
1 parent ff51cf4 commit 6c0e7b0
Show file tree
Hide file tree
Showing 7 changed files with 125 additions and 20 deletions.
1 change: 0 additions & 1 deletion default.context
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ $if(pdfa)$
profile={$if(pdfaiccprofile)$$for(pdfaiccprofile)$$pdfaiccprofile$$sep$,$endfor$$else$sRGB.icc$endif$},
intent=$if(pdfaintent)$$pdfaintent$$else$sRGB IEC61966-2.1$endif$]
$endif$
\setupbackend[export=yes]
\setupstructure[state=start,method=auto]

% use microtypography
Expand Down
5 changes: 5 additions & 0 deletions default.jats_articleauthoring
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ $if(article.funding-statement)$
<funding-statement>$article.funding-statement$</funding-statement>
</funding-group>
$endif$
$if(supplementary-material)$
<supplementary-material>
$supplementary-material$
</supplementary-material>
$endif$
</article-meta>
</front>
<body>
Expand Down
32 changes: 20 additions & 12 deletions default.latex
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ $endif$
$if(aspectratio)$
aspectratio=$aspectratio$,
$endif$
$if(babel-lang)$
$babel-lang$,
$endif$
$endif$
$for(classoption)$
$classoption$$sep$,
Expand Down Expand Up @@ -299,15 +302,17 @@ $endif$
$if(graphics)$
\usepackage{graphicx}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
\newsavebox\pandoc@box
\newcommand*\pandocbounded[1]{% scales image to fit in text height/width
\sbox\pandoc@box{#1}%
\Gscale@div\@tempa{\textheight}{\dimexpr\ht\pandoc@box+\dp\pandoc@box\relax}%
\Gscale@div\@tempb{\linewidth}{\wd\pandoc@box}%
\ifdim\@tempb\p@<\@tempa\p@\let\@tempa\@tempb\fi% select the smaller of both
\ifdim\@tempa\p@<\p@\scalebox{\@tempa}{\usebox\pandoc@box}%
\else\usebox{\pandoc@box}%
\fi%
}
% Set default figure placement to htbp
\makeatletter
\def\fps@figure{htbp}
\makeatother
$endif$
Expand Down Expand Up @@ -440,13 +445,15 @@ $endfor$
% get rid of language-specific shorthands (see #6817):
\let\LanguageShortHands\languageshorthands
\def\languageshorthands#1{}
$if(selnolig-langs)$
\ifLuaTeX
\usepackage[$for(selnolig-langs)$$it$$sep$,$endfor$]{selnolig} % disable illegal ligatures
\fi
$endif$
$endif$
$for(header-includes)$
$header-includes$
$endfor$
\ifLuaTeX
\usepackage{selnolig} % disable illegal ligatures
\fi
$if(dir)$
\ifPDFTeX
\TeXXeTstate=1
Expand Down Expand Up @@ -571,7 +578,8 @@ $if(beamer)$
$if(toc-title)$
\frametitle{$toc-title$}
$endif$
\tableofcontents[hideallsubsections]
\setcounter{tocdepth}{$toc-depth$}
\tableofcontents
\end{frame}
$else$
{
Expand Down
64 changes: 64 additions & 0 deletions default.openxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing">
<w:body>
$if(title)$
<w:p>
<w:pPr>
<w:pStyle w:val="Title" />
</w:pPr>
$title$
</w:p>
$endif$
$if(subtitle)$
<w:p>
<w:pPr>
<w:pStyle w:val="Subtitle" />
</w:pPr>
$subtitle$
</w:p>
$endif$
$for(author)$
<w:p>
<w:pPr>
<w:pStyle w:val="Author" />
</w:pPr>
$author$
</w:p>
$endfor$
$if(date)$
<w:p>
<w:pPr>
<w:pStyle w:val="Date" />
</w:pPr>
$date$
</w:p>
$endif$
$if(abstract)$
$if(abstract-title)$
<w:p>
<w:pPr>
<w:pStyle w:val="AbstractTitle" />
</w:pPr>
<w:r><w:t xml:space="preserve">$abstract-title$</w:t></w:r>
</w:p>
$endif$
$abstract$
$endif$
$for(include-before)$
$include-before$
$endfor$
$if(toc)$
$toc$
$endif$
$body$
$for(include-after)$
$include-after$
$endfor$
$-- sectpr will be set to the last sectpr in a reference.docx, if present
$if(sectpr)$
$sectpr$
$else$
<w:sectPr />
$endif$
</w:body>
</w:document>
12 changes: 11 additions & 1 deletion default.texinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
\input texinfo
\input texinfo @c -*-texinfo-*-
$if(filename)$
@setfilename $filename$
$endif$
$if(title)$
@settitle $title$$if(version)$ $version$$endif$
$endif$

@documentencoding UTF-8
$for(header-includes)$
$header-includes$
Expand All @@ -16,6 +23,9 @@ $endif$
$if(titlepage)$
@titlepage
@title $title$
$if(version)$
@subtitle $version$
$endif$
$for(author)$
@author $author$
$endfor$
Expand Down
13 changes: 8 additions & 5 deletions default.typst
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,18 @@ $endif$
$if(title)$
title: [$title$],
$endif$
$if(subtitle)$
subtitle: [$subtitle$],
$endif$
$if(author)$
authors: (
$for(author)$
$if(author.name)$
( name: "$author.name$",
affiliation: "$author.affiliation$",
email: "$author.email$" ),
( name: [$author.name$],
affiliation: [$author.affiliation$],
email: [$author.email$] ),
$else$
( name: "$author$",
( name: [$author$],
affiliation: "",
email: "" ),
$endif$
Expand All @@ -43,7 +46,7 @@ $if(keywords)$
keywords: ($for(keywords)$$keyword$$sep$,$endfor$),
$endif$
$if(date)$
date: "$date$",
date: [$date$],
$endif$
$if(lang)$
lang: "$lang$",
Expand Down
18 changes: 17 additions & 1 deletion template.typst
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
#let content-to-string(content) = {
if content.has("text") {
content.text
} else if content.has("children") {
content.children.map(content-to-string).join("")
} else if content.has("body") {
content-to-string(content.body)
} else if content == [ ] {
" "
}
}
#let conf(
title: none,
subtitle: none,
authors: (),
keywords: (),
date: none,
Expand All @@ -16,7 +28,7 @@
) = {
set document(
title: title,
author: authors.map(author => author.name),
author: authors.map(author => content-to-string(author.name)),
keywords: keywords,
)
set page(
Expand All @@ -34,6 +46,10 @@
if title != none {
align(center)[#block(inset: 2em)[
#text(weight: "bold", size: 1.5em)[#title]
#(if subtitle != none {
parbreak()
text(weight: "bold", size: 1.25em)[#subtitle]
})
]]
}

Expand Down

0 comments on commit 6c0e7b0

Please sign in to comment.