简体   繁体   English

Pandoc MD 到 PDF ,全尺寸水平尺

[英]Pandoc MD to PDF , full size horizontal rule

I'm using pandoc (on windows with miktex)我正在使用 pandoc(在带有 miktex 的 Windows 上)

with markdown i create a horizontal rule, save that as my source.md使用降价我创建了一个水平规则,将其保存为我的 source.md

---

(or even an hr tag instead) (或者甚至是 hr 标签)

but when I convert to PDF the horizontal rule is a tiny little line in the middle of the page, centered.但是当我转换为 PDF 时,水平线是页面中间的一条小线,居中。

How do I get it to create one from margin to margin like it does when I convert it to HTML?当我将它转换为 HTML 时,我如何让它从边距到边距创建一个?

Edit:编辑:

I tried a CSS styled DIV tag that creates a rule but it is completely ignored during a pdf output.我尝试了一个创建规则的 CSS 样式的 DIV 标签,但它在 pdf 输出过程中被完全忽略。

As pointed above, you can redefine the \\rule command in your custom LaTeX template to ignore the first argument:如上所述,您可以在自定义 LaTeX 模板中重新定义\\rule命令以忽略第一个参数:

\let\OldRule\rule
\renewcommand{\rule}[2]{\OldRule{\linewidth}{#2}}

The horizontal rule produces the LaTeX code \\begin{center}\\rule{3in}{0.4pt}\\end{center} when using pandoc -t latex .使用pandoc -t latex时,水平规则会生成 LaTeX 代码\\begin{center}\\rule{3in}{0.4pt}\\end{center} So you might try to redefine the \\rule command in your custom Pandoc template .因此,您可能会尝试在自定义Pandoc 模板中重新定义\\rule命令。

Other than that, using ConTeXt instead of LaTeX already results in a full-size horizontal rule.除此之外,使用 ConTeXt 而不是 LaTeX 已经产生了全尺寸的水平线。

Try $\\hrulefill$ .试试$\\hrulefill$ This worked for me.这对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM