This question covers R Studio, pandoc and also LaTeX I suppose. The following is what my YAML looks like in R Studio:
---
name: Me Me Me
surname: Myself
position: "Job seeker"
address: "Some address in Newfoundland"
phone: +1 800 111111
www: google.com
email: "myemail#yahoo.com"
linkedin: john-joseph-jingle-jabber-smith/123
date: "`r format(Sys.time(), '%B %Y')`"
output: vitae::moderncv
theme: classic
---
In the footer, the page number is displayed. People with a similar problem have fixed this by changing the LaTeX preamble, but I have no such file, instead I have a collection of one .cls and several .sty files. Which of these would I need to change in order to suppress page numbering? Or is it possible to add pandoc args for this in the preamble?
moderncv has the \nopagenumbers macro to switch off page numbers:
---
name: Me Me Me
surname: Myself
position: "Job seeker"
address: "Some address in Newfoundland"
phone: +1 800 111111
www: google.com
email: "myemail#yahoo.com"
linkedin: john-joseph-jingle-jabber-smith/123
date: "`r format(Sys.time(), '%B %Y')`"
output:
vitae::moderncv:
keep_tex: true
header-includes:
- \nopagenumbers
theme: classic
---
test
\clearpage
test
Related
I am trying to integrate footnotes AND a logo on the frontpage of a Rmarkdown generated PDF.
I try this:
---
title : "My report"
date : November 4th, 2022
author: "Author 1[^note1]"
documentclass : report
keep_tex : true
header-includes:
- \usepackage{titling}
- \pretitle{\begin{center}
\includegraphics[width=2in,height=2in]{logo.png}\LARGE\\}
- \posttitle{\end{center}}
output : pdf_document
---
[^note1]: Writing, Research, Editing
Inspired by this procedure to integrate the logo:
https://bookdown.org/yihui/rmarkdown-cookbook/latex-logo.html
And this for the footnotes:
https://stackoverflow.com/a/62514739/12398676
However, I am getting this error:
! Argument of \reserved#a has an extra }.
<inserted text>
\par
l.69 ...or 1\footnote{Writing, Research, Editing}}
Error: LaTeX failed to compile logo_footnote.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See logo_footnote.log for more info.
Execution halted
Anyone has an idea of what is going wrong?
EDIT: the solution provided by samcarter_is_at_topanswers.xyz
... is one step closer to the solution but not quite there.
I now have a logo and author name, but the author name is overlayed with the date
EDIT2: In the solution provided by samcarter_is_at_topanswers.xyz I get a similar display problem even without a logo
---
title : "My report"
date : November 4th, 2022
documentclass : report
keep_tex : true
header-includes:
- \AtBeginDocument{\author{Author 1\protect\footnote{Writing, Research, Editing}}}
output :
pdf_document:
keep_tex: true
---
test
You can work around the problem like this:
---
title : "My report"
date : November 4th, 2022
documentclass : report
keep_tex : true
header-includes:
- \AtBeginDocument{\author{Author 1\protect\footnote{Writing, Research, Editing}}}
- \usepackage{titling}
- \pretitle{\begin{center}
\includegraphics[width=2in,height=2in]{example-image-duck}\LARGE\par}
- \posttitle{\end{center}}
output :
pdf_document:
keep_tex: true
---
test
I have plenty of markdown files starting with a rather long header-includes, followed by some included directives:
---
header-includes:
- \usepackage{fvextra}
- \usepackage{tcolorbox}
- \DefineVerbatimEnvironment{Highlighting}{Verbatim}{breaklines,breakanywhere,breaksymbol=,breakanywheresymbolpre=,commandchars=\\\{\}}
- \usepackage[margins=raggedright]{floatrow}
title: "Mathématiques \n55. Les dérivées"
subtitle: ""
author: Marc Le Bihan
geometry: margin=2cm
fontsize: 12pt
output: pdf
classoption: fleqn
urlcolor: blue
---
\input{apprentissage-include}
where apprentissage-include.tex has such definitions:
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{breaklines,breakanywhere,breaksymbol=,breakanywheresymbolpre=,commandchars=\\\{\}}
\newcommand{\donnee}[1]{\textbf{\textcolor{Purple}{#1}}}
\newcommand{\definition}[1]{\textbf{\textcolor{blue}{#1}}}
[...]
I would like to include the header-includes preamble too, to change its content more easily when updates are needed.
I've created an header-include.tex containing:
---
header-includes:
- \usepackage{fvextra}
[...]
---
But whatever I've tried :
\input{header-include}
\input{apprentissage-include}
or
---
\input{header-include}
---
\input{apprentissage-include}
I'm receiving the message :
! LaTeX Error: Can be used only in preamble.
Do I have a way to succeed?
As you are loading packages in the header-include.tex file it needs to go into the header. To get access to the latex syntax of \input{...}, you have to put it into the header includes:
markdown file:
---
output:
pdf_document:
keep_tex: true
header-includes:
- \input{header-include}
- \input{apprentissage-include}
title: "Mathématiques \n55. Les dérivées"
subtitle: ""
author: Marc Le Bihan
geometry: margin=2cm
fontsize: 12pt
classoption: fleqn
urlcolor: blue
---
test
The header-include.tex file needs to use latex syntax, so no - or any other markdown syntax
header-include.tex:
\usepackage{fvextra}
The apprentissage-include.tex file is the same as in your question
apprentissage-include.tex
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{breaklines,breakanywhere,breaksymbol=,breakanywheresymbolpre=,commandchars=\\\{\}}
\newcommand{\donnee}[1]{\textbf{\textcolor{Purple}{#1}}}
\newcommand{\definition}[1]{\textbf{\textcolor{blue}{#1}}}
Im trying to include a title page customized in latex in my r markdown beamer presentation, but im getting two title pages in the output: one generated by R markdown and another one generated by the latex code that I included in the before-body option of the YAML header.
Is there any way to prevent r markdown from generating a title page so that I only get my personalized title page in the output?
Here is a MWE:
---
author: my-name
title: my-title
date: "`r format(Sys.time(), '%d %B %Y')`"
output:
beamer_presentation:
includes:
before_body: title-page.tex
---
## First frame
- some content
## Second frame
- some content
Contents of title-page.tex:
\begin{frame}[plain]
\inserttitle
\insertauthor
\insertdate
\end{frame}
I already tried adding \AtBeginDocument{\let\maketitle\relax} to a file included in_header but I still got two title pages.
Instead of manually creating your title page, you can simply modify the frame title template:
---
author: my-name
title: my-title
date: "`r format(Sys.time(), '%d %B %Y')`"
output:
beamer_presentation:
keep_tex: true
header-includes: |
\setbeamertemplate{title page}{
\inserttitle
\insertauthor
\insertdate
}
---
## First frame
- some content
## Second frame
- some content
I compiling a short document using bookdown in Rstudio. I would simply like to drop the table of contents at the beginning of the document. I could "knit to pdf" instead of "knit to pdf_book" or "knit to pdf_document2", but then would loose a lot of the bookdown functions (cross references etc.).
Should be fairly easy, isn't it?
---
title: "MWE"
output:
bookdown::pdf_book:
toc: false
---
It also works with pdf_document2:
---
title: "MWE"
output:
bookdown::pdf_document2:
toc: false
---
I want to include latex packages in R markdown pdf and beamer.
Could you help me in including usepackage command in rmarkdown beamer file?
Thanks a lot.
A simple solution would be to have your header setup like this:
---
title: "Document title"
author: "Author's name"
date: "Document date"
output: beamer_presentation
header-includes:
- \usepackage[brazil]{babel}
- \usepackage{graphicx}
- \usepackage[a4paper]{geometry}
---
The YAML header of the Rmd would look like:
---
title: "Habits"
output:
pdf_document:
includes:
in_header: header.tex
---
Then, in the file header.tex, include any usepackage statements you need, eg. \usepackage{pdflscape}
See http://rmarkdown.rstudio.com/pdf_document_format.html for more information.