在rmarkdown中编织html时如何左右对齐文本 [英] How to justify the text to both sides when knitting html in rmarkdown

查看:249
本文介绍了在rmarkdown中编织html时如何左右对齐文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

---
title: '1'
author: "A"
date: "April 4, 2017"
output: html_document
---

      Figure 3 includes the residual plot and QQ-plot. The residual plot have no obvious pattern: the expect value of residuals is close to 0 and the variances are approximately equal. The QQ-plot shows the standardized residuals are close to the theoretical quantiles. Thus, **the residuals are normally distributed and homoscedastic, and the assumption of the liner model is satisfied**. The VIF values for each variable in the best model is small, indicating **there are no obvious multicolinearity**.

例如,使用上面的代码,如图所示,默认情况下,第二行和第三行向左对齐.

如果我要对齐两侧,该怎么办? (注意:不与中心对齐!)

Rmarkdown单词文档中的文本对齐提供了单词输出大小写的解决方案,但是我没有找到有关html案例的很好参考.

解决方案

只需在YAML之后立即覆盖对齐方式即可:

---
title: '1'
author: "A"
date: "April 4, 2017"
output: html_document
---

<style>
body {
text-align: justify}
</style>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Figure 3 includes the residual plot and QQ-plot. The residual plot have no obvious pattern: the expect value of residuals is close to 0 and the variances are approximately equal. The QQ-plot shows the standardized residuals are close to the theoretical quantiles. Thus, **the residuals are normally distributed and homoscedastic, and the assumption of the liner model is satisfied**. The VIF values for each variable in the best model is small, indicating **there are no obvious multicolinearity**.

归功于Guilherme Parreira,此处

---
title: '1'
author: "A"
date: "April 4, 2017"
output: html_document
---

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Figure 3 includes the residual plot and QQ-plot. The residual plot have no obvious pattern: the expect value of residuals is close to 0 and the variances are approximately equal. The QQ-plot shows the standardized residuals are close to the theoretical quantiles. Thus, **the residuals are normally distributed and homoscedastic, and the assumption of the liner model is satisfied**. The VIF values for each variable in the best model is small, indicating **there are no obvious multicolinearity**.

Use the above code for example, as it shows in the picture, the second line and third line are aligned to the left by default.

What should I do if I want to align to both sides? (Notice: not align to the center!)

Text Justification in Rmarkdown word document gives the solution for word output case, but I haven't found a good reference for html case.

解决方案

Just overwrite the alignment right after the YAML:

---
title: '1'
author: "A"
date: "April 4, 2017"
output: html_document
---

<style>
body {
text-align: justify}
</style>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Figure 3 includes the residual plot and QQ-plot. The residual plot have no obvious pattern: the expect value of residuals is close to 0 and the variances are approximately equal. The QQ-plot shows the standardized residuals are close to the theoretical quantiles. Thus, **the residuals are normally distributed and homoscedastic, and the assumption of the liner model is satisfied**. The VIF values for each variable in the best model is small, indicating **there are no obvious multicolinearity**.

Credits to Guilherme Parreira, here

这篇关于在rmarkdown中编织html时如何左右对齐文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆