Pandoc LaTex PDF headed and footer - latex

I am using pandoc v 1.18 I want to add header as well as footer text.
I want complete control meaning I want to place heater text at left, center and middle and the same with footer.
But I am unable to get even a single place to show up.
I have the following in my YAML header in my markdown file
---
header: This is fancy
footer: So is this
headertext: This is fancy
footertext: So is this
#abstract: This is a pandoc test . . .
documentclass: report
output:
pdf_document:
fontsize: 12pt
mainfont: Roboto
geometry: [top=2cm, bottom=1.5cm, left=1cm, right=1cm]
css : pandoc.css
linkcolor : cyan
toc : true
---
I have tried to use header and headertext separately as well and that did not work as well.

Easiest solution is to add a custom latex header. Create header.tex in your working directory and add something like:
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\rhead{Fancy on the right}
\lhead{Fancy on the left}
\cfoot{Fancy in the footer}
See the fancyhdr manual for help.
And then compile with pandoc myfile.md -o myfile.pdf -H header.tex. With Rmarkdown, this can be set in the YAML front matter:
---
output:
pdf_document:
includes:
in-header: header.tex
---
To be able to set the header with a variable in the YAML like you wanted, you will need to play with the rmarkdown latex template (see the pandoc manual section about templates) but you'll probably lose the possibility to fine-tune the header and footer with fancyhdr.

Related

markdown pdf by pandoc : fontsize of 11 or 12pt grow the font, but 13 or 14pt return to a lower size

Using this header :
---
header-includes:
- \usepackage{fvextra}
- \DefineVerbatimEnvironment{Highlighting}{Verbatim}{breaklines,breakanywhere,breaksymbol=,breakanywheresymbolpre=,commandchars=\\\{\}}
title: "Analyse spatiale"
subtitle: "Geostatistique, QGIS, Geoserver"
author: Marc Le Bihan
geometry: margin=2cm
fontsize: 12pt
output: pdf
classoption: fleqn
urlcolor: blue
---
for a markdown transformed with pandoc to a pdf with this markdown command :
pandoc -f markdown-implicit_figures analyse_spatiale.md -o analyse_spatiale.pdf
11pt or 12pt have a visible effect in the pdf for fontsize:, but 13pt, 14pt return to a lower font.
Why?
13pt and 14pt are not class options which are allowed by default. They will fall back to the default 10pt option. However you can use the extsizes package to make more font sizes available:
---
title: "Analyse spatiale"
subtitle: "Geostatistique, QGIS, Geoserver"
author: Marc Le Bihan
output: pdf_document
geometry: margin=2cm
classoption: fleqn
urlcolor: blue
header-includes:
- \usepackage{fvextra}
- \DefineVerbatimEnvironment{Highlighting}{Verbatim}{breaklines,breakanywhere,breaksymbol=,breakanywheresymbolpre=,commandchars=\\\{\}}
- \usepackage[14pt]{extsizes}
---
fff
This has to do with LaTeX, which pandoc uses to generate the PDF: The default LaTeX article class only supports 10pt, 11pt, and 12pt font sizes; any other value will be ignored.

How to have multiple note page in Rmarkdown beamer presentation

In Markdown beamer presentation output, my multiple notes pages are being combined into one note page. When I looked into the .tex file (from my keep_text=TRUE option), it is because the notes commands are put between \begin{frame} ... \end{frame} instead of outside \end{frame}. Below is my reproducible code in Rmarkdown beamer presentation document. Any help will be appreciated.
---
output:
beamer_presentation
keep_tex: yes
---
## slide title
- item 1
- item 2
\note{
long paragraph 1
}
\note{
long paragraph 2
}
I get this output
But what I wanted was:
You can temporarily switch from markdown to real latex and end the frame before adding the notes:
---
output:
beamer_presentation:
keep_tex: true
header-includes:
- \setbeameroption{show notes}
---
## slide title
- item 1
- item 2
``` {=latex}
\end{frame}
\note{
long paragraph 1
}
\note{
long paragraph 2
}
\begin{frame}
```
normal slide
https://rstudio.cloud/project/1051204

Rmarkdown Beamer 16:9 aspect ratio

How to set the aspect ratio of beamer slides created using Rmarkdown in Rstudio to 16:9? It does not seem to be a standard option. I tried changing the \documentclass{} options using a header.tex insert but this was not successful.
Put the option in double quotes:
output:
beamer_presentation:
classoption: "aspectratio=169"
Notice that classoption keyword is at the same level with output.
pandoc 1.19
texlive 2015
knitr 1.17
rmarkdown 1.6

How to generate black and white pdf from sphinx?

I want to generate a PDF from sphinx that is only black and white. The standard sphinx.sty uses \RequirePackage{color} and \RequirePackage{fancyvrb}.
If I just remove color, I get a whole list of errors. I could not find any reference in fancyvrb's documentation.
How can I achieve that (without rewriting the whole sphinx.sty)?
You can edit the conf.py and add addtions to the preamble before the build with custom LaTeX, so that sphinx will render colors as black. For example.
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
'preamble': r'''
\usepackage{titlesec}
\titleformat{\section}
{\color{black}\normalfont\Large\bfseries}
{\color{black}\thesection}{1em}{}
\titleformat{\subsection}
{\color{black}\normalfont\Large\bfseries}
{\color{black}\thesubsection}{1em}{}
\usepackage{hyperref}
\hypersetup{colorlinks=true,
linkcolor=black,
citecolor=black,
filecolor=black,
menucolor=black,
urlcolor=black,
bookmarksnumbered=true
}
'''
# Latex figure (float) alignment
#'figure_align': 'htbp',
}
This will change all sections and subsections to black and change all your hyperlinks to black as well.

Table in Header with latex?

I need to create some work instructions in latex. Is there anyway to get a table in the header of a latex page?
Use the fancyhdr package.
For example:
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead[L]{\begin{tabular}{l}Line 1\\Line 2\end{tabular}}

Resources