How to put final dot after closing quotes in RMarkdown - r

I'm writing an essay in RMarkdown and I'd like to display the dot at the end of the sentence.
I'm using the " character both for open and close the quote. Obviously, I'm inserting the dot after the closing quotes but what is shown is this:
This is my preamble:
\documentclass[12pt, a4paper, twoside, openright]{report}
\usepackage{sectsty}
\usepackage[style=authoryear, sorting=nyt, backend=bibtex]{biblatex}
\usepackage[italian]{babel}
\usepackage{float}
\usepackage{paralist}
\usepackage{setspace}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{dcolumn}
\usepackage{graphicx}
\usepackage{geometry}
\usepackage{subfiles}
\usepackage[utf8]{inputenc}
\usepackage{titlesec}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{dsfont}
\usepackage{bm}
\usepackage{wasysym}
\usepackage{amstext}
\usepackage{array}
\usepackage{hhline}
\usepackage[labelfont=bf]{caption}
\usepackage{csquotes}
\renewcommand{\baselinestretch}{1.4}
\geometry{left = 3cm, right = 3cm, top = 3cm, bottom = 2.5cm}
\graphicspath{{img}}
\setcounter{chapter}{0}
\renewcommand{\thesection}{\thechapter.\arabic{section}}
\titleformat{\chapter}[hang]{\normalfont\huge\bfseries\raggedright}{\thechapter}{40pt}{\huge}
\sectionfont{\bfseries\Large\raggedright}
\subsectionfont{\raggedright}
\subsubsectionfont{\itshape\raggedright}
\newcommand{\R}{\mathbb{R}}
\newcolumntype{L}{>{$}l<{$}}
\bibliography{bibliografia.bib}
And this is my code (text) that shows what is reported in the previous image:
"...tutto sia correlato con tutto il resto, ma oggetti vicini siano più correlati di oggetti lontani".
How can I fix it?

Try this solution:
---
title: "Test Table"
date: '2021-11-11'
header-includes:
- \usepackage{csquotes}
output:
pdf_document
---
\enquote{I love StackOverflow}.
Addition
\setquotestyle[quotes]{french}
\enquote{I love StackOverflow}.

Related

kableExtra not working when putting a picture as a content of a cell

I have a markdown file in which I have this header:
---
title: "Report"
author: ''
date: "`r format(Sys.time(), '%d %B, %Y')`"
output: pdf_document
header-includes:
- \usepackage{amsmath}
- \usepackage{amssymb}
- \usepackage{tikz}
- \usepackage{float}
- \usepackage{booktabs}
- \usepackage{tabularx}
- \usepackage[pages=some]{background}
- \usepackage{graphicx}
- \usepackage{subcaption}
- \usepackage{array,blindtext}
- \usepackage{tcolorbox}
- \usepackage{fancyhdr}
- \usepackage{titling}
- \usepackage{xcolor}
- \usepackage{geometry}
- \usepackage{framed, color}
- \usepackage{enumitem}
- \usepackage{booktabs}
- \usepackage{longtable}
- \usepackage{array}
- \usepackage{multirow}
- \usepackage{wrapfig}
- \usepackage{colortbl}
- \usepackage{pdflscape}
- \usepackage{tabu}
- \usepackage{threeparttable}
- \usepackage{threeparttablex}
- \usepackage[normalem]{ulem}
- \usepackage[utf8]{inputenc}
- \usepackage{makecell}
- \AtBeginDocument{\let\maketitle\relax}
- \definecolor{titlepagecolor}{HTML}{E8F8F5}
- \definecolor{namecolor}{HTML}{787878}
- \definecolor{mygen}{HTML}{3AB5B1}
- \definecolor{mygen2}{HTML}{ABA8A7}
- \definecolor{mygen3}{HTML}{2D2D2D}
- \definecolor{mygen4}{HTML}{02A1B1}
- \definecolor{gene1}{HTML}{74c476}
- \definecolor{gene2}{HTML}{6CA26D}
- \definecolor{gene3}{HTML}{66c2a4}
- \definecolor{gene4}{HTML}{EBFFEB}
- \definecolor{lineacopertina}{HTML}{138D75}
- \definecolor{colorealtetesto}{HTML}{117864}
- \definecolor{shadecolor}{HTML}{3AB5B1}
---
and it works fine with every combination I run (i posted it because i've read that in some cases tha problem could be the preamble) but my problem is that when I try to generate a table in a for loop in which there is a picture as cell content for a column latex gives me an error and it fails in generating a pdf file, this are the lines of code:
if(FTab$column[i]=="CAUSATIVO"){
FTab$Interpretazione[i]<"\\includegraphics{\\\\192.168.0.10\\pic1.png} \\\\"
}else if(FTab$column[i]=="PROTETTIVO"){
FTab$Interpretazione[i]<-"\\includegraphics{\\\\192.168.0.10\\pic2.png} \\\\"
}else{
FTab$Interpretazione[i]<"\\includegraphics{\\\\192.168.0.10\\pic3.png} \\\\"
}
}
FTab<- FTab %>% select(1:5,7)
FTab %>% kable("latex", **escape = F**, booktabs = T, linesep = "") %>% kable_styling(latex_options = c("scale_down"))%>% row_spec(0, background = "#3AB5B1")}
when I try whit this code it gives me this error:
! Argument of __kernel_file_name_expand_loop:w has an extra }.
par
l.216 \end{tabular}}
if with the same code I swhitch on escape=T it doesn't interpret the latex codes and instead of the picture in the table there is the text.
This are the resulting .tex file lines where it gives me the error:
\vspace*{0.3cm}
\begin{table}[H]
\centering
\resizebox{\linewidth}{!}{
\begin{tabular}{llllll}
\toprule
\cellcolor[HTML]{3AB5B1}{Gene} & \cellcolor[HTML]{3AB5B1}{SNP} & \cellcolor[HTML]{3AB5B1}{Variazione} & \cellcolor[HTML]{3AB5B1}{Allele di rischio} & \cellcolor[HTML]{3AB5B1}{Genotipo} & \cellcolor[HTML]{3AB5B1}{Interpretazione}\\
\midrule
LCT, MCM6 & rs4988235 & -13910 T>C & C & CC & \includegraphics[width=0.8cm, height=0.8cm]{\\192.168.21.57\genetica\ROBERTO\pics_18112020\faccinarossa.png} \\\\
\bottomrule
\end{tabular}}
\end{table}
Using the flextable package, it's fine to insert images in tables, and knit some markdown files to .pdf, or even .docx output. See the flextable manual and how-to insert images in your tables here.

Rmarkdown and xelatex minipages don't work on linux/ubuntu but work on windows

I have a basic report in Rmarkdown
---
output:
pdf_document:
latex_engine: xelatex
geometry: left=2cm,right=1cm,top=1cm,bottom=0cm
fontsize: 12pt
params:
A: test
B: test2
C: test3
header-includes:
- \usepackage{booktabs}
- \usepackage{longtable}
- \usepackage{array}
- \usepackage{multirow}
- \usepackage{wrapfig}
- \usepackage{float}
- \usepackage{colortbl}
- \usepackage{pdflscape}
- \usepackage{tabu}
- \usepackage{threeparttable}
- \usepackage[normalem]{ulem}
- \usepackage{fontspec}
---
\begin{minipage}{2in}
Personal-Nr. `r params$A`
\end{minipage}
\hfill
\begin{minipage}{1in}
`r params$B`
\end{minipage}
\vspace{-\parskip}
\begin{minipage}{2in}
AHV-Nr. `r params$A`
\end{minipage}
\hfill
\begin{minipage}{1in}
`r params$B`
\end{minipage}
\vspace{-\parskip}
\begin{minipage}{2in}
Eintritt: `r params$A`
\end{minipage}
\hfill
\begin{minipage}{1in}
`r params$B`
\end{minipage}
\vspace{-\parskip}
\
\
\large
**TITLE**
\normalsize
When I run this on my Windows + Rstudio + R 4.0
I see this
And this is how it looks on my Ubuntu Linux server (with installed xelatex)
I am wondering why these commands (minipages and also \large) seem to be ignored on linux?
Am I missing a header or a package?

How to delete the number page in the title in a document Rmarkdown?

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.
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.

Set and resize image as footer Rmarkdown title page

I'm trying to set and resize an image as a footer in the title page of a markdown document.
I got the desired results in LaTex with:
\documentclass{article}
\title{Test}
\author{}
\date{}
\usepackage{graphicx}
\usepackage{fancyhdr}
\fancypagestyle{plain}{
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\lfoot{\includegraphics[width=400px]{footer.png}}
}
\begin{document}
\maketitle
\end{document}
But when I try to do the same thing in the Markdown document I get the following error:
Error in yaml::yaml.load(string, ...) :
Scanner error: while scanning a plain scalar at line 6, column 5 found a tab character that violate intendation at line 7, column 1
Calls: ... parse_yaml_front_matter -> yaml_load_utf8 ->
Execution halted
The code I have is:
---
title: "Test"
author: ""
header-includes:
- \usepackage{graphicx}
- \usepackage{fancyhdr}
- \fancypagestyle{plain}{
- \fancyhf{}
- \renewcommand{\headrulewidth}{0pt}
- \renewcommand{\footrulewidth}{0pt}
- \lfoot{\includegraphics[width=400px]{footer.png}}}
output: pdf_document
---
I've tried solutions like Creating a footer for every page using R markdown but it does't do the job for the title page.
Try:
---
title: "Test"
author: ""
header-includes: |
\usepackage{graphicx}
\usepackage{fancyhdr}
\fancypagestyle{plain}{
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\lfoot{\includegraphics[width=400px]{footer.png}}}
output: pdf_document
---
Yaml is a beast for escaping quotes and suchlike. You might want to create a separate file containing your latex header and just include that.
---
header-includes: yourfile.tex
---

Setting documentclass in Rmarkdown v2

I would like to write my master thesis in RMarkdown v2 and I would be very glad if I could use a prepared LaTeX class.
Also I'd like to put some lines in the header and somehow add an abstract.
Can any1 knows how to do that?
Lines I'd be happy to have before \begin{document} are typically:
\usepackage[utf8]{inputenc}
\usepackage{polski}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{tikz}
\usepackage{float} %pakiet do obsługi obrazków
\usepackage{graphicx} %pakiet do dodawania obrazków
\usepackage{tabularx} %pakiet do utrzymywania szerokości tabel równo z szerokością tekstu
\usepackage[T1]{fontenc} %przełączamy sie na fonty EC
\usepackage{dsfont}
% \usepackage[latin2]{inputenc} %kodowania polskich znakow ISO-8859-2 - mamy utf wyzej
\usepackage{xcolor} %pakiet do nadawania kolorów w \definecolor
\usepackage{listings} %pakiet do robienia tła jak w programie R
\lstset{language=R,%
% numbers=left,%
tabsize=3,%
numberstyle=\footnotesize,%
basicstyle=\ttfamily \footnotesize \color{black},%
escapeinside={(*#}{#*)}}
\usepackage{longtable}
\definecolor{ListingBackground}{rgb}{0.95,0.95,0.95}
\definecolor{ListingRule}{rgb}{0.7,0.7,0.7}
\lstdefinestyle{incode} %definiowanie stylu tła dla pisania kodu w R
{
basicstyle={\ttfamily\footnotesize},
backgroundcolor={\color{ListingBackground}},
frame={lr},
rulecolor={\color{ListingRule}},
framerule={2pt}
}
\usepackage{hyperref} %pakiet do dodawania hiperłącz
\hypersetup{colorlinks=true,
linkcolor=blue,
citecolor=blue,
urlcolor=blue}
%------------------------------------------------------------------------------%
\title{ o }
\author{Marcin Kosiński}
\supervisor{prof. dr hab. Michał Nowak}
\type{magisters}
\discipline{matematyka}
\monthyear{lipiec 2015}
\date{\today}
\album{123456}
And if possible after \begin{document} .
\begin{abstract}
some text
\end{abstract}
\tableofcontents
\listoffigures
\listoftables
Thanks for help in advance :) ! I'm aware I'll need to specify setting somehow in the begging of the Rmarkdown v2 document
---
title: "Magisterka"
author: "Marcin Kosiński"
date: "Tuesday, July 29, 2014"
output: pdf_document
documentclass: mini
includes:
in_header: headerMgr.tex
---
EDIT:
The soultion is good YAML specification:
---
title: "Magisterka"
author: "Marcin Kosiński"
date: "Tuesday, July 29, 2014"
output:
pdf_document:
includes:
in_header: header.tex
before_body: doc_prefix.tex
---
Based on this http://rmarkdown.rstudio.com/pdf_document_format.html, you need to include those lines:
---
title: "Magisterka"
author: "Marcin Kosiński"
date: "Tuesday, July 29, 2014"
output:
pdf_document:
includes:
in_header: header.tex
before_body: doc_prefix.tex
---
You need to remember to put all of the files (.Rmd, and all of .tex) in the same folder.

Resources