I am converting a markdown file to pdf using pandoc. How can I suppress page numbers in the pdf file?
Asked
Active
Viewed 2.4k times
1 Answers
75
I will answer my own question here:
I learned in this post that pandoc markdown understands standard latex commands. Take for example the following markdown file called test.md
:
% A pdf file without page numbers created from pandoc markdown
% sieste
% June 2013
\pagenumbering{gobble}
# First header
etc
and the command
pandoc test.md -o test.pdf
produces the desired pdf without page numbers.
I tried to use \pagestyle{empty}
at first, but it did not work: If I put it where \pagenumbering{gobble}
is now, page numbering is only turned off from page 2 on, and the first page is still numbered. And if I put it before the title block, the title in the pdf is messed up.
-
6For those attempting in Rmarkdown, add `#' \pagenumbering{gobble}` after your preamble. – MikeRSpencer Jan 06 '16 at 19:41
-
6or `header-includes: - \pgenumbering{gobble}` in the `YAML`. Remember to indent properly. – DaveRGP Jan 17 '18 at 14:21
-
5@DaveRGP, you should probably correct your last comment: in "pgenumbering", the "a" missing. – Prof.Chaos Feb 02 '18 at 10:31
-
@Prof.Chaos, thanks for spotting. I would, but my ability to edit comments expires 15min after posting. – DaveRGP Feb 02 '18 at 11:37
-
O really? That suxx. O well, let's hope people read our comments, then. :) – Prof.Chaos Feb 05 '18 at 15:04
-
4`\thispagestyle{empty}` also works fine! – nilon Mar 06 '19 at 16:26
-
1Using `pagestyle: empty` in the yaml header in my markdown file also worked for me. – John Nov 19 '19 at 12:59
-
1@nilon This only removes the page number on the first page (for me) – sieste Nov 25 '19 at 11:54
-
@John This does not work for me, I still get a page number on the first page. – sieste Nov 25 '19 at 11:57
-
1See https://tex.stackexchange.com/a/464904/74612 → "use `-V pagestyle=empty` as parameter for pandoc" – Jaleks Feb 09 '22 at 08:01