# Is there a way to dump out the text of a LaTeX document?

Another way of going about my problem with a non-LaTeX collaberator, Is there a way to dump out the text of a LaTeX document? As in, instead of making a nice PDF, just give me the raw text output, sans fancy formatting? So if I had something like:

\documentclass{article}
\begin{document}
Foo \emph{bar} baz
\end{document}


It would give me a .txt with just "foo bar baz" in it (I could always try and copy and past out of the PDF I guess....)

• If you are prepared to go down this road, it's probably better to convert to word format (either directly or via HTML). That way you can at least use change tracking so you know what to put back into the LaTeX document. – Stephan Lehmke Nov 28 '13 at 18:32
• Canageek, isn't it then better to do what (I hope) most people do with their supervisors: (Let them) print it, do corrections with red pen, and give it back to you? – yo' Nov 28 '13 at 18:43
• Could catdvi be used here? – Sean Allred Nov 28 '13 at 19:29
• pandoc could do the trick . . . – DG' Nov 28 '13 at 20:00
• – cmhughes Nov 29 '13 at 5:06

On Linux you can use pdftotext to output the pdf als blank text. pdftotext foo.pdf creates a textfile called foo.txt, but this solution isn't perfect. It will f.e. output the unnecessary dots that are used in table of contents, because it cant decide between characters that are used for text and ones that are used for style purposes.
• All methods will fail on many formulas because formulas are 2-dimensional, while plain text is a 1-dimensional format. Also upper ASCII characters in text files depend on an encoding. I've had only bad experience with pdftotext. The programs ps2ascii and dvi2tty come with some TeX distributions. They seem to get at least the standard ASCII characters correct. Tabulars are messed up. Not sure about two-column text. – Dan Nov 29 '13 at 4:34