"Loris Bennett" <loris.benn...@fu-berlin.de> writes: > Hi, > > I want to export to LaTeX and refer to tables and code blocks as in the > example below. However a name with a colon, such as 'tab:my_data' used > as a variable for a source block fails: > > org-babel-ref-resolve: Reference 'my_data' not found in this buffer >
Yes, it looks as if the babel header parsing code is a bit picky: changing just tab:my_data to tabmy_data everywhere it occurs is enough for the export to succeed. > Obviously, and perhaps not surprisingly, the use of the colon in the > name seems to be problematic. > > Should this work? If not, is there a common alternative to the idiom > tab:shootings_in_the_foot and fig:foot_with_hole? > > Cheers, > > Loris > > PS: In the example below, the last table is not exported to the LaTeX > file, but this is presumably an unrelated issue ... > Yes, you need ":exports both" for that. > Example: > > * Test with block names containing a colon > ** Data > My data can be found in Table [[tab:my_data]]. > #+CAPTION: My data > #+NAME: tab:my_data > | a | b | > |---+---| > | 2 | 4 | > | 3 | 9 | > > ** Code > > My code can be found in Listing [[code:my_code]]. > > #+CAPTION: My code > #+NAME: code:my_code > #+HEADER: :var data=tab:my_data :colnames yes > #+BEGIN_SRC R > d <- data > #+END_SRC > > ** Results > > My results can be found in Table [[tab:my_results]]. > > #+CAPTION: My results > #+NAME: tab:my_results > #+RESULTS: code:my_code > | a | b | > |---+---| > | 2 | 4 | > | 3 | 9 | > > ** Conclusions > > Names with colons don't work. Nick