pandoc-latex-template icon indicating copy to clipboard operation
pandoc-latex-template copied to clipboard

Feature Request: Override titlepage completely (PDF)

Open ctjlewis opened this issue 2 years ago • 4 comments

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 avatar Oct 06 '21 20:10 ctjlewis

I worked around with frontmatter:

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

And, at the top of the document:

\includepdf{Cover.pdf}
\pagebreak

ctjlewis avatar Oct 06 '21 20:10 ctjlewis

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 avatar Dec 20 '22 13:12 daamien

@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:

  • AFAIK The \pagebreak command is not necessary
  • This may not work when the table of content (toc is activated), you insert the cover using the include-before variable
include-before:
   - \includepdf{Cover.pdf}

daamien avatar Dec 22 '22 11:12 daamien

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()$

pykong avatar Mar 21 '23 18:03 pykong