Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

centre title in PDF converted from markdown using Pandoc

Tags:

markdown

r

pandoc

I'm converting a markdown document to a PDF document using Pandoc from within R. I'm trying to centre the title.

So far, I've tried:

 <center># This is my title</center>

and

-># This is my title<-

but neither have worked. Is there a way to centre the title when converting from markdown to PDF using Pandoc?

like image 382
luciano Avatar asked May 07 '13 13:05

luciano


1 Answers

pandoc has its own extended version of markdown. This includes a title block.

If the file begins with a title block

% my title
% Me; Someone else
% May 2013

This will be parsed into LaTeX and the resulting pdf as

\title{my title}
\author{Me \and Someone Else}
\date{May 2013}

and then `

\maketitle

called within the document.

This will create the standard centred title.

If you want to change how the title etc is formatted you could use the titling package.

If you want to change how the section headers are formatted, you could use the titlesec package.

To automagically have pandoc implement these you could define your own template. A simpler option is to have a file with your desired latex preamble to be included in the header. and then use the appropriate arguments when calling pandoc (eg -H FILE or --include-in-header=FILE)

like image 97
mnel Avatar answered Oct 04 '22 18:10

mnel