9

how can I convert tex to plain text (txt) or doc ? I'm using texstudio.

I have problem with characters when I coppied from pdf

8
  • tex file is a plain text file. You can open it with any text editor. What you wish is probably to copy from the output pdf file and paste the contents somewhere. This is not so simple since the pdf could have a lot of formatted text. – Sigur Jun 25 '15 at 14:29
  • I need text with tex syntax – mskuratowski Jun 25 '15 at 14:31
  • It is not clear what you want. Do you want to copy from the pdf and paste it as TeX commands? – Sigur Jun 25 '15 at 14:32
  • 1
    I have both tex and pdf file. I want have plain text without code syntax which I have used in tex file – mskuratowski Jun 25 '15 at 14:35
  • 2
    You might also do well to read seanallred.com/tex/2015/05/25/tex-terminology.html, OP. See detex. – Sean Allred Jun 25 '15 at 15:38
7
pandoc --to=plain --wrap=none evaluation.tex

I found pandoc very useful. You can convert latex to various formats including doc and plain text. The installation instructions are very easy and all well-known operating systems (Linux, Max OS X and Window) are supported. To try it online see this.

3
  • This does not resolve citations, references and acronyms. – Spenhouet Jul 28 '19 at 12:41
  • While this is not perfect, I am still impressed by how well it works. It converted footnotes correctly and even got some tables more or less right. For exporting to a proper spell-checker, this is more than enough (while everything else I tried had much more problems). – ingomueller.net May 22 '20 at 20:58
  • This appears to leave mathmode parts as raw tex – Alec Jacobson Apr 9 at 15:58
5

Since modern word processors (like MS Word or openoffice/libreoffice) allow HTML input, there is an alternative path: Convert your LaTeX document to HTML (with latex2html or tex4ht) and import the HTML to the word processor.

There is also a tool called latex2rtf converting latex to rtf, a generic word processor format.

5
detex yourfile > yourfile.txt

https://en.wikibooks.org/wiki/LaTeX/Export_To_Other_Formats#Convert_to_plain_text

1
  • 1
    detex does not handle abbreviations with glossaries properly (as expected). – stefanct Mar 5 at 23:06
2

I've seen extremely similar questions to yours posted on this site before, so doing a prior search might help. However, the general consensus that I've gleaned from those questions' answers is that programs for removing (La)TeX syntax directly from your .tex file frequently return only semi-successful results.

You mentioned that a .doc(x) file would be acceptable. If you have a current version of MS Word, you should use it to import the PDF rather than copying and pasting the PDF contents.

More information about the characters that are causing problems would be helpful (e.g., are they symbols in equations?), but using packages for Unicode functionality in your .tex file prior to creating the PDF may help.

0

You could use OpenDetex.

detex my.tex > my.txt
0

One possibility nobody mentioned so far is to compile to dvi to pdf first and then convert that to plain text. Two possibilities:

  1. pdftotext
  2. catdvi

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.