Skip to contents

Get options for table rendering in a 'knitr' context. It should not be used by the end user, but its documentation should be read as a place where table options are documented when 'knitr' is used.

The function is a utility to facilitate the retrieval of table options supported by the 'flextable', 'officedown' and 'officer' packages.

These options should be set with knitr::opts_chunk$set(). The names and expected values are listed in the following sections.

Usage

opts_current_table()

Value

a list

knitr chunk options for table captions

labelnamevalue
caption id/bookmarktab.idNULL
captiontab.capNULL
display table caption on top of the table or nottab.topcaptionTRUE
caption table sequence identifier.tab.lp"tab:"

knitr chunk options for Word table captions

labelnamevalue
Word stylename to use for table captions.tab.cap.styleNULL
prefix for numbering chunk (default to "Table ").tab.cap.preTable
suffix for numbering chunk (default to ": ").tab.cap.sep" :"
title number depthtab.cap.tnd0
separator to use between title number and table number.tab.cap.tns"-"
caption prefix formatting propertiestab.cap.fp_textfp_text_lite(bold = TRUE)

knitr chunk options for Word tables

labelnamevalue
the Word stylename to use for tablestab.styleNULL
autofit' or 'fixed' algorithm.tab.layout"autofit"
value of the preferred width of the table in percent (base 1).tab.width1
Alternative title texttab.alt.titleNULL
Alternative description texttab.alt.descriptionNULL

knitr chunk options for data.frame with officedown

labelnamevalue
apply or remove formatting from the first row in the tablefirst_rowTRUE
apply or remove formatting from the first column in the tablefirst_columnFALSE
apply or remove formatting from the last row in the tablelast_rowFALSE
apply or remove formatting from the last column in the tablelast_columnFALSE
don't display odd and even rowsno_hbandTRUE
don't display odd and even columnsno_vbandTRUE

returned elements

  • cap.style (default: NULL)

  • cap.pre (default: "Table ")

  • cap.sep (default: ":")

  • cap.tnd (default: 0)

  • cap.tns (default: "-")

  • cap.fp_text (default: fp_text_lite(bold = TRUE))

  • id (default: NULL)

  • cap (default: NULL)

  • alt.title (default: NULL)

  • alt.description (default: NULL)

  • topcaption (default: TRUE)

  • style (default: NULL)

  • tab.lp (default: "tab:")

  • table_layout (default: "autofit")

  • table_width (default: 1)

  • first_row (default: TRUE)

  • first_column (default: FALSE)

  • last_row (default: FALSE)

  • last_column (default: FALSE)

  • no_hband (default: TRUE)

  • no_vband (default: TRUE)

See also