7

I'm using Pandoc to convert Markdown to PDF via LaTeX. I'm very happy with the result, particularly now I've discovered Pandoc's support for YAML document metadata with which you can make substantial customisations to output.

However, I have been asked to include our company logo (available as PNG or SVG) above the document title.

I suspect this can be achieved by modifying the Pandoc template.

Alternatively, perhaps an included .tex or .latex document could adjusts the way the title is displayed / laid out (I'm not sure if LaTeX supports this kind of "overriding"?) like this:

----
output:
  pdf_document:
    includes:
      in_header: some-file-with-title-customisations.tex
      before_body: or-in-here.tex
      after_body: or-maybe-here.tex
----

I'm not sure what I should customise in the template (or in a file that I include), and how I should customise it, though.

  • Welcome to TeX.SX! I am no pandoc user, but I think we need more information what you're actually doing there. – user31729 May 28 '15 at 10:20
5

For the documentation of a recent customer project I used the following (modified) section to replace the respective lines of the default Pandoc template (which itself can be printed with the pandoc -D latex command):

\makeatletter
\def\maketitle{%
  \null
  \thispagestyle{empty}%
  \includegraphics[width=3em]{red_corner.png}
  \vfill
  \begin{flushleft}\leavevmode
    \titlefont
    {\LARGE \@title\par}%
    \authorfont
    \vskip 1cm
    %{\normalsize \@author\par}%
    {\large \@author\par}%
    \normalfont
    \vskip 2cm
    {\normalsize \@date\par}%
  \end{flushleft}%
  \vfill
  \begin{flushright}
      \includegraphics[width=3em]{green_corner.png}
  \end{flushright}%
  \null
  \cleardoublepage
  }
\makeatother

It includes two small graphics on the title page.

This should serve you as an idea trigger how you can achieve what you imagine for your own title page.

Caveats

Above snippet additionally uses customizations authorfont and titlefont which are defined in the same template, earlier, as:

\definecolor{lhgray}{HTML}{494949}
\newfontfamily\titlefont{Source Sans Pro Bold}
\newfontfamily\authorfont[Color={lhgray}]{Source Sans Pro}

Howto

So just create your new Pandoc template by following these steps:

  1. Run pandoc -D latex > my-pandoc-latex.template
  2. Edit the file my-pandoc-latex.template according to your needs, using above snippets as inspiration.
  3. Produce your output by running pandoc --template my-pandoc-latex.template ...
  • Thank you – I'll give this a try when recreating the documentation again. – Benjohn Jul 14 '15 at 8:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.