[texhax] Callable TeX?

Thomas Schneider schneidt at mail.nih.gov
Wed Oct 27 18:49:58 CEST 2010

> Is this the sort of thing you had in mind?
> echo '\documentclass{article}\\begin{document}Hello, World!\\end{document}' | latex 

On my Mac OS X in a Terminal,
that creates a file called article.log containg:
% more article.log 
This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009) (format=latex 2009.11.7)  27 OCT 2010 12:37
entering extended mode
 %&-line parsing enabled.
**\documentclass{article}\\begin{document}Hello, World!\\end{document}
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
File: size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
\c at part=\count79
\c at section=\count80
\c at subsection=\count81
\c at subsubsection=\count82
\c at paragraph=\count83
\c at subparagraph=\count84
\c at figure=\count85
\c at table=\count86

! LaTeX Error: There's no line here to end.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
<*> \documentclass{article}\\b
                              egin{document}Hello, World!\\end{document}
! Emergency stop.
<*> \documentclass{article}\\b
                              egin{document}Hello, World!\\end{document}
Your command was ignored.
Type  I <command> <return>  to replace it with another command,
or  <return>  to continue without it.

Here is how much of TeX's memory you used:
 193 strings out of 493849
 2203 string characters out of 3149230
 48936 words of memory out of 3000000
 3563 multiletter control sequences out of 15000+200000
 3640 words of font info for 14 fonts, out of 3000000 for 9000
 714 hyphenation exceptions out of 8191
 22i,0n,17p,194b,36s stack positions out of 5000i,500n,10000p,200000b,50000s
No pages of output.

Making the two double back slashes into single backslashes:

echo '\documentclass{article}\begin{document}Hello, World!\end{document}'|latex 

does the trick, creating three files:

article.aux article.dvi article.log


dvips article.dvi

gives a nice article.ps.  I put these together into a file, made it
executable (chmod) and now have a small self contained typesetting

It's worth actually trying code.  Apparently the backslash is not
protecting the second backslash - both are passed by the shell to



  Thomas D. Schneider, Ph.D.
  National Institutes of Health
  National Cancer Institute
  Gene Regulation and Chromosome Biology Laboratory
  Molecular Information Theory Group
  Frederick, Maryland  21702-1201
  schneidt at mail.nih.gov
  toms at alum.mit.edu (permanent)
  http://alum.mit.edu/www/toms (permanent)

More information about the texhax mailing list