R Markdown水平尺也可以与LaTeX pdf一起使用吗? [英] R Markdown horizontal rule that will also work with LaTeX pdf?

查看:116
本文介绍了R Markdown水平尺也可以与LaTeX pdf一起使用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道***是Pandoc对水平尺的减价.这条水平线在HTML上看起来不错,但是如果我将Markdown编织成pdf,则水平标尺仅运行pdf宽度的一半,并且居中.这种组合只会使水平线看起来很难看.

I am aware that *** is Pandoc's Markdown for a horizontal rule. This horizontal line looks good on HTML, but if I knit my Markdown into a pdf the horizontal rule only runs half the width of the pdf, and it is centered. This combination just makes the horizontal rule look plain ugly.

我如何在我的R Markdown中正确放置一条可以正确呈现为HTML和pdf的水平尺? Properly == full length/full width.当我在使用它时,是否可以格式化水平线(颜色,厚度等),而不必进入很多我一无所知的CSS.

How do I properly put a horizontal rule in my R Markdown that can render properly to both HTML and pdf? Properly == full length/full width. And while I'm at it, can I format the horizontal rule (color, thickness, etc.) without getting into much CSS which I know nothing about.

推荐答案

制作一个tex文件,例如header.tex,其中包含:

Make a tex file, say header.tex, containing:

\let\oldrule=\rule
\renewcommand{\rule}[1]{\oldrule{\linewidth}}

然后在您的Rmd文件中:

---
title: "test"
author: "Stéphane Laurent"
date: "30 mars 2018"
output: 
  pdf_document:
    includes:
      in_header: header.tex
---

这篇关于R Markdown水平尺也可以与LaTeX pdf一起使用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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