# Is there a way to compile a LaTeX table into tab delimited text?

I am submitting a manuscript to a journal1 that will only accept Word or .rtf submissions (arrrg!) and they require that tables be tab separated text.

Is there a way to compile LaTeX tables into tab separated text?

I am using latex2rtf for the main document but this embeds the tables. I also tried detex but that didn't strip the table formatting (e.g., &). I am running texlive on Linux.

Thank you.

1. The journal is Freshwater Biology FYI
-
Maybe you can use a search and replace approach. –  Leo Liu Aug 18 '11 at 17:19

An automatical way doesn't exist. But you can replace the & with \>. Then you only have to define a preceding line which defines the tabstops like

foo \= bar \= baz \= foobar \= foobarbaz\kill


or

\hspace*{1cm} \= \hspace{2cm} \= \hspace{1cm} \= \hspace{3cm}\kill


The tabular environment has then to be replaced by tabbing environment. Should be possible if you do not have too many tabulars

-
thanks for the answer. Can you briefly explain what your code is doing or point me to a place where I can read up on it. I don't really follow what you are suggesting. Thanks –  KennyPeanuts Aug 18 '11 at 18:29
it converts your tabular into a tabbing environment with tab stops. Here is an example: mirrors.ctan.org/info/examples/Tabulars-E/01-02-2.ltx –  Herbert Aug 18 '11 at 19:49
Perfect. Thanks for the additional info. –  KennyPeanuts Aug 19 '11 at 1:17

I wanted a way to batch process a bunch of tables so I wrote a sed script to convert the LaTeX formatting. The basic script is below but it is easy to add lines for special cases (e.g. s/\\---/-/g would convert all of the LaTeX \--- dashes to just -)

s/&/\t/g                    # replace LaTeX & delimiters with tab
s/%.*/ /g                   # remove LaTeX comments
s/\\.*/ /g                  # remove all remaining LaTeX formatting

-