TABLE does not divide printWidth among its cells, so a two-cell table is 150 columns wide at printWidth 80
- Dominant language
- Macaulay2
- Stars
- 435
- Forks
- 297
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 11
Description
This issue was triaged from [`bugs/dan/formatting-TABLEs`](https://github.com/Macaulay2/M2/blob/388c1ff0ce30d83751dea7bc7eac77fdc1305dd7/bugs/dan/formatting-TABLEs), one of the 857 files removed from the pre-GitHub `bugs/` tree by [`d2c8d27826`](https://github.com/Macaulay2/M2/commit/d2c8d27826) and catalogued in [#36](https://github.com/Macaulay2/M2/issues/36). **The commentary below was written by Claude (Claude Opus 5, via Claude Code)**, not by @d-torrance, whose account posted it -- please weigh it accordingly.
### The original file, verbatim
```text
currently we aren't diminishing the printWidth at all while formatting tables:
i14 : info TABLE { "class" => "examples", TR { TD u , TD u }}
+-------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
o14 = |asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf|asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf|
|qwer qwer qwer qwer qwer qwer qwer qwer qwer qwer qwer qwer qwer qwer qwer qwer|qwer qwer qwer qwer qwer qwer qwer qwer qwer qwer qwer qwer qwer qwer qwer qwer|
|asdf asdf asdf asdf asdf |asdf asdf asdf asdf asdf |
|qwer qwer qwer qwer qwer |qwer qwer qwer qwer qwer |
+-------------------------------------------------------------------------------+-------------------------------------------------------------------------------+
i15 : printWidth
o15 = 80
```
### Where it stands today
A `TABLE` does not divide the available width among its cells, so the rendered net is as wide as the
sum of the cells regardless of `printWidth`.
```m2
i1 : needsPackage "Text";
i2 : printWidth = 80;
i3 : u = concatenate(16:"asdf "); -- 80 characters
i4 : n = net TABLE { TR { TD u, TD u }};
i5 : width n
o5 = 150
i6 : apply(unstack n, length)
o6 = {150, 80}
```
The `info` form is the same:
```m2
i7 : width info TABLE { "class" => "examples", TR { TD u, TD u }}
o7 = 151
```
Every line of that one is 151 characters wide, at `printWidth` 80.
### Why it matters more for `info` than for the terminal
Interactive output can be scrolled. The `info` form goes into the generated `.info` files, where the
reader has no horizontal scroll — and tables are used in documentation, `TABLE { "class" =>
"examples", ... }` being the standard wrapper for example blocks.
### Not the same as #1752
[#1752](https://github.com/Macaulay2/M2/issues/1752) is the other `net TABLE` report — one-line
tables rendering incorrectly, and `TR` options being printed as content — opened December 2020 and
closed February 2021. It never mentions width or `printWidth`, and the workaround discussed there,
`netList(..., Boxes => false, HorizontalSpace => 2)`, is about spacing rather than about fitting.
Recording that here so the two are not conflated.
`open` · disposition `issue` · source of truth: [`bug-triage/catalog.tsv`](https://github.com/d-torrance/M2/blob/bug-triage/bug-triage/catalog.tsv)
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the Text package and the TABLE, TR, TD, net, and info entry points shown in the reproduction; run the examples with printWidth set to 80. Trace how available width is assigned to table cells, then verify that both net TABLE and info TABLE output fit within printWidth rather than expanding to the combined cell width.
Written by the indexing model from the issue text.
Assessment
- Domain
- cli, documentation
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100