如何解决如何使用 multicol 格式在 Rmarkdown 报告中包含数字
我在使用 ireports
包自定义报告时遇到了一些问题。我想要做的本质上是创建一个多列和横向报告,到目前为止我已经设法通过将以下内容添加到包中的默认 tex
序言
\usepackage[landscape]{geometry}
usepackage{multicol}
当我尝试在我的 Rmd 文件中添加一个图形时,我的问题出现了,它只是没有出现。我看了一下,我看到这可能是因为 multicol
包不允许出现浮动数字(请参阅 here),但是我不确定如何实现此解决方案。有什么方法可以成功地将图形保持在它在我的 Rmd 中的确切位置?
这是我的文档的样子,只是没有出现图
这是我的完整 Rmd 文件
---
title: Document Title
author: INWTlab
date: \today
params:
logo: logo.png
cover: cover.png
iblue: 6d1d26
igray: ffffff
documentclass: article
fontsize: 11
papersize: a4paper
output:
IReports::businessReport:
keep_tex: TRUE
latex_engine: xelatex
resetStyleFiles: FALSE
header-includes:
- \newcommand{\logo}{`r gsub("_","\\_",params$logo)`}
- \newcommand{\cover}{`r gsub("_",params$cover)`}
- \newcommand{\iblue}{`r params$iblue`}
- \newcommand{\igray}{`r params$igray`}
include-before:
- \renewcommand{\contentsname}{Contents Page}
- \renewcommand{\pagename}{Page}
---
```{r setup,include = FALSE}
# packages
library(dplyr)
library(knitr)
library(xtable)
# settings
knitr::opts_chunk$set(echo = FALSE,message = FALSE,warning = FALSE)
```
\maketitle
\tableofcontents
\addcontentsline{toc}{section}{Contents}
\clearpage
\begin{multicols}{2}
\section{First Section}
\justify
\textbf{On a net basis,US yields rose considerably over the course of the month as investors eyed a rush of new debt issuance in a Biden-led administration.} Longer-dated US Treasury yields came under sustained pressure over the course of the month amid a consensus on the likelihood of the Democratic-controlled Congress easing fiscal policy to support the economy. A rise in inflation expectations induced by the incoming administration's fiscal policy stance fuelled a 10 basis point increase in the benchmark 10 year yield to a level of 1.07\%,while the 10year-2year spread steepened by about 15 basis points over the course of the month.
```{r fig1,fig.align='center',fig.cap="First Plot \\label{Figure1}",fig.height=2.4,fig.width=3}
library(ggplot2)
mtcars$cyl <- as.factor(mtcars$cyl)
ggplot(mtcars,aes(x=hp,y=mpg,color=cyl,shape=cyl)) +
geom_point(size=3)
```
\newpage
\section{Second Section}
\end{multicols}
```````````````````````
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。