【问题标题】:xtable caption alignment left aligned with table or centered (using knitr)xtable 标题对齐与表格左对齐或居中(使用 knitr)
【发布时间】:2015-07-13 09:23:00
【问题描述】:

我想将左调整的 xtable 图形标题与表格对齐,或者如果这不起作用,至少居中,因为我认为将小表格居中并留下相应的标题看起来有点愚蠢对齐。此外,表格和标题都左对齐也不是最佳选择。

应该可以usinglatex.environments = "left",但我收到一条错误消息,就像在this 帖子中一样。

我认为问题不在于引用,因为无论有没有label="myLabel",我都会收到相同的错误消息。

这里是 MWE:

<<table, echo=FALSE, results='asis'>>=
print(xtable(lm(mpg~hp, data=mtcars), caption="Linear Model", label="myLabel") , caption.placement = "top", latex.environments="left")
@

错误(短格式,长版本见this再发帖):

Missing $ inserted.
Missing delimiter (. inserted)
Missing $ inserted
Missing \right. inserted

有人知道解决方案吗?与表格左侧对齐或居中对齐,我会对任何解决方案感到满意。

【问题讨论】:

  • 我有问题。同时使用latex.environments="left"发现问题了吗?

标签: r knitr caption xtable


【解决方案1】:

好的,所以我找到了一个至少将表格标题居中的解决方案,使用包caption,指定

\usepackage[
    singlelinecheck=false,
    justification=centering
]{caption}

【讨论】:

猜你喜欢
  • 2018-06-29
  • 2021-04-18
  • 2017-01-16
  • 1970-01-01
  • 1970-01-01
  • 2015-07-18
  • 2019-10-01
  • 1970-01-01
  • 2021-07-22
相关资源
最近更新 更多