brentthorne / posterdown

Use RMarkdown to generate PDF Conference Posters via HTML
https://brentthorne.github.io/posterdown_html_showcase/
Other
838 stars 129 forks source link

Figure and table references & captions not displayed correctly #99

Closed jobreu closed 5 years ago

jobreu commented 5 years ago

First of all, thank you for this amazing package! When I knit the poster (using posterdown_betterport), the references and captions for my tables and figures are not displayed properly. When I use the same code as in the template (\@ref(fig:code_chunk_name) + defining a figure caption via fig.cap in the code chunk options), what gets shown in the knitted HTML document is literally "@ref(#fig:code_chunk_name)" instead of "Figure 1". It's the same for tables. For reference: I generated the plot using ggplot2 and the table using kableExtra.

brentthorne commented 5 years ago

Hello @jobreu, it looks like you may be missing the backslash before the inline reference. That means it should be \@ref(fig:code_chunk_name).

For tables the only difference is that you use tab instead of fig. Also you need to type out the word Figure or Table and then out in your reference because it will only generate the number for you not the word.

Let me know if that helps!

jobreu commented 5 years ago

Hi @brentthorne, thanks for the quick response! I did what you suggested but the issue still persists.

brentthorne commented 5 years ago

Maybe try using a code chunk name without underscores? Otherwise I would need to see your session info and also what versions of the rmarkdown packages you are using to take another guess at it.

Can you try to reproduce the issue within a single pagedown or bookdown document also?

Thanks

jobreu commented 5 years ago

Removing the underscore from the code chunk name was the solution. Thanks a lot!