如何在 R markdown html 文档中将 YAML 标题居中?

How do I center my YAML heading in an R markdown html document?(如何在 R markdown html 文档中将 YAML 标题居中?)
本文介绍了如何在 R markdown html 文档中将 YAML 标题居中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我想让我的 YAML 标头信息以我的 html 文档为中心.

I want to have my YAML header information centered on my html document.

我希望其他一切正常.

我可以将任何 html 或其他代码应用于 YAML 标头以实现此目的吗?

Can I apply any html or other code to the YAML header to make this happen?

我该怎么做??

例子:

我有:

---
title: "Shiny HTML Doc"
author: "theforestecologist"
date: "Apr 14, 2017"
output:  html_document
runtime: shiny
---

推荐答案

这里有一些 css 样式,您可以使用它们来完成您所需要的.

Here is some css styling that you can use to accomplish what you need.

  • markdown 文档标题使用 h1.title CSS 选择器
  • markdown 文档作者字段使用 h4.author CSS 选择器
  • markdown 文档 datea 字段使用 h4.date CSS 选择器
  • The markdown document title uses the h1.title CSS selector
  • The markdown document author field uses the h4.author CSS selector
  • The markdown document datea field uses the h4.date CSS selector

代码如下:

---
title: "Shiny HTML Doc"
author: "theforestecologist"
date: "Apr 14, 2017"
output:  html_document
runtime: shiny
---

<style type="text/css">

h1.title {
  font-size: 38px;
  color: DarkRed;
  text-align: center;
}
h4.author { /* Header 4 - and the author and data headers use this too  */
    font-size: 18px;
  font-family: "Times New Roman", Times, serif;
  color: DarkRed;
  text-align: center;
}
h4.date { /* Header 4 - and the author and data headers use this too  */
  font-size: 18px;
  font-family: "Times New Roman", Times, serif;
  color: DarkBlue;
  text-align: center;
}
</style>


# H1 Header

Some body text

## H2 Header

More body text



```{r echo=T}
n <- 100
df <- data.frame(x=rnorm(n),y=rnorm(n))
```

这就是它最终的样子:

这篇关于如何在 R markdown html 文档中将 YAML 标题居中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

业务场景:使用update语句去更新数据库字段。 原因:update接收值不正确。原来代码: $query = "UPDATE student SET date = now() WHERE id = $id";$result = $mysqli-query($query2) or die($mysqli-error); // 问题出现了在这句 $data = $result-fetch_ass
在layui树状组件tree中,勾选问题可以通过以下方法解决: 通过tree的oncheck事件来监听勾选操作,然后根据勾选状态进行相应的处理。例如: tree.on('check', function(obj) { // 获取勾选状态 var isChecked = obj.checked; // 获取当前节点数据 var data =
经常用到layui的朋友都知道,layui tree默认是不能自定义图标的,那么我们要自定义的话要怎么操作呢? 首先用编辑器软件(修改时候用编辑器记得编码),打开layui.js。搜索: i class="layui-icon layui-icon-file" 改为如下代码: i class="'+ (i.icon || "l
在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会
append() 方法在被选元素的结尾(仍然在内部)插入指定内容。 语法: $(selector).append( content ) var creatPrintList = function(data){ var innerHtml = ""; for(var i =0;i data.length;i++){ innerHtml +="li class='contentLi'"; innerHtml +="a href
问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转