Quantcast
Channel: Org-mode cross references disrupted by ATTR_LATEX? - Emacs Stack Exchange
Viewing all articles
Browse latest Browse all 3

Org-mode cross references disrupted by ATTR_LATEX?

$
0
0

I have a couple of tables in the following runnable, complete, self-contained example, and I can successfully "forward-reference" them by name in the text:

Table [[tab:line-word-byte-count]] tells us that the outputhas $1.5~M$ lines, $5.6~M$ words, and $69$ megabytes.#+NAME: tab:line-word-byte-count#+CAPTION: Line, word, and byte counts| 1485702 | 5626026 | 69141951 |Table [[TestFiles]] contains some filenames we can analyze.#+NAME: TestFiles#+CAPTION: List of files names.| test_file.fbx            || armatures_and_things.fbx |

After running org-latex-export-to-pdf, I see the following

enter image description here

Ok, the uderscores in the filenames are causing LaTeX to typeset the names with subscripts, not what I want. So I add ONE line:

Table [[tab:line-word-byte-count]] tells us that the outputhas $1.5~M$ lines, $5.6~M$ words, and $69$ megabytes.#+NAME: tab:line-word-byte-count#+CAPTION: Line, word, and byte counts| 1485702 | 5626026 | 69141951 |Table [[TestFiles]] contains some filenames we can analyze.#+ATTR_LATEX: :mode verbatim#+NAME: TestFiles#+CAPTION: List of files names.| test_file.fbx            || armatures_and_things.fbx |

and the caption AND the reference disappear, but the contents get typeset correctly. It doesn't matter where I put the ATTR_LATEX, before or after the NAME or CAPTION. Any of the six permutations of those three lines gives me the same bad results.

enter image description here

It seems that I can have EITHER captions and references OR verbatim contents, but not both. I'd be grateful for any advice.

EDIT:

I should say that I'd rather not change the contents of the table because I want to feed them to a block of C code, where they are interpreted as strings. Using the proposed answer below, I could chop off the leading and trailing = signs, but then my C code will know about the special formatting I did to get the captions and references. I'd rather not make the C code too aware of the fact that it's being called in the code-block. For example:

#+name:   just-open-and-close#+header: :exports  both#+header: :flags    -std=c++14 -lfbxsdk#+header: :includes '(<iostream> <stdio.h>)#+header: :var      filenames   = TestFiles#+BEGIN_SRC C++  int main (int argc, char ** argv) {      printf ("filePath: %s\n", filenames[0][0]);      // ... some more code to open the file ...  }#+END_SRC#+RESULTS: just-open-and-close: filePath: =test_filefbx=: An error occurred while loading the file

Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images