groff
[Top][All Lists]
Advanced

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

Re: About groff and dformat


From: Riza Dindir
Subject: Re: About groff and dformat
Date: Wed, 17 Aug 2022 19:23:31 +0300

Hello Thomas

I did need tbl, abd chem for the original document, where I wanted to
create a document that had all the elements and preprocessors used in
troff.

One thing that I realized is this. When you use chem, you can not have
the # character in the dformat or other preprocessor blocks, since the
chem macro package does take # as a comment and erases all the
characters to the end of the line. Now in that particular dformat
example that I used, there was an expression "Channel #". When you
process this with dformat and then with chem, or the other way around,
or have chem in the pipeline, chem will erase all the characters
including the # from the generated troff document. Hence the error.

So if chem is  being used, better change the # character to something
else, or use \N'35' (ascii 35 is the # character). But this might not
work because the font used might not have that character, or the
character with ascii code 35 might not be existing. Since I do not
know how groff works at this level, I am not sure.

If one wants to enter a character and has the ascii code for that,
would this be the correct usage? That is entering a character that one
knows the ascii numeric value of, can one use the \N'xx' control
sequence? Would that change based on the font, or something else? Or
will the control sequence \N'35' always be mapped to the character #?

Regards,
Riza

On Wed, Aug 17, 2022 at 6:48 PM Thomas Dupond <thomas@dupond.eu> wrote:
>
> Riza Dindir <riza.dindir@gmail.com> wrote:
>
> > Hello Thomas,
>
> Hi!
>
> > Finally I was able to use the dformat without problems.
>
> Congrats! :)
>
> > The problem was the order in the pipe. In the original paper the
> > author provided an example on the order of the preprocessors. I did
> > not have the correct order. It should have been
> >
> > !sh dformat.sh format-test.ms | pic | tbl | eqn | groff -ms > main.ps
>
> I have the same result as you have. I don't know why the order matters,
> my knowledge of prepocessors is lacking.
>
> However I recreated your document easily with:
>
> $ dformat.awk format-test.ms | groff -ms -pe -Tps > main.ps
>
> I did not use tbl (with the -t switch) and it worked perfectly.  You
> don't need tbl for this particular document.
>
> I noted that when producing the pdf (either with groff -Tpdf or ps2pdf),
> the dotted lines appear thinner than in the postscript file.  To be
> honest, I would not have noticed them if I only looked at the pdf file.
>
> > That solved the problem, and I can create the dformat in the document.
> >
> > Thanks for the help.
> >
> > Regards,
> > Riza
> >
> > On Wed, Aug 17, 2022 at 6:59 AM Riza Dindir <riza.dindir@gmail.com> wrote:
> > >
> > > Hello Thomas,
> > >
> > > To make sure, I have this in my dformat.sh
> > >
> > > awk -f dformat.awk $*
> > >
> > > I tried with the dformat.awk that I have found
> > > (https://github.com/arnoldrobbins/dformat) and the dformat.awk that
> > > you have pointed out (https://github.com/sathlan/dformat). But still I
> > > am getting the same error message and the dformat picture is displayed
> > > partially.
> > >
> > > What is the version of groff (mine is 1.22.4), and awk (mine is
> > > 20210215) that you are using? Clearly I must be doing something wrong.
> > >
> > > Although I could just remove inline equations from the dformat spec in
> > > the document, I would like to understand what is wrong.
> > >
> > > Regards,
> > > Riza
> > >
> > > On Tue, Aug 16, 2022 at 9:59 PM Thomas Dupond <thomas@dupond.eu> wrote:
> > > >
> > > > Riza Dindir <riza.dindir@gmail.com> wrote:
> > > >
> > > > > Hello All,
> > > >
> > > > Hi!
> > > >
> > > > > I am trying to get dformat to work. What I did was this.
> > > > >
> > > > > I first tried to include an example dformat script into my document. I
> > > > > got the first example from the troff.org site
> > > > > (https://troff.org/prog.html). The first example for the dformat
> > > > > processor. That example has been using inline equations/math
> > > > > expressions.
> > > > >
> > > > > Then I went and got the dformat awk script. That script I got from
> > > > > (https://github.com/arnoldrobbins/dformat) which might not be the
> > > > > original script.
> > > >
> > > > I know the following github repo is a transcript of the dformat by
> > > > Jon L. Bentley:
> > > >
> > > > https://github.com/sathlan/dformat
> > > >
> > > > I had no problem generating your document with it. :)
> > > >
> > > > > Anyways I have this simple document.
> > > > >
> > > > > .TL
> > > > > Some format
> > > > > .NH
> > > > > deneme
> > > > > .EQ
> > > > > delim @@
> > > > > .EN
> > > > > .LP
> > > > > .begin dformat
> > > > > style bitwid 0.08
> > > > > style charwid 0
> > > > > style recspread 0.3
> > > > > noname
> > > > >         --16 Frame
> > > > >         --16 Frame
> > > > >   A1:   --16 Frame
> > > > >         --16 Frame
> > > > >         --8-dashed ...
> > > > > noname
> > > > >   A2:   8--8 Flags
> > > > >         8--8 Status
> > > > >         --8 @roman Chunk sub 1@
> > > > >   B1:   --8 @roman Chunk sub 2@
> > > > >         --8-dashed ...
> > > > >         --8 @roman Chunk sub m@
> > > > >         16--16 CRC
> > > > >   A3:   8--8 Flags
> > > > > noname
> > > > >   B2:   8--8 @roman Data sub 1@
> > > > >         8--8 @roman Data sub 2@
> > > > >         8--8 @roman Data sub 3@
> > > > >         8--8 @roman Data sub 4@
> > > > >         --8-dashed ...
> > > > >         8--8 @roman Data sub n-1@
> > > > >         8--8 @roman Data sub n@
> > > > >         6--6 Length
> > > > >   B3:   10--10 Channel #
> > > > > pic line dotted from A1.sw to A2.nw
> > > > > pic line dotted from A1.se to A3.ne
> > > > > pic line dotted from B1.sw to B2.nw
> > > > > pic line dotted from B1.se to B3.ne
> > > > > .end
> > > > >
> > > > > And am running the command line as
> > > > >
> > > > > !sh dformat.sh format-test.ms | eqn | pic | groff -ms > main.ps
> > > > >
> > > > > The command says this
> > > > >
> > > > > pic:<standard input>:98: syntax error before '\'
> > > > > pic:<standard input>:98: giving up on this picture
> > > > >
> > > > > Does anybody use dformat? Which dformat script are you using?
> > > > >
> > > > > Regards,
> > > > > Riza
> > > > >
> > > > >
> > > >
> > > > --
> > > > Regards,
> > > > Thomas
>
> --
> Regards,
> Thomas



reply via email to

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