On an Ubuntu 10 server (yes, not the latest version anymore), I would like to run LaTeX so that I can invoke the program via command line and pass .tex files to compile. Is this possible?

TeX Live would be one of the distributions that you can choose, right?

I can just install it with the following command, can't I?

sudo apt-get install texlive

And then? How can I invoke TeX Live via command line, without a GUI (as this is on a remote server)?

  • Try man latex. Also texlive comes with a lot of documentation. Oct 12, 2013 at 19:37

1 Answer 1


Yes, that command will install a basic but fully functional LaTeX environment.

You then compile a document mydoc.tex:

latex mydoc
latex mydoc

Which will produce a dvi file which you can further convert to postscript with dvips. (Or other output formats, eg png with dvipng.) In the more likely event that you want PDF output, use pdflatex instead of latex. (I assume this is available in 10.04, I don't have a copy on hand to check).

If you are running on a server, you might want the option -interaction=nonstopmode, otherwise it will pause and wait for your input if it finds an error in the document.

It is necessary to run latex/pdflatex more than once since during the first pass it will produce various auxiliary files which it then uses to improve the layout the next time around.

More detailed questions about latex are probably best asked on the appropriate stackexchange.

  • Thank you so much! This worked fine, but although you said I have to run pdflatex more than once, the PDF is always there after the first run. So is running it once enough after all?
    – caw
    Oct 11, 2013 at 19:07

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.