[Tex/LaTex] LaTeX Markup Options


I was wondering what prevented the implementation of a MarkDown system in (La)TeX? I know that pandoc does a conversion of MarkDown with extra features to LaTeX. I also know that many are happy with the way LaTeX is right now, so please do not feel offended.

In particular I was wondering why stuff like -> or => cannot be translated to \rightarrow or \Rightarrow and similar transformations along with the usual MarkDown features. After all to me it seems that (La)Tex after all is a way to mark-up plain text in a way that it can be rendered neatly for printing devices. I also know that there's LyX and TeXmacs but those have left the plain-text approach of tex.

In particular I'm genuine curious if and why one could not implement MarkDown features right in LaTeX, after all TeX is Turing complete, no? Does it in some way break the existing system in a way I do not see?

There's a lot that could make writing text a little more pleasant on the eyes. For example, writing a theorem like so:


PROOF: ...

Next paragraph continues after two new lines...

and similarly for definitions lemmata, you name it. Again please don't get me wrong. There are enormous amounts of useful commands in (La)TeX. As it is now, (La)TeX does do some of these transformations already. E.g. turning — into an em-dash or treating a blank line as the separation of two paragraphs. And modern (La)TeX can deal with unicode thus not necessarily requiring the ASCII-fication of Greek Letters. There will always be more obscure things one wants to do with (La)TeX, but what is preventing the system from incorporating features like these? Or am I missing something completely and this is possible already?

Best Answer

LaTeX is this LaTeX for historical reason. It is not perfect. And it could support some MarkDown features. For example, there is a LaTeX package wiki, which support document like this:


==section title==

A numbered list:
# foo
# bar
# baz

===subsection title===

''important'' thing


Another good example is listings package. It read the input verbatim, recognize the keywords, and make proper output. listings is designed for typeset programming languages with syntax highlighting. However, the same approach can be used for your request. So, this shows another example you request:

\lstset{literate={->}{$\rightarrow$}1 {=>}{$\Rightarrow$}1}


a -> b, A => B


But remember, TeX, the core language is not designed for this kind of markup texts. We have to use some weird trick to implement the features in TeX.

Unlike most modern programming language, TeX uses category codes for special purpose. If TeX use a common lexical analysis, it will be easier to define a markdown system. In TeX, it is easy to define a command \THEOREM or \PROOF to typeset a theorem. But it will take much more effort (although possible) to support a syntax like

PROOF: baz

And we can ask why Knuth choose this macro syntax. I think it is natural to use a markup language syntax, like troff, SGML and RTF. And it is clear that a pure markdown system (like stackexchange without HTML) is not powerful enough for complex style. So early TeX, which is a personal tool of Knuth, needn't support a Markdown syntax, thus the design based on category codes and macros is OK. Many people complain about this, I have no good idea for this.

Things are changing, LaTeX becomes easier to use today. For math symbol, we can use unicode-math package to write a math equation like this:

$ ∑A_n → ±∞ $
Related Question