I am writing a document in markdown, and I read that I could change the font to Arial like this:
---
fontfamily: arev
---
But it did not work. But when I try to change the font to Times, it's working fine
---
fontfamily: times
---
So how do I change the font to Arial?
If Helvetica is "good enough" you can use:
fontfamily: helvet
header-includes:
- \renewcommand{\familydefault}{\sfdefault}
Pandoc uses LaTeX per default for PDF generation, so it depends on your TeX installation.
If you're on TeX Live you can use most in this font catalogue.
Related
I would like to write all parenthetical citations in small fonts when I produce HTML/revealjs outputs from markdown using pandoc. Putting <small>...</small> tags around the [#citation] notation (e.g. <small>[#citation]</small>) can be the way to achieve that effect, but I just leave [#citation]s as they are since there are a lot of [#citation] in my multiple .md files.
I came up with the following lua-filter (say small-parencite.lua) that selectively makes the font size of parenthetical citations small. However, this lua-filter does not change the font size of any parenthetical citation.
Cite = function(cite)
content = cite.content
-- if FORMAT:match 'html' or FORMAT:match 'revealjs' then
if cite.citations == 'NormalCitation' then
pandoc.Str('<small>' .. content .. '</small>')
end
-- end
return cite
end
Does anybody point out what I am missing in that lua-filter? Note that I want the font size of narrative citations to remain the same as normal texts as shown below:
MWE
small-parencite.lua
Cite = function(cite)
content = cite.content
-- if FORMAT:match 'html' or FORMAT:match 'revealjs' then
if cite.citations == 'NormalCitation' then
pandoc.Str('<small>' .. content .. '</small>')
end
-- end
return cite
end
test.md
---
output:
html_document:
md_extensions: -ascii_identifiers
pandoc_args:
- small-parencite.lua
references:
- author:
- family: Allaire
given: JJ
- family: Xie
given: Yihui
- family: McPherson
given: Jonathan
- family: Luraschi
given: Javier
- family: Ushey
given: Kevin
- family: Atkins
given: Aron
- family: Wickham
given: Hadley
- family: Cheng
given: Joe
- family: Chang
given: Winston
- family: Iannone
given: Richard
id: R-rmarkdown
issued: 2020
note: R package version 2.3
title: "rmarkdown: Dynamic Documents for R"
title-short: rmarkdown
type: book
url: "https://github.com/rstudio/rmarkdown"
- author:
- family: Xie
given: Yihui
edition: 2nd
id: knitr2015
issued: 2015
note: ISBN 978-1498716963
publisher: Chapman; Hall/CRC
publisher-place: Boca Raton, Florida
title: Dynamic Documents with R and knitr
type: book
url: "https://yihui.org/knitr/"
---
I want to write all parenthetical citations in small fonts like this:
This is knitr <small>[#knitr2015]</small>.
But I do not want to use `<small>...</small>` tags (e.g. `<small>[#citation]</small>`) to achieve that effect. I just leave `[#citation]`s as they are like this:
This is knitr [#knitr2015]
Note that I want the font size of narrative citations to remain the same as normal texts as shown below:
This is a markdown variant by #R-rmarkdown.
# References
Is this what you want?
function Cite(el)
if el.citations[1].mode == 'NormalCitation' then
return {
pandoc.RawInline("html", "<small>"),
el,
pandoc.RawInline("html", "</small>")
}
end
end
I am writing my thesis in Rmarkdown and Latex with a seperate literature.bib file that contains the bibtex sources. I now have a footnote and I would like to have a citation like in the normal text, but within the footnote. Is there any package to achieve that? When i just try it, like I would have a citation in the normal text, the footnote stops beeing a footnote when i render to pdf. The citation style I use is the Harvard citation style, so only something like this appears and should appear in the footnote:
The rest of information is than provided under the heading References at the end of the document. Thanks in advance! I appreciate any help...!
Here a minimal reproducable example:
--> This is the code for the main .rmd file
---
output:
bookdown::pdf_document2:
toc: no
papersize: a4
geometry: margin = 1in
fontsize: 11pt
bibliography: literatur.bib
---
#TEST
This is just an example #test.\footnote{I would also like to have a citation here in this footnote!!}
\newpage
# References
<div id="refs"></div>
-->This is the code for the literatur.bib file
#online{test,
author = {PACER},
title = {Service Center},
url = {https://pcl.uscourts.gov},
urldate = {2021-09-10}
}
Hope that is helpful?!
If you use markdown syntax for the footnote, you can also insert the citation via markdown syntax:
---
output:
bookdown::pdf_document2:
toc: no
papersize: a4
geometry: margin = 1in
fontsize: 11pt
bibliography: literatur.bib
---
#TEST
This is just an example #test.^[I would also like to have a citation here in this footnote!! See [#test]]
\newpage
# References
<div id="refs"></div>
fonts.conf newbie!
I have a font family containing 19 different styles. These range from the usual Bold, Italic, Bold Italic etc to Condensed Light, Condensed Light Italic, Thin Italic, Black, ...
I have an app (highcharts) that uses JSON that can contain fontFamily and, optionally, fontStyle. The app appears to be accessing the fonts.conf.
My question is: what should the fonts.conf look like that will take something like:
fontFamily: "CModernCondLtIt"
and select the physical font file: CModern-CondLight-Italic.ttf
Assuming that the output of fc-list -v shows:
... family: "Ch Modern"(s)
style: "Condensed Light Italic"(s) "Cond Light Italic"(s)
fullname: "Ch Modern Cond Light Italic"(s)
file: "/usr/share/fonts/CModern-CondLight-Italic.ttf"(s)
Would I use match or alias?
and what would the XML look like?
Instead of Chapter X when creating a PDF from bookdown, I would like it to be "Módulo X" (in Spanish).
So I would like to know how to change chapter name using bookdown.
My YAML is:
---
title: "TITLE"
author: "Mario Modesto-Mata"
date: "`r Sys.Date()`"
output: pdf_document
description: This is a minimal example of using the bookdown package to write a book.
The output format for this example is bookdown::gitbook.
documentclass: book
link-citations: yes
bibliography: book.bib
site: bookdown::bookdown_site
language:
label:
chapter_name: "Módulo"
---
I tried with the last three line codes, with no success. Any idea?
From the bookdown documentation we can learn two things:
There is no language.label.chapter_name but language.ui.chapter_name.
This setting is meant for HTML output. For PDF output one should configure LaTeX.
Configuring LaTeX is quite simple. You only need to add lang: es to your header.
However, this will use "Capítulo" instead of "Módulo". One can adjust this by redefining the LaTeX command \chaptername. BTW, at the moment you are not using bookdown but the standard pdf_docuemnt from rmarkdown. If you wont to use bookdown features, you should use bookdown::pdf_book or bookdown::pdf_document2.
Putting everything together:
---
title: "TITLE"
author: "Mario Modesto-Mata"
date: "`r Sys.Date()`"
output: bookdown::pdf_book
description: This is a minimal example of using the bookdown package to write a book.
The output format for this example is bookdown::gitbook.
documentclass: book
lang: es
link-citations: yes
bibliography: book.bib
site: bookdown::bookdown_site
header-includes:
- \AtBeginDocument{\renewcommand{\chaptername}{Módulo}}
---
Result:
Note that header-includes is nice for simple stuff in single file documents like this minimal example. In most cases one is better off including a tex into the header via output.<your-format>.includes.in_header, c.f. Include TeX header in R package for RMarkdown documents.
How can I show page numbers (preferably like 4/10, 5/10 etc.) on an rmarkdown beamer presentation?
In the front matter of the document, you can include a .tex file with extra commands as shown in RStudio's documentation here.
I created a new .tex file that I called "header_pagenrs.tex" which only includes the top 2 lines from #user4281727's answer:
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{footline}[page number]
Then I referenced this file at the top of my .Rmd file:
---
title: "Things and Stuff"
author: "Me"
output:
beamer_presentation:
includes:
in_header: header_pagenrs.tex
---
If this still gives you errors, you might also be missing some required TeX packages (a separate problem from RStudio and rmarkdown).
Here's another option that worked for me. Didn't need to add a .tex file to my folder. Just included the following (based on above code from #civilstat) at the top of my Markdown doc.
---
title: 'Your Title'
author: "Your Name"
date: "July 4, 1776"
output:
beamer_presentation(keep_tex = TRUE): default
header-includes:
- \setbeamertemplate{navigation symbols}{}
- \setbeamertemplate{footline}[page number]
---
If your beamer version is reasonable up to date (>= v3.48), you can adjust the format of the frame numbers while keeping the footline of your chosen beamer theme unchanged otherwise.
---
output:
beamer_presentation:
theme: "Berlin"
keep_tex: true
header-includes:
- \setbeamertemplate{page number in head/foot}[totalframenumber]
---
test
Try to put the lines below into the template
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{footline}[page number]
~/Library/R/3.1/library/rmarkdown/rmd/beamer/default.tex