将自定义注释包装在texreg输出中 [英] Wrapping custom notes in texreg output

查看:124
本文介绍了将自定义注释包装在texreg输出中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在由texreg创建的表格的底部添加一个较长的注释;我希望这可以简单地进行环绕,但是似乎没有任何内置功能可以实现这一点.

I'm trying to add a fairly long note to the bottom of a table created by texreg; I want this to simply wrap around, but there doesn't seem to be any functionality built into the function for doing so.

例如,

texreg(lm(speed~dist,data=cars),
       custom.note=paste("%stars. This regression should be",
                         "intepreted with strong caution as",
                         "it is likely plagued by extensive",
                         "omitted variable bias"))

其中的哪个在编译时会给出类似的内容:

Which, when compiled, gives something like:

格式很残酷;更好的办法是替换标准输出:

The formatting is atrocious; much better would be something like replacing the standard output:

\multicolumn{2}{l}{\scriptsize{$^{***}p<0.001$, $^{**}p<0.01$, $^*p<0.05$. This regression should be intepreted with strong caution as it is likely plagued by extensive omitted variable bias}}

具有更易消化的包装:

\multicolumn{2}{l}{\scriptsize{$^{***}p<0.001$, $^{**}p<0.01$, $^*p<0.05$.}} \\
\multicolumn{2}{l}{\scriptsize{This regression should be intepreted with}} \\
\multicolumn{2}{l}{\scriptsize{strong caution as it is likely plagued by}} \\
\multicolumn{2}{l}{\scriptsize{extensive omitted variable bias}}

哪个输出将更接近我要查找的内容:

Which gives output much closer to what I'm looking for:

有没有办法以编程方式执行此操作?

Is there a way to do this programatically?

推荐答案

我可能会指出一个整洁的我收到的替代解决方案最晚您需要更新texreg软件包时,您可能会对此感兴趣.

I might point out a neat alternative solution I received which could be of interest to you, at the latest when you need to update the texreg package.

因此,自定义注释在LaTeX代码中以\multicolumn结尾,因此我们不能使用par\\之类的换行命令.但是我们可以使用\parbox实现自动换行.如果仍然需要自定义换行符,则可以使用四个反斜杠\\\\.为了获得更好的格式,我们可以在文本内容的开头使用\\vspace{2pt}:

Accordingly the custom note ends in a \multicolumn in the LaTeX code, thus we cannot use line break commands like par or \\. But we can achieve the automatic line break with \parbox. If we still want a custom line break we can use four backslashes \\\\. For better formatting we can use \\vspace{2pt} just at the beginning of the text content:

texreg(lm(speed ~ dist, data = cars),
       custom.note = ("\\parbox{.4\\linewidth}{\\vspace{2pt}%stars. \\\\
       This regression should be intepreted with strong caution as it is 
       likely plagued by extensive omitted variable bias.}"))

这篇关于将自定义注释包装在texreg输出中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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