生成ioslides文档时,明明设置了文字加粗,但出来的效果很奇怪,本该加粗的文字并没有加粗。
以下是.Rmd文档中的内容:
---
output:
ioslides_presentation:
widescreen: true
smaller: true
css: my-theme.css
---
## 举个栗子
### 第一种情况
+ 文字
- 文字
- 文字**本该加粗的文字**
### 第二种情况
+ 文字
- 文字
- 文字**本该加粗的文字**
### 第三种情况
+ <u>文字</u>:文字<b>本该加粗的文字</b>
+ <u>文字</u>:文字<a>本该加粗的文字</a>
第一张图
得到的效果如下:
my-theme.css
文档中的内容如下:
slides > slide {
background-image: url("images/背景图片.png");
background-position: bottom;
background-size: contain;
background-repeat: repeat-x;
font-family: 'Microsoft YaHei',monospace;
}
body, h2, p, table, th, td, pre, strong, em {color:black; }
b {color:green;}
u {color:blue;}
a {color:orange;}
img {
max-width: 100%;
height: auto;
outline-style:none;
}
/* aligns two-column slides in the center */
div {
text-align: center;
vertical-align: baseline;
}
第二张图
我把css主题文档中的背景相关设置删了以后,加粗又正常了,如下图所示:
改了的css文档长下面这样:
slides > slide {
font-family: 'Microsoft YaHei',monospace;
}
body, h2, p, table, th, td, pre, strong, em {color:black; }
b {color:green;}
u {color:blue;}
a {color:orange;}
img {
max-width: 100%;
height: auto;
outline-style:none;
}
/* aligns two-column slides in the center */
div {
text-align: center;
vertical-align: baseline;
}
还有一个想不通的点,因为加粗不管用,我便想着改变文字的颜色,设置了b {color:green;}
后,对应的文字<b>本该加粗的文字</b>
确实变绿了;可是为撒设置u {color:blue;}
后,对应的文字不仅变蓝了还自带下划线,这里的字母u是我随便写的;不懂为撒字母u有下划线,我又设置了 a {color:orange;}
,字母a也是随便写的,奇怪的是怎么a对应的文字在第一张图里没下划线,在第二张图里又有下划线了。
R环境如下:
R version 4.1.1 (2021-08-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19043)
Matrix products: default
locale:
[1] LC_COLLATE=Chinese (Simplified)_China.936 LC_CTYPE=Chinese (Simplified)_China.936
[3] LC_MONETARY=Chinese (Simplified)_China.936 LC_NUMERIC=C
[5] LC_TIME=Chinese (Simplified)_China.936
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.1.1 fastmap_1.1.0 htmltools_0.5.2 tools_4.1.1 yaml_2.2.1 rmarkdown_2.11 knitr_1.36
[8] xfun_0.26 digest_0.6.28 rlang_0.4.11 evaluate_0.14