Wandmalfarbe / pandoc-latex-template

A pandoc LaTeX template to convert markdown files to PDF or LaTeX.
BSD 3-Clause "New" or "Revised" License
6.09k stars 959 forks source link

Feature Request: Override titlepage completely (PDF) #260

Open ctjlewis opened 2 years ago

ctjlewis commented 2 years ago

I'd like to just design the title page PDF myself and then add it as the title page. This currently does not seem possible, even via workarounds like setting a titlepage background and trying to make the text transparent (titlepage-text-color will not accept transparent values).

ctjlewis commented 2 years ago

I worked around with frontmatter:

---
header-includes:
  - \usepackage{pdfpages}
---

And, at the top of the document:

\includepdf{Cover.pdf}
\pagebreak
daamien commented 1 year ago

I'm thinking that a titlepage-override-latex parameter would be nice:

$if(titlepage-override-latex)$
  $titlepage-override-latex$
$elseif(titlepage-background)$
{
% The titlepage with a background image has other text spacing and text size
[...]
}
$else$
{
[...]
}
$endif$

@Wandmalfarbe: I'm willing to implement this and the associated tests, if it's ok for you

daamien commented 1 year ago

@ctjlewis: thanks for the idea of using pdfpages ! I wrote a filter that generates the cover based on an SVG template and the pandoc metadata

https://github.com/daamien/pandoc-cover/

By the way, a couple of remarks about your solution:

include-before:
   - \includepdf{Cover.pdf}
pykong commented 1 year ago

I'd also like the ability to override the cover page. I am not familiar with SVG templates, as used in pandoc-cover.

The ability to use any files supported by pandoc as template is most versatile. We could use pandoc partials in that respect in order to have variables in that temple be expanded (see https://github.com/jgm/pandoc/issues/5931#issuecomment-557847759).

Something along the lines of:

\begin{titlepage}
$cover.tex()$
\end{titlepage}

I do not know though how to set the partial dynamically. I have opened an issue to ask jgm for guidance on this problem: https://github.com/jgm/doctemplates/issues/23#issue-1634553621

I have also tried to use a template partial within the frontmatter, but this does not get rendered, giving an empty title page with the variable string ad verbatim.

include-before:
   - $cover.tex()$