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 output
has $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
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 output
has $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.
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
=
signs, but that's kind of yucchy, because my C code will know about the special formatting I did to get the captions and references. See my edit above (in a few minutes after I comose it). – Reb.Cabin Jun 02 '17 at 02:54#+options: ^:nil
, the tables typeset acceptably and the captions and references go through. With#+ATTR_LATEX :align >{\ttfamily}, the captions and references are gone again. Doesn't seem I can put an
#+ATTR_LATEX` on a table and get captions and references. In addition, I started to rather like the monofont in the table (because it's really input to a program), so I can create a new question: How to get captions, references, monofont, and unmodified content all together. It wouldn't be right to add conditions to this question, which you answered, however. – Reb.Cabin Jun 02 '17 at 12:30#+ATTR_LATEX :align >{\ttfamily}l
works perfectly on all counts! I had originally omitted to type in the trailingl
ell
. That is definitely a pesky letter in the alphabet. – Reb.Cabin Jun 02 '17 at 13:20:align {\ttfamily}l
is latex and specifies a one-column table. If you want to do this for a multicolumn table, you can use multiple copies of the same column format, i.e.#+ATTR_LATEX: :align >{\ttfamily}l>{\ttfamily}l
. – Michael M Jun 02 '17 at 20:48tabular
environments (Org default) and maybe even other tabular environments (which you can specify in#+attr_latex:
. https://en.wikibooks.org/wiki/LaTeX/Tables – Michael M Jun 02 '17 at 20:57