bugGNU roff - Bugs: bug #62238, skip papersize.tmac on nroff...

 
 

bug #62238: skip papersize.tmac on nroff devices

Submitter:  Bjarni Ingi Gislason <bjarniig>
Submitted:  Wed 30 Mar 2022 07:01:07 PM UTC
   
 
Category:  Macro - others/general Severity:  1 - Wish
Item Group:  Lint Status:  Fixed
Privacy:  Public Assigned to:  gbranden
Open/Closed:  Closed Planned Release:  1.23.0
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sun 05 Jun 2022 02:05:25 AM UTC, comment #9: 


comment #8:

>   By default "troff" formats input for papersize "letter", even when the
> printers are configured for a different size.


I believe what the documentation says is that by default, troff formats for a paper length of "11 inches".

This is not precisely the same thing as formatting for letter paper, albeit that's a convenient choice since that is in fact the length of letter paper in portrait orientation.

The default line length, however, is 6.5 inches, and the default page offset (for typesetting devices) is 1 inch.

Neither of those figures is a match for the width of U.S. letter paper, nor is their sum.  (They happen to be good choices for that paper format if 1-inch horizontal margins are desired, though.)
 

>   So all output for a printer, that troff creates in the repository, is
> for papersize "letter".


This is a ticket in an issue tracker.  Do you have a defect to report or a feature request to change?  Was the resolution of this ticket responsive to your comment #0?

G. Branden Robinson <gbranden>
Group administrator
Sat 04 Jun 2022 10:06:27 PM UTC, comment #8: 

  By default "troff" formats input for papersize "letter", even when the
printers are configured for a different size.

  So all output for a printer, that troff creates in the repository, is
for papersize "letter".

Bjarni Ingi Gislason <bjarniig>
Fri 03 Jun 2022 09:06:14 AM UTC, comment #7: 


commit e96e181ad22f01d1c9a02e16083ab9374b136f0d
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Wed Jun 1 12:59:14 2022 -0500

    tmac/troffrc: Skip "papersize.tmac" if not troff.

    * tmac/troffrc: Skip loading of "papersize.tmac" if not in troff mode.

    Fixes <https://savannah.gnu.org/bugs/?62238>.  Thanks to Bjarni Ingi
    Gislason for the report.


G. Branden Robinson <gbranden>
Group administrator
Thu 02 Jun 2022 12:31:07 AM UTC, comment #6: 


comment #5:

>   The line with "@PAGE@" refers to comment #2 line with
> "tmac/troffrc.in", which is supposed to create the final "troffrc" with
> the actual value of "PAGE" to define the string "paper", which is needed in
> "papersize.tmac".


There is no file "tmac/troffrc.in" in groff Git.

https://git.savannah.gnu.org/cgit/groff.git/tree/tmac

Could you please verify that issues are valid with respect to and reproducible using an official groff distribution archive, or an unmodified groff Git HEAD before reporting them to the Savannah bug tracker?

G. Branden Robinson <gbranden>
Group administrator
Wed 01 Jun 2022 10:22:13 PM UTC, comment #5: 

  The line with "@PAGE@" refers to comment #2 line with
"tmac/troffrc.in", which is supposed to create the final "troffrc" with
the actual value of "PAGE" to define the string "paper", which is needed in
"papersize.tmac".

Bjarni Ingi Gislason <bjarniig>
Wed 01 Jun 2022 01:15:04 AM UTC, comment #4: 

First of all, comment #3 doesn't seem to have much to do with the original report (comment #0).

comment #3:

>   The "paper" register should only be defined for troff, insert for
> example the line
>
> .if t \
>
>   before the line:
>
> .do if !d paper .ds paper @PAGE@


I see no such line in my groff Git HEAD checkout, nor in my copy of the same file on my groff 1.22.4 installation.

If you're quoting papersize.tmac, it would seem your copy has significantly diverged.

https://git.savannah.gnu.org/cgit/groff.git/tree/tmac/papersize.tmac

Nevertheless, I have the following patch in preparation.


$ git diff
diff --git a/tmac/troffrc b/tmac/troffrc
index 59ee9c076..a2784d78d 100644
--- a/tmac/troffrc
+++ b/tmac/troffrc
@@ -57,10 +57,10 @@ troffrc!html
 .\" Set the input localization to English.
 .do mso en.tmac
 .
-.\" Handle paper formats.
-.do mso papersize.tmac
+.\" Handle paper formats on typesetting devices.
+.if t .do mso papersize.tmac
 .
-.\" Handle PS images.
+.\" Handle Encapsulated PostScript images.
 .do mso pspic.tmac
 .do mso pdfpic.tmac
 .


G. Branden Robinson <gbranden>
Group administrator
Wed 20 Apr 2022 02:38:15 AM UTC, comment #3: 

  The "paper" register should only be defined for troff, insert for
example the line

.if t \

  before the line:

.do if !d paper .ds paper @PAGE@

Bjarni Ingi Gislason <bjarniig>
Mon 11 Apr 2022 06:41:51 PM UTC, comment #2: 


comment #1:

>

[...]

> >   In the file "contrib/pdfmark/pdfmark.am" there is a flag
> > "PDFMARK_PFLAG"
>
> ...not in groff Git HEAD or the groff 1.22.4 tag, there isn't.
>
> Is this one of your customizations?
>

  No.
  This was removed in my branch and master's after my submission.
[...]

> Yes, and since `PAGE` is a build-time macro defining the default paper size for the formatter, it's superfluous to pass a `-dpaper` option to the formatter to assign the same value.
>

  The "PAGE" configuration variable does not change the default page
size (page_length) of the formatter, just that of the printers as
defined in the DESC files for the fonts.

  The value of "11" is hard-coded in the file "src/roff/troff/div.cpp"
(units_per_inch*11).

  The pagesize macro is called in the troffrc file but the "paper" is
not set, and so the default page size of the formatter is still the
hard-coded value (and the line length ".l").

  The question is: should the paper size and the page size (register
".p") be synchronised?

By adding to a version of "tmac/troffrc" (tmac/troffrc.in) something
like:

.do if !d paper .ds paper @PAGE@

  before the line ".do mso papersize.tmac"

  and to the "tmac.am" a line similar to "tmac/www.tmac"?

[...]

> What is deficient in this presentation?


See above.
[...]

> What is it you're asking for?

See above.

Bjarni Ingi Gislason <bjarniig>
Sun 10 Apr 2022 01:41:57 AM UTC, comment #1: 


original submission:

> Subject: add a PAPER_FLAG for groff when creating PostScript or PDF
> files
>
>   In the file "contrib/pdfmark/pdfmark.am" there is a flag
> "PDFMARK_PFLAG"


...not in groff Git HEAD or the groff 1.22.4 tag, there isn't.

Is this one of your customizations?

> to define the paper size with the options
> "-dpaper=$(PAGE) -P-p$(PAGE)" where "PAGE" is a configuration variable.


Yes, and since `PAGE` is a build-time macro defining the default paper size for the formatter, it's superfluous to pass a `-dpaper` option to the formatter to assign the same value.

The paper size used by the output driver is another matter, and discussed in detail in the groff(1) man page.


   Paper size
       In GNU roff, the page dimensions for the formatter troff and for
       output devices are handled separately.  In the formatter,
       requests are used to set the page length (.pl), page offset (or
       left margin, .po), and line length (.ll).  The right margin is
       not explicitly configured; the combination of page offset and
       line length provides the information necessary to derive it.  The
       papersize macro package, automatically loaded by troff, provides
       an interface for configuring page dimensions by convenient names,
       like “letter” or “A4”; see groff_tmac(5).  The default used by
       the formatter depends on its build configuration; in this
       installation, it is “a4”.

       It is up to each macro package to respect the page dimensions
       configured in this way.  Some offer alternative mechanisms.

       For each output device, the size of the output medium can be set
       in its DESC file.  Most also recognize a command‐line option -p
       to override the default dimensions and an option -l to use
       landscape orientation.  See groff_font(5) for a description of
       the papersize directive, which takes an argument of the same form
       as -p.  The output driver’s man page, such as grops(1), may also
       be helpful.  groff uses the command‐line option -P to pass
       options to output devices; for example, use the following for
       PostScript output on A4 paper in landscape orientation.

              groff -Tps -dpaper=a4l -P-pa4 -P-l -ms foo.ms > foo.ps


What is deficient in this presentation?

>   These options should also be used for groff to define the (printer's) page size
> for the output on discrete pages to synchronise the typesetting on a
> page and its expected size when printed.


Yes, that is what `-dpaper` and `-P-p` (where supported) are for.  Manipulating these flags is what permits such synchronicity.

What is it you're asking for?

G. Branden Robinson <gbranden>
Group administrator
Wed 30 Mar 2022 07:01:07 PM UTC, original submission:  

Subject: add a PAPER_FLAG for groff when creating PostScript or PDF
files

  In the file "contrib/pdfmark/pdfmark.am" there is a flag
"PDFMARK_PFLAG" to define the paper size with the options
"-dpaper=$(PAGE) -P-p$(PAGE)" where "PAGE" is a configuration variable.

  These options should also be used for groff to define the (printer's) page size
for the output on discrete pages to synchronise the typesetting on a
page and its expected size when printed.

Bjarni Ingi Gislason <bjarniig>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gbranden (Posted a comment)
  • -email is unavailable- added by bjarniig (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-06-03 gbranden StatusIn Progress Fixed
        Open/ClosedOpen Closed
        Planned ReleaseNone 1.23.0
    2022-06-01 gbranden CategoryNone Macro - others/general
        Item GroupNone Lint
    2022-06-01 gbranden StatusNeed Info In Progress
        Assigned toNone gbranden
        SummaryAdd a PAPER_FLAG for groff when creating PostScript or PDF files skip papersize.tmac on nroff devices
    2022-04-10 gbranden Severity3 - Normal 1 - Wish
        StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code