Blog of Sara Jakša

Change Latex file to Word

I have recently tried to change my latex file into doc. I needed to send my economic thesis to somebody, and they don't know what to do with the latex file. The first time, I had send the pdf, but they prefer making comments in word.

So I figured out, that I am just going to transform pdf to word, and I already did once. This time, the results were not pretty, so I tried to find another way.

The next one was pandoc, which have the ability to transform latex to docx, but the first time I tried, there was no citations (which is a big no-no for master thesis). So I tried to include the citation.

When I was doing the transformation the first time, it just hang there, and nothing happened. When I came to check my bash history right now, to copy the one that did not work, and I figured out, why it did not work. The following one did work right now:

```bash
pandoc texfile.tex --bibliography=bibfile.bib --csl=style.csl -o finalfile.docx
```

Which means, that I sent the wrong version to a mentor again. That is embarrassing. Really embarrassing.

Well, while I was trying to figure out, why it was just hanging (I forgot to include the latex file), I checked the internet. One thing that they noted was, that bib file should be ASCII only. Well, mine certainly was not. So I had to find a way to find these non-ASCII characters. So I found this somewhere, which prints every line with non-ASCII characters and highlights them:

```bash
grep --color='auto' -P -n "[^\x00-\x7f]" filename
```

The --color tells us, when to highlight things (always, never or auto), the -P means that the expression is Perl regex expression, and -n also prints line numbers, so things are easier to find in the file.

So, if anybody want to transform latex to word, this is a way to do it.