library(mill)
## In this test I get an extra midrule that is not visible in the word
## document and the subsequent addlinespace additions are then also
## misaligned
observed <- format(docx_tables("text-003.docx")[[1]], output = "tex")
expected <- c("\\begin{table}[H]",
" \\begin{threeparttable}",
paste(" \\caption{Number of foetuses (herds\\textsuperscript{A})",
"investigated by species from 2010--2019 through the aborted",
"foetus examination programme.}"),
" \\begin{tabular}{",
" l",
" r",
" r",
" r",
" r",
" r",
" r",
" r",
" r",
" r",
" r}",
"",
" \\toprule",
"",
" Species &",
" 2010 &",
" 2011 &",
" 2012 &",
" 2013 &",
" 2014 &",
" 2015 &",
" 2016 &",
" 2017 &",
" 2018 &",
" 2019 \\\\",
"",
" \\midrule",
"",
" Cattle &",
" 62 &",
" 21 &",
" 63 &",
" 114 &",
" 32 (27) &",
" 29 (23) &",
" 34 (23) &",
" 20 (18) &",
" 34 (28) &",
" 21 (20) \\\\",
"",
" Goat &",
" 9 &",
" 3 &",
" 5 &",
" 4 &",
" 2 (2) &",
" 0 &",
" 2 (2) &",
" 2 (1) &",
" 5 (3) &",
" 3 (2) \\\\",
"",
" Sheep &",
" 70 &",
" 45 &",
" 79 &",
" 89 &",
" 28 (14) &",
" 31 (21) &",
" 16 (13) &",
" 22 (15) &",
" 23 (16) &",
" 12 (8) \\\\",
"",
" \\addlinespace",
"",
" Alpaca &",
" 5 &",
" 0 &",
" 0 &",
" 0 &",
" 0 &",
" 2 (1) &",
" 1 (1) &",
" 0 &",
" 0 &",
" 0 \\\\",
"",
" Bison &",
" 0 &",
" 0 &",
" 1 &",
" 0 &",
" 0 &",
" 0 &",
" 1 (1) &",
" 0 &",
" 0 &",
" 0 \\\\",
"",
" Visent &",
" 0 &",
" 2 &",
" 1 &",
" 0 &",
" 0 &",
" 0 &",
" 0 &",
" 0 &",
" 0 &",
" 0 \\\\",
"",
" \\addlinespace",
"",
" Gnu &",
" 0 &",
" 0 &",
" 0 &",
" 1 &",
" 0 &",
" 0 &",
" 0 &",
" 0 &",
" 0 &",
" 0 \\\\",
"",
" Pig &",
" 61 &",
" 51 &",
" 54 &",
" 46 &",
" 31 (12) &",
" 17 (10) &",
" 43 (22) &",
" 6 (4) &",
" 16 (9) &",
" 31 (14) \\\\",
"",
" Water buffalo &",
" 0 &",
" 0 &",
" 0 &",
" 0 &",
" 0 &",
" 0 &",
" 0 &",
" 1 (1) &",
" 0 &",
" 0 \\\\",
"",
" \\midrule",
"",
" \\textbf{Total} &",
" \\textbf{207} &",
" \\textbf{122} &",
" \\textbf{203} &",
" \\textbf{259} &",
" \\textbf{93 (55)} &",
" \\textbf{79 (55)} &",
" \\textbf{97 (62)} &",
" \\textbf{51 (39)} &",
" \\textbf{78 (56)} &",
" \\textbf{67 (44)} \\\\",
"",
" \\bottomrule",
"",
" \\end{tabular}",
" \\begin{tablenotes}",
" \\item \\textsuperscript{A}Number of herds not available prior to 2014",
" \\end{tablenotes}",
" \\label{tab:abortion-by-species}",
" \\end{threeparttable}",
"\\end{table}")
stopifnot(identical(observed, expected))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.