r - 不同的 HTML 和 PDF 输出格式
问题描述
我正在尝试在 rmarkdown 中创建报告,但我想要的输出形状仅在 HTML 文件中是正确的。当我导出为 PDF 时,格式是不同的。标题在页面中间,作者 1 和 2 之间没有空格,日期在页面中间,等等……你知道为什么会这样吗?我能做些什么来克服这个问题?
---
title: "açoifjwçoifjwçaofijwaçfijo"
author: '1: lululukuku <br> 2: eeeeeeeeeeeee'
date: "`r format(Sys.time(), '%d, %B, %Y')`"
output:
html_notebook: default
pdf_document: default
---
<style type="text/css">
h1.title {
font-size: 38px;
color: DarkBlack;
text-align: left;
}
h4.date {
font-size: 18px;
font-family: "Times New Roman", Times, serif;
color: DarkBlack;
float: right;
}
h4.author {
font-size: 18px;
font-family: "Times New Roman", Times, serif;
color: DarkBlack;
float: left;
}
div#header {
overflow: auto;
}
</style>
---
用于渲染的代码:
rmarkdown::render('aaa.Rmd', 'html_document', 'teste.html')
rmarkdown::render('aaa.Rmd', 'pdf_document', 'teste.pdf')
和输出:
HTML:
PDF:
解决方案
推荐阅读
- indexing - RavenDB 4 - 根据 AbstractIndexCreationTask 检索索引名称
类实现 - javascript - 在页面中运行隐藏的 javascript 函数
- ios - Unity Firebase iOS 缺少符号 arm64
- java - 在 ArrayList 中为现有条目设置值
- java - 即使在实现 onSaveInstanceState() 和 onRestoreInstanceState() 方法后也无法保存我的活动状态
- php - 如何生成用于在线票务服务的安全且唯一的令牌?
- vue.js - 如何通过动态道具
- javascript - 添加新形状后画布不渲染形状
- django - 如何在 django 中创建一个具有多个模型之一的外键的模型?
- jquery - 在悬停时显示元素延迟