groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Groff] questions about postscript and tex/latex output


From: Ted Harding
Subject: RE: [Groff] questions about postscript and tex/latex output
Date: Sat, 12 Mar 2005 01:34:49 -0000 (GMT)

Hi Robert,

On 12-Mar-05 Robert Dodier wrote:
> Hi everyone,
> 
> I have a couple of simple questions which I hope you
> can help me with. The files I am working with (composed
> in 1985) are composed with MS macros.
> 
> (1) The postscript output option (-T ps) puts the stuff
> between .DS/.DE in variable-width font, although I would
> have expected fixed width font. Is there a way to cajole
> groff into considering .DS/.DE stuff to be fixed width font?
> It's OK with me if the answer is "yes, throw in this 
> macro .FOOBAR before every .DS" or something like that.

There's no reason to expect fixed-width font for what is between
.DE and .DE -- what you get is, without additional measures,
in the ambient font (i.e. what is in use when ".DE" is invoked).

You can, however, easily arrange for a special font for such
displays. For instance

.DS
.ft CR
...text of display...
.ft
.DE

and then it will be in Courier Roman (a fixed-width font) for
the duration of the display, reverting afterwards to what it
was before.

> (2) Is there a way to generate tex or latex output from groff?

The default output device with groff is the PostScript device
(as if you had invoked it with "groff -Tps ... ").

You can produce TeX-compatible "device-independent" output
with

  groff -Tdvi ... -o TeX_file.dvi troff_file

which will generate a ".dvi" file to which you can apply the
TeX commands for generating device-specific output (e.g. dvips
to convert the .dvi file to PostScript). Beware, however, that
a lot of the characters in the devdvi fonts have different
groff names from the corresponding characters in (say) the
devps fonts.

What you *cannot* do (at any rate not using groff) is convert
a groff "source" file into a TeX/LaTeX "source" file on which
you can then run TeX (or edit as a TeX file).

Even if there was some program which claimed to do such a
conversion, you should not expect good results. The two programs,
groff and TeX, are conceived along different lines, and neither
would map onto the other. The fact that each offers users a rich
palette of possibilities to define their own macros, etc., means
that a conversion program would have to cope with anything of
this kind that the user might think of.

> I've RTFM and searched the mailing list archives but I wasn't
> able to find answers to these questions. If anyone can shed
> light on these questions I will be very much obliged.
> 
> All the best,
> Robert Dodier

It would be worth studying the overall structure of a groff run.
Apart from the use of pre-processors (whose function is merely
to convert passage of "special description" -- e.g. the equation
description language "eqn", or the graph description language "pic"
or the table description language "tbl" -- into groff language,
prior to submitting everything to groff for processing), groff
takes an input stream, processes it according to its contents
and the device specified with "-T", and outputs a stream in
"intermediate language" (described in "man groff_out").

This intermediate-language stream is then submitted to a
device-specific post-processor -- grops for PostScript,
grodvi for ".dvi", grohtml for HTML, grotty for fixed-width
terminal output, etc. Already encapsulated in the intermediate
stream are many fine details of the formatting, in particular
precise positions and motions for the placement of characters,
and detailed specifications of font changes, etc. This is all
at a much lower level than what TeX source code corresponds to,
and a postprocessor to generate TeX source would have to undo
a lot of this. (In passing, I wonder what one might call such
a post-processor; "grotex"? Maybe "grotesk"?)

Hoping this helps,
Ted.


--------------------------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 094 0861
Date: 12-Mar-05                                       Time: 01:34:48
------------------------------ XFMail ------------------------------




reply via email to

[Prev in Thread] Current Thread [Next in Thread]