I&#x27;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&#x27;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&#x27;s primatives with their own macros resulting in different kinds of markup language.
TeX&#x27;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&#x27;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&#x27;s a LaTeX package for that. Complex diagrams and graphics, there&#x27;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 &amp; 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&#x27;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&#x27;s Trac programming language based on macros and Christopher Strachey&#x27;s General Purpose Macrogenerator. These were early (mid 1960&#x27;s) explorations into the viability of macro processors as means for expressing arbitrary computations. Reader&#x27;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&#x27;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&#x27;ve done. It&#x27;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&#x27;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&#x27;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&#x27;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 &quot;far more readable and more likely to be correct first time&quot;. I can&#x27;t wait.<p>I think LaTeX is absolutely without peer, but I wish improving it&#x27;s programming method wasn&#x27;t so daunting. I keep toying with starting a project to do just that, but so many others have tried and failed. It&#x27;s disheartening.<p>Links:<p>[TRAC] <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;TRAC_(programming_language)" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;TRAC_(programming_language)</a><p>[GPM] <a href="http:&#x2F;&#x2F;comjnl.oxfordjournals.org&#x2F;content&#x2F;8&#x2F;3&#x2F;225.full.pdf" rel="nofollow">http:&#x2F;&#x2F;comjnl.oxfordjournals.org&#x2F;content&#x2F;8&#x2F;3&#x2F;225.full.pdf</a><p>[m4] info pages available on Unix and Linux<p>[Tikz &amp; PGF] <a href="https:&#x2F;&#x2F;www.ctan.org&#x2F;pkg&#x2F;pgf?lang=en" rel="nofollow">https:&#x2F;&#x2F;www.ctan.org&#x2F;pkg&#x2F;pgf?lang=en</a><p>[Memoir] <a href="https:&#x2F;&#x2F;www.ctan.org&#x2F;pkg&#x2F;memoir?lang=en" rel="nofollow">https:&#x2F;&#x2F;www.ctan.org&#x2F;pkg&#x2F;memoir?lang=en</a><p>[expl3] <a href="https:&#x2F;&#x2F;www.tug.org&#x2F;TUGboat&#x2F;tb30-1&#x2F;tb94wright-latex3.pdf" rel="nofollow">https:&#x2F;&#x2F;www.tug.org&#x2F;TUGboat&#x2F;tb30-1&#x2F;tb94wright-latex3.pdf</a>