Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

\typein limitations?

0 views
Skip to first unread message

Stefan Froehlich

unread,
Jul 15, 2000, 3:00:00 AM7/15/00
to
Hello,

I tried to automatically create a LaTeX document by piping a string
into tex via the \typein command. However it seems that after about
4 kB of input TeX stops processing... is this a hard limitation or
somethin which can be changed? I had a quick look at texmf.cnf, but
could not find anything specific (I am no expert at that, however).

Any hints appreciated...

Bye,
Stefan

--
Fuer die verwoehnte Dame: Stefan - in den Stunden nach dem Raport!
(http://www.sloganizer.de/)

Robin Fairbairns

unread,
Jul 16, 2000, 3:00:00 AM7/16/00
to
Stefan Froehlich <Stefan...@Froehlich.Priv.at> wrote:
>I tried to automatically create a LaTeX document by piping a string
>into tex via the \typein command. However it seems that after about
>4 kB of input TeX stops processing... is this a hard limitation or
>somethin which can be changed? I had a quick look at texmf.cnf, but
>could not find anything specific (I am no expert at that, however).

current tetex comes with a 50000 input buffer, but istr some earlier
web2c distribution with a 4k one. the texmf variable is buf_size.

i bet there's a better way of doing this job, though...
--
Robin Fairbairns, Cambridge

Stefan Froehlich

unread,
Jul 16, 2000, 3:00:00 AM7/16/00
to
On 16 Jul 2000 08:21:32 GMT Robin Fairbairns <r...@betsy.cl.cam.ac.uk> wrote:
>>I tried to automatically create a LaTeX document by piping a string
>>into tex via the \typein command. However it seems that after about
>>4 kB of input TeX stops processing... is this a hard limitation or
>>somethin which can be changed? I had a quick look at texmf.cnf, but
>>could not find anything specific (I am no expert at that, however).

> current tetex comes with a 50000 input buffer, but istr some earlier
> web2c distribution with a 4k one. the texmf variable is buf_size.

Ah. In this case, the problem must be somewhere else, because:

| sfroehli@euklid:~$ grep "^buf_size" /etc/texmf/texmf.cnf
| buf_size = 50000

What I actually do is to call the lines

| # call LaTeX and bild dvi file
| `echo \"$string\" |latex $_[0].tex`;
| `dvips -o $_[0].ps $_[0].dvi`;

to create a nicely formatted document. The size of $string is highly variable
and can range from a few bytes up to about 20k. The output of the first
statement is

| This is TeX, Version 3.14159 (Web2C 7.2) (invoice.tex LaTeX2e <1998/06/01>
| Babel and hyphenation patterns for american, french, german, ngerman, n
| ohyphenation, loaded. (/usr/lib/texmf/tex/latex/g-brief/g-brief.cls Document
| Class: g-brief 1997/09/15 v2.2 g-brief class
[...]
| (/usr/lib/texmf/tex/latex/misc/supertabular.sty) (invoice.aux) Datum
| \@typein=Betreff \@typein=Hauptteil
| \@typein=Empfaenger \@typein= Underfull \hbox (badness 10000) has occurred
| while \output is active Underfull \hbox (badness 10000) has occurred
| while \output is active [1] Underfull \hbox (badness 5245) in paragraph at
| lines 63--63 []\T1/cmr/m/n/10.95 div. Pro-gramm-ver-bes-se-run-gen,
| Be-spre- Datum \@typein=[2] Datum \@typein= ! Emergency stop. l.63
| \typein{Hauptteil} ^^M Output written on invoice.dvi (2 pages, 9160 bytes).
| Transcript written on invoice.log.

This "Emergency stop" only occurs, if $string is longer than the app. 4k
I mentioned in my first posting. It does not seem to be the fault of the
input buffer size, however...

> i bet there's a better way of doing this job, though...

I'm always open to good suggestions :-)

Bye,
Stefan

--
Stefan - denn verstaute Liebe bettelt niemals.
(http://www.sloganizer.de/)

Edward Avis

unread,
Jul 16, 2000, 3:00:00 AM7/16/00
to
I too have been looking for a way to pipe input to latex (and ideally
get the output DVI on standard output); \typein looks useful but the
fixed size input buffer doesn't.

I wrote a program 'pip' as a wrapper for programs which require input
and output filenames rather than reading from stdin and writing to
stdout; but tex produces so many output files (and often in the
'wrong' place if the input file is in a different directory) that I
haven't found a way to cleanly wrap it so that you can say

% cat input.tex | filter_latex | dvips

or whatever.

--
Ed Avis
ep...@doc.ic.ac.uk

Stefan Froehlich

unread,
Jul 16, 2000, 3:00:00 AM7/16/00
to
On 16 Jul 2000 15:17:54 +0200 Stefan Ulrich <ulr...@cis.uni-muenchen.de> wrote:
> Hmm, why not write directly to a pipe, e.g.

> latex << EOF
> \documentclass{letter}
> \begin{document}
> ... stuff ...
> \end{document}
> EOF

Urgs... I have not seen the obvious, I suppose, as the original
solution was working quite fine until the input data became too big.
It's a bit trickier to use text templates this way, but problems here
are solveable at least.

Thanks :-)

Bye,
Stefan

--
Stefan - Der grosse Wurf: Eifern wenn es zetert!
(http://www.sloganizer.de/)

Edward Avis

unread,
Jul 17, 2000, 3:00:00 AM7/17/00
to
You might like to know that I have now written the wrapper I was
talking about to let latex (or just tex) read from stdin and write to
stdout. See <http://www.doc.ic.ac.uk/~epa98/work/apps/pip/>.

I hope it will be useful for automated use of LaTeX in shell
pipelines.

--
Ed Avis
ep...@doc.ic.ac.uk

David Carlisle

unread,
Jul 17, 2000, 3:00:00 AM7/17/00
to Edward Avis
Edward Avis <ep...@doc.ic.ac.uk> writes:

Some TeX systems have a TEXOUTPUT control over where auxilliary files
get written, and even if not, it is usually possible to arrange that the
filter_latex command runs in some special directory (created for that
job in /usr/tmp/xxxxx) and then just arrange taht TEXINPUTS is set so
that teh temporary files can be found.

David

0 new messages