Ubuntu: Running LaTeX via command line on Ubuntu server



Question:

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 web server)?


Solution: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.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »