[comp.text] TeX to ASCII

mcglk@blake.acs.washington.edu (Ken McGlothlen) (12/15/88)

In article <372@blake...>, I wrote about getting a TeX to ASCII convertor.
I received a number of responses regarding dvidoc-like devices, which is
useful to know.  However. . . .

My problem is that if I just TeX the source file, I'm going to get a .DVI
file which uses the Plain TeX cmr fonts.  Using dvidoc on this .DVI file
will give me some---er, rather strange-looking margins.  If a line uses
lots of "l"s and "i"s and "t"s, I'll get an awfully long line out of dvidoc,
since TeX uses proportional spacing.

Am I making sense?

I'd *like* to have a single source file written in straight, Plain TeX, that
produces a standard, run-of-the-mill .DVI file.  *However*, I would like to
be able to specify an \input line that set TeX up for typesetting in ragged-
right, fixed-pitch font, with a user-specified "characters per inch," and the
possibility of turning, say, \bullet, into something like "*" (and so on).
This would be ideal for producing, say, documentation for a program in both
a nice-looking typeset format on paper, and an on-line document that looks
somewhat similar.  Optional right-justification would be nice, as long as it
followed the rules that TeX tries to follow regarding stretchability (white
space after periods stretches at three times the rate of interword space, and
so forth).

This is a teeny bit more complicated.  dvidoc alone won't cut it.  The
LaTeX {verbatim} environment won't cut it, either.  I need a set of macros
which set TeX up neatly for fixed-pitch output.  At *that* point, dvidoc
would be lovely---I hope.

Thanks.

				--Ken McGlothlen
				  mcglk@blake.acs.washington.edu

mrd@sun.soe.clarkson.edu (Michael DeCorte) (12/15/88)

In article <389@blake.acs.washington.edu> mcglk@blake.acs.washington.edu (Ken McGlothlen) writes:

   I need a set of macros
   which set TeX up neatly for fixed-pitch output.  At *that* point, dvidoc
   would be lovely---I hope.

Perhaps that is your problem.  Have you been using dvidoc.sty or
docmac.tex?  If you haven't then that is the problem.  I use dvidoc
and it works just fine for me.  Take a look in the Clarkson depository
for dvidoc.shar1 and dvidoc.shar2 for more info.


--

Michael DeCorte // (315)265-2439 // P.O. Box 652, Potsdam, NY 13676
Internet: mrd@sun.soe.clarkson.edu  // Bitnet:   mrd@clutx.bitnet        
---------------------------------------------------------------------------
Clarkson Archive Server // commands = help, index, send, path
archive-server@sun.soe.clarkson.edu
archive-server%sun.soe.clarkson.edu@omnigate.bitnet
dumb1!dumb2!dumb3!smart!sun.soe.clarkson.edu!archive-server
---------------------------------------------------------------------------

langdon@lll-lcc.llnl.gov (Bruce Langdon) (12/15/88)

In article <389@blake.acs.washington.edu>, mcglk@blake.acs.washington.edu (Ken McGlothlen) writes:
> ...if I just TeX the source file, I'm going to get a .DVI
> file which uses the Plain TeX cmr fonts.  ...   If a line uses
> lots of "l"s and "i"s and "t"s, I'll get an awfully long line out of dvidoc,
> since TeX uses proportional spacing.

dvidoc comes with a few macros for plain and Latex that redefine the usual
fonts to all be a fixed-width font whose .tfm file is in the distribution.

> I'd *like* to have a single source file written in straight, Plain TeX, that
> produces a standard, run-of-the-mill .DVI file.  *However*, I would like to
> be able to specify an \input line that set TeX up for typesetting in ragged-
> right, fixed-pitch font, with a user-specified "characters per inch,"...
> This would be ideal for producing, say, documentation for a program in both
> a nice-looking typeset format on paper, and an on-line document..

Just what I'm doing with dvidoc. 
>   ...dvidoc alone won't cut it.
>   I need a set of macros which set TeX up neatly for fixed-pitch output.

Perhaps you haven't looked at it?
I did add some other stuff. Things like redefining \hsize and \enspace
in terms of `em', the universal character width, and redefining \medskip
etc in terms of \normalbaselineskip. I don't now have the macros on this system
but I'd be glad to share. Maybe someone can improve/complete them...
----------------------------------------------------------------------
	Bruce Langdon  L-472                langdon@lll-lcc.llnl.gov
	Physics Department                  14363%f@nmfecc.arpa
	Lawrence Livermore National Laboratory       
	Livermore, CA 94550                 (415) 422-5444
UUCP: ..{qantel,ucdavis,pyramid,harvard,topaz}!lll-lcc!langdon

nwinton@zaphod.axion.bt.co.uk (Neil Winton) (12/16/88)

From article <389@blake.acs.washington.edu>, by mcglk@blake.acs.washington.edu (Ken McGlothlen):
> In article <372@blake...>, I wrote about getting a TeX to ASCII convertor.
> I received a number of responses regarding dvidoc-like devices, which is
> useful to know.  However. . . .
> 
> I'd *like* to have a single source file written in straight, Plain TeX, that
> produces a standard, run-of-the-mill .DVI file.  *However*, I would like to
> be able to specify an \input line that set TeX up for typesetting in ragged-
> right, fixed-pitch font, with a user-specified "characters per inch," and the
> possibility of turning, say, \bullet, into something like "*" (and so on).
> This would be ideal for producing, say, documentation for a program in both
> a nice-looking typeset format on paper, and an on-line document that looks
> somewhat similar.  Optional right-justification would be nice, as long as it
> followed the rules that TeX tries to follow regarding stretchability (white
> space after periods stretches at three times the rate of interword space, and
> so forth).
> 

Alright!  I've got something that comes close to this.  I re-wrote DVIDOC
in C (Why?  ENOPASCAL) and I made a stab at hacking lplain (LaTeX plain
format) into something vaguely useful which produces justified ASCII text
when the DVI file is processed via DVIDOC by making all font references
use the fixed-width `DOC' font.  It does some simple-minded
beautification, redefining \TeX as `TeX', replacing list bullet
characters etc.  The main deficiency is the occasional spurious lineskip
in mid-paragraph.  This could be solved, I suspect, by defining something
like \mainbaselineskip properly --- but I never pursued it.  There are
several associated \documentstyle options (doc.sty, doc_a4.sty and
others) which enable the fixed-width stuff in such a way that if the
document is LaTeX'd it is properly typeset but if it is `docTeX'd the
fixed-width characters are used.

If this sounds more promising then let me know and I'll get it to you
in the New Year.  If I get enough interest it'll probably go to
comp.sources.unix and the UK TeX archive (at spock.aston.ac.uk).

> Thanks.
> 
> 				--Ken McGlothlen
> 				  mcglk@blake.acs.washington.edu

	Season's Greetings,

		Neil

E-Mail (UUCP)  NWinton@axion.bt.co.uk  (...!uunet!mcvax!ukc!axion!nwinton)
Organisation   British Telecom Research Laboratories (RT3134)
Snail Mail     BTRL, Rm 23 B68, Martlesham Heath, IPSWICH IP5 7RE, UK
Telephone      +44 473 646079 (or +44 473 643210)
*** This line intentionally left justified ***