docx_document: Formatter wrapper for 'html_document', facilitates easier...

View source: R/docx_document.R

docx_documentR Documentation

Formatter wrapper for html_document, facilitates easier porting to docx

Description

This function adds the option of having adaptations needed for seemless integration with MS Word for importing html-documents in the .docx-format. The advantage of html documents is the ability to create advanced formatting frequently needed in medical publications and that is available in the htmlTable function. You can view the series for more details regarding how to achieve fast-track-publishing (ftp) together with knitr.

Usage

docx_document(
  ...,
  self_contained = FALSE,
  mathjax = NULL,
  theme = NULL,
  highlight = NULL,
  css = "rmarkdown/docx.css",
  h1_style = "margin: 24pt 0pt 0pt 0pt;",
  other_h_style = "margin: 10pt 0pt 0pt 0pt;",
  remove_scripts = TRUE,
  force_captions = FALSE,
  css_max_width
)

Arguments

...

Passed onto html_document.

self_contained

Overrides the default TRUE for html_document to FALSE as LibreOffice hangs on long lines such as the base64 images included in the self-contained version.

mathjax

The advanced mathjax does not work with with Word/LibreOffice.

theme

No theme should be used for the output as the custom CSS should take care of everything.

highlight

By default turn off highlighting as scripts are difficult to import. This does though work somewhat OK when copy-pasting from the web-browser.

css

The CSS if other that the default within the package

h1_style

You can choose any css style formatting here that you want to be applied to all h1 elements. Note: this is only applied if LibreOffice_adapt is TRUE.

other_h_style

This is the formatting applied to any other h elements not included to the first. Note: this is only applied if LibreOffice_adapt is TRUE.

remove_scripts

TRUE if <script></script> tags are to be removed. These are usually not compatible with Word-processors and should therefore in most cases be stripped from the document.

force_captions

Since out.width and out.height remove the option of having captions this allows a workaround through some processing via the XML-package

css_max_width

The max width of the body element. Defaults to "40em" if not specified. Any CSS-compliant width format works.

Details

If you want to get equations into Word the currently best way is to use the word_document format.

Value

R Markdown output format to pass to render

Author(s)

Max Gordon

Examples

# Possible yaml configuration at the top of the Rmd doc
## Not run: 
---
title: "Test"
author: "Max Gordon"
output:
  Gmisc::docx_document
---

## End(Not run)

gforge/Gmisc documentation built on Aug. 30, 2023, 7:38 a.m.