TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I run

$ latex my_doc.tex


$ pdflatex my_doc.tex

it works, and when I run

$ pdftex my_doc.tex

it doesn't work.

The thing is I noticed that both LaTeX and pdflatex commands are symbolic links to the same pdftex executable. That is,

$ which latex pdflatex pdftex




$ ls -l /usr/bin/latex /usr/bin/pdflatex /usr/bin/pdftex


/usr/bin/latex -> pdftex
/usr/bin/pdflatex -> pdftex

So how is it possible that commands being symbolic links to a same executable do not behave in the same way ?


I have Ubuntu 12.10 with TeXLive-full 2012.20120611-4 installed.

share|improve this question
pdftex is a pdf variant of "plain TeX", that's why you get errors compiling your document with it. – karlkoeller Jul 17 '13 at 15:18
BTW: Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – karlkoeller Jul 17 '13 at 15:19
My question is, perhaps, more a 'linux command' thing than a 'TeX engine/format' thing (I don't know). That is, how is it possible that LaTeX knows when I type latex or pdftex at the command prompt, while both commands point at the same executable? – Martin G. Jul 17 '13 at 15:30
Thanks karlkoeller for the welcome ! I will have a look at the starter guide shortly. – Martin G. Jul 17 '13 at 15:33
up vote 11 down vote accepted

Programs get passed argv[0] ie the name by which they are called as well as any explicit following arguments and they can, and do test this and act accordingly. Basically if you make a symbolic link or copy of a web2c tex executable then it acts like tex &zzz where zzz is the name of the copy or link.

share|improve this answer
Sorry, David, can you explain it a bit better? – karlkoeller Jul 17 '13 at 15:40
@karlkoeller not really, there isn't anything else to say, the operating system passes the name of the program as the 0th argument so a program can act differently depending on its name just as it acts differently depending on its arguments. – David Carlisle Jul 17 '13 at 15:44
Thanks. I understand. I remembered my dusty programming (C++) skills ! – Martin G. Jul 17 '13 at 16:01
@karl: argv is a parameter of the main function (programming level) which stands for arguments vector and contains the values of the command line arguments. argv is guaranteed to have at least one element, which is the name of the program. argc is another parameter which holds the argument count, so when argc > 1, the program has arguments to be processed. The logic explained by David is: when tex runs, it looks for the value on argv[0] and act accordingly. It's actually a cool trick. :) – Paulo Cereda Jul 18 '13 at 12:05
@Paulo Thanks for the explanation. I know what argv and argc are 'cause I programmed in C, but I didn't know that this is the way in which TeX-related executables are called. The problem is that I don't speak English too much well and sometimes I have difficulties to understand David's words... – karlkoeller Jul 18 '13 at 14:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.