[texhax] Callable TeX?

James Quirk jjq at galcit.caltech.edu
Fri Oct 29 01:20:30 CEST 2010


On Thu, 28 Oct 2010, Michael Doob wrote:

> On Thursday 28 October 2010 1:56 am, Donald Arseneau wrote:
> > Thomas Schneider <schneidt at mail.nih.gov> writes:
> > 
> > > > Is this the sort of thing you had in mind?
> > > > echo '\documentclass{article}\\begin{document}Hello, World!\\end{document}' | latex 
> > > 
> > 
> > No doubling of backslashes.  (Double all backslashes if the
> > command line uses weak "" quoting)
> Well, this is actually shell dependent (it shouldn't be, I suppose,
> but it is). But really guys, all I wanted to indicate is that its
> easy to pipe stuff into latex. This does not seem to be widely known.
> Even less widely known, you can easily read input off the command line.
> For example, if the contents of test.tex is
To recycle JFK's Moon Speech, ``the greater my software knowledge,
the greater my ignorance unfolds.'' But if you're up for a 
challenge, take a look at:


and you will see an example of TeX as a callable engine that works at 
two-levels: (i) a program invoked TeX to produce the PDF; (ii) the PDF 
invokes either Mathtran remotely or a localhost server embedded in the PDF 
so as to be able to typeset TeX equations input interactively. Note that 
Mathtran is Jonathan Fine's work mentioned earlier in this thread, which 
delivers PNGs. The localhost server employs SWFs with scalable fonts for 
improved legibility.

Also be sure to view the PDF with AR9.3.4 on Linux, as AR9.4.0 is broken.

The document includes its own source-code browser to show you how it was 
programmed. You can activate it from the bookmarks panel.(And Victor, I've 
checked that this example runs under OSX, provided you have swftools 
installed, see http://www.swftools.org/download.html). No AMRITA needed. 

> \documentclass{article}
> \begin{document}
> \read16 to\myinputline
> Here is the input: \myinputline
> \end{document}
> then the line
> echo '\TeX{} is great!' | latex test.tex
> will insert the echoed material into the printed page.
Now what am I selling? Certainly not myself or a software package. A good 
place to start would be this newspaper article that appeared in the UK, 
back in February:

``If you're going to do good science, release the compuer code too''

My comment snuck in at the end and so has its own url:


After talking to the article's author, I started on a piece of work that 
has yielded three acknowledged AR vulnerabilities and counting.

Where am I going with this ramble. Well it's very clear that the 
programming capabilties on this newsgroup are every bit as variable as 
they are in the rest of society. And therein lies the reason I would, 
today, hesitate to claim that '\TeX{} is great!' without critically 
appraising where the system is weak.

Before I'm flamed, you have to understand that I have my eye on the year 
2360. Yes none of us will be around, but the thought experiment to 
consider is how will our document actions be judged by our descendants. 
Sad to say, in the computational sciences I am not at all confident we 
will be thought of highly, for the reasons given in the URL above.

My concern, and primary reason for popping up here, is that there are 
many, many software tricks which are not widely appreciated. And once you 
start going down a path that ponders ways to improve the communication of 
computing, in its broadest sense, all sorts of weaknesses of TeX start to 
surface. Note that does not detract from TeX's design strengths, I'm 
talking strictly about its current implementation. Also note that my work 
in this area is aimed at understanding certain software issues, and is not 
aimed at usurping TeX or any other software package. For instance,
the equation-editor example seamlessly leverages off LaTeX, Perl, Ruby,
ActionScript, JavaScript, and MXML. And the same basic approach can
be used with R, or Octave, or pretty much any package that can
be batch driven.

My final thought is the following. Courtesy of Goole I am just a couple of 
clicks away from investigating any person on this newsgroup. Thus I came 
across Ron Fehd's ``Everything you ever wanted to know about a program but 
were afraid to ask'' in which he concludes: ``Program documentation is an 
over-looked and under-appreciated aspect of programming effort. Effective 
documentaiton contributes to program reuse. The costs associated with 
documentation are miniscule in comparison to those associated with 
redevelopment.'' But with recent developments in electronic formats the 
distinction between a program and a document is much smaller than it used 
to be, and in the years to come it will get even smaller. Therefore what 
long-term evolution path do you, and the other contributors on this 
thread, see as being needed so as to keep TeX's intellectual spirit alive?



> Cheers,
> Michael

More information about the texhax mailing list