When I used \textsf{what} in the following document, "what" disappears in the output file. What should I do to prevent the problem while changing the font of "what"? Thanks!
title: "test"
author: test
date: 11/23/2020
link-citations: yes
output:
bookdown::html_document2: default
---
\textsf{what}
If you want to change the font when rendering to html output you colud use some inline CSS e.g.
<p style = "font-family: Times New Roman; color: red;">what</p>
will print "what" in red using Times New Roman.
I believe \textsf{what} is latex syntax, which is for PDF output. You are rendering to HTML in your example.
as the #stefan suggested inline CSS in your Rmarkdown it would look like this
---
title: "test"
author: test
date: 11/23/2020
link-citations: yes
output:
bookdown::html_document2: default
---
<style>
body, p {
background-color: lightgray;
color: black;
font-family: Arial Black;
}
</style>
what
I used Arial Black for the example to showcase the effects below.
Related
I was wondering if there is a simple way to do the change of font size, colour and style (bold, italic, etc.) for particular words or phrases in individual xaraingan slides within rmarkdown.
The following is my code:
---
title: "Econ"
subtitle: "Week 1"
author: "Instructor"
date: "`r Sys.Date()`"
output:
xaringan::moon_reader:
css: [default, metropolis, metropolis-fonts]
lib_dir: libs
nature:
highlightStyle: arta
highlightLines: true
countIncrementalSlides: false
---
# Is economics a science?
--
Probably not, maybe pseudo-science?.
I want to make "pseudo-science" bold, italicized, red, slightly bigger.
To style certain lines or phrases, you need to define your own content class (say .my-style) using CSS and wrap those lines or phrases with that content class (like .my-style[lines or phrases]) and define CSS rules for styles that you want to use in CSS file styles.css. Then attach that CSS file by specifying it in the YAML key css: along with other style files.
---
title: "Econ"
subtitle: "Week 1"
author: "Instructor"
date: "`r Sys.Date()`"
output:
xaringan::moon_reader:
css: [default, metropolis, metropolis-fonts, "styles.css"]
lib_dir: libs
nature:
highlightStyle: arta
highlightLines: true
countIncrementalSlides: false
---
# Is economics a science?
--
Probably not, maybe .my-style[pseudo-science]?.
styles.css
.my-style {
font-weight: bold;
font-style: italic;
font-size: 1.5em;
color: red;
}
Is it possible to render pdf and HTML documents with R Markdown where the body text is automatically in two columns throughout the whole document?
I am using the code below to generate the PDF. It renders a pdf with no problems, but when I add classoption: twocolumn it throws the following error.
Error in (function (toc = FALSE, toc_depth = 2, number_sections = FALSE, :
unused argument (classoption = "twocolumn")
Calls: <Anonymous> -> create_output_format -> do.call
Execution halted
---
title: "My Document"
output:
pdf_document:
classoption: twocolumn
---
<style type="text/css">
body{ /* Normal */
font-size: 14px;
}
td { /* Table */
font-size:10px;
}
h1.title {
font-size: 30px;
color: Black;
}
h1 { /* Header 1 */
font-size: 18px;
color: Black;
}
h2 { /* Header 2 */
font-size: 14px;
color: DarkBlue;
}
</style>
# Introduction to my document
****************
I would like all this text to be in two columns.
to layers with carbon the stagnant water becomes, the surface layers with the ocean can take uptake from below, the harder it is for winds to mix the amount of carbon dioxide. The stagnant water becomes.
carbonate-rich water also supports fewer phytoplankton, and carbonate-rich water also supports fewer phytoplankton, and carbon dioxide up.m below, the harder it is for winds to mix the harder it is for winds to mix the stagnant water also supports fewer phytoplankton, and carbon the harder it is for winds to mix the deeper layers with carbon dioxide.
I have an application that is written in the apex oracle environment, but I want to change the font in this application (for example on "Calibri". I downlad this font:
But I can't find how to do it.
I also tried to Theme Roller the css in the topic with the help of this code, but it did not help.
I will be grateful for the help.
Yes you can add your custom font to Oracle APEX by following the next steps (tried with .otf file not .ttf):
Add the .otf file to your application Static Application Files (for example: your-custom-font.otf)
Add an Application item called FONT
Create an Application process:
Process Point: On Load: Before Header (page template header)
Code
begin
:FONT := '<style type="text/css">
#font-face {
font-family: "DefaultFont";
src: url(#APP_IMAGES#your-custom-font.otf);
}
body {
font-family: "DefaultFont" !important;
}
.ui-widget {
font-family: "DefaultFont" !important;
}
</style> ';
end;
On every page where you want to use this custom font, on page level section HTML Header > HTML Header set the substitution string &FONT.
The described process is very helpful if you need different fonts for different users, but if all your users have the same font. Then you just need following Inline CSS to the page:
#font-face {
font-family: "DefaultFont";
src: url(#APP_IMAGES#your-custom-font.otf);
}
body {
font-family: "DefaultFont" !important;
}
.ui-widget {
font-family: "DefaultFont" !important;
}
Or for Calibri add this CSS:
body {
font-family: Calibri, sans-serif !important;
}
Also when choosing font consider this.
I'm trying to convert a set of slides written in Rmarkdown and outputted in HTML with xaringan::moon_reader into PDF, and I used pagedown::chrome_print() to convert to PDF.
The issue is, the converted PDF has its title page missing as well as random pages throughout the slides. I tried to manually print the HTML file with Chrome and other browsers in an attempt to save to PDF, but they have the same missing pages.
I'm open to any advice on how to export to PDF without any pages missing. It doesn't have to be chrome_print() as long as the slides can be exported in PDF successfully.
Here's a reproducible pseudocode of the slides:
---
title: document_title
author: author_name
output:
xaringan::moon_reader:
css: [default, metropolis, metropolis-fonts]
lib_dir: libs
nature:
ratio: '4:3'
highlightStyle: github
highlightLines: true
countIncrementalSlides: false
editor_options:
chunk_output_type: console
---
count: false
<style>
.center2 {
margin: 0;
position: absolute;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
pre.sourceCode {
max-height: 200px;
overflow-y: auto;
}
/*
.remark-slide-number {
position: inherit;
}
.remark-slide-number .progress-bar-container {
position: absolute;
bottom: 0;
height: 4px;
display: block;
left: 0;
right: 0;
}
.remark-slide-number .progress-bar {
height: 100%;
background-color: blue;
}
*/
</style>
# only using two backticks for codechunks in rmd to escape ending the codeblock on stackoverflow
``{css, echo=FALSE}
#media print {
.has-continuation {
display: block !important;
}
}
``
``{r setup, include=FALSE}
options(htmltools.dir.version = FALSE)
library(knitr)
opts_chunk$set(
fig.align="center",
fig.height=4,
dpi=300,
cache=T ,
echo=F
)
library(tidyverse)
library(hrbrthemes)
library(fontawesome)
``
count: true
# Slide 1
</br>
.font130[
1. Content 1
2. Content 2
]
---
count: false
# Slide 2
</br>
.font130[
Content for slide 2
]
---
``{r gen_pdf, include = FALSE, cache = FALSE, eval = TRUE}
pagedown::chrome_print("slides.html", output = "slides.pdf")
``
We have count:true and count: false throughout the documents but it doesn't seem to relate to whether the page is missing or not.
Thank you so much in advance!
I've figured out what went wrong with my slides for anyone having the same issue:
So in the end it does have something to do with count: true or count: false
count: true indicates the start of a page, but count: false adds on new information on the same page on html format, but all the intermediate results are covered by whichever section that is your last count: false section.
An example would be :
---
count: true
Content 1
---
count: false
Content 2
---
count: false
Content 3
In this case Content 1 would be the start of a new page and everything will show up fine in .html, but on the pdf it was converted to, only Content 3 will show up, and not Content 1 or 2.
Title page was set to count: true automatically, but if you have a count: false section right after it, it will not show up.
Hopefully this explains it!
When using the metropolis theme in xaringan (RStudio 1.2.1070)
output:
xaringan::moon_reader:
css: [default, metropolis, metropolis-fonts]
I wish to have a smaller font for the title of each slide. If I use h1 for a slide title i.e.
---
# The title of this slide
content
it works as expected, but if I try to use h2 i.e.
---
## The title of this slide
content
the text appears in the body of the slide and not the banner.
Suggestions?
Update
Thanks for the prompt answer Martin. I modified your suggestion slightly.
Including:
.remark-slide-content.hljs-default {
border-top: 40px solid #23373B;
}
adds the border to the title slide (which I didn't want).
For me, just adding this works fine:
<style>
.remark-slide-content > h1 { font-size: 35px; margin-top: -88px; }
</style>
Nevertheless, I must say my original question about using ## was prompted by the entry on xaringan Presentations in R Markdown: The Definitive Guide https://bookdown.org/yihui/rmarkdown/xaringan-format.html where it states:
7.3.1 Slides and properties
Every new slide is created under a horizontal rule (---). The content
of the slide can be arbitrary, e.g., it does not have to have a slide
title, and if it does, the title can be of any level you prefer (#,
##, or ###).
Try the following:
---
title: Test
output:
xaringan::moon_reader:
css: [default, metropolis, metropolis-fonts]
---
<style>
.remark-slide-content.hljs-default {
border-top: 40px solid #23373B;
}
.remark-slide-content > h1 {
font-size: 20px;
margin-top: -55px;
}
</style>
---
# The title of this slide
content
I guess you have to play around with the settings to achieve exactly the layout you want.