bugGNU roff - Bugs: bug #55754, tbl table with embedded EQ/EN...

 
 

bug #55754: tbl table with embedded EQ/EN equations does not format correctly

Submitter:  Graham <leiyo7ua>
Submitted:  Thu 21 Feb 2019 03:37:33 PM UTC
   
 
Category:  Preprocessor tbl Severity:  3 - Normal
Item Group:  Incorrect behaviour Status:  Invalid
Privacy:  Public Assigned to:  gbranden
Open/Closed:  Closed Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 12 Jun 2021 01:54:06 PM UTC, comment #2: 

Hi Graham,

There wasn't really a bug here, but our documentation did not point out something that the AT&T tbl documentation from the 1970s made clear: you can't embed .EQ/.EN macros inside a tbl(1) table.

However, it was easy to miss, being buried among a list of caveats.

"Note that when eqn and tbl are used together on the same file tbl should be used first. If there are no equations within tables, either order works, but it is usually faster to run tbl first, since eqn normally produces a larger expansion of the input than tbl. However, if there are equations within tables (using the delim mechanism in eqn), tbl must be first or the output will be scrambled. Users must also beware of using equations in n-style columns; this is nearly always wrong, since tbl attempts to split numerical format items into two parts and this is not possible with equations. The user can defend against this by giving the delim(xx) table option; this prevents splitting of numerical columns within the delimiters. For example, if the eqn delimiters are $$, giving delim($$) a numerical column such as "1245 $+- 16$" will be divided after 1245, not after 16."

I've prepared a change to our tbl(1) man page to clarify this issue.


commit c86962a3207558ec79763dcf1294916a08c0d40b (HEAD -> master)
Author:     G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Jun 12 02:56:52 2021 +1000
Commit:     G. Branden Robinson <g.branden.robinson@gmail.com>
CommitDate: Sat Jun 12 02:57:41 2021 +1000

    tbl(1): Advise users to avoid .EQ calls in tables.

    Suggest alternative.  Prompted by Savannah #55754.

diff --git a/src/preproc/tbl/tbl.1.man b/src/preproc/tbl/tbl.1.man
index 370f3843..c54279a9 100644
--- a/src/preproc/tbl/tbl.1.man
+++ b/src/preproc/tbl/tbl.1.man
@@ -1025,6 +1025,20 @@ should always be called before
 .RI ( groff (@MAN1EXT@)
 automatically takes care of the correct order of preprocessors).
 .
+Don't call the
+.B EQ
+and
+.B EN
+macros within tables;
+instead,
+set up delimeters in your
+.I eqn \" generic
+input and use the
+.B delim()
+table option so that
+.IR \%@g@tbl
+will recognize them.
+.
 .
 .\" ====================================================================
 .SS "GNU \f[I]tbl\f[] enhancements"


Here is an updated version of your table which implements the advice above.  I also removed your unnecessary use of text blocks for all of the table cells.  This had two benefits: (1) it makes the source document mush shorter and easier to read and (2) it makes the final table row (for "Break-Even Point") vertically centered relative to the tall equation cell to its right.

This is still an ms document.

I have attached the results of my formatting it with groff 1.22.4, using the command "groff -t -e -ms tbl-gbr.ms > tbl-gbr.ps".


.EQ
delim @@
.EN
.TS
tab(#) center delim(@@);
cp-3 | cp-3
l | cw(3i) .
_
.sp 5p
DEFINITIONS#EQUATION
.sp 5p
=
.sp 5p
TR = Total Revenue#@TR mark ~=~ TC@
FC = Fixed Costs#@(P times X) lineup ~=~ FC ~+~ (V times X)@
V = Variable Costs#@(P times X) ~-~ (V times X) lineup ~=~ FC@
P = Price#@(PX ~-~ VX) lineup ~=~ FC@
X = Unit Sales#@X(P - V) lineup ~=~ FC@
BEP = Break-Even Point#@BEP ~=~ X lineup ~=~ FC over left ( P - V right )@
.sp 5p
_
.TE



G. Branden Robinson <gbranden>
Group administrator
Sat 23 Feb 2019 08:26:37 PM UTC, comment #1: 

  1) Make the software produce diagnostics.

  2) Your example is unnecessary big for finding a bug.
  Make the table as simple and short as possible.

  3) There is a bug in the ms-macros, that handles the macros .EQ and
.EN in the table.
  Workaround is to use delimiters (usually $) in the table.

  4) .EQ L is not handled correctly (test without the 'L').

Bjarni Ingi Gislason <bjarniig>
Thu 21 Feb 2019 03:37:33 PM UTC, original submission:  


This maybe a bug or I maybe a fool. :)

I have attached two files.
tbl.tbl
tbl.ms

If the file tbl.tbl is processed with groff as follows it formats correctly.
groff -t -e tbl.tbl

If the file tbl.tbl is processed with groff as follows the formating of the table falls apart. The only difference in the files is the addition of the commands for the ms macro. I have also tried processing the file with groffer however it does not pickup the ms macro commands. If groffer is forced to
interpret the ms commands with the option -ms the formating of the table is destroyed. 
groff -t -e -ms tbl.ms

It is possible I am doing something wrong. However, it is the only table in the file that is causing problems.

GNU groff version 1.22.3
Copyright (C) 2014 Free Software Foundation, Inc.
GNU groff comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of groff and its subprograms
under the terms of the GNU General Public License.
For more information about these matters, see the file
named COPYING.

called subprograms:

GNU grops (groff) version 1.22.3
GNU troff (groff) version 1.22.3

Graham <leiyo7ua>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #51551:  tbl-gbr.ps.png added by gbranden (27KiB - image/png)
file #46325:  tbl.tbl added by leiyo7ua (544B - application/octet-stream)
file #46326:  tbl.ms added by leiyo7ua (734B - text/x-troff-ms)

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    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-01-22 gbranden CategoryMacro ms Preprocessor tbl
        Item GroupNone Incorrect behaviour
        SummaryTable with eqn does not format correctly. tbl table with embedded EQ/EN equations does not format correctly
    2021-06-12 gbranden Attached File- Added tbl-gbr.ps.png, #51551
        StatusNone Invalid
        Assigned toNone gbranden
        Open/ClosedOpen Closed
    2019-02-21 leiyo7ua Attached File- Added tbl.tbl, #46325
        Attached File- Added tbl.ms, #46326
        Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code