I would like to include a table in an R markdown document (Bookdown/Huskydown) which should meet the following requirements. Ideally, the table works with several output formats, e.g. LaTex/PDF and HTML.
Requirements:
- Table width: fixed
- Cell width: fixed
- Vertical alignment: cell content aligned to the top
- Text formatting: like bold or italics (best would be if md formatting supported, such that code is output agnostic) and allow for line breaks in longer texts
- Citations: should be rendered
- URLs: as clickable links both in HTML and LaTex/PDF
- Figures: include
- figures stored locally, either in
- a markdown way
or - a knitr way
knitr::include_graphics("Rlogo.png")
- a markdown way
- figures taken straight from the web
- figures stored locally, either in
- Caption for the table
- Captions text formatting: caption should also allow for text formatting
- Footnote: include footnotes in the table
- Table numeration: tables are should be numerated
- Referencing the table: in the document is needed
Notes regarding different approaches
- Fixed cell width: in markdown the number of "-"s in table header determine cell width
- Linebreaks:
- LaTex:
\\linebreak - All others:
<br/>
- LaTex:
- Referencing
- LaTex: add
\label{foo}=>\ref{foo}(\@ref(foo)) - Markdown: add
Table: (\#tab:md-table) Caption==>\@ref(tab:md-table))
- LaTex: add
Comments on different approaches
- Markdown: easy coding of tables in markdown
- Kable & kableExtra: Versatile R markdown coding of the table, but vertical text alignment obscure and figures are not included in PDF
- Pander: achieves the most, but no vertical alignment and footnotes
- Huxtable: most promising, but figures are not included in PDF

This is less an answer than providing MWEs for the table shown above
markdown
kable table
kableExtra table
pander table
huxtable table
Referencing the tables
works differently for different table types
Adding a short caption for the LoT
Finally adding a short caption for the table of figures is not really working as desired (ref:huxtable-table-caption) huxtable-table caption (ref:huxtable-table-scaption) huxtable-table short caption