[docutils:bugs] #440 longtable labels in the wrong place
"Günter Milde" via Docutils-develop <[email protected]>
| Newsgroups | gmane.text.docutils.devel |
|---|---|
| Message-ID | </p/docutils/bugs/440/0c819aa6e5028d4158d8468849e883ff63f4c5f3.bugs@docutils.p.sourceforge.net> |
Thank you for the additional info, it helped to reproduce the problem.
Mind, that for references to section numbers with `reference-label: ref`, you need to activate section numbering by LaTeX (`sectnum-xform: False`), Docutils-generated section numbers do not show up (cf. the documentation fixes in [r9395]
With at least one LaTeX-numbered section in the document, a `\ref` to a table with title/caption (and hence Table number) also works with the `\label` placed after the table, so setting [sectnum-xform](https://docutils.sourceforge.io/docs/user/config.html#sectnum-xform) to `False` for the LaTeX writer (or using the somewhat misleading command line option `--no-section-numbering`) might provide a fast workaround.
Does the attached patch (against [r9395]) solve the problem?
Attachments:
- [0001-LaTeX-writer-fix-placement-of-hyperlink-target-label-for-tables.patch](https://sourceforge.net/p/docutils/bugs/_discuss/thread/0d2d55e26b/0adc/attachment/0001-LaTeX-writer-fix-placement-of-hyperlink-target-label-for-tables.patch) (8.2 kB; text/x-patch)
---
**[bugs:#440] longtable labels in the wrong place**
**Status:** pending-remind
**Created:** Tue Dec 21, 2021 11:39 PM UTC by Erik Hansen
**Last Updated:** Thu Dec 30, 2021 03:56 AM UTC
**Owner:** nobody
**Attachments:**
- [0001-Move-longtable-labels-to-table-body.patch](https://sourceforge.net/p/docutils/bugs/440/attachment/0001-Move-longtable-labels-to-table-body.patch) (1.7 kB; text/x-patch)
The latex2e writer outputs `\label{}` for tables after `\end{longtable}`. This is incorrect causing the table referencing to end up with empty reference text rather than the table number. The author of the `longtable` latex package suggest putting the `\label{}` inside the caption itself `\caption{My caption \label{mylabel}}` or inside the table body. The latter option has the added benefit of working for tables without a caption. I've attached a proposed fix.
`longtable` package documentation can be found at https://mirror.ox.ac.uk/sites/ctan.org/macros/latex/required/tools/longtable.pdf. See page 4 and 5 about the discussion on labeling.
---
Sent from sourceforge.net because [email protected] is subscribed to https://sourceforge.net/p/docutils/bugs/
To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.