hplgit / doconce

Lightweight markup language - document once, include anywhere
http://hplgit.github.io/doconce/doc/web/index.html
Other
309 stars 60 forks source link

How to insert labels and caption in Tables? #177

Closed Fenrihr closed 5 years ago

Fenrihr commented 5 years ago

Hi, I want to create tables and then referencing that table in format ...as you can see in Table 1. The manual says:

Tables are inlined in the text, without numbers or labels for reference.

But also say:

When that functionality is needed, one can make use of the preprocessor and if-tests on the format and insert format-specific code for tables.

there is a way to achieve this behavior?

KGHustad commented 5 years ago

Yes, you could write a LaTeX table and place it inside a block which will only be used for LaTeX. If you're only targeting LaTeX, that's a fine solution, but if you're not, you will also need to reference the table conditionally (in non-LaTeX formats, the label will be undefined).

# #if format in ("latex", "pdflatex")
<insert LaTeX table here>
# #else
<insert DocOnce table here>
# #endif