DocX to PDF with Pandoc

I wanted to make a DocX into a PDF, since I don't have Office or any Alternative and prefer to not open such files.

pandoc -f docx --sandbox *file.docx --output *file.pdf
leads to
! LaTeX Error: File "lmodern.sty" not found.

I tried to mitigate that with adding -V 'fontfamily:courier'. This resolved this problem, but then it required another file...

! LaTeX Error: File "xcolor.sty" not found.

I installed "texlive-latexrecommended" after asking ChatGPT and searching on the net. The first recommendations in both cases so far were using the program "tlmgr" which always causes errors, like missing directories and such.

Then it wants another file:

! LaTeX Error: File "soul.sty" not found.
sudo tlmgr install soul
tlmgr: package repository https://ctan.javinator9889.com/systems/texlive/tlnet (not verified:
pubkey missing)
===============================================================================
tlmgr itself needs to be updated.
Please do this via either
tlmgr update --self
or by getting the latest updater for Unix-ish systems:
https://mirror.ctan.org/systems/texlive/tlnet/update-tlmgr-latest.sh
and/or Windows systems:
https://mirror.ctan.org/systems/texlive/tlnet/update-tlmgr-latest.exe
Then continue with other updates as usual.
===============================================================================
tlmgr: Terminating; please see warning above!

Okay, I'm trying one solution...

sudo tlmgr update --self
tlmgr: package repository https://ctan.fisiquimicamente.com/systems/texlive/tlnet (not verified: pubkey missing)

Should I download this manually? Oh, wait...

sudo pacsearch tlmgr
extra/texlive-langchinese 2023.66594-14 (texlive-lang)
TeX Live - Chinese
extra/texlive-langenglish 2023.66594-14 (texlive-lang)
TeX Live - US and UK English

So, I install "texlive-langenglish" with Pacman after searching what I need to install... Then:

sudo tlmgr update --self
tlmgr: package repository https://ctan.fisiquimicamente.com/systems/texlive/tlnet (verified)
tlmgr: saving backups to /usr/share/tlpkg/backups
tlmgr: no self-updates for tlmgr available

Okay, this is fixed now. But, I still can't get my PDF, since the "soul"-file is missing.

sudo tlmgr install soul
tlmgr: package repository https://ctan.javinator9889.com/systems/texlive/tlnet (verified)
tlmgr install: package already present: soul

Okay, then it should work. But no, it's still not recognized:

`pandoc -f docx --sandbox *file.docx --output *file.pdf`
leads to
Error producing PDF.
! LaTeX Error: File "soul.sty" not found

Quick reminder that ChatGPT’s information is a bit over two years old.

Soul.sty is installed, but apparently not where LaTex expects to find it. You’ll have to look up where it ‘aught’ to be, and where pacman put it. The maybe make a symlink so LaTex can find its way to it. I don’t have any experience with LaTex, so apologies I can’t be more specific.

3 Likes

Just install LibreOffice, open the DocX file, and export to PDF. I know you said you don't want to install any office software, but you have installed like five other packages trying to do this dead simple task and it's still not working.

You can always just uninstall LibreOffice after you make the PDF if you want.

4 Likes

It needs freaking 627MB. But yes, I most likely will do that and then delete it again, since I need the document today.

It’s still a problem that Pandoc and LaTex don’t work better.

You know if you hate installing office in your system this stuff can be done online for free there are tonnes of .docx to .pdf converter.

Thanks, I know but I don't trust them. Pandoc would be the best solution, but I can see that this is a LaTex problem and Garuda can't take care of it. There should be a LaTex package which handles errors and tells the user what's missing.

I'll go with the path of installing LibreOffice and deleting it again.

Hmm... Then how about using pandoc in docker. It apparently has a docker image as well.
https://pandoc.org/installing.html#docker
This should handle the dependency hell you are facing.

I tried one more thing and it worked:
I already had "texlive-latex" and "texlive-basic" installed, but "texlive-plaingeneric" was the one that was missing.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.