gpt4 book ai didi

r - 在 R Markdown 中创建可填充的彩色文本框 (PDF)

转载 作者:行者123 更新时间:2023-12-02 20:22:32 57 4
gpt4 key购买 nike

我正在尝试创建一个 Markdown ,其中图表和表格附带的文本位于深蓝色框中,如下图所示: enter image description here

我尝试查看 this solution ,但我根本无法复制这个盒子,当然也不能复制彩色版本。有人知道如何在 Markdown 中做到这一点吗?

---
title: "Untitled"
author: "Test"
date: "22/6/2018"
output: pdf_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

## R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.

When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

```{r cars}
summary(cars)
```

## Including Plots

You can also embed plots, for example:

```{r pressure, echo=FALSE}
plot(pressure)
```

Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.

\begin{Form}
\TextField[width = 10cm, height = 10cm]{This is the textbox.}
I would like a dark blue textbox with white writing
\end{Form}

最佳答案

\TextField 命令采用一些可选参数来定义颜色和默认文本:

---
output:
pdf_document:
keep_tex: yes
---

\begin{Form}
\TextField[width = 10cm,%
height = 3cm,%
multiline=true,%
bordercolor = 0 0 0.5,%
backgroundcolor = 0 0 0.5,%
color = 1 1 1,%
value = {%
This is the textbox.
I would like a dark blue textbox with white writing
}%
]{}
\end{Form}

这会产生:

enter image description here

可以编辑 \TextField 以包含多行文本,但我无法设置多行。使用 \string\n (参见 https://tex.stackexchange.com/questions/416218/how-to-add-line-breaks-to-hyperref-pdf-form-textfield )对我不起作用。不过,这可能取决于 PDF 查看器。我正在使用 Evince。

关于r - 在 R Markdown 中创建可填充的彩色文本框 (PDF),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50985656/

57 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com