I'm really looking forward to the evolution of Markdown, but it will not be a complete replacement for TeX (for many years). TeX is designed around a powerful (macro based) programming system. This is an excerpt from a comment that I posted on HN a while back that is apropos this discussion:<p>TeX's macro style of programming is too difficult. Nevertheless, people have done amazing things with it.<p>TeX has somewhere around 325 primatives, and one of the most important is the \def primative used to define macros. These primatives are used to define additional macros, hundreds of them, available in different so called formats. A basic format known as Plain TeX includes about 600 macros in addition to the 325 primatives. LaTeX is another format, the most widely used, but there are others, like ConTeXt, that are also very capable. Each of these extend TeX's primatives with their own macros resulting in different kinds of markup language.
TeX's primatives are focused on the low level aspects of typesetting (font sizes, text positions, alignment, etc.). LaTeX provides a markup language that is focused on the logical description of the document's components: headings, chapters, itemized lists, and so forth. The result is a system that does simple things easily while allowing very complex typesetting to be performed when needed.<p>In addition to the TeX core primatives and the hundreds of commands (implemented as macros) in a format like LaTeX there are additional packages, classes, and styles that are used to provide support for any conceivable document. LaTeX has a rich ecosystem of packages. Typesetting chess? There's a LaTeX package for that. Complex diagrams and graphics, there's a LaTeX package for that. Writing a paper in the style of Tufte? Writing a book? or a musical score? or building a barcode? there are packages for that. The <i>documentation</i> for the Tikz & PGF graphics package is over 1100 pages long! The documentation for the Memoir package is 570 pages.<p>The amazing thing is that all of this is built out of macros. Diving into this, and once one needs to customize the look of a document it's inevitable, you find yourself in a maze of twisty little passages.
Once upon a time, while writing assembly language for large computers, I enjoyed writing fancy assembler macros. I was facinated with Calvin Moore's Trac programming language based on macros and Christopher Strachey's General Purpose Macrogenerator. These were early (mid 1960's) explorations into the viability of macro processors as means for expressing arbitrary computations. Reader's interested in trying out macros for programming can try the m4 programming language (by Kernighan and Ritchie) found on Unix and Linux systems. m4 is used in autoconf and sendmail config files. Yet, TeX macros are in a whole other dimension.
All of these powerful macro systems have one thing in common: parameterized macros can be expanded into text that is then rescanned looking for newly formed macros calls (or new macro definitions) to expand as many times as one wants. This isn't just an occasional leaky abstraction; it is programming by way of leaky abstractions. Looking at TeX packages is some of the most difficult programming that I've done. It's unbelievably impressive what people have come up with (e.g. floating point implemented via macro expansion in about 600 lines of TeX), but it's also unbelievably frustrating to program in such an environment.
The LaTeX3 project is an attempt to rewrite LaTeX (still running on top of the TeX core). Started in the early 1990's it is still not done. I think its just that they are mired in a swamp of macros. They do have a relatively stable set of macros written, with the catchy name expl3, that are intended for use when writing LaTeX3. Here's a sample<p><pre><code> \cs_gset_eq:cc
{ \cf@encoding \token_to_str:N #1 } { ? \token_to_str:N #1 }
</code></pre>
This is described in the documentation as being a big improvement over the old macros and "far more readable and more likely to be correct first time". I can't wait.<p>I think LaTeX is absolutely without peer, but I wish improving it's programming method wasn't so daunting. I keep toying with starting a project to do just that, but so many others have tried and failed. It's disheartening.<p>Links:<p>[TRAC] <a href="https://en.wikipedia.org/wiki/TRAC_(programming_language)" rel="nofollow">https://en.wikipedia.org/wiki/TRAC_(programming_language)</a><p>[GPM] <a href="http://comjnl.oxfordjournals.org/content/8/3/225.full.pdf" rel="nofollow">http://comjnl.oxfordjournals.org/content/8/3/225.full.pdf</a><p>[m4] info pages available on Unix and Linux<p>[Tikz & PGF] <a href="https://www.ctan.org/pkg/pgf?lang=en" rel="nofollow">https://www.ctan.org/pkg/pgf?lang=en</a><p>[Memoir] <a href="https://www.ctan.org/pkg/memoir?lang=en" rel="nofollow">https://www.ctan.org/pkg/memoir?lang=en</a><p>[expl3] <a href="https://www.tug.org/TUGboat/tb30-1/tb94wright-latex3.pdf" rel="nofollow">https://www.tug.org/TUGboat/tb30-1/tb94wright-latex3.pdf</a>