wjschne / apaquarto

A quarto extension for creating APA7 documents in .docx, .html, and .pdf formats
https://wjschne.github.io/apaquarto/
Creative Commons Zero v1.0 Universal
170 stars 15 forks source link

`documentmode: jou` error #2

Closed mvuorre closed 1 year ago

mvuorre commented 1 year ago

Hi,

Wonderful work! Thanks for putting this together.

I can compile the example document to pdf&html&docx, but trying to create a pdf with documentmode: jou doesnt work:

compilation failed- no matching packages
Package longtable Error: longtable not in 1-column mode.

See the longtable package documentation for explanation.
Type  H <return>  for immediate help.
 ...

l.330 \begin{longtable*}
                        [l]{|p{0.75in}|p{0.75in}}

see quarto-apa-test.log for more information.

This error is specific to the table created in the template. It looks like flextable is not the best choice here (https://stackoverflow.com/questions/68104689/flextable-seems-to-be-incompatible-with-multicol-latex-package). You can create APA-looking tables with e.g. kableExtra. So replacing the table code starting on line 243 to for example:

library(kableExtra)
tibble(Numbers = seq(1,4), Letters = LETTERS[seq(Numbers)]) %>% 
  kbl(booktabs = TRUE) %>% 
  kable_classic_2()

removes the error. Unfortunately there are then more errors with the apatb table labels:

compilation failed- no matching packages
LaTeX Error: Not in outer par mode.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.321 \centering

Switching from {r apatb-mytable} on l.237 to {r tbl-mytable} fixes this, leading to a clean rendered document in jou mode.

The resulting fixed template is here (https://github.com/mvuorre/apaquarto/tree/dev) but do note that it is not using the custom APA table label.

I guess next steps would be to fix the custom apatb and figure labels etc--are those really needed?

wjschne commented 1 year ago

Thanks for this.

I put a note in the readme and in the template that jou mode is not yet working properly with tables. Hopefully, I can find a solution that works for any type of table someone wants to use.

The custom labels are an admittedly hacky solution. I would very much prefer to use the standard quarto prefixes. The custom labels were used because I could not figure out how to stop quarto from putting the figure caption below the image in the .docx format. Getting a good .docx document is my primary concern for this extension. Ideally, a lua filter would fix this, but all my efforts on that front failed, so I did something that worked for me.