# Is LaTeX intended for unattended typesetting?

With markup converters like Pandoc, it has now become possible to generate LaTeX documents without ever touching any LaTeX code.

However, obtaining aesthetic page breaks for slightly complex documents, taking for example into account figures, widows and orphans may still require manual intervention in the LaTeX code. (I know there are packages for this out there, but unfortunately, these do not resolve all issues.)

So it seems that we are quite not yet at that utopian point were one can blindly write content without ever having to worry about how the output will look like. (This argument is often used though for LaTeX/LyX advocacy!)

This made me wonder: Did LaTeX 2ε developers intend for unattended typesetting? If not, will LaTeX 3 change anything to this respect?

EDIT

For the sake of clarity, I am mainly referring to documents such as dissertations, reports and books.

-
Isn't this discussion about tradeoffs? Either good quality or automated typesetting? What LaTeX gives (maybe) is that it replaces "good quality and manual typesetting vs terrible quality and automated typesetting" with "good quality and manual typesetting vs decent quality and automated typesetting"... – mbork Feb 26 '14 at 10:59
Quoting Frank Mittelbach: "TeX generates pages based on precompiled paragraph data. This issue describes the fundamental problem in TeX’s approach: the program builds optimized paragraph shapes without any knowledge about their final placement on a page. The result is a “galley” from which columns are cut to a specified vertical size. A consequence of this is that one can’t have the shape of a paragraph depend on its final position on the page when using TEX’s page builder algorithm." – Serge Stroobandt Feb 26 '14 at 13:18
@SergeStroobandt That particular problem is (in theory) avoidable in luatex, although I don't think we've demonstrated any usable code that exploits that possibility yet. (You can work round it with more difficulty, and some restrictions, in classic tex as well). – David Carlisle Feb 26 '14 at 14:54

It has always been a possibility although obviously the document markup side of latex is mostly aimed at hand authored documents, but even back while 2e was being developed there were wysiwyg systems like sw that are essentially generating latex that isn't touched and latex is often used for typesetting from XML (or previously SGML) using xslt or dsssl or similar (Sebastian's jadetex stylesheets for typesetting TEI SGM via dsssl being more or less contemporary with the development of 2e).

Of course how far you can get by without hand editing the generated tex depends on what kind of document it is and how much control you have elsewhere in the process.

If you are typesetting millions of standard invoices from some database queries or similar where there are no typographic problems and you are just using tex as a convenient pdf generator then you can (and people do) automate the whole process.

In a system like scientific word (or I suppose lyx, although I haven't seen that) you don't (normally) edit the tex but you have manual control over the layout to an extent via the GUI.

Then there are people using database backed catalogue systems where tex is used to typeset fragments but the logic to arrange and paginate those fragments is pushed off to other software (or lua) or whatever.

One of the main aims of L3 will be a more flexible output routine (as the memory constraints now are so different from the constraints when 2.09 and 2e were developed) That can help TeX make better (and so hopefully more automatic) decisions about page breaking and float placement, but time will tell....

-

People who want perfect typography will often be unsatisfied with LaTeX's output without manual adjustment. However, if you are fine with reasonably good output, then the answer is yes: LaTeX can be used for unattended typesetting. There are plenty of options that change LaTeX's behavior for avoiding orphans, widows, and to influence figure placements, which give you a good starting point that can also be used as-it-is for most purposes.

There are a few exceptions to the rule, however, such as balancing the columns on the last page of a document in two-column mode. While there is at least one package for doing this, the float behavior is a bit odd. As long as you only use features that do not require special attention, LaTeX should be suitable for the job.

Note that many manual LaTeX placement-and-layout tricks that people do are meant to reduce the number of pages without influencing the layout significantly. This is for example of relevance in scientific publications to be submitted to venues with a page limit. If this is of relevance, then no automated system that will do a very good job for you.

Here is an example that I know where LaTeX has been used in an automated manner: the largest German telecommunications company used LaTeX for making their invoices (and might still do so - not sure). This was visible from the invoice PDF files that one would get by mail when opting out of paper invoices. Admittedly, they did not have complicated floats or similar stuff. I strongly suspect that that they did not post-process the invoices manually to improve their layout.

-
The general answer is no: good typography requires looking at the output and fix it. Line breaks can be psychologically bad, long math formulas need knowing what they mean in order to be broken. Widows, orphans and floats are just some of the finer details one has to cope with. – egreg Feb 26 '14 at 11:05
@egreg just volunteered to proofread the German phone book:-) – David Carlisle Feb 26 '14 at 11:08
@egreg: If you add constraints depending on the content of the document to the list of things that you want your typesetting system to take care of, then the answer is obviously no, as the system cannot interpret it -- so the OP probably didn't have that in mind. – DCTLib Feb 26 '14 at 11:14
@Ruedi Float placement refinements may require moving the environment a couple of paragraphs earlier or later, so the float can appear in the same spread as the main reference. Bad or unsuitable page breaks can be fixed with \enlargethispage. A telephone directory is definitely not the model of good typography. – egreg Feb 26 '14 at 11:19