
LaTeX was not built for the web - apepe
https://authorea.com/4675
======
JonSkeptic
LaTeX was built to typeset documents. You have pages in documents and
pagination is of critical importance in LaTeX. In the web you don't have
pages, it's evolved to be seamless and scrollable. Natuarally, LaTeX was not
designed for such an environment.

That doesn't mean that LaTeX is worthless on the web. The gluing algorithms
that Knuth used for creating sentences and paragraphs do (for the most part)
work, even in documents without pages. In all honesty, the web could benefit
greatly from LaTeX, pagination aside.

I'm glad that the author seems to have a practical perspective on this: >We
think LaTeX is still the best programming language to tell a computer how to
place text on a page. But the TeX project started pre-web, in 1978, and its
scope and function are tightly linked to the printed page, not the webpage.

He goes on to give an example of constructing a table in LaTex which requires
(or assumes by default) a suggested location for LaTeX to place the table in
the page; something which is currently nonsensical in all but a few web
environments. Like the author, I also find CSS appealing for a potential
"LaTeX" on the web solution.

However, LaTeX was designed from the very first to be the next standard in
type setting and is a turing complete language. CSS is still under debate for
being turing complete, and it lacks nearly all of the features that are iconic
of LaTeX, except for the ability to format math equations ( and even then...).

I'm not sure what the next standard in typesetting will be, but it will be
designed to be device agnostic (with book existing as a supported format), it
will target the web and similar digital media, it will be turing complete, and
it will be created specifically to fulfill each of those goals, not to have
them retroactively attached in a ham-fisted way.

~~~
mehrdada
"We think LaTeX is still the best programming language to tell a computer how
to place text on a page."

No. The output might be beautiful, but the language is most certainly not.
Awful to debug.

I consider a more modern language that compiles to LaTeX and leverage its
rendering engine for paper docs (while giving you sufficient control over the
output) and also gives you a nice web output more pragmatic and a nicer way to
approach the problem.

~~~
ghswa
"No. The output might be beautiful, but the language is most certainly not.
Awful to debug."

Absolutely agree but, as far as I'm aware, this "more modern alternative" does
not exist.

~~~
vmarsy
What about this ?
[http://dlmf.nist.gov/LaTeXML/](http://dlmf.nist.gov/LaTeXML/)

Having some XML output seems to make it easier to add CSS rules ?

~~~
SeanLuke
Combines the complexity of LaTeX with the hideousness of XML. Great.

------
unfamiliar
Give me something that

    
    
      * is a simple and logically consistent as Markdown
    
      * has the ability to embed LaTeX formulas
    
      * has a functional #include for larger documents
    
      * can refer back to headings, equations and citations
    
      * can compile to PDF or webpage
    
      * compiles FAST
    

and I will give you a lot of money.

LaTeX is a horrible language, inconsistent and badly designed and unpleasant
to look at. TeX is good at what it does but the whole system is horribly slow
to compile documents. Documents will compile fine with some frontends but not
with others. Markdown is not feature complete enough.

The scientific community is unfortunately stuck with LaTeX for the foreseeable
future. Seems like every day someone asks me how to do something that should
be very simple, which inevitably involves loading some obscure package.

~~~
claudius
What do you find complicated/logically-inconsistent about LaTeX? The job it is
supposed to do is nontrivial, so it seems appropriate that the tool is at
least somewhat nontrivial, too, especially if you don’t like defaults.

It admittedly doesn’t compile to HTML and the compile-time can be on the order
of minutes for very large documents, but are these really deal-breakers?

If you really don’t like LaTeX, have a look at org-mode, which seems to be
able to fulfil most, if not all, of your requirements (not sure about compile
times).

~~~
ecspike
Org is really good about letting you unobtrusively embed LaTex into a document
and can export to a bunch of formats.

I was doing an algorithms course with lots of mathematical formulas last year.
Org was a godsend for completing the homework assignments.

------
treerex
Perhaps I'm just old and tired, but I loathe reading technical papers on a
screen, whether it's my LCD monitor, my iPad, or my Kindle. One thing that
irks me about the WWW specifications, for example, is that you cannot get a
nicely formatted hard copy. I'm find with technical material being put on the
web, but for the love of $DEITY please make a decently formatted PDF available
too.

~~~
apepe
Agreed. That is one reason why most technical and scientific documents are
still perused in PDF. In Authorea you can export each document to a journal
format (Export). Soon we will have a printer-friendly style which is basically
CSS.

------
dbloom
From the article:

 _This table command instructs TeX to put the table in the page, here, where
the table is declared (h) AND at the top of the page (t)._

PrinceXML, an XML/HTML + CSS to PDF renderer, can do this using a "float:top"
style:
[http://www.princexml.com/doc/9.0/properties/float/](http://www.princexml.com/doc/9.0/properties/float/)

Also, before they abandoned their bespoke browser engine, Opera released an
experimental build that could render web pages as paged media (see
[http://dev.opera.com/articles/view/opera-reader-a-new-way-
to...](http://dev.opera.com/articles/view/opera-reader-a-new-way-to-read-the-
web/) ). It, too, supports floating to top (as vendor-prefixed "-o-top").

Paged media is as alive as ever (it's just moving from dead trees to tablets),
so I wouldn't count this stuff out just yet.

------
oandrei
The main problem with LaTeX is that it does not have a good hyperlink
mechanism. So, I am thinking about how to switch from LaTeX to HTML. I have a
markup system based on Racket:

[http://andreimikhailov.com/slides/bystroTeX/slides-
manual/in...](http://andreimikhailov.com/slides/bystroTeX/slides-
manual/index.html)

The main application was supposed to be slides, to replace the Beamer. But I
think it is good for generic math-oriented web publishing. It does not work on
Windows, though. Comments/suggestions/testing are welcome!

~~~
claudius
Is there anything specifically wrong with the hyperref package? It seems to
work rather decently for me.

~~~
oandrei
I want to put a hyperlink to Eq. (4.4) of [http://arxiv.org/abs/hep-
th/9907164](http://arxiv.org/abs/hep-th/9907164) What is the right format? How
can it even in principle work? If I click on the link:

[http://arxiv.org/abs/hep-th/9907164/Eq_4_4](http://arxiv.org/abs/hep-
th/9907164/Eq_4_4)

what is supposed to happen?

~~~
dubya
Is [http://arxiv.org/pdf/hep-
th/9907164v2.pdf#page=30](http://arxiv.org/pdf/hep-th/9907164v2.pdf#page=30) a
reasonable approximation? It works in Chrome and should work with the Adobe
plugin, but doesn't work in Safari. I don't know if PDF has finer scale
references than page.

~~~
oandrei
Also, if they submit a revised version, it will be a different page. Anyway, I
don't think we will ever get a good PDF reader, because there is no demand.
People read HTML.

~~~
dubya
After a little more digging, I've found that pdf files can have named
destinations, like eqrefs, so you don't have to use page numbers as
references. See
[http://www.tug.org/pipermail/pdftex/2007-October/007383.html](http://www.tug.org/pipermail/pdftex/2007-October/007383.html)
for how to make them in LaTeX.

This does require whoever generates the pdf to include the labels, but then so
does html. It shouldn't be too hard to generate a reference to any named
equation in a file.

What exactly is your problem with current PDF readers? PDF.js is pretty nice
for browsers, Preview.app is standard on OS X, Linux has several that were
fine and I know that Windows has many that are considered good alternatives to
Acrobat Reader. Even phones and tablets do a good job, though e-readers do
not.

~~~
oandrei
You are right, and thank you for the link. Actually, let me use this to
advertise my own fork of PdfViewer:

[https://github.com/amkhlv/pdfviewer](https://github.com/amkhlv/pdfviewer)

I started that fork because I could not find a viewer which would keep
vertical position, and jump back after following an internal link, and have
bookmarks with charhints.

There is a conceptual problem, however: as I said, I feel that PDF is getting
deprecated because of insufficient demand. If this is true, then it does not
make much sense to invest effort into TeX + PDF. Maybe I am wrong. Sometimes I
think that I am simply allergic to TeX :)

------
mpettitt
In terms of pure mathematical typesetting, it's great, and, as they mention,
Mathjax does a fantastic job of handling equations in webpages. Yes, TeX takes
some learning, but it's a let less verbose than MathML for the same equation,
and being distinct isn't necessarily an issue: there is precedent within HTML,
such as CSS and Javascript code being embedded within pages. A browser with
native support for (a subset of) TeX would allow for a lot of technical papers
to be presented in a fully searchable, device agnostic manner, and would avoid
the additional learning curve or conversion to MathML.

For layout, though, HTML with CSS is the way to go if your prime target is
web.

------
songgao
> What does the future hold for academic writing? We like to think that a few
> years from now we will format our research papers with the web version in
> mind, rather than the printed PDF.

I've been thinking about this for almost a year. I believe as well that
webview-first is the future of technical publications. The problem is how to
either 1) get traditional publishers to adopt newer and better technology (a
lot of publishers are still using systems seemingly from 90s that doesn't even
support features that have been stablized in TexLive for years); or 2) build
new publishers that gain enough reputation fast enough, so that the academia
would consider them as good communication channels.

Personally I like the second way better. It's more convenient (and easier to
think out of box) to start from scratch than to change an existing system (by
system I mean organizations, publishers, rather than a computer system).

Academia is somehow like a trust chain. People tend to follow reputable
researchers/professors. If a platform can get most reputable researchers, it
can be adopted soon.

~~~
14113
I really hope we don't optimise for a webview-first future. I personally find
reading large pieces of text on a screen uncomfortable at best, and painful at
worse. I want to be able to print out any scientific or academic documents,
and at the moment LaTeX and PDF do that for me the best.

------
_random_
And HTML was not built for GUIs. Does it stop the ongoing madness? No.

------
freyfogle
These guys are well worth a look
[https://www.writelatex.com](https://www.writelatex.com) if you're looking for
web-based, collaborative LaTeX tools.

Along with mendeley and peerj there's the makings of little cluster of
companies trying to innovate in the academic publishing space here in London.

~~~
apepe
Thanks, yes! We know and are in touch with all these guys (writelatex,
mendeley, and peerj). Great stuff coming out of London in this space. Digital
Science and Figshare are also there. We are very excited that there's a
movement to change/improve academic publishing.

------
mjn
One tricky bit is that I think a good solution medium-term will need to handle
both media. Right now, a typical academic paper's print format transfers
relatively poorly to the web. But the reading experience you get when you
print out a web-formatted document to paper is also typically pretty poor,
especially with things like figure layout.

It's possible e-readers will someday obsolete print entirely, but I personally
still find it difficult to read longer-form stuff on a screen, so I'd like to
see better options for print layout of web documents. Technologically these
are possible, e.g. PrinceXML shows quite a bit of print-layout stuff you can
do with the web-technology stack (though it's unfortunately proprietary), but
the bits and pieces don't quite plug together well yet.

------
ozten
Correct, tangle was built for the WEB. Well TeX was built written in WEB.

(sorry for the bad knuth toolchain jokes)

------
sentenza
There is another problem.

Some time ago, I thought about integrating LaTeX into user-facing software,
not to render an entire web page but to generate a few formulas and images
containing formulas in real-time or close to real-time. It breaks my heart to
say that it seems impossible to do so, because LaTex is soooo slow.

The codebase is written in an obscure language (that Knuth created for the
purpose?) and would have to be converted to something optimizable such as C in
order to become faster.

Since I won't be re-implementing LaTex soon, I'll stick with MathJax for
simple formulas and must look for something else if I want to create a
complicated formula-containing image.

~~~
Crito
Web2c is typically used these days. The issue is not as simple as _" It needs
to be written in C"_.

~~~
sentenza
Well, I gave up when I saw that it wasn't written in anything I could work
with, so this is news to me.

Also, having had some bad experiences with to-C translated code (looking at
you, Matlab), I'd say that knowing that Web2C exists doesn't cause me great
optimism.

~~~
maxerickson
There is recent work on a TeX engine with a Lua interface:

[http://tex.stackexchange.com/questions/36/differences-
betwee...](http://tex.stackexchange.com/questions/36/differences-between-
luatex-context-and-xetex)

But still LaTeX sits on top of that, so it probably doesn't move you along
very much.

------
thesorrow
I think the guys at [http://substance.io](http://substance.io) are trying to
solve this problem. You should take a look !

~~~
apepe
thanks! I did come across substance.io a few months ago. Seems like they made
a lot of progress. Looks beautiful. It's time to get in touch with them again.

------
thearn4
On a related note, has there been any recent word on LaTeX3?

------
NN88
Should I learn to finally do my resume in LaTeX?

~~~
wtbob
I did, and would recommend it to others. The final product is just so much
nicer looking than I feel the reader subconsciously finds one to be a more
appealing candidate.

You almost certainly want to use a better font than Computer Modern, but
that's easy.

