
What's new in TeX - leephillips
http://lwn.net/SubscriberLink/662053/1729d17e91b68d47/
======
dginev
Good HTML output for TeX does exist in various shapes and forms, and in fact
Pandoc is one of the weaker converters out there in therms of TeX coverage.

You would get better mileage with tools such as LaTeXML[1] or TeX4HT[2], which
cover very substantial subsets of TeX, if not yet 100% feature-complete.

My own take on "Should LaTeX survive on the web?" is "yes, if it evolves to
meet the paradigm shift". I wrote a detailed version of that position at [3].

\- [1]
[https://en.wikipedia.org/wiki/LaTeXML](https://en.wikipedia.org/wiki/LaTeXML)

\- [2]
[https://en.wikipedia.org/wiki/TeX4ht](https://en.wikipedia.org/wiki/TeX4ht)

\- [3]
[http://prodg.org/blog/latex_today/2015-03-16/LaTeX%20is%20De...](http://prodg.org/blog/latex_today/2015-03-16/LaTeX%20is%20Dead%20%28long%20live%20LaTeX%29)

~~~
quentinp
I cannot thank you enough for the work Bruce Miller, you and others are doing
on LaTeXML.

However, LaTeXML is not 100% feature-complete at all (sorry if this is not
what you were saying). For anybody not knowing how to improve LaTeXML itself
(eg. by adding support for missing LaTeX packages), the only way to get it
working is by using it from the beginning to avoid using anything that would
not work out of the box in LaTeXML.

------
j2kun
Part of what bothers me so much about TeX is how obscure and opaque the
language feels. I am familiar with ten programming languages, from C and
assembly to Haskell, Perl, Lisp. But just the way that people write TeX macros
makes everything so unapproachable. The only insight I have gleaned is that
it's like one big fat state machine, which makes it extremely hard to code
with principle.

I understand Knuth wrote a book, but reading through it has only made me
wonder more about the bizarre choices.

~~~
arnsholt
The reason TeX can be so unapproachable is the fact that it's a very different
language from pretty much any other programming language you've ever used.
It's not a Turing machine, and it's not lambda calculus. It's not even Horn
clauses (which is the model behind Prolog). It's a string rewriting system;
basically a giant cascade of rules like "rewrite this string to this other
string" applied over and over until the whole input is consumed.

As it happens, this is yet another Turing-equivalent form of computation. The
closest analogy I have is programming in Lisp, but with the constraint that
you can only use special forms and macros, no functions are allowed.

~~~
vanderZwan
I was about to say: isn't that just another expression language?

I've sometimes wondered if Lisp-like languages wouldn't be a much better way
of writing documents than our current markup languages of choice. If I'll ever
seriously try to pick up Racket, it'll probably be to give Pollen a spin and
see how it is in practice.

[http://pollenpub.com/](http://pollenpub.com/)

------
copperx
As an instructor, I want to provide printed handouts, assignments, problem
sets both printed and online, and having reflowing HTML is a great advantage
for students when working though a problem in a split screen.

I was looking for a workflow that would produce PDFs and HTML, and I reached
the same conclusions as the article.

I was hoping they had some sort of solution.

~~~
FraaJad
pandoc as another user suggested.

Examples:

\-
[http://www.seas.upenn.edu/~cis194/lectures.html](http://www.seas.upenn.edu/~cis194/lectures.html)
\- [http://www.scs.stanford.edu/11au-
cs240h/notes/](http://www.scs.stanford.edu/11au-cs240h/notes/)

~~~
copperx
I had settled on AsciiDoc, but I'll reconsider pandoc. It seems to be very
popular.

------
todd8
TeX's macro style of programming is too difficult. Nevertheless, people have
done amazing things with it.

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.

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 documentation
for the Tikz & PGF graphics package is over 1100 pages long! The documentation
for the Memoir package is 570 pages.

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

    
    
         \cs_gset_eq:cc
        { \cf@encoding \token_to_str:N  #1 } { ? \token_to_str:N #1 }
    

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.

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.

Links:

[TRAC]
[https://en.wikipedia.org/wiki/TRAC_(programming_language)](https://en.wikipedia.org/wiki/TRAC_\(programming_language\))

[GPM]
[http://comjnl.oxfordjournals.org/content/8/3/225.full.pdf](http://comjnl.oxfordjournals.org/content/8/3/225.full.pdf)

[m4] info pages available on Unix and Linux

[Tikz & PGF]
[https://www.ctan.org/pkg/pgf?lang=en](https://www.ctan.org/pkg/pgf?lang=en)

[Memoir]
[https://www.ctan.org/pkg/memoir?lang=en](https://www.ctan.org/pkg/memoir?lang=en)

[expl3] [https://www.tug.org/TUGboat/tb30-1/tb94wright-
latex3.pdf](https://www.tug.org/TUGboat/tb30-1/tb94wright-latex3.pdf)

~~~
pvaldes
wow, how many tasty information, thanks

------
david_ar
I'm currently working on a project [1] that aims to tie together a number of
existing tools to make "TeX on the Web" as painless as possible. It's still in
the ( _very_ ) early stages, so there's still a number of features yet to be
implemented [2]. We're also working with the CorTeX project to bring this to
existing collections of scientific publications like arXiv

[1] [https://davidar.io/TeX.js/](https://davidar.io/TeX.js/) [2]
[https://github.com/davidar/TeX.js/issues](https://github.com/davidar/TeX.js/issues)

------
amai
One of the best looking HTML output from LaTeX can in fact be generated with
[https://www.softcover.io/](https://www.softcover.io/) . Although it uses a
limited subset of LaTex called PolyTeX (see
[https://github.com/softcover/polytexnic](https://github.com/softcover/polytexnic))
I was able to convert my LaTeX documents quite easily to PolyTeX and generate
good looking HTML output.

Some example output can be seen in the manual
[http://manual.softcover.io/book/softcover_markdown#sec-
embed...](http://manual.softcover.io/book/softcover_markdown#sec-
embedded_math)

The softcover tools
([https://github.com/softcover/softcover](https://github.com/softcover/softcover))
are based on code developed for creating the HTML for [http://tauday.com/tau-
manifesto](http://tauday.com/tau-manifesto) and
[http://www.feynmanlectures.caltech.edu/](http://www.feynmanlectures.caltech.edu/).
Internally Softcover uses [https://www-
sop.inria.fr/marelle/tralics/](https://www-sop.inria.fr/marelle/tralics/) to
convert from LaTeX to XML/HTML.

P.S.: I'm not affiliated with softcover.io in any way.

------
massysett
Does anyone have much experience using roff rather than TeX? I feel like I
have to install heaps of stuff to get anything done in TeX, LaTeX, or any of
the *TeX, and it feels like a wobbly tower that collapses with minimal
provocation. roff seems dead but I was encouraged to recently stumble upon
this package of roff macros which makes me think roff deserves another look,
especially for my simple needs.

[http://www.schaffter.ca/mom/mom-01.html](http://www.schaffter.ca/mom/mom-01.html)

~~~
i_feel_great
Groff is definitely easier to use. For really simple stuff, just the standard
macro packages me, mm and ms are absolutely fine. And they compile faster -
much faster than pdflatex. The mom package is very good, but a bit more
complex. I gave up on it a few years ago after having trouble building it on
NetBSD, and it looked like it was abandoned. But that link shows Peter
Schaffter is still maintaining it. Might have to look up my old groff_mom
files and have another go.

And it looks like it comes with the standard Ubuntu installs. See man
groff_mom.

------
leipert
The Article contains a mistake regarding the KaTeX library. KaTeX supports
server-side rendering via node, but also rendering in-browser.

In the article it is stated, that it only supports serverside rendering.

------
pjmlp
I was a lot into TeX and LaTeX back in the day while at university, however
nowadays I just use Word and save to PDF for distribution.

For the multiple output formats, at work the documentation teams use Dockbook
and DITA.

Of course they don't write XML by hand in such cases, rather use tools like
oXygen, XMLmind, CORENA Studio among others.

------
tmaly
It would be cool if there was a javascript WYSIWYG editor that generated Tex
under the hood

------
signa11
the author should have tried other browsers as well f.e. firefox, which
supports both hyphenator as well as ligatures... (need relevant config lines,
disabled by default afaik)

