Touch up figure and table captions after using convert_docx_to_rmd()
Source: R/add_captions.R
add_captions.Rd
After using convert_docx_to_rmd()
, figure and table captions
are part of the main text and cross references to them are just text and
numbers, making it difficult to integrate these .Rmd
files in reports:
they are not automatically renumbered, these captions cannot be listed,...
This function replaces the figure and table descriptions with true captions,
and cross references to these figures and tables with dynamic references
(that refer to the figure or table label).
Usage
add_captions(
from,
to,
name_figure_from = "Figuur",
name_table_from = "Tabel",
name_figure_to = "Figuur",
name_table_to = "Tabel"
)
Arguments
- from
The
.Rmd
file to convert. Can be given as an absolute or relative path.- to
The filename to write the resulting
.Rmd
file. Can be given as an absolute or relative path.- name_figure_from
name that is given to figures in captions and cross references in the
.Rmd
provided infrom
(default isFiguur
)- name_table_from
name that is given to tables in captions and cross references in the
.Rmd
provided infrom
(default isTabel
)- name_figure_to
name that should be given to figures in cross references in the output
.Rmd
(default isFiguur
)- name_table_to
name that should be given to tables in cross references in the output
.Rmd
(default isTabel
)
Details
This function expects an input that is generated by
convert_docx_to_rmd()
, with
figure captions below the figure and starting with
Figuur
(or other name to be defined in variablename_figure
), then a unique number and finally the description in one paragraphtable captions above the table and starting with
Tabel
(or other name to be defined in variablename_table
), then a unique number and finally the description in one paragraphfigures consisting of one image, not 2 figures near each other
cross references having the same label as the figure or table they refer to, default
Figuur
orTabel
followed by the unique number written in exactly the same way
Please check carefully for mistakes after using this function
See also
Other convert:
convert_docx_to_rmd()