我知道如果我想把我的身材放在中心,我可以设置>>> import enchant
>>> d=enchant.Dict("en_US")
>>> d.add("def")
>>> d.add("abc")
>>> d.suggest("P92")
** (python.exe:15036): CRITICAL **: enchant_is_all_caps: assertion `word && *word' failed
['ᾈ\t_us', 'Def', 'Abc']
。但是,如果我想将输出集中在pdf文档中呢?
答案 0 :(得分:8)
以下代码对我有用。
\center Centered Text \center
而且,如果您需要将其设置为粗体,就我的情况而言,您可以使用下划线(两个在开始,两个在结尾):
\center __Centered Text__ \center
答案 1 :(得分:0)
希望添加我的答案还为时不晚。
您可以在Rstudio Markdown文档中使用html tags。
要使文本居中,您只需要:
<center> TEXT TO CENTER </center>
这在编织Rstudio Markdowns时对我有用。
答案 2 :(得分:0)
将R代码在Rmd文件中生成的图与在其他文件中现有图形的图居中的选项不同。
对于您在R中生成的数字,我认为fig.align="center
就足够了,即使您需要PDF输出。
要使<center> <\center>
工作,您只能使用HTML输出。如果仍然需要PDF输出,我认为您可以使用include_graphics(your_img.png)
包中的knitr
,然后可以使用fig.align="center
之类的块选项。如果您还想更改此图形的大小,请使用类似out.width="50%"
的东西,而不要使用fig.width
。
有关更多详细信息,我发现本文非常有用tips and tricks for working with images and figures in r markdown documents。