I am trying to create a presentation using RMarkdown beamer. I want a slide to have 2 columns and this is what I have so far:
---
title: title
author: name
date: date
output:
beamer_presentation:
theme: Szeged
slide_level: 2
includes:
in_header: header.tex
keep_tex: true
linkcolor: false
---
## TEST
\footnotesize
\justify
:::::::::::::: {.columns}
::: {.column}
- I will write something here tex text text tex text text tex text text
:::
::: {.column}
- And then something here tex text text tex text text tex text text tex text text
:::
::::::::::::::
The header.tex's content is:
\definecolor{mycolorlightblue}{RGB}{103,153,200}
\definecolor{mycolordarkblue}{RGB}{0,70,127}
% add packages
\usepackage{tikz}
\usetikzlibrary{arrows}
\usepackage{tcolorbox}
\usepackage{ragged2e}
% remove 2nd section from header
\makeatletter
\beamer#theme#subsectionfalse
\makeatother
% change colour of lines
\setbeamercolor{separation line}{bg=mycolorlightblue}
% text title
\setbeamercolor{title}{fg=mycolordarkblue}
\setbeamercolor{frametitle}{fg=mycolordarkblue}
% text colour
\setbeamercolor{frametitle}{fg=mycolordarkblue}
% item colour
\setbeamercolor{structure}{fg=mycolordarkblue}
% define colour text
% \usebeamerfont{section title}\color{blue!70!green}\insertsection\par
% no header or footer on first page
\thispagestyle{empty}
% remove title slides at beginning of sections
\AtBeginSection{}
% add page counter to the footer
\setbeamertemplate{footline}[frame number]
% logo of my university
\titlegraphic{%
\begin{picture}(0,0)
\put(155,0){\makebox(0,0)[rt]{\includegraphics[]{ALL-ICONS.png}}}
\end{picture}}
This is the result I am seeing, almost perfect, but the 2nd column starts slight below the first one, as shown below, do you understand why?
correspondent .tex file to the .rmd:
\begin{frame}{TEST}
\protect\hypertarget{test}{}
\footnotesize
\justify
\begin{columns}[T]
\begin{column}{0.48\textwidth}
\begin{itemize}
\tightlist
\item
I will write something here text text text text text text text text
text text text text text text text
\end{itemize}
\end{column}
\begin{column}{0.48\textwidth}
\begin{itemize}
\tightlist
\item
And then something here text text text text text text text text text
text text text text text text
\end{itemize}
\end{column}
\end{columns}
\end{frame}
The problem is the \justify, it should be \justifying instead (but at the position you use it, it won't have any effect on the text in the columns anyway, so you could also just remove it ...)
---
title: title
author: name
date: date
output:
beamer_presentation:
theme: Szeged
slide_level: 2
includes:
in_header: header.tex
keep_tex: true
---
## TEST
\footnotesize
:::::::::::::: {.columns}
::: {.column}
- I will write something here tex text text tex text text tex text text
:::
::: {.column}
- And then something here tex text text tex text text tex text text tex text text
:::
::::::::::::::
Related
Thanks in advance for your help!
I know similar questions have been asked, but I cant get any of them to work. I am trying to get the caption to be the same width as the image I am captioning.
Here is the code: it results in all of the words falling in line after the Figure title (image attached to show what it currently looks like.1
\documentclass[twoside,twocolumn]{article}
\usepackage{blindtext} % Package to generate dummy text throughout this template
\usepackage[sc]{mathpazo} % Use the Palatino font
\usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs
\linespread{1.05} % Line spacing - Palatino needs more space between lines
\usepackage{microtype} % Slightly tweak font spacing for aesthetics
\usepackage[english]{babel} % Language hyphenation and typographical rules
\usepackage[hmarginratio=1:1,top=32mm,columnsep=20pt]{geometry} % Document margins
\usepackage[hang, small,labelfont=bf,up,textfont=it,up]{caption} % Custom captions under/above floats in tables or figures
\usepackage{booktabs} % Horizontal rules in tables
\usepackage{lettrine} % The lettrine is the first enlarged letter at the beginning of the text
\usepackage{enumitem} % Customized lists
\setlist[itemize]{noitemsep} % Make itemize lists more compact
\usepackage{abstract} % Allows abstract customization
\renewcommand{\abstractnamefont}{\normalfont\bfseries} % Set the "Abstract" text to bold
\renewcommand{\abstracttextfont}{\normalfont\small\itshape} % Set the abstract itself to small italic text
\usepackage{titlesec} % Allows customization of titles
\renewcommand\thesection{\Roman{section}} % Roman numerals for the sections
\renewcommand\thesubsection{\roman{subsection}} % roman numerals for subsections
\titleformat{\section}[block]{\large\scshape\centering}{\thesection.}{1em}{} % Change the look of the section titles
\titleformat{\subsection}[block]{\large}{\thesubsection.}{1em}{} % Change the look of the section titles
\usepackage{fancyhdr} % Headers and footers
\pagestyle{fancy} % All pages have headers and footers
\fancyhead{} % Blank out the default header
\fancyfoot{} % Blank out the default footer
\fancyhead[C]{Test} % Custom header text
\fancyfoot[RO,LE]{\thepage} % Custom footer text
\usepackage{titling} % Customizing the title section
\usepackage{hyperref} % For hyperlinks in the PDF
\usepackage{graphicx}
\graphicspath{ {./images/} }
\setlength{\droptitle}{-4\baselineskip} % Move the title up
\pretitle{\begin{center}\Huge\bfseries} % Article title formatting
\posttitle{\end{center}}
\setlength\parindent{24pt}
\usepackage{float}
\usepackage{floatrow}
\usepackage{pdfpages}
\newsavebox\mysavebox
\begin{document}
\begin{figure}[t]
\includegraphics[width=7.5cm]{img1.jpg}
\centering
\caption{Imaged tunnel slide of yeast. This image depicts how yeast cells were counted to determine sample concentrations. Small budding cells were not included in the total cell count. Note: 4× relay lens and 40× objective used. A ${1.75x10^6}$ mL volume is shown.}
\label{fig:mesh1}
\end{figure}
\end{document}
Very important: never ignore error messages. If an error tells you that you mustn't use floatrow with the float package, don't ignore this error and remove one of the packages.
Then if you don't want the caption to have an hanging indent, remove the hang option from the caption package.
don't abuse the letter x as multiplication symbol. Use \times instead.
have a look at the siunitx package to get correct spacing and fonts for units
with 7.5cm your image is too wide for your column, a warning in the log file will tell you this. You can avoid this by using \linewidth.
\documentclass[twoside,twocolumn]{article}
\usepackage{blindtext} % Package to generate dummy text throughout this template
\usepackage[sc]{mathpazo} % Use the Palatino font
\usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs
\linespread{1.05} % Line spacing - Palatino needs more space between lines
\usepackage{microtype} % Slightly tweak font spacing for aesthetics
\usepackage[english]{babel} % Language hyphenation and typographical rules
\usepackage[hmarginratio=1:1,top=32mm,columnsep=20pt]{geometry} % Document margins
\usepackage[small,labelfont=bf,up,textfont=it,up]{caption} % Custom captions under/above floats in tables or figures
\usepackage{booktabs} % Horizontal rules in tables
\usepackage{lettrine} % The lettrine is the first enlarged letter at the beginning of the text
\usepackage{enumitem} % Customized lists
\setlist[itemize]{noitemsep} % Make itemize lists more compact
\usepackage{abstract} % Allows abstract customization
\renewcommand{\abstractnamefont}{\normalfont\bfseries} % Set the "Abstract" text to bold
\renewcommand{\abstracttextfont}{\normalfont\small\itshape} % Set the abstract itself to small italic text
\usepackage{titlesec} % Allows customization of titles
\renewcommand\thesection{\Roman{section}} % Roman numerals for the sections
\renewcommand\thesubsection{\roman{subsection}} % roman numerals for subsections
\titleformat{\section}[block]{\large\scshape\centering}{\thesection.}{1em}{} % Change the look of the section titles
\titleformat{\subsection}[block]{\large}{\thesubsection.}{1em}{} % Change the look of the section titles
\usepackage{fancyhdr} % Headers and footers
\pagestyle{fancy} % All pages have headers and footers
\fancyhead{} % Blank out the default header
\fancyfoot{} % Blank out the default footer
\fancyhead[C]{Test} % Custom header text
\fancyfoot[RO,LE]{\thepage} % Custom footer text
\usepackage{titling} % Customizing the title section
\usepackage{hyperref} % For hyperlinks in the PDF
\usepackage{graphicx}
\graphicspath{ {./images/} }
\setlength{\droptitle}{-4\baselineskip} % Move the title up
\pretitle{\begin{center}\Huge\bfseries} % Article title formatting
\posttitle{\end{center}}
\setlength\parindent{24pt}
%\usepackage{float}
\usepackage{floatrow}
\usepackage{pdfpages}
\newsavebox\mysavebox
\begin{document}
\begin{figure}[t]
\includegraphics[width=\linewidth]{example-image-duck}
\centering
\caption{Imaged tunnel slide of yeast. This image depicts how yeast cells were counted to determine sample concentrations. Small budding cells were not included in the total cell count. Note: 4× relay lens and 40× objective used. A ${1.75 \times 10^6}$ mL volume is shown.}
\label{fig:mesh1}
\end{figure}
\end{document}
I have successfully been able to add a latex title page to my Rmarkdown file, but the rest of the document doesn't appear. Here is my YAML:
---
output:
pdf_document:
includes:
in_header: title.tex
---
I haven't changed anything else in the Rmarkdown file, it has the standard text starting with: This is an Rmarkdown document etc. I include my title.tex file:
\usepackage{graphicx}
\begin{document}
\begin{titlepage}
\begin{center}
\includegraphics{UCTLogoLong.jpg}
\vspace*{2cm}
\textbf {\Huge Applied Spatial Data Analysis} % MAIN TITLE
\vspace{0.5cm}
{\LARGE Assignment 1} % SUBTITLE
\vspace{1cm}
\noindent\makebox[\linewidth]{\rule{\textwidth}{1pt}}
{\LARGE Geostatistics}
\noindent\makebox[\linewidth]{\rule{\textwidth}{1pt}}
\vspace{1cm}
{\Large NAME } % AUTHOR
{\Large STUDENT NUMBER}
\vspace{1cm}
\includegraphics[width=5cm,height=5cm,keepaspectratio]{statslogo.png}
\vspace{0.2cm}
Department of Statistical Sciences\\
University of Cape Town\\
South Africa\\
\today
\end{center}
\end{titlepage}
\end{document}
I am relatively new to Rmarkdown and have no idea why the standard Rmarkdown text isn't showing in knitted pdf. Any help will be much appreciated.
The problem is that with the \begin{document}...\end{document} you tell latex that it should ignore everything after that. Instead you could issue the content of the title page \AtBeginDocument{...}
title.tex:
\usepackage{graphicx}
\AtBeginDocument{
\begin{titlepage}
\begin{center}
\includegraphics{example-image-duck}
\vspace*{2cm}
\textbf {\Huge Applied Spatial Data Analysis} % MAIN TITLE
\vspace{0.5cm}
{\LARGE Assignment 1} % SUBTITLE
\vspace{1cm}
\noindent\makebox[\linewidth]{\rule{\textwidth}{1pt}}
{\LARGE Geostatistics}
\noindent\makebox[\linewidth]{\rule{\textwidth}{1pt}}
\vspace{1cm}
{\Large John Doe } % AUTHOR
{\Large something}
\vspace{1cm}
\includegraphics[width=5cm,height=5cm,keepaspectratio]{example-image-duck}
\vspace{0.2cm}
Department of Statistical Sciences\\
University of Cape Town\\
South Africa\\
\today
\end{center}
\end{titlepage}
\clearpage
}
Furthermore, I had to remove the empty line in
---
output:
pdf_document:
includes:
in_header: title.tex
---
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
I have a double-column paper and I want to fit a long text within a bracket equation with the following code:
\begin{equation}
\small
M =\begin{cases*}
1, & some text is in here some text is in here some text is in here some text is in here some text is in here some text is in here \\
0, & otherwise\\
\end{cases*}
\end{equation}
The text for case one goes over the column. I want to fit all the text for case one in multiple lines with the column width.
You could add a \parbox of suitable width around the text:
\documentclass[twocolumn]{article}
\usepackage{mathtools}
\usepackage{lipsum}
\begin{document}
\lipsum[2]
{
\small
\begin{equation}
M =\begin{cases*}
1, & \parbox[t]{5.5cm}{some text is in here some text is in here some text is in here some text is in here some text is in here some text is in here} \\
0, & otherwise\\
\end{cases*}
\end{equation}}
\lipsum[2]
\end{document}
(please note that it is better to make font size changes outside of the equation environment)
I am trying to make a caption to a figure that looks like this:
Figure 1: Text Text Text Text Text Text Text Text Text Text Text Text
Text Text Text
or alternatively like this:
Figure 1:
Text Text Text Text Text Text Text Text Text Text Text Text Text Text
Text Text Text
but the caption has an indent, that makes it look like this:
\documentclass{scrreprt}
\begin{document}
\begin{figure}
\caption{Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text}
\end{figure}
\end{document}
The caption package offers the plain format for this:
\documentclass{scrreprt}
\usepackage[format=plain]{caption}
\begin{document}
\begin{figure}
\caption{Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text}
\end{figure}
\end{document}
To change this on a figure-to-figure basis:
\documentclass{scrreprt}
\usepackage{caption}
\begin{document}
\begin{figure}
\caption{normal caption with hanging indent Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text}
\end{figure}
\begin{figure}
\captionsetup{format=plain}
\caption{Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text}
\end{figure}
\begin{figure}
\caption{normal caption with hanging indent Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text}
\end{figure}
\end{document}