5 ms·
TeX is a document typesetting language, not a file format. It's really, really awesome for making documents that are typeset in a very specific way. LaTeX giv
by mikekchar 7y ago
TeX is a document typesetting language, not a file format. It's really, really awesome for making documents that are typeset in a very specific way. LaTeX gives you a set of macros on top of TeX that allows you to abstract some of that stuff to a certain degree, but the underlying engine is for typesetting.
HTML does not have the fidelity of TeX. You just can't do the same things in HTML that you can do in TeX. Just to make it clear, TeX is a real programming language, though with a truly bizarre syntax and grammar (I still love it, though ;-) ). Trying to execute TeX and output HTML is incredibly difficult to do with any kind of quality. You could take LaTeX documents and then write a completely different formatting system that output HTML, but at that point, you would be better off using a system that is intended to output HTML: like docbook :-)
- aasasd 7y agoHmmm. This convinces me that I should look into Tex and Latex soonish, as I can't comprehend why anyone would want exact typesetting for electronic-first documents in the age of varying screen sizes. I dream of the day when PDF is as dead as Flash, for I have dozens of PDFs in my reading pile—which I can't reasonably get to, because I don't have a 14" tablet or a printer and can't spend days on end propped in front of the laptop just to read through them. Meanwhile, practically all of those docs are two-column walls of text alternating with rectangular pictures, nothing more complicated than Markdown, and they won't be printed in a paper journal. But the authors felt for some reason that they have to employ PDF. I've been sermonizing for years that it'd be better to publish in HTML and, if the author feels like it, build PDF from the same source—and now it turns out that Tex is a one-track thing and I could just as well ‘print’ HTML to PDF! I gotta see what's so special about Tex that HTML doesn't look serious enough to the big boys.
- mikekchar 7y agoTeX was written in the 70's ;-) The main reason for using TeX is if you want to typeset a document that will be "photo-ready" for a print publication. Quite frequently it is for typesetting scientific papers (which is why it is popular with academics). Like I said, TeX is a typesetting language. It is literally a programming language that takes typesetting programs (including the data) and outputs an exact photo-ready output. It's very easy to convert the photo-ready output to a PDF, or a PNG, or GIF, SVG, etc. Because TeX is a programming language, you can write macros (there are no functions in TeX). These macros work on input you give it. In the old, old days, someone would create a set of macros for typesetting documents for each of the major journals and publications you might want to publish to. Eventually, a guy name Leslie Lamport wrote a whole set of really good macros called LaTeX that would allow you to write documents in a consistent way for a whole bunch of different types of publications. That way you could minimally change the document and resubmit it to a different publisher. So why do people still you TeX? There are two main reasons: First because there is still a need for very high quality print output. TeX is special in that it has perfect algorithms for doing things like line breaking, kerning, etc, etc, etc. The output of TeX is dramatically better than just about any other piece of software. It's insanely better than any word processor will output and there are probably only a handful of desktop publishing packages that are even close. If you need absolutely perfect print output, then TeX (and LaTeX) are a really good fit. The other reason for using LaTeX (not so much TeX, because typesetting documents in TeX is almost insane: I used to do it for fun, but I have never, ever in my career met another person who has done this) is for typesetting mathematics. The LaTeX macros for math are extremely convenient and the pictorial output from TeX are perfect. This allows you to typeset your mathematics in LaTeX, generate a picture and then paste that picture into an HTML document, or Word document, or whatever. There is one notable file format that is built on top of TeX that also is meant for digital use: Texinfo. This is the original documentation format for GNU. You can write hyperlink documents in Texinfo and it will generate TeX output for high quality print documents, and HTML (as well as a few other formats). It is very limited in its features, though and the HTML output is so-so, IMHO. There are a couple of other document formatting systems that output TeX as well (and in fact, I'm pretty sure there is one that will allow you to build some rudimentary TeX documents with docbook), but I'll let you look for those if you are interested.
- brudgers 7y agoTeX is special in that it has perfect algorithms for doing things like line breaking, kerning, etc, etc, etc. The output of TeX is dramatically better than just about any other piece of software. It's insanely better than any word processor will output and there are probably only a handful of desktop publishing packages that are even close. If you need absolutely perfect print output, then TeX (and LaTeX) are a really good fit. Because Donald Knuth.
- Crinus 7y ago> Texinfo Note that Texinfo was originally meant to generate output for the info file format (viewed by the GNU info viewer as well as GNU emacs and a few other less used viewers) alongside TeX, which is probably where it got its name (tex+info output). The info format is essentially a primitive hypertext format with support for hierarchical nodes and keyword indices packaged in a single file (essentially a primitive text-only form of CHM, though later versions of info also support external image references). The HTML and other output formats were added much later.
- simonh 7y agoI think you're misunderstanding what typesetting means. LaTex is for producing output to send to a typesetter to generate a printed document. What Tex produces is essentially a document page image. It was never intended for producing documents for user consumption on electronic devices. The least worst approach would be to use it to generate a PDF.
- aasasd 7y agoNo, I'm aware of that. However, as far as I know, Tex is largely used in the academia to produce PDFs—I've been told in person that this is the process. (And I'm guessing that it outputs PDFs with text layers because that's what I see.) What I don't know is why anyone would prefer PDFs nowadays instead of more flexible formats, namely something HTML-based in the vein of Epub. I've seen people argue vehemently that PDF's exact formatting is necessary but I fail to see why, when most papers I see differ from Markdown only in having two columns and formulas. I asked a friend, and apparently some journals are still printed on paper but no one buys them on paper. So the practical reason for the use of PDFs seems to be that people can print them at home to avoid reading from the screen. One actual reason for non-adoption of HTML, that I can see, is that there's lots of tooling available for collecting, organizing and annotating PDFs. But it doesn't look insurmountable, since files with metadata could just as well be HTML-based, and there are already multiple tools exactly for annotating HTML, only they position themselves for different audiences.
- simonh 7y agoOh right, academic culture I suppose. Anyway nowadays with tablets PDFs are much easier to consume than they used to be. The thing is ePubs and such aren't all that easy to consume. They don't provide standardised predictable layout, so you can't control how it will be presented to the reader. HTML and ePub only provide layout hints to the device or reader app. Even the reader doesn't have much control how the document is displayed. In contrast PDF provides complete, precise control over presentation. If it looks bad or is misleading due to layout issues or truncated tables and such, all of which are possible and can be very significant in scientific or technical material, it's all on the publisher. I read a ton of PDFs, but then I'm a gamer and most tabletop RPGs are published in PDFs. In that case it's because many of them contain a lot of tables, forms and illustrations. They're also trying to create an atmosphere and express a theme, so layout matters. For a lot of material layout makes such a big difference to how material is interpreted that it is content.
- todd8 7y agoOthers have already described TeX quite well. One important feature not mentioned is that it is virtually error free now and is frozen at version 3.14159... (yes pi) Donald Knuth decided that there is value in having a system that for all time will produce exactly the output the author intended 20 years or 200 years later. Every TeX system will layout a document in exactly the same way within the limits of the output device—internally TeX computes positions with fixed point arithmetic at units smaller than light wavelengths. There is a tremendous ecosystem that runs on top of TeX written in the TeX macro based language. This includes the popular LaTeX system, hundreds of packages including tools for example to typeset musical scores, chess articles, and everything else you can imagine. Do note that some of these packages are very high quality—many comercial books in difficult to typeset subject like Physics, Mathematics, and CS are written using TeX.