pandoc

How to set the number of decimals in report produced with knitr/pander?

那年仲夏 提交于 2019-11-30 13:46:18
I know it's a fairly old problem, and it has been discussed before, but I can't get it work as expected. I have a markdown document, and I would like to use knitr and pander to produce a .docx report with a consistent numeric format with two decimals, such as 0.12, 3.60, 14.00, or 163.21 for both inline and chunk outputs. I have read this thread How to avoid using round() in every \Sexpr{}? where it was suggested that pander can do that automatically. However, it does not seem to work for me. Please let me know what I'm missing here. The script: ```{r, echo=FALSE} library(knitr) opts_chunk$set

How to convert Markdown + CSS -> PDF?

怎甘沉沦 提交于 2019-11-30 13:13:13
问题 I'm trying to convert a Markdown file into a PDF. I'm looking for only two things: A way to easily change the style of the pdf (for example with a CSS file) A syntax highlighter for code blocks What tools can I use for that? I tried Pandoc, but it uses Latex for the formatting which is not easy to use. 回答1: Pandoc can convert your Markdown to HTML, but the styling/layout is a different topic. If you want to produce a PDF but use CSS for styling, you need something that can interpret CSS. That

Batch processing Pandoc conversions in Windows

安稳与你 提交于 2019-11-30 08:37:13
问题 I am trying to convert a large number of HTML files into Markdown using Pandoc in Windows, and have found an answer on how to do this on a Mac, but receive errors when attempting to run the following in Windows PowerShell. find . -name \*.md -type f -exec pandoc -o {}.txt {} \; Can someone help me translate this to work in Windows? 回答1: to convert files in folders recursively try this (Windows prompt command line): for /r "startfolder" %i in (*.htm *.html) do pandoc -f html -t markdown "%~fi"

How can I specify pandoc's markdown extensions using a YAML block?

限于喜欢 提交于 2019-11-30 08:31:43
Background Pandoc's markdown lets you specify extensions for how you would like your markdown to be handled: Markdown syntax extensions can be individually enabled or disabled by appending +EXTENSION or -EXTENSION to the format name. So, for example, markdown_strict+footnotes+definition_lists is strict markdown with footnotes and definition lists enabled, and markdown-pipe_tables+hard_line_breaks is pandoc’s markdown without pipe tables and with hard line breaks. My specific question For a given pandoc conversion where, say, I use grid tables in my source: pandoc myReport.md --from markdown

How to convert Markdown + CSS -> PDF?

≡放荡痞女 提交于 2019-11-30 06:26:59
I'm trying to convert a Markdown file into a PDF. I'm looking for only two things: A way to easily change the style of the pdf (for example with a CSS file) A syntax highlighter for code blocks What tools can I use for that? I tried Pandoc, but it uses Latex for the formatting which is not easy to use. Pandoc can convert your Markdown to HTML, but the styling/layout is a different topic. If you want to produce a PDF but use CSS for styling, you need something that can interpret CSS. That is either use a browser and print to PDF, pay for Prince or try wkhtmltopdf . Btw, pandoc can also use

pandoc “cannot parse yaml header” when converting md to pdf

妖精的绣舞 提交于 2019-11-30 06:18:47
I am trying to convert a markdown document to pdf using pandoc, and it was working fine until it just started to show an error: pandoc: Could not parse YAML header: did not find expected alphabetic or numeric character "source" (line 32, column 85 pandoc: YAML header is not an object "source" (line 17, column 1) pandoc: Could not parse YAML header: did not find expected alphabetic or numeric character "source" (line 8, column 91) Lines 32 and 8 are blank lines between paragraphs, and all that's on line 17 is "---". I don't even know what YAML is, but I don't want to use it, just MD->LaTeX->PDF

How to control cell width in pandoc/markdown table?

不想你离开。 提交于 2019-11-30 05:00:29
Is there a way to control the maximum cell width in a pandoc table? For example: | | | |----------|------------| | I want to the contents of this cell to fit on one line| XXXXXXX | I want to control how the line in the left cell is broken or, in other words, I want to control the maximum width of a cell. Kurt Pfeifle {CAVEATS: This answer applies to Pandoc only, and only when making use of the multiline_table extension to the input in the Markdown syntax. So it won't work for Github Flavored Markdown (GFM).} Multiline tables do support the relative width of columns. (However, you will not be

Pandoc: Template with YAML metadata

邮差的信 提交于 2019-11-30 04:38:57
问题 I use pandoc for generate index.html with YAML metadata. I know iterate associative arrays from pandoc template: YAML : - Author: Mastropiero - Author: Gunter Fraggen TEMPLATE : $for(author)$ $author$ $endfor$ But... How to iterate lists without key ? YAML : - Author: - [Value1, Value2] - [Value1B, Value2B] TEMPLATE : $for(author)$ ... // how works? $endfor$ 回答1: As your template shows, within a loop pandoc makes a local variable with the same name as the array ('author' in your case). So to

Using table caption on R markdown file using knitr to use in pandoc to convert to pdf

醉酒当歌 提交于 2019-11-30 03:38:25
I am wondering if it is possible to use the table captions like figure captions using knitr in .Rmd file ? I saw options for figure caption but I couldn't see the option for the table caption. I also want to remove the message such as "% latex table generated in R 2.15.2 by xtable 1.7-0 package % Wed Mar 06 15:02:11 2013" . I used X table to create the table: The sample code I used is as follows: ```{r table2, results='asis', message=FALSE} library(xtable) print(xtable(head(iris))) ``` The table I got after processing through pandoc is as follows: I tried to use message=FALSE in Rmd file to

Knitr & Rmarkdown docx tables

ぐ巨炮叔叔 提交于 2019-11-30 01:27:38
When using knitr and rmarkdown together to create a word document you can use an existing document to style the output. For example in my yaml header: output: word_document: reference_docx: style.docx fig_caption: TRUE within this style i have created a default table style - the goal here is to have the kable table output in the correct style. When I knit the word document and use the style.docx the tables are not stylized according to the table. Using the style inspector has not been helpful so far, unsure if the default table style is the incorrect style to modify. Example Code: ```{r kable}