我正在尝试使用 rstudio 的四开版实现创建幻灯片,并且我希望在节目中所有非标题幻灯片的左上角有一个通用图标。(我也希望它出现在标题幻灯片上,但我已经弄清楚了!)
在一张幻灯片上,我可以使用{background-image="logo.png" background-size=15% background-position="0% 0%"}并且该幻灯片效果很好。
在 YAML 中,
data-background-image: ./logo.png
data-background-size: 15%
data-background-position: 0% 0%
Run Code Online (Sandbox Code Playgroud)
非常适合标题幻灯片。如果我使用
background-image: logo.png
background-size: 15%
background-position: 0% 0%
Run Code Online (Sandbox Code Playgroud)
我在所有幻灯片上都得到了正确的图像,但它占据了整张幻灯片,不考虑尺寸参数。
关于如何处理这个问题有什么建议吗?也许背景实际上并不是执行此操作的正确方法,因为它只是一个徽标,但这似乎比尝试更改四开本中“徽标”的属性更容易,因为我没有看到任何选项改变它的大小。
使用 Rstudio 创建 RevealJS 演示文稿,无论我做什么,我都无法将背景更改为图像。
\n## title {background-image = "URL or file.extension" }\nRun Code Online (Sandbox Code Playgroud)\n或者
\n{data-background-image= }\nRun Code Online (Sandbox Code Playgroud)\n不起作用,同时
\n{background-color= }\nRun Code Online (Sandbox Code Playgroud)\n做。
\n我一直在尝试几种媒体类型 - png、jpeg、gif。URL 和本地文件都位于项目的主文件夹中。所有这些图像在我的浏览器中加载得很好。
\n我得到的是一张标题幻灯片,其中标题仅包含括号内的表达式:
\n\n我还想使用 GIF 作为标题幻灯片的背景图像。这就是我最初打算做的事情,渐渐地我明白,即使是简单的幻灯片背景图像也无法像 Quarto 网站示例中所示的那样工作。
\n> sessionInfo() \nR version 4.1.1 (2021-08-10) \nPlatform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19044)\n\n> RStudio.Version() \n\n$mode "desktop" \n\n$version \xe2\x80\x982022.7.1.554\xe2\x80\x99\n\n$long_version "2022.07.1+554"\n\n$release_name "Spotted Wakerobin"\nRun Code Online (Sandbox Code Playgroud)\n 这个想法是复制rmarkdownin上的 PDF 输出quarto,在本例中,是在单个文档上创建多页方向。我可以通过使用这个技巧rmarkdown轻松做到这一点。但是,我无法在四开本中执行此操作,它会不断发送错误消息
compilation failed- error
Undefined control sequence.
l.201 \blandscape
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
---
title: "Portrait and Landscape"
format:
pdf:
include-in-header:
- packages.tex
---
# Quarto
Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see <https://quarto.org>.
\newpage
\blandscape
# Running Code
When you click the **Render** button a document will be generated that includes both content and the output of embedded code. You …Run Code Online (Sandbox Code Playgroud) 我有一个像这样的数据集(df):
| 年龄 | n |
|---|---|
| 18 | 2500 |
| 19 号 | 1200 |
| 20 | 4500 |
| 21 | 800 |
| 23 | 120 |
| 24 | 50 |
| 25+ | 100 |
我创建了一个像这样的代码的ggplot,它按年龄显示学生群体
ggplot(df, aes(x=Age, y=n)) +
geom_bar(stat="identity") + ggtitle("Student Body by Age at ETH in the assesment year") + scale_y_continuous(labels = function(x) format(x, scientific = FALSE))
Run Code Online (Sandbox Code Playgroud)
现在我想在直方图旁边创建一个图例,显示按年龄划分的评估年份的成功率。有了这些数据集
| 年龄 | % 成功 |
|---|---|
| 18-19日 | 80 |
| 20-21日 | 60 |
| 23-24日 | 50 |
| 25+ | 20 |
有没有代码可以添加带有年龄成功率的图例?
直方图很好,但我想要一个图例,在右侧显示按年龄划分的成功率。
如何在四开PDF文档中自定义图形标题的字体大小?我已经检查了 mainfont和fontfamily选项,但文档没有提供如何使用更改 pdf 文档中各个元素的字体大小的示例。
我想在 HTML 中多次使用同一个脚注Quarto。问题是,一旦我创建脚注并使用它两次,它将显示为两个脚注。这是一个可重现的示例:
---
title: "Footnote multiple times"
editor: visual
format: html
---
Some example text for a footnote[^1].
Some example text for same footnote[^1].
[^1]: Example footnote.
Run Code Online (Sandbox Code Playgroud)
输出:
正如您所看到的,脚注显示为两个单独的脚注(重复),而我创建了一个脚注。所以我想知道是否有人知道如何创建一个脚注并在 HTML 四开本中多次使用它?
有人建议如何设置 #quarto .qmd #rstats pdf 的页眉和页脚吗?我尝试了这个,但没有页脚显示:
---
title: "Untitled"
format:
pdf:
include-in-header:
text:
\usepackage{fancyhdr}
---
\fancyfoot[L]{Footer text}
# Chapter ONE
text
\newpage
# Chapter TWO
Run Code Online (Sandbox Code Playgroud)
我可以使用 fancyhdr 吗?如果是,怎么办?如果没有,那怎么办?谢谢!
在使用 PDF 输出选项的 RMarkdown 中,有时代码块的输出会在页面之间分割(如下面的示例所示)。这有时会产生输出的一小部分位于一页上,而较大部分位于另一页上的输出。
Microsoft Word 可以选择启用寡妇/孤儿控制选项,以防止这种分离。
如果一个部分少于一定行数,我可以在 RMarkdown 中启用任何类似的选项来合并跨页面的连续块吗?
我当前的方法涉及交叉引用输出并\newline在代码块之前放置在两个页面之间分割的代码块。显然,这是不必要的复杂并且很容易出错。
我正在用来quarto准备 Beamer 演示文稿。我想减小给定块内代码的字体大小,以便一切都更合适。请参阅下面的示例:
生成块的代码是:
```{python}
# Import packages
import numpy as np
```
```{python}
#| echo: true
w = np.array([0.7, 0.3])
Sigma = np.array([[0.09, 0.1], [0.1, 0.25]])
var_rp = w.T @ Sigma @ w
print("Variance of our example portfolio {:.4f}".format(var_rp))
print("Standard Deviation of our example portfolio {:.2f}".format(np.sqrt(var_rp)))
```
Run Code Online (Sandbox Code Playgroud)
有没有办法更改该块的字体大小,以便所有代码行都适合 pdf 中的一行?提前致谢!
我已经在 Quarto 文档( https://quarto.org/docs/output-formats/html-code.html#appearance )中看到了如何自定义块外观,但是如何自定义块输出的颜色和/或背景,以便它在渲染的 HTML 文档中,除了字体样式之外,它与纯文本的区别是什么?
谢谢!