[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug: redundant and undocumented #label is required to link to a tabl
From: |
Nicolas Goaziou |
Subject: |
Re: Bug: redundant and undocumented #label is required to link to a table [9.4.4 (9.4.4-dist @ /home/powellj/elisp/org-9.4.4/lisp/)] |
Date: |
Mon, 19 Apr 2021 19:45:45 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) |
Hello,
James Powell <powellj@pdx.edu> writes:
> Using Org mode version 9.4.4 I build this document:
>
> <<begin>>
>
> #+NAME: t1
> #+begin_src R :exports both
>
> library(tidyverse) x <- tribble(~a, ~b, 1, 3) x #+end_src
>
> #+CAPTION: Org Table
> #+RESULTS: t1
>
> | 1 | 3 |
>
> I want to refer to Table [[t1]].
> <<end>>
>
> What I expect: the latex export will include the table and link to it.
>
> What happens instead: the code and table appear, numbered and captioned.
> However, the link is broken ("I want to refer to Table ??"). Looking in
> the latex, this line reads
>
> > I want to refer to Table \ref{org993764c}.
>
> but that label org993764c appears nowhere else in the file.
>
> Org-lint doesn't complain about the file at all. I posted this
> earlier to this list and learned about a workaround
>
> " It works if you put a #+label on the table ... which confuses me,
> because I looked through the manual for #+label and there's no mention
> of it at all, but a bunch of my Org files use it (for LaTeX export). "
#+label is an outdated equivalent for #+name.
In this case, you are referencing the source code block whereas you want
to reference the table. So #+name should go before the table.
Note that if you follow [[t1]] link, point will move to the source code
block, not the table.
Regards,
--
Nicolas Goaziou