## Minimal Latex environment for Linux (vim + entr + mupdf)

In the past year I have completely moved to the linux environment and it has been great for everything I do except for document writing. I have read about Latex and played with it for sometime but the whole process of write file > build pdf > view pdf looked to be tedious and using a IDE was not my preference (I could just use office on wine if thats the case). All I wanted was a way to edit text file using vim and see the resulting pdf in a window realtime.

After playing with few pdf viewers and utilities. I think I have the perfect solution. It has three components

• vim (text editor)
• entr (simple linux program to monitor files)
• mupdf (lightweight pdf viewer)

Open the .tex file in vim, open the final pdf file in mupdf. The run the following command in the background. Thats all.

ls your.tex | entr /bin/sh -c “pdflatex your.tex && pkill -HUP mupdf”

To explain, ‘ls your.tex’ lists the file to be monitored, entr runs the command between the double quotes using the program /bin/sh when the monitored file is changed. The commands inside the quotes are to build the pdf using pdflatex and update mupdf. So now every time you write your .tex file in vim, mupdf will show the final output. The entire environment is shown in the video below.

ps. I am using i3 for the split between terminal and pdf viewer and screen for split inside terminal.