Rmarkdown Beamer 16:9 aspect ratio - latex

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

Related

Changing fontsize of word "References" in Latex

I'm a beginner to latex, I was writing an article. At the end when adding references. I did:
\begin{thebibliography}{100}
Some bibitems here
\end{thebibliography}
After compiling, the word "Reference" appears in pdf, and it is too big in size. I want its font size to be 12pt. How can I do that?
Using the titlesec package, you can temporarily change the size of section headings:
\documentclass[12pt]{article}
\usepackage{titlesec}
\begin{document}
test
\begingroup
\titleformat*{\section}{\fontsize{12pt}{14pt}\bfseries\selectfont}
\begin{thebibliography}{100}
Some bibitems here
\end{thebibliography}
\endgroup
\end{document}

Different font (size) for text in images from Inkscape to Latex

I am using Inkscape to convert images to Latex, so the text scales nicely. Using SaveAs pdf, with generate Latex ticked.
This creates a .pdf_tex file that contains something like this:
\begingroup%
\begin{picture}(1,1.18884212)%
\put(0,0){\includegraphics[width=\unitlength,page=1]{Scapula.pdf}}%
\put(0.6981335,0.82053681){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{Infraspinous fossa}}}%
\end{picture}%
\endgroup%
I would like to change the font size and possible also the font, so the text in all images is different from the body text. I think this is possible by e.g. redefining \smash within "picture", but I don't know how. Is this the correct approach? If so, any tips on how to do it?
With the etoolbox you could add the fontsize change to the picture environment:
\documentclass{article}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{etoolbox}
\AtBeginEnvironment{picture}{\huge}
\begin{document}
\begingroup%
\begin{picture}(1,1.18884212)%
\put(0,0){\includegraphics[width=\unitlength,page=1]{example-image.pdf}}%
\put(0.6981335,0.82053681){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{Infraspinous fossa}}}%
\end{picture}%
\endgroup%
\end{document}

How to add .fig file into a Latex document?

I created in Xfig a .fig file and now I have to add it to my Latex document. Can someone help me with this problem because I'm new in Latex and tried this code bellow but it doesen't work. I searched for various solutions but still I become this error.
\documentclass[12pt]{article}
\usepackage{graphicx}
\begin{document}
\begin{figure}[!htb]
\center{\includegraphics[width=2]{myfigure.fig}}
\end{figure}
\end{document}
I just want to center a figure on the page but the error is:
Cannot determine size of graphic in myfigure.fig (no Bounding Box).
The .fig file/format is not supported for inclusion into (La)TeX as an image. You need to export the image to a supported format via the File > Export dialog. Supported formats include Postscript, EPS as PDF stand-alone vector formats, combined files (vector + LaTeX for text) and many of the raster formats (like BMP, PNG and JPEG).
Also, use \centering to centre an image within the figure environment.

Pandoc LaTex PDF headed and footer

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.

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.

Resources