# Problem with a damaged .tex file

Yesterday a failed USB extraction damaged an important .tex file for me, I attached the file in a Dropbox link.

When I try to open the .tex in Texmaker a message suddenly appears that says something like "the encoding is wrong", and on the screen strange symbols appear, like:

<^üøzÖWÿòY÷ÓïßcRøhão3£O¼+F×^>õ¾ûÛo0¿ô¿Lò/q  ½ûð=dúóßKtxÇïÏì^®ËÙëßÿx÷áÃÓÌååª<¸<ýûß># '¿ðrcþÛ¿9æôðr}1Ö
¼\«8ß¿þáI|±«ö,.¿CªßüðîÍ·~¹zÿþñgþÿFü=*


It is a frustration, because it is the work of many weeks, I know that it is my fault, but I dont know what I have to do, I am desperated, I tried a lot of things:

• to recover it using the .bak file, but it is very old.
• to open in diferents text editors, like Emacs, Notepad++, and others.
• to change the codification in bash (I use MATE 1.12.1 in my laptop).

Of course I did all of this experiments with a copy of the file.

The file is a (truncated) synctex gzipped file, not your source.

If you rename it it to a.gz and unzip you see

SyncTeX Version:1
Input:1:/media/miguel/02CB19EA700B7E0B/articulos/trabajos_en_curso/tsunami_lisboa/./articu
lo_tsunami.tex
Input:2:/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Input:3:/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo
Input:4:/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty
Input:5:/usr/share/texlive/texmf-dist/tex/latex/base/utf8.def
Input:6:/usr/share/texlive/texmf-dist/tex/latex/base/t1enc.dfu
Input:7:/usr/share/texlive/texmf-dist/tex/latex/base/ot1enc.dfu
Input:8:/usr/share/texlive/texmf-dist/tex/latex/base/omsenc.dfu
Input:9:/usr/share/texlive/texmf-dist/tex/generic/babel/babel.sty

• Thanks for your rapid answer, but i dont understand what you mean with : "The file is a (truncated) synctex gzipped file, not your source." . And when I rename the file to a.gz and I unzip the file in the bash the result is : \$ gzip -dv a.gz a.gz: gzip: a.gz: unexpected end of file – Miguel Molinos Jun 28 '17 at 9:57
• yes it's truncated so gunzip will reject it but if you use zcat or similar it will stream the first part of the file before it gives the error so you will see the decoded contents that I showed. one of the "extra" files tex can write when running is a xxx.synctex.gz file, this just has coordinate data so you can click on the pdf preview and jump back to your source. This xxx.synctex.gz file has for some reason been written over the xxx.tex source. @MiguelMolinos – David Carlisle Jun 28 '17 at 10:02
• @MiguelMolinos if you do not have zcat try gzip -dc a.gz that works for me – David Carlisle Jun 28 '17 at 10:05