0

I am working on a document with Rmarkdown with latex output, the file compiles well and delivers the document correctly, however I want to delete the page number that appears in the document title, that is, number 1. I have tried the alternatives of latex such as \thispagestyle {empty}, but I don't find it. My code is as follows:

---
title: |
  | \vspace{5cm} \Huge [My title][1]
  | \vspace{0.5cm} \LARGE My subtitle
author: "xxx"
date: "`r Sys.Date()`"

output:
  pdf_document:
    citation_package: natbib
    fig_caption: yes
    keep_tex: yes
    number_sections: yes
    highlight: zenburn
csl: ajpa.csl
bibliography: bibliography.bib

header-includes:
- \usepackage{draftwatermark}
- \usepackage{fancyhdr}
- \usepackage{xcolor, hyperref}
- \usepackage{lipsum}
- \usepackage{appendix}
- \setlength{\headheight}{47pt}
- \setlength{\footskip}{25pt}
- \renewcommand{\headrulewidth}{0.5pt}
- \renewcommand{\footrulewidth}{0.5pt}
- \rhead{\thepage}
- \hypersetup{colorlinks   = true, linkcolor = black, urlcolor  = blue, citecolor
  = blue}
- \fancypagestyle{plain}{\pagestyle{fancy}}
- \pagestyle{fancy}
- \lhead{\includegraphics[width=7cm,height=1cm]{C:/mypath/stack.jpg}}
---

The result of the code is that document format for all the sheets, but I need to delete the number 1 and the top image only from the front page of the document (see attached image)enter image description here, and that the number 1 start on the next sheet. Thank you very much for your time and advice.

  • Hi! What did you try so far? Did you for example try any of the solutions provided here: https://stackoverflow.com/questions/38765422/how-to-start-page-numbering-in-r-markdown-from-the-second-page OR https://tex.stackexchange.com/questions/487450/disabling-page-numbering-bottom-of-page – Annet Feb 07 '20 at 07:40
  • @Annet Thanks for your advice, I was reviewing them and I could reach the desired result, I will leave the result with the code in the answer – boris_traveler Feb 10 '20 at 15:17
  • Does this answer your question? [How to start page numbering in R Markdown from the second page?](https://stackoverflow.com/questions/38765422/how-to-start-page-numbering-in-r-markdown-from-the-second-page) – Annet Feb 10 '20 at 18:59
  • @Annet you are right. the problem was that I was always considered the command '''\pagenumbering {Arabic}''' inside the YAML, being that it was outside of this. Thanks a lot!! – boris_traveler Feb 10 '20 at 21:13

1 Answers1

2

The solution was easier than I thought, but it took me a little while to understand the structure in Rmarkdown. \pagenumbering{gobble} should be placed inside the YAML to delete the page number on the title page and then add \pagenumbering{arabic} outside the YAML metadata.

header-includes:
- \usepackage{draftwatermark}
- \usepackage{fancyhdr}
- \usepackage{xcolor, hyperref}
- \usepackage{lipsum}
- \usepackage{appendix}
- \setlength{\headheight}{47pt}
- \setlength{\footskip}{25pt}
- \renewcommand{\headrulewidth}{0.5pt}
- \renewcommand{\footrulewidth}{0.5pt}
- \pagenumbering{gobble}
- \hypersetup{colorlinks   = true, linkcolor = black, urlcolor  = blue, citecolor
  = blue}
- \pagestyle{fancy}
- \lhead{\includegraphics[width=7cm,height=1cm]{C:/mypath/stack.jpg}}
- \rhead{\thepage}
---
\newpage
\pagenumbering{arabic}
\renewcommand\contentsname{Contents}

I hope it serves others who have this same problem. regards.