# [pdftex] TeX as a composition server?

James Quirk jjq at galcit.caltech.edu
Mon Oct 25 21:55:11 CEST 2010

Ross,

On Tue, 26 Oct 2010, Ross Moore wrote:

> Hi James,
>
> Why write it into a long file?
> You can do the loop in TeX itself.
Yes, but you fell into my trap!

For the present exercise, I would actually write:

fold::amrita { example for Peter Davis
fold::amrita { body of document
do n=1,100000
fold::latex { lorem ipsum
Lorem ipsum dolor sit amet, consectetur adipisicing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
in reprehenderit in voluptate velit esse cillum dolore eu fugiat
nulla pariatur. Excepteur sint occaecat cupidatat non proident,
sunt in culpa qui officia deserunt mollit anim id est laborum.

}
end do
}
LatexTail
Latex
}

which is a tree-based program. Then when John C. comes along and wants to
use Cobol, I would introduce him to fold::cobol, just another node in a
general framework, which could be compiled in situ using fold::cc, or
fold::cxx, or whatever. Similarly, I would use fold:mxml or fold::as3 to
build a nice shiny YouTube player, or any other /RichMedia annotation. So
while I agree you can easily do the present task in TeX, there are many
specialist tasks where a TeX-centric view of the world is rather limiting.
Hence my earlier assertion that LaTeX3 is too little, too late,
espcially in the computational sciences.

James

>
>
> \loop
>  ... Blah blah ...
>  \newpage
> \ifnum\value{page}<10000 \repeat
>
>
> I'm assuming LaTeX here, for \newpage and \value .
> This is probably more practical than a Plain TeX test, which would be even faster, after declaring a counter for use within the loop.
>
>
> Hope this helps,
>
>       Ross
>
>
>
> On 26/10/2010, at 5:56 AM, James Quirk <jjq at galcit.caltech.edu> wrote:
>
> > Peter,
> >
> >> Basically, yes.  I just want to see how fast TeX can compose a few tens of
> >> thousands of pages of text.  It could all be "Lorem ipsum ..." or whatever.
> >
> > A few lines of Perl, Python, Ruby, or whatever, is all you need.
> > For instance:
> >
> > #------------------start--------------------------------
> > my $n = 100000; > > my$lorem = <<'TXT';
> > Lorem ipsum dolor sit amet, consectetur adipisicing elit,
> > sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
> > Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
> > nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
> > in reprehenderit in voluptate velit esse cillum dolore eu fugiat
> > nulla pariatur. Excepteur sint occaecat cupidatat non proident,
> > sunt in culpa qui officia deserunt mollit anim id est laborum.
> >
> > TXT
> >
> > open LTX,">","lorem.tex";
> > \documentclass{article}
> > \begin{document}
> > for($i=0;$i<$n;$i++) {
> >   print LTX \$lorem;
> > }
> > print LTX <<'TAIL';
> > \end{document}
> > TAIL
> > #------------------end--------------------------------
> >
> > generates a document of 13044 pages.
> >
> > James
> >
> >>
> >> Thanks,
> >> -pd
> >>
>