I know LaTeX and I've heard that LaTeX is a set of macros in TeX. But what does it exactly mean?
TeX is both a program (which does the typesetting, tex-core) and format (a set of macros that the engine uses, plain-tex). Looked at in either way, TeX gives you the basics only. If you read the source for The TeXBook, you'll see that Knuth wrote more macros to be able to typeset the book, and made a format for that.
LaTeX is a generalised set of macros to let you do many things. Most people don't want to have to program TeX, especially to set up things like sections, title pages, bibliographies and so on. LaTeX provides all of that: these are the 'macros' that it is made up of.
In short TeX is all about formatting, for document/template designers, while LaTeX is all about content, for document writers.
TeX is a typesetting system. It provides many commands which allow you to specify the format of your document with great detail (e.g. font styles, spacing, kerning, ligatures, etc.), and has specialized algorithms to compute the optimal flow of text in your document (e.g. where to cut lines, pages, etc.). TeX is all about giving you powerful algorithms and commands to specify even the tiniest detail to make your documents look pretty.
LaTeX is a set of macros built on top of TeX. The idea behind LaTeX is to shift the focus from the format to the content of your document. In LaTeX commands are all about giving a structure to the content of your document (e.g. sections, emphasis, tables, indices, etc.). In LaTeX you just say
It's important to distinguish between typesetting "engines", "formats", and "packages".
Here are three ways to print "Hello World". The first requires (Plain) TeX, the second LaTeX2e, and the third
Assume the input file is named
For more information on the subject of TeX engines and formats, I recommend Section 1 of the document A guide to LuaLaTeX by Manuel Pégourié-Gonnard. It features a handy table that categorizes the potential interactions between four engines, two formats, and two ways of creating dvi and pdf files.
Don Knuth provide both the TeX typesetting program and the plain TeX macros (the file plain.tex).
TeX the program does the typesetting. The preloaded macros (and the input documents, of course) control what is typeset.
Typically, the macros and input document place items on a horizontal list and then, when the \par command (for example, a blank line) is issued TeX the program breaks the paragraphs into lines.
If you run TeX with \tracingall you can see what are macros and what are TeX commands. I suggest you try this with
rather than a LaTeX document. LaTeX does a lot of macro processing, particularly for font selection.
TeX is a typesetting engine which has a macro language available. This macro language is very different from other, more typical, languages. The TeX engine reads text, font metrics and does the typesetting. This means that it decides where the characters from the loaded font will be on the page.
There are several extensions over classical TeX: pdfTeX, XeTeX, LuaTeX. They are able to produce PDF output. The classical TeX is able to produce only DVI output, which is mostly not used today.
TeX (and its extensions) have (for example) the
When you process your document, then you run TeX (or one of its
extensions) with a macro package preprocessed into binary form, which is
called a "format" in TeX terminology. For example, LaTeX is preprocessed from
When the user runs
If vanilla TeX is run (without a preprocessed macro package) then only about
300 primitive commands are available (extensions of TeX provide additional
commands). But if TeX with preprocessed
The common macro packages (LaTeX, ConTeXt) are based on the first macro package (format)
created by Knuth,
My text above only simplifies the reality, sorry. The reality is much more varied due to historical reasons.
TeX, LaTeX, ConTeXT - different languages / syntax for typesetting.
For each of these there are many engines available that can process the above syntax and generate dvi, ps, pdf, html, svg.... and what not.
To confuse even more there are engines called tex and latex, which can be used to process tex and latex syntaxes respectivly to produce dvi outputs.
Treating the system as blackbox: ConTeXt, LaTeX and TeX have significantly different syntax and different compilers hence they are different. And most users do not need to know that one is using the other behind the scene, that's an implementation detail. The beginner user needs to know that (a) they are different (b) they all produce awesome quality documents (c) each package has its own "native" way to do stuff (d) you can seek for all of them here.
I'd add that the name actually shows the difference: LaTeX = "Layman's TeX". This also shows that it's enough to master LaTeX to get (most) things done, but TeX to be a real master. As the saying goes: there are TeXnicians and TeXperts...
EDIT: I know this answer is inaccurate (it's one of my first contributions to TeX.SX, I have learned a lot since, tanks mostly to the community behind this site). I kept it deliberately, because this is a quite widely accepted belief, among newbies especially. The comments and the downvote I received put things right, therefore I don't believe this should be edited as it was, namely to LaTeX = "Lamport's TeX" (Leslie Lamport was the initial developer of LaTeX).
I don't know where the comments are gone (I can't see them anymore), but the edit skews the original answer and cancels its message. As I said, I kept this for educational/informative reasons. We learn not only from things that are done right, but also from mistakes. If we are smart enough, from those of our peers, too.