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.

1
  • 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, 2015 at 10:20

2 Answers 2

7

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 ...
1
  • Thank you – I'll give this a try when recreating the documentation again.
    – Benjohn
    Jul 14, 2015 at 8:32
0

As shown in the R Markdown Cookbook:

title: |
  ![](logo.jpg){width=1in}  
  Adding a Logo to LaTeX Title
1
  • 1
    The cookbook is updated - it shows a better way to do it now using the titling package. Oct 24, 2022 at 22:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .