1.0.3: pictures fill the free width or height of their page, long table heads stay with their table
A picture takes the full line width or the full free height, whichever it reaches first; a drawing moves to the next page only below picturekeep of its full-page size; inside a sentence at most half the page, inside a figure at most the top float share. A long table is marked directly in front of its first head, so a page break before it prints no head or foot on the heading's page. Review findings fixed, full suite green. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d7aac52ac7
commit
5f56145fb3
16 files changed
+667
-91
No files matched your search
@@ -2,6 +2,20 @@
|
||||
|
||||
Defects of the suite, each with its cause, its correction and the test that measures it.
|
||||
|
||||
## A table header appears before its heading
|
||||
|
||||
- **Found:** 2026-11-18, a table at a page boundary printed its header before its heading and again below it; a table with a continuation footer could also print that footer before the table.
|
||||
- **Cause:** longtable had installed its output routine when TeX selected a break before the heading, so it treated that break as a table continuation.
|
||||
- **Fix:** every long table gets a number of its own, set as a mark directly in front of its first head, and continuation output prints a header or footer only when the preceding page contains the current table. The mark stands after longtable's own break in front of the table, so a break there leaves no head or foot on the page of the heading, and a table with an empty `\LTcaptype`, which longtable's own counter skips, still gets its number. A patch that no longer matches a longtable release warns instead of stopping every build.
|
||||
- **Test:** `tests/layout.py` › `longtable_boundary` checks both boundary cases and all rows, headers and footers of a separate multi-page table, and a table whose first rows are joined at the foot of a page (`tests/longtable-joined.tex`): it moves with its heading, with one head, no foot before it and all four rows.
|
||||
|
||||
## A picture shrinks until unreadable or leaves free room empty
|
||||
|
||||
- **Found:** 2026-11-18, twice: a diagram with a detailed legend became too small to read after preceding content moved it lower on the page; and a tall swimlane diagram under the title block stopped at half the text height and left the lower half of its page empty, with nothing after it on that page.
|
||||
- **Cause:** the picture scaler reduced lying vector diagrams to any remaining page height, and capped upright pictures at half the text height whatever the page still had free. A picture made as high as the whole text height also did not fit under the invisible material a document starts with, and left its first page empty.
|
||||
- **Fix:** every picture takes the full line width or the full free height, whichever it reaches first. A drawing moves to the next page and fills it only where it would keep less than `picturekeep` (default half) of its size on a page of its own, or where less than a quarter of the page is free; a raster keeps its remaining-space and enlargement limits. The height of a page of its own is the text height less the space between paragraphs and the line the picture stands on. Inside a sentence a picture takes at most half the page, because its line would otherwise break the paragraph; inside a figure at most the top share LaTeX allows a float, less the caption, because a larger figure waits for the end of the document.
|
||||
- **Test:** `tests/layout.py` › `pictures` (F6.5, F6.7): an upright picture alone fills the text height, a lying one under 28 lines and an upright one under 10 lines fill the free room of their page, an upright one under 25 lines moves and fills the next page, the picture under 10 lines ends at the foot of the text, with `picturekeep=0.3` the picture under 25 lines stays, a lying picture under 40 lines moves, a picture inside a sentence stays within half the page, and an upright figure with `[!ht]` and with `[ht]` under 25 lines stands on the next page; isolated original/fixed comparison.
|
||||
|
||||
## Search through every folder below the document
|
||||
|
||||
- **Found:** 2026-11-14, converting a document at the root of a checkout of 68377 folders: the conversion took 56 minutes 24 seconds, of which the probe 12 minutes 39 seconds and the first of the two LaTeX runs of the document 21 minutes 41 seconds.
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
- 2026-11-19 **1.0.3**
|
||||
- A table beginning at a page break no longer prints a continuation header or footer before its heading; headers and footers still appear on pages that continue the table.
|
||||
- A picture fills the full line width or the full free height of its page, whichever it reaches first, upright pictures included, which stopped at half the text height before. A diagram that would keep less than half its full-page size in the free room moves to the next page instead of shrinking until its labels are unreadable; the share is the new option `picturekeep`. A picture inside a sentence takes at most half the page, and a picture inside a figure at most the share of a page LaTeX allows a float at the top, less its caption, so a large figure no longer waits for the end of the document. Raster pictures retain their existing remaining-space behaviour.
|
||||
|
||||
- 2026-11-14 **1.0.2**
|
||||
- An HTML table in a document no longer makes the converting machine open an address: an `<iframe>` in a cell made the build ask the page it names and paste it into the PDF
|
||||
- The label of a form field stands on the page as it is written: a brace, a backslash, `%`, `&` or `#` in it stopped the build or was read as LaTeX, which could put a file of the machine into the PDF
|
||||
|
||||
+4
-4
@@ -81,13 +81,13 @@ The writer wants a reader to know where he is, on every page.
|
||||
## F6 Tables and pictures
|
||||
|
||||
- **F6.1** `\businesstablehead` marks a head cell, `\businessrowrule` draws the line between two rows.
|
||||
- **F6.2** A table that runs over a page break leaves no error in the build log.
|
||||
- **F6.2** A table that runs over a page break repeats its header on continuation pages without printing one before its heading, and leaves no error in the build log.
|
||||
- **F6.9** The room over and under a rule of a table follows the face the company set, not the one LaTeX starts with.
|
||||
- **F6.3** A picture goes where it fits and carries its caption under it without a number, centred under the picture over one line and over several.
|
||||
- **F6.5** `\businessgraphic` sets a picture at the size of the family: upright the full width of the line and at most half the text height, lying the full free height of the page and at most the full width, both centred and in proportion. A picture given a size of its own keeps it.
|
||||
- **F6.5** `\businessgraphic` sets a picture centred and in proportion, upright or lying: the full line width or the full height still free on the page, whichever it reaches first. Inside a sentence a picture takes at most half the page; inside a figure at most the share of a page LaTeX gives a float at the top of a page, less its caption. A picture given a size of its own keeps it.
|
||||
- **F6.6** A raster picture is enlarged at most twice over; a drawing as far as the rules allow.
|
||||
- **F6.7** A picture that would leave more than a quarter of the page empty is made small enough to stand on it, together with its caption. Where less than a quarter is left, the picture moves to the next page at its full size, a lying one too, and the room it leaves stays empty at the foot of the page instead of being spread over its spaces.
|
||||
- **F6.8** The six shares of a picture are options of the template.
|
||||
- **F6.7** A picture that does not fit at its full-page size shrinks into the free room of its page, with its caption, when more than a quarter of the page is free; a drawing only as long as it keeps at least half its full-page size, otherwise it moves to the next page and fills it. The room left at the foot stays empty instead of being spread over its spaces.
|
||||
- **F6.8** The seven shares of a picture are options of the template.
|
||||
- **F6.4** A picture directly under a heading does not float away from it.
|
||||
|
||||
## F7 Signs
|
||||
|
||||
@@ -281,21 +281,21 @@ Use `\businessgraphic` for template-controlled image sizing:
|
||||
\businessgraphic[width=4cm]{diagram}
|
||||
```
|
||||
|
||||
Default sizing depends on orientation:
|
||||
Default sizing:
|
||||
|
||||
- Portrait images use up to the full line width and half the text height.
|
||||
- Landscape images use up to the full line width and the free height remaining on the page.
|
||||
- Every image, portrait or landscape, takes the full line width or the full height still free on the current page, whichever it reaches first. Inside a sentence an image takes at most half the page; inside a figure at most the top share LaTeX allows a float, less the caption.
|
||||
- Images retain their aspect ratio and are centred.
|
||||
- If an image would leave no more than 25% of a page empty, it moves to the next page. Otherwise, it is reduced to fit the current page.
|
||||
- An image that does not fit at its full-page size is reduced into the free room when more than 25% of the page is free. A vector graphic is reduced only while it keeps at least half its full-page size; otherwise it moves to the next page and fills it.
|
||||
- Vector graphics may use the full calculated size. Raster images are enlarged by at most a factor of two.
|
||||
|
||||
| Option | Default | Meaning |
|
||||
| --- | ---: | --- |
|
||||
| `portraitwidth` | `1` | Maximum share of the line width for portrait images |
|
||||
| `portraitheight` | `0.5` | Maximum share of the text height for portrait images |
|
||||
| `portraitheight` | `1` | Maximum share of the free height for portrait images |
|
||||
| `landscapewidth` | `1` | Maximum share of the line width for landscape images |
|
||||
| `landscapeheight` | `1` | Maximum share of the remaining page height |
|
||||
| `pictureempty` | `0.25` | Maximum empty page share before an image is reduced |
|
||||
| `landscapeheight` | `1` | Maximum share of the free height for landscape images |
|
||||
| `pictureempty` | `0.25` | Page share that must be free before an image is reduced into it |
|
||||
| `picturekeep` | `0.5` | Smallest share of its full-page size a vector graphic keeps before it moves to the next page |
|
||||
| `picturezoom` | `2` | Maximum enlargement factor for raster images |
|
||||
|
||||
Markdown conversion applies these rules automatically.
|
||||
|
||||
@@ -110,9 +110,13 @@ The distance under the title block is the same whether the document opens with a
|
||||
|
||||
A heading directly under a heading stays with it, over every distance to the foot of the page and in three forms: with text under the second heading, with a table, and with a picture. The second heading used to reserve its own eight lines, and that reservation broke the page between the two — measured at three of sixteen distances, where the upper heading stood alone on a page with nothing under it.
|
||||
|
||||
### A table at a page boundary
|
||||
|
||||
`tests/layout.py` builds neutral boundary cases where longtable previously printed a continuation header or footer before the heading. It checks their placement and all 100 rows, first and repeated headers, and continuation and final footers of a separate multi-page table. The isolated originals fail their boundary checks; the corrected template passes them. A third fixture joins the first rows of a table with `\\*` at the foot of a page and checks that the table moves with its heading, prints neither head nor foot before it, and keeps all four rows with one head.
|
||||
|
||||
### The size of a picture
|
||||
|
||||
Three pictures, each alone on its page, measured at the ink: an upright one at half the text height, a lying one at the full width of the line, a raster one at the width its own size allows. Every one of them centred to the point. A fourth document gives a raster picture a tenth of enlargement by option and measures that it stays there, and a fifth puts a picture where a third of the page is left and measures that it is made small enough to stand on it.
|
||||
Three pictures, each alone on its page, measured at the ink: an upright one at the full text height, a lying one at the full width of the line, a raster one at the width its own size allows. Every one of them is centred. A fourth document limits raster enlargement to a tenth and measures that limit. A fifth puts a lying vector under 28 lines and checks that it stays and fills the free room, narrower than the line. A sixth puts an upright picture under 10 lines and checks that it fills the free height beyond half the text height. A seventh puts an upright picture under 25 lines, where it would keep less than half its size, and checks that it moves to the next page and fills it; the sixth picture ends within two lines of where the seventh ends, at the foot of the text. With `picturekeep=0.3` the seventh picture stays on its page. A lying picture under 40 lines, where less than a quarter of the page is free, moves to the next page. An upright picture inside a sentence stays at most half the page high. An upright picture in a figure under 25 lines, followed by two pages of text, stands on the second page and does not wait for the end, placed `[!ht]` and placed `[ht]`. The Markdown converter test separately checks a raster reduced to fit with its caption.
|
||||
|
||||
### The title rule
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "business-suite",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"description": "Generic LaTeX template suite: document, letter and presentation, configured by a corporate identity",
|
||||
"scripts": {
|
||||
"build": "npm run build:example && npm run build:markdown",
|
||||
|
||||
+197
-17
@@ -237,8 +237,9 @@ ZOOM = r"""\documentclass[a4paper,10pt]{article}
|
||||
"""
|
||||
|
||||
|
||||
# A picture that does not fit into what is left of the page: half a page of
|
||||
# text, then a picture that would take a whole one.
|
||||
# A picture that does not fit into what is left of the page at full width: most
|
||||
# of a page of text, then a lying picture. It keeps more than half its size in
|
||||
# the free room, so it stays and fills that room.
|
||||
PICTUREROOM = r"""\documentclass[a4paper,10pt]{article}
|
||||
\usepackage{nordwind}
|
||||
\begin{document}
|
||||
@@ -247,6 +248,51 @@ PICTUREROOM = r"""\documentclass[a4paper,10pt]{article}
|
||||
\businessgraphic{example-image-16x9}
|
||||
\end{document}
|
||||
"""
|
||||
# An upright picture under a few lines of text: it fills the free height of
|
||||
# the page instead of stopping at half the text height.
|
||||
UPRIGHTROOM = PICTUREROOM.replace(
|
||||
"Lorem ipsum dolor sit amet, consetetur sadipscing elitr.\\par\n" * 28,
|
||||
"Lorem ipsum dolor sit amet, consetetur sadipscing elitr.\\par\n" * 10
|
||||
).replace("example-image-16x9", "example-image-9x16")
|
||||
# An upright picture under so much text that the free room would keep less than
|
||||
# half of its size on a page of its own: a drawing that small is hard to read,
|
||||
# so it moves to the next page and fills it.
|
||||
PICTUREKEEP = PICTUREROOM.replace(
|
||||
"Lorem ipsum dolor sit amet, consetetur sadipscing elitr.\\par\n" * 28,
|
||||
"Lorem ipsum dolor sit amet, consetetur sadipscing elitr.\\par\n" * 25
|
||||
).replace("example-image-16x9", "example-image-9x16")
|
||||
# The same with a lower share: at 0.3 the upright picture keeps enough of its
|
||||
# size in the room under 25 lines and stays.
|
||||
PICTUREKEEPOPTION = PICTUREKEEP.replace(r"\usepackage{nordwind}",
|
||||
r"\usepackage[picturekeep=0.3]{nordwind}")
|
||||
# A lying picture under 40 lines, where less than a quarter of the page is
|
||||
# free: it moves to the next page whatever it would keep.
|
||||
PICTUREEMPTY = PICTUREROOM.replace(
|
||||
"Lorem ipsum dolor sit amet, consetetur sadipscing elitr.\\par\n" * 28,
|
||||
"Lorem ipsum dolor sit amet, consetetur sadipscing elitr.\\par\n" * 40)
|
||||
# An upright picture inside a sentence: its line may not grow as tall as the
|
||||
# page, so it takes at most half the page.
|
||||
PICTUREINLINE = r"""\documentclass[a4paper,10pt]{article}
|
||||
\usepackage{nordwind}
|
||||
\begin{document}
|
||||
\pagestyle{empty}
|
||||
Before \businessgraphic{example-image-9x16} after.
|
||||
\end{document}
|
||||
"""
|
||||
# An upright picture in a figure under 25 lines, followed by two pages of text:
|
||||
# the figure must stand on the next page and not wait for the end.
|
||||
PICTUREFLOAT = r"""\documentclass[a4paper,10pt]{article}
|
||||
\usepackage{nordwind}
|
||||
\begin{document}
|
||||
\pagestyle{empty}
|
||||
""" + "Lorem ipsum dolor sit amet, consetetur sadipscing elitr.\\par\n" * 25 + r"""
|
||||
\begin{figure}[!ht]
|
||||
\businessgraphic{example-image-9x16}
|
||||
\caption{Upright figure}
|
||||
\end{figure}
|
||||
""" + "Text after the figure, line after line.\\par\n" * 120 + r"""
|
||||
\end{document}
|
||||
"""
|
||||
|
||||
|
||||
# A document that opens with a heading, and the same one that opens with a
|
||||
@@ -916,9 +962,9 @@ def pairs(check):
|
||||
def pictures(check):
|
||||
"""What a picture takes of the page, measured at the ink on the page.
|
||||
|
||||
Upright: the full width of the line, at most half the height of the text.
|
||||
Lying: the full height that is free, at most the full width. A raster of
|
||||
pixels is enlarged twice over and no further. Every one of them centred.
|
||||
Upright and lying: the full width of the line or the full free height,
|
||||
whichever is reached first. A raster of pixels is enlarged twice over and
|
||||
no further. Every one of them centred.
|
||||
"""
|
||||
pdf, _ = build(support.write("pictures.tex", PICTURES), EXAMPLES)
|
||||
for number, (name, rule) in enumerate((
|
||||
@@ -942,9 +988,12 @@ def pictures(check):
|
||||
# A4 is 597.5 points wide, the text block 540.6 with 28.35 on each
|
||||
# side, and the text is 713.9 points high.
|
||||
if rule == "height":
|
||||
check.that(abs(height - 0.5 * 713.9) < 12,
|
||||
# The text height less the space between paragraphs and the line
|
||||
# the picture stands on, which a 10 point document keeps under
|
||||
# two lines of 12 points.
|
||||
check.that(713.9 - 24 < height <= 713.9,
|
||||
f"the upright picture is {height:.1f} points high and "
|
||||
"not the half of the text height it may take")
|
||||
"does not fill the 713.9 of the text height")
|
||||
if rule == "width":
|
||||
check.that(abs(width - 540.6) < 4,
|
||||
f"the lying picture is {width:.1f} points wide against "
|
||||
@@ -970,22 +1019,152 @@ def pictures(check):
|
||||
check.that(abs(width - 441.6) < 4,
|
||||
f"the raster picture is {width:.1f} points wide, and a tenth "
|
||||
"over its own 401.5 is 441.6")
|
||||
# And the picture that does not fit into what is left of the page stays on
|
||||
# it, small enough to fill what is there.
|
||||
# A lying vector picture that keeps more than half its size in the free
|
||||
# room stays on the page and fills that room: narrower than the line, wider
|
||||
# than half of it, its foot at the foot of the text.
|
||||
room, _ = build(support.write("pictureroom.tex", PICTUREROOM), EXAMPLES)
|
||||
check.that(support.pages(room) == 1,
|
||||
f"the page with the picture broke into {support.pages(room)} "
|
||||
"pages instead of fitting the picture into what was left")
|
||||
f"the vector picture occupied {support.pages(room)} pages "
|
||||
"instead of filling the free room of the first")
|
||||
if support.pages(room) == 1:
|
||||
page = Page(room, 1)
|
||||
factor = 72.0 / page.dpi
|
||||
tallest = max(bands(page), key=lambda band: band[-1] - band[0])
|
||||
high = (tallest[-1] - tallest[0] + 1) * factor
|
||||
# At the full width of the line the picture is 304 points high, and
|
||||
# what was left of the page is less than that.
|
||||
check.that(high < 300,
|
||||
f"the picture is {high:.1f} points high, so it was not made "
|
||||
"small enough for the room that was left")
|
||||
columns = page.ink_columns(tallest[0], tallest[-1] + 1)
|
||||
width = (columns[-1] - columns[0] + 1) * factor
|
||||
check.that(0.5 * 540.6 < width < 540.6 - 4,
|
||||
f"the vector picture is {width:.1f} points wide and does "
|
||||
"not fill the free room under the text")
|
||||
# An upright picture under a few lines fills the free height of the page.
|
||||
upright, _ = build(support.write("uprightroom.tex", UPRIGHTROOM), EXAMPLES)
|
||||
check.that(support.pages(upright) == 1,
|
||||
f"the upright picture occupied {support.pages(upright)} pages "
|
||||
"instead of filling the free room of the first")
|
||||
upright_foot = None
|
||||
if support.pages(upright) == 1:
|
||||
page = Page(upright, 1)
|
||||
factor = 72.0 / page.dpi
|
||||
tallest = max(bands(page), key=lambda band: band[-1] - band[0])
|
||||
height = (tallest[-1] - tallest[0] + 1) * factor
|
||||
upright_foot = tallest[-1] * factor
|
||||
check.that(height > 0.6 * 713.9,
|
||||
f"the upright picture is {height:.1f} points high and "
|
||||
"stops at half the text height instead of filling the room")
|
||||
# An upright picture that would keep less than half its size in the free
|
||||
# room moves to the next page and fills it.
|
||||
keep, _ = build(support.write("picturekeep.tex", PICTUREKEEP), EXAMPLES)
|
||||
check.that(support.pages(keep) == 2,
|
||||
f"the upright picture occupied {support.pages(keep)} pages "
|
||||
"instead of moving to the next page")
|
||||
if support.pages(keep) == 2:
|
||||
page = Page(keep, 2)
|
||||
factor = 72.0 / page.dpi
|
||||
tallest = max(bands(page), key=lambda band: band[-1] - band[0])
|
||||
height = (tallest[-1] - tallest[0] + 1) * factor
|
||||
check.that(713.9 - 24 < height <= 713.9,
|
||||
f"the moved picture is {height:.1f} points high and does "
|
||||
"not fill the next page")
|
||||
# A picture that fills the room ends where a picture that fills a
|
||||
# whole page ends: at the foot of the text.
|
||||
if upright_foot is not None:
|
||||
keep_foot = tallest[-1] * factor
|
||||
check.that(abs(upright_foot - keep_foot) < 24,
|
||||
f"the upright picture ends {keep_foot - upright_foot:.1f}"
|
||||
" points above the foot of the text instead of "
|
||||
"filling the free room")
|
||||
# With `picturekeep=0.3` the same picture keeps enough and stays.
|
||||
option, _ = build(support.write("picturekeepoption.tex", PICTUREKEEPOPTION),
|
||||
EXAMPLES)
|
||||
check.that(support.pages(option) == 1,
|
||||
f"with picturekeep=0.3 the picture occupied "
|
||||
f"{support.pages(option)} pages instead of staying in the room")
|
||||
# Under 40 lines less than a quarter of the page is free: the picture moves.
|
||||
empty, _ = build(support.write("pictureempty.tex", PICTUREEMPTY), EXAMPLES)
|
||||
check.that(support.pages(empty) == 2,
|
||||
f"the picture under 40 lines occupied {support.pages(empty)} "
|
||||
"pages instead of moving to the next page")
|
||||
# Inside a sentence a picture takes at most half the page.
|
||||
inline, _ = build(support.write("pictureinline.tex", PICTUREINLINE), EXAMPLES)
|
||||
page = Page(inline, 1)
|
||||
factor = 72.0 / page.dpi
|
||||
tallest = max(bands(page), key=lambda band: band[-1] - band[0])
|
||||
height = (tallest[-1] - tallest[0] + 1) * factor
|
||||
check.that(support.pages(inline) == 1 and height <= 0.5 * 713.9 + 2,
|
||||
f"the picture inside a sentence is {height:.1f} points high, "
|
||||
"over half the page")
|
||||
# A figure that moves stands on the next page and does not wait for the end.
|
||||
figure, _ = build(support.write("picturefloat.tex", PICTUREFLOAT), EXAMPLES)
|
||||
pages = support.text(figure).split("\f")
|
||||
where = [number for number, text in enumerate(pages, start=1)
|
||||
if "Upright figure" in text]
|
||||
check.that(where == [2] and support.pages(figure) >= 3,
|
||||
f"the upright figure stands on page(s) {where} of "
|
||||
f"{support.pages(figure)} instead of the second")
|
||||
# The same figure placed `[ht]`, without `!`, does not wait for the end either.
|
||||
plain_float, _ = build(support.write("picturefloatht.tex",
|
||||
PICTUREFLOAT.replace("[!ht]", "[ht]")),
|
||||
EXAMPLES)
|
||||
pages = support.text(plain_float).split("\f")
|
||||
where = [number for number, text in enumerate(pages, start=1)
|
||||
if "Upright figure" in text]
|
||||
check.that(where == [2] and support.pages(plain_float) >= 3,
|
||||
f"the upright figure placed [ht] stands on page(s) {where} of "
|
||||
f"{support.pages(plain_float)} instead of the second")
|
||||
|
||||
|
||||
def longtable_boundary(check):
|
||||
"""A table head must not precede its heading at a page boundary."""
|
||||
fixture = os.path.join(support.ROOT, "tests", "longtable-boundary.tex")
|
||||
pdf, _ = build(fixture, EXAMPLES)
|
||||
pages = support.text(pdf).split("\f")
|
||||
heading_pages = [page for page in pages if "Table introduction" in page]
|
||||
check.that(len(heading_pages) == 1, "table introduction is missing or repeated")
|
||||
if len(heading_pages) == 1:
|
||||
page = heading_pages[0]
|
||||
check.that(page.count("Column name") == 1 and
|
||||
page.index("Table introduction") < page.index("Column name"),
|
||||
"table header is repeated or appears before its heading")
|
||||
continuations = [page for page in pages if re.search(r"Entry\s+\d+", page)]
|
||||
check.that(len(continuations) >= 2 and all(page.count("Continued name") == 1
|
||||
for page in continuations),
|
||||
"a long table page lacks its continuation header")
|
||||
entries = re.findall(r"Entry\s+(\d+)", "\n".join(continuations))
|
||||
check.that(entries == [str(i) for i in range(100)],
|
||||
"long table entries are missing, duplicated or out of order")
|
||||
fixture = os.path.join(support.ROOT, "tests", "longtable-feet.tex")
|
||||
pdf, _ = build(fixture, EXAMPLES)
|
||||
pages = support.text(pdf).split("\f")
|
||||
check.that("Table introduction" in support.text(pdf),
|
||||
"the heading of the boundary table is missing")
|
||||
before, _, after = support.text(pdf).partition("Table introduction")
|
||||
check.that("Boundary foot" not in before and "Boundary repeated" not in before,
|
||||
"a continuation header or footer appears before the table")
|
||||
check.that(after.count("Boundary first") == 1 and
|
||||
after.count("Boundary final") == 1,
|
||||
"the first header or final footer is missing")
|
||||
continuations = [page for page in pages if re.search(r"Entry\s+\d+", page)]
|
||||
check.that(len(continuations) == 2 and
|
||||
"Long first" in continuations[0] and "Long foot" in continuations[0] and
|
||||
"Long repeated" in continuations[1] and "Long final" in continuations[1],
|
||||
"long table first/continuation heads or feet are missing")
|
||||
entries = re.findall(r"Entry\s+(\d+)", "\n".join(continuations))
|
||||
check.that(entries == [str(i) for i in range(100)],
|
||||
"long table with feet lost or duplicated entries")
|
||||
# A table whose first rows are joined at the foot of a page moves with its
|
||||
# heading, and neither its head nor its foot is printed before it.
|
||||
fixture = os.path.join(support.ROOT, "tests", "longtable-joined.tex")
|
||||
pdf, _ = build(fixture, EXAMPLES)
|
||||
text = support.text(pdf)
|
||||
check.that("Joined introduction" in text,
|
||||
"the heading of the joined table is missing")
|
||||
before, _, after = text.partition("Joined introduction")
|
||||
check.that("Joined name" not in before and "Joined foot" not in before,
|
||||
"a head or foot of the joined table appears before its heading")
|
||||
check.that(after.count("Joined name") == 1 and "Joined foot" not in after
|
||||
and all(word in after for word in
|
||||
("First joined", "Second joined", "Third joined",
|
||||
"Fourth joined")),
|
||||
"the joined table lost a row or printed its head or foot twice")
|
||||
|
||||
|
||||
def main():
|
||||
@@ -1005,6 +1184,7 @@ def main():
|
||||
left_edge(check)
|
||||
together(check)
|
||||
levels(check)
|
||||
longtable_boundary(check)
|
||||
return check.done()
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
\documentclass[a4paper,10pt]{article}
|
||||
\usepackage{nordwind}
|
||||
\begin{document}
|
||||
Fixture opening.\clearpage
|
||||
Previous content.\par\penalty10000
|
||||
\dimen0=\textheight
|
||||
\advance\dimen0-11\normalbaselineskip
|
||||
\advance\dimen0-\pagetotal
|
||||
\vskip\dimen0 plus10\normalbaselineskip minus3\normalbaselineskip
|
||||
\penalty10000
|
||||
\subsubsection{Table introduction}
|
||||
\begin{longtable}{ll}
|
||||
\toprule
|
||||
\businesstablehead{Column name} & \businesstablehead{Column value}\\
|
||||
\midrule\endhead
|
||||
\bottomrule\endlastfoot
|
||||
\rule{0pt}{2\normalbaselineskip}First entry & One\\\businessrowrule
|
||||
\rule{0pt}{2\normalbaselineskip}Second entry & Two\\\businessrowrule
|
||||
\rule{0pt}{2\normalbaselineskip}Third entry & Three\\
|
||||
\end{longtable}
|
||||
\clearpage
|
||||
\section{Long continuation}
|
||||
\begin{longtable}{ll}
|
||||
\toprule
|
||||
\businesstablehead{Continued name} & \businesstablehead{Continued value}\\
|
||||
\midrule\endhead
|
||||
\bottomrule\endlastfoot
|
||||
Entry 0 & Value\\
|
||||
Entry 1 & Value\\
|
||||
Entry 2 & Value\\
|
||||
Entry 3 & Value\\
|
||||
Entry 4 & Value\\
|
||||
Entry 5 & Value\\
|
||||
Entry 6 & Value\\
|
||||
Entry 7 & Value\\
|
||||
Entry 8 & Value\\
|
||||
Entry 9 & Value\\
|
||||
Entry 10 & Value\\
|
||||
Entry 11 & Value\\
|
||||
Entry 12 & Value\\
|
||||
Entry 13 & Value\\
|
||||
Entry 14 & Value\\
|
||||
Entry 15 & Value\\
|
||||
Entry 16 & Value\\
|
||||
Entry 17 & Value\\
|
||||
Entry 18 & Value\\
|
||||
Entry 19 & Value\\
|
||||
Entry 20 & Value\\
|
||||
Entry 21 & Value\\
|
||||
Entry 22 & Value\\
|
||||
Entry 23 & Value\\
|
||||
Entry 24 & Value\\
|
||||
Entry 25 & Value\\
|
||||
Entry 26 & Value\\
|
||||
Entry 27 & Value\\
|
||||
Entry 28 & Value\\
|
||||
Entry 29 & Value\\
|
||||
Entry 30 & Value\\
|
||||
Entry 31 & Value\\
|
||||
Entry 32 & Value\\
|
||||
Entry 33 & Value\\
|
||||
Entry 34 & Value\\
|
||||
Entry 35 & Value\\
|
||||
Entry 36 & Value\\
|
||||
Entry 37 & Value\\
|
||||
Entry 38 & Value\\
|
||||
Entry 39 & Value\\
|
||||
Entry 40 & Value\\
|
||||
Entry 41 & Value\\
|
||||
Entry 42 & Value\\
|
||||
Entry 43 & Value\\
|
||||
Entry 44 & Value\\
|
||||
Entry 45 & Value\\
|
||||
Entry 46 & Value\\
|
||||
Entry 47 & Value\\
|
||||
Entry 48 & Value\\
|
||||
Entry 49 & Value\\
|
||||
Entry 50 & Value\\
|
||||
Entry 51 & Value\\
|
||||
Entry 52 & Value\\
|
||||
Entry 53 & Value\\
|
||||
Entry 54 & Value\\
|
||||
Entry 55 & Value\\
|
||||
Entry 56 & Value\\
|
||||
Entry 57 & Value\\
|
||||
Entry 58 & Value\\
|
||||
Entry 59 & Value\\
|
||||
Entry 60 & Value\\
|
||||
Entry 61 & Value\\
|
||||
Entry 62 & Value\\
|
||||
Entry 63 & Value\\
|
||||
Entry 64 & Value\\
|
||||
Entry 65 & Value\\
|
||||
Entry 66 & Value\\
|
||||
Entry 67 & Value\\
|
||||
Entry 68 & Value\\
|
||||
Entry 69 & Value\\
|
||||
Entry 70 & Value\\
|
||||
Entry 71 & Value\\
|
||||
Entry 72 & Value\\
|
||||
Entry 73 & Value\\
|
||||
Entry 74 & Value\\
|
||||
Entry 75 & Value\\
|
||||
Entry 76 & Value\\
|
||||
Entry 77 & Value\\
|
||||
Entry 78 & Value\\
|
||||
Entry 79 & Value\\
|
||||
Entry 80 & Value\\
|
||||
Entry 81 & Value\\
|
||||
Entry 82 & Value\\
|
||||
Entry 83 & Value\\
|
||||
Entry 84 & Value\\
|
||||
Entry 85 & Value\\
|
||||
Entry 86 & Value\\
|
||||
Entry 87 & Value\\
|
||||
Entry 88 & Value\\
|
||||
Entry 89 & Value\\
|
||||
Entry 90 & Value\\
|
||||
Entry 91 & Value\\
|
||||
Entry 92 & Value\\
|
||||
Entry 93 & Value\\
|
||||
Entry 94 & Value\\
|
||||
Entry 95 & Value\\
|
||||
Entry 96 & Value\\
|
||||
Entry 97 & Value\\
|
||||
Entry 98 & Value\\
|
||||
Entry 99 & Value\\
|
||||
|
||||
\end{longtable}
|
||||
\end{document}
|
||||
@@ -0,0 +1,142 @@
|
||||
\documentclass[a4paper,10pt]{article}
|
||||
\usepackage{nordwind}
|
||||
\begin{document}
|
||||
Fixture opening.\clearpage
|
||||
Previous content.\par\penalty10000
|
||||
\dimen0=\textheight
|
||||
\advance\dimen0-12\normalbaselineskip
|
||||
\advance\dimen0-\pagetotal
|
||||
\vskip\dimen0 plus12\normalbaselineskip minus3\normalbaselineskip
|
||||
\penalty10000
|
||||
\subsubsection{Table introduction}
|
||||
\begin{longtable}{ll}
|
||||
\toprule
|
||||
\businesstablehead{Boundary first} & Name\\
|
||||
\midrule\endfirsthead
|
||||
\toprule
|
||||
\businesstablehead{Boundary repeated} & Name\\
|
||||
\midrule\endhead
|
||||
Boundary foot & Continued\\
|
||||
\endfoot
|
||||
Boundary final & Finished\\
|
||||
\bottomrule\endlastfoot
|
||||
\rule{0pt}{2\normalbaselineskip}First entry & One\\\businessrowrule
|
||||
\rule{0pt}{2\normalbaselineskip}Second entry & Two\\\businessrowrule
|
||||
\rule{0pt}{2\normalbaselineskip}Third entry & Three\\
|
||||
\end{longtable}
|
||||
\clearpage
|
||||
\section{Long continuation}
|
||||
\begin{longtable}{ll}
|
||||
\toprule
|
||||
\businesstablehead{Long first} & Name\\
|
||||
\midrule\endfirsthead
|
||||
\toprule
|
||||
\businesstablehead{Long repeated} & Name\\
|
||||
\midrule\endhead
|
||||
Long foot & Continued\\
|
||||
\endfoot
|
||||
Long final & Finished\\
|
||||
\bottomrule\endlastfoot
|
||||
Entry 0 & Value\\
|
||||
Entry 1 & Value\\
|
||||
Entry 2 & Value\\
|
||||
Entry 3 & Value\\
|
||||
Entry 4 & Value\\
|
||||
Entry 5 & Value\\
|
||||
Entry 6 & Value\\
|
||||
Entry 7 & Value\\
|
||||
Entry 8 & Value\\
|
||||
Entry 9 & Value\\
|
||||
Entry 10 & Value\\
|
||||
Entry 11 & Value\\
|
||||
Entry 12 & Value\\
|
||||
Entry 13 & Value\\
|
||||
Entry 14 & Value\\
|
||||
Entry 15 & Value\\
|
||||
Entry 16 & Value\\
|
||||
Entry 17 & Value\\
|
||||
Entry 18 & Value\\
|
||||
Entry 19 & Value\\
|
||||
Entry 20 & Value\\
|
||||
Entry 21 & Value\\
|
||||
Entry 22 & Value\\
|
||||
Entry 23 & Value\\
|
||||
Entry 24 & Value\\
|
||||
Entry 25 & Value\\
|
||||
Entry 26 & Value\\
|
||||
Entry 27 & Value\\
|
||||
Entry 28 & Value\\
|
||||
Entry 29 & Value\\
|
||||
Entry 30 & Value\\
|
||||
Entry 31 & Value\\
|
||||
Entry 32 & Value\\
|
||||
Entry 33 & Value\\
|
||||
Entry 34 & Value\\
|
||||
Entry 35 & Value\\
|
||||
Entry 36 & Value\\
|
||||
Entry 37 & Value\\
|
||||
Entry 38 & Value\\
|
||||
Entry 39 & Value\\
|
||||
Entry 40 & Value\\
|
||||
Entry 41 & Value\\
|
||||
Entry 42 & Value\\
|
||||
Entry 43 & Value\\
|
||||
Entry 44 & Value\\
|
||||
Entry 45 & Value\\
|
||||
Entry 46 & Value\\
|
||||
Entry 47 & Value\\
|
||||
Entry 48 & Value\\
|
||||
Entry 49 & Value\\
|
||||
Entry 50 & Value\\
|
||||
Entry 51 & Value\\
|
||||
Entry 52 & Value\\
|
||||
Entry 53 & Value\\
|
||||
Entry 54 & Value\\
|
||||
Entry 55 & Value\\
|
||||
Entry 56 & Value\\
|
||||
Entry 57 & Value\\
|
||||
Entry 58 & Value\\
|
||||
Entry 59 & Value\\
|
||||
Entry 60 & Value\\
|
||||
Entry 61 & Value\\
|
||||
Entry 62 & Value\\
|
||||
Entry 63 & Value\\
|
||||
Entry 64 & Value\\
|
||||
Entry 65 & Value\\
|
||||
Entry 66 & Value\\
|
||||
Entry 67 & Value\\
|
||||
Entry 68 & Value\\
|
||||
Entry 69 & Value\\
|
||||
Entry 70 & Value\\
|
||||
Entry 71 & Value\\
|
||||
Entry 72 & Value\\
|
||||
Entry 73 & Value\\
|
||||
Entry 74 & Value\\
|
||||
Entry 75 & Value\\
|
||||
Entry 76 & Value\\
|
||||
Entry 77 & Value\\
|
||||
Entry 78 & Value\\
|
||||
Entry 79 & Value\\
|
||||
Entry 80 & Value\\
|
||||
Entry 81 & Value\\
|
||||
Entry 82 & Value\\
|
||||
Entry 83 & Value\\
|
||||
Entry 84 & Value\\
|
||||
Entry 85 & Value\\
|
||||
Entry 86 & Value\\
|
||||
Entry 87 & Value\\
|
||||
Entry 88 & Value\\
|
||||
Entry 89 & Value\\
|
||||
Entry 90 & Value\\
|
||||
Entry 91 & Value\\
|
||||
Entry 92 & Value\\
|
||||
Entry 93 & Value\\
|
||||
Entry 94 & Value\\
|
||||
Entry 95 & Value\\
|
||||
Entry 96 & Value\\
|
||||
Entry 97 & Value\\
|
||||
Entry 98 & Value\\
|
||||
Entry 99 & Value\\
|
||||
|
||||
\end{longtable}
|
||||
\end{document}
|
||||
@@ -0,0 +1,23 @@
|
||||
\documentclass[a4paper,10pt]{article}
|
||||
\usepackage{nordwind}
|
||||
\begin{document}
|
||||
Fixture opening.\clearpage
|
||||
Previous content.\par\penalty10000
|
||||
\dimen0=\textheight
|
||||
\advance\dimen0-7\normalbaselineskip
|
||||
\advance\dimen0-\pagetotal
|
||||
\vskip\dimen0 plus2\normalbaselineskip minus1\normalbaselineskip
|
||||
\penalty10000
|
||||
\subsubsection{Joined introduction}
|
||||
\begin{longtable}{ll}
|
||||
\toprule
|
||||
\businesstablehead{Joined name} & \businesstablehead{Joined value}\\
|
||||
\midrule\endhead
|
||||
\midrule\multicolumn{2}{r}{Joined foot}\\\endfoot
|
||||
\bottomrule\endlastfoot
|
||||
\rule{0pt}{2\normalbaselineskip}First joined & One\\*
|
||||
\rule{0pt}{2\normalbaselineskip}Second joined & Two\\*
|
||||
\rule{0pt}{2\normalbaselineskip}Third joined & Three\\*
|
||||
\rule{0pt}{2\normalbaselineskip}Fourth joined & Four\\
|
||||
\end{longtable}
|
||||
\end{document}
|
||||
@@ -170,16 +170,18 @@
|
||||
% How far the space between two paragraphs may be stretched so that a page ends
|
||||
% where every other page ends. Half a line, so it follows the type as well.
|
||||
\newcommand{\business@pagestretch}{0.5\baselineskip}
|
||||
% What a picture may take of the page, as shares. An upright picture takes the
|
||||
% whole width of the line and at most half the height of the text; a lying one
|
||||
% the whole height still free on the page and at most the whole width. A page
|
||||
% may lose a quarter of itself to a picture that moves to the next one, and a
|
||||
% raster picture may be enlarged twice over and no further.
|
||||
% What a picture may take of the page, as shares. Upright or lying, a picture
|
||||
% takes the whole width of the line or the whole height still free on the page,
|
||||
% whichever it reaches first. A page may lose a quarter of itself to a picture
|
||||
% that moves to the next one, a drawing stays where it was written as long as it
|
||||
% keeps half its size on a page of its own, and a raster picture may be enlarged
|
||||
% twice over and no further.
|
||||
\newcommand{\business@portraitwidth}{1}
|
||||
\newcommand{\business@portraitheight}{0.5}
|
||||
\newcommand{\business@portraitheight}{1}
|
||||
\newcommand{\business@landscapewidth}{1}
|
||||
\newcommand{\business@landscapeheight}{1}
|
||||
\newcommand{\business@pictureempty}{0.25}
|
||||
\newcommand{\business@picturekeep}{0.5}
|
||||
\newcommand{\business@picturezoom}{2}
|
||||
|
||||
\newif\ifbusiness@pagelogo
|
||||
@@ -212,6 +214,32 @@
|
||||
% does not fit moves to the next page and leaves its room empty. Here for the
|
||||
% same reason as the flags above.
|
||||
\newif\ifbusiness@shortpage
|
||||
% longtable defines its start in expl3 syntax, which `\patchcmd` cannot read
|
||||
% again under ordinary catcodes, so the mark in front of a table's first head
|
||||
% goes in with expl3's own replacement. The definition stands here and not in
|
||||
% the layout block for the reason the flags above stand here: it carries an
|
||||
% `\ifvoid` without its `\fi`, and a document that asks for `plain` skips that
|
||||
% block by counting `\if` and `\fi` tokens, so the build stopped with
|
||||
% «Incomplete \iftrue» (measured on 2026-11-18 in the plain deck fixture).
|
||||
\ExplSyntaxOn
|
||||
\cs_new_protected:Npn \business@marklongtablestart
|
||||
{
|
||||
\tl_if_in:NnTF \LT@start
|
||||
{ \ifvoid \LT@firsthead \copy \LT@head }
|
||||
{
|
||||
\tl_replace_once:Nnn \LT@start
|
||||
{ \ifvoid \LT@firsthead \copy \LT@head }
|
||||
{
|
||||
\marks \business@longtablemarks { \the \business@longtables }
|
||||
\ifvoid \LT@firsthead \copy \LT@head
|
||||
}
|
||||
}
|
||||
{
|
||||
\PackageWarningNoLine { business-suite }
|
||||
{ Cannot~mark~the~start~of~a~longtable }
|
||||
}
|
||||
}
|
||||
\ExplSyntaxOff
|
||||
|
||||
\DeclareOptionX{logoheight}{\renewcommand{\business@logoheight}{#1}}
|
||||
\DeclareOptionX{headerheight}{\def\business@headerheight{#1}}
|
||||
@@ -229,6 +257,7 @@
|
||||
\DeclareOptionX{landscapewidth}{\renewcommand{\business@landscapewidth}{#1}}
|
||||
\DeclareOptionX{landscapeheight}{\renewcommand{\business@landscapeheight}{#1}}
|
||||
\DeclareOptionX{pictureempty}{\renewcommand{\business@pictureempty}{#1}}
|
||||
\DeclareOptionX{picturekeep}{\renewcommand{\business@picturekeep}{#1}}
|
||||
\DeclareOptionX{picturezoom}{\renewcommand{\business@picturezoom}{#1}}
|
||||
% The word across the page, as an option of the document: `watermark=ENTWURF`
|
||||
% writes that word, and the bare `draft` writes DRAFT, which is the word this
|
||||
@@ -328,22 +357,15 @@
|
||||
% ===================
|
||||
% How large a picture is
|
||||
% ===================
|
||||
% A picture of this family fills the width it stands in and keeps its
|
||||
% proportions, and the two formats are not the same case.
|
||||
% A picture of this family keeps its proportions and takes the full width of
|
||||
% the line or the full height still free on the page, whichever it reaches
|
||||
% first, upright and lying alike. A half-page limit for upright pictures left
|
||||
% the lower half of a page empty under a tall diagram that had nothing after
|
||||
% it on that page (measured on 2026-11-18).
|
||||
%
|
||||
% UPRIGHT, taller than wide: the full width of the line, and at most half the
|
||||
% height of the text. A page that a single upright picture fills leaves the
|
||||
% text nothing to stand beside it.
|
||||
%
|
||||
% LYING, wider than tall: the full height that is still FREE on this page —
|
||||
% the heading over it and everything else already set are gone from it — and
|
||||
% at most the full width of the line. A picture of a diagram is read across,
|
||||
% so it takes what the page still has.
|
||||
%
|
||||
% And whatever the format: a picture that does not fit into the room left on
|
||||
% the page takes the page break with it and leaves that room empty. Up to a
|
||||
% quarter of a page that costs nothing; beyond it the picture is made small
|
||||
% enough to stand where it was written, and the page is full.
|
||||
% A picture that would shrink into the free room moves to the next page and
|
||||
% fills it where less than a quarter of the page is free, and a drawing also
|
||||
% where it would keep less than half its size on a page of its own.
|
||||
%
|
||||
% A drawing is scaled as far as the rules say, because it is drawn again at
|
||||
% every size. A photograph is a raster of pixels and gets coarse: it may be
|
||||
@@ -351,12 +373,12 @@
|
||||
%
|
||||
% Every share is an option, because a company with another kind of picture
|
||||
% needs other numbers: `portraitwidth`, `portraitheight`, `landscapewidth`,
|
||||
% `landscapeheight`, `pictureempty` and `picturezoom`.
|
||||
% `landscapeheight`, `pictureempty`, `picturekeep` and `picturezoom`.
|
||||
\newsavebox{\business@picturebox}
|
||||
\newdimen\business@picturew
|
||||
\newdimen\business@pictureh
|
||||
\newdimen\business@pictureroom
|
||||
\newdimen\business@fitroom
|
||||
\newdimen\business@pageroom
|
||||
\newcommand{\business@picturescale}{1}
|
||||
% The file kinds that are a raster of pixels and cannot be enlarged freely.
|
||||
\newcommand{\business@rasters}{png,jpg,jpeg,bmp,gif,tif,tiff}
|
||||
@@ -372,7 +394,12 @@
|
||||
% picture stands on. Both are named quantities of the page, subtracted
|
||||
% exactly; without them a picture measured to the last point does not fit
|
||||
% after all, and the page breaks in front of it.
|
||||
\business@pictureroom=\textheight
|
||||
% A page of its own gives the text height less the same two: a picture as
|
||||
% high as the whole text height did not fit under the invisible material a
|
||||
% document starts with, and left its first page empty (measured on
|
||||
% 2026-11-18).
|
||||
\business@pageroom=\dimexpr\textheight-\parskip-\baselineskip\relax
|
||||
\business@pictureroom=\business@pageroom
|
||||
\ifhmode\else
|
||||
\ifdim\pagegoal<\maxdimen
|
||||
\ifdim\dimexpr\pagegoal-\pagetotal-\parskip-\baselineskip\relax>\z@
|
||||
@@ -388,45 +415,73 @@
|
||||
\ifx\@captype\@undefined\else
|
||||
\advance\business@pictureroom by -\dimexpr\abovecaptionskip
|
||||
+\baselineskip\relax
|
||||
\fi
|
||||
\ifdim\business@pictureroom>\textheight
|
||||
\business@pictureroom=\textheight
|
||||
\fi
|
||||
% The height a lying picture is made to fill. Where more than a quarter of
|
||||
% the page is left, it is that rest; where less is left, the picture does not
|
||||
% shrink into it, it moves and fills the next page. Taking the rest whatever
|
||||
% it was set a picture of the full line width 60 points high into the last
|
||||
% strip of a page: measured on 2026-10-05, where the rule that a picture
|
||||
% moves when it would leave less than a quarter empty never came into play.
|
||||
\ifdim\business@pictureroom>\business@pictureempty\textheight
|
||||
\business@fitroom=\business@pictureroom
|
||||
\else
|
||||
\business@fitroom=\textheight
|
||||
\fi
|
||||
\ifdim\business@pictureh<\business@picturew
|
||||
\edef\business@picturescale{\fpeval{min(
|
||||
\business@landscapewidth * \number\linewidth
|
||||
/ \number\business@picturew,
|
||||
\business@landscapeheight * \number\business@fitroom
|
||||
/ \number\business@pictureh)}}%
|
||||
\else
|
||||
\edef\business@picturescale{\fpeval{min(
|
||||
\business@portraitwidth * \number\linewidth
|
||||
/ \number\business@picturew,
|
||||
\business@portraitheight * \number\textheight
|
||||
/ \number\business@pictureh)}}%
|
||||
\fi
|
||||
\ifbusiness@bitmap
|
||||
\ifdim\business@picturescale\p@>\business@picturezoom\p@
|
||||
\let\business@picturescale\business@picturezoom
|
||||
\advance\business@pageroom by -\dimexpr\abovecaptionskip
|
||||
+\baselineskip\relax
|
||||
% A float that moves may take no more of a page than LaTeX lets a float
|
||||
% take at the top of one; a picture made for the whole page waited for
|
||||
% the end of the document and held back every later figure.
|
||||
\dimen@=\dimexpr\topfraction\textheight-\abovecaptionskip
|
||||
-\baselineskip\relax
|
||||
\ifdim\business@pageroom>\dimen@
|
||||
\business@pageroom=\dimen@
|
||||
\fi
|
||||
\fi
|
||||
% The page keeps its picture where the picture was written, as long as what
|
||||
% it would otherwise leave empty is worth it.
|
||||
\ifdim\business@picturescale\business@pictureh>\business@pictureroom
|
||||
% A picture inside a sentence makes its line as tall as itself, and a line
|
||||
% as tall as a page breaks the paragraph and leaves the page before it
|
||||
% empty: inside a sentence a picture takes at most half the page.
|
||||
\ifhmode
|
||||
\business@pageroom=0.5\business@pageroom
|
||||
\business@pictureroom=\business@pageroom
|
||||
\fi
|
||||
\ifdim\business@pictureroom>\business@pageroom
|
||||
\business@pictureroom=\business@pageroom
|
||||
\fi
|
||||
% The shares of the format: an upright picture and a lying one may each be
|
||||
% given their own.
|
||||
\ifdim\business@pictureh<\business@picturew
|
||||
\let\business@widthshare\business@landscapewidth
|
||||
\let\business@heightshare\business@landscapeheight
|
||||
\else
|
||||
\let\business@widthshare\business@portraitwidth
|
||||
\let\business@heightshare\business@portraitheight
|
||||
\fi
|
||||
% The size the picture has on a page of its own, and the size it has in
|
||||
% what is still free on this page: each the full width of the line or the
|
||||
% full height, whichever is reached first.
|
||||
\edef\business@pagescale{\fpeval{min(
|
||||
\business@widthshare * \number\linewidth / \number\business@picturew,
|
||||
\business@heightshare * \number\business@pageroom
|
||||
/ \number\business@pictureh)}}%
|
||||
\edef\business@roomscale{\fpeval{min(
|
||||
\business@widthshare * \number\linewidth / \number\business@picturew,
|
||||
\business@heightshare * \number\business@pictureroom
|
||||
/ \number\business@pictureh)}}%
|
||||
\ifbusiness@bitmap
|
||||
\ifdim\business@pagescale\p@>\business@picturezoom\p@
|
||||
\let\business@pagescale\business@picturezoom
|
||||
\fi
|
||||
\ifdim\business@roomscale\p@>\business@picturezoom\p@
|
||||
\let\business@roomscale\business@picturezoom
|
||||
\fi
|
||||
\fi
|
||||
% The picture fills the free room of this page. It moves to the next page
|
||||
% and fills that one only where the room is less than a quarter of a page,
|
||||
% or where a drawing would come out smaller than the share `picturekeep` of
|
||||
% its size on a page of its own: a diagram shrunk further becomes too small
|
||||
% to read (measured on 2026-11-18, a diagram with a detailed legend). A
|
||||
% raster has no such limit and shrinks into any room over the quarter.
|
||||
\let\business@picturescale\business@pagescale
|
||||
\ifdim\business@roomscale\p@<\business@pagescale\p@
|
||||
\ifdim\business@pictureroom>\business@pictureempty\textheight
|
||||
\edef\business@picturescale{\fpeval{\number\business@pictureroom
|
||||
/ \number\business@pictureh}}%
|
||||
\ifbusiness@bitmap
|
||||
\let\business@picturescale\business@roomscale
|
||||
\else
|
||||
\ifdim\business@roomscale\p@<\fpeval{\business@picturekeep
|
||||
* \business@pagescale}\p@
|
||||
\else
|
||||
\let\business@picturescale\business@roomscale
|
||||
\fi
|
||||
\fi
|
||||
\fi
|
||||
\fi}
|
||||
% A picture that stands alone is centred on the line; one that stands INSIDE a
|
||||
@@ -1312,10 +1367,34 @@
|
||||
{\csname business@need@\the\@tempcnta\endcsname}}}%
|
||||
\repeat
|
||||
\fi}
|
||||
% Every long table gets a number of its own, and that number is the mark set
|
||||
% directly in front of its first head. longtable's own counter is not
|
||||
% stepped for a table whose `\LTcaptype` is empty, and a mark set before
|
||||
% longtable's own break in front of the table landed on the page that holds
|
||||
% only the heading, which then printed the table's foot and head there.
|
||||
\newmarks\business@longtablemarks
|
||||
\newcount\business@longtables
|
||||
\AtBeginDocument{%
|
||||
\@ifundefined{LT@start}{}{%
|
||||
\patchcmd{\LT@output}{\unvbox\@cclv\copy\LT@foot}{%
|
||||
\unvbox\@cclv
|
||||
\ifnum0\botmarks\business@longtablemarks=\business@longtables
|
||||
\copy\LT@foot
|
||||
\fi}{}{%
|
||||
\PackageWarningNoLine{business-suite}{%
|
||||
Cannot guard the longtable continuation foot}%
|
||||
}%
|
||||
\patchcmd{\LT@output}{\copy\LT@head\nobreak}{%
|
||||
\ifnum0\botmarks\business@longtablemarks=\business@longtables
|
||||
\copy\LT@head\nobreak
|
||||
\fi}{}{%
|
||||
\PackageWarningNoLine{business-suite}{%
|
||||
Cannot guard the longtable continuation head}%
|
||||
}%
|
||||
\business@marklongtablestart
|
||||
\let\business@longtablestart\LT@start
|
||||
\def\LT@start{\business@tableneed\business@longtablestart}}}
|
||||
\def\LT@start{\global\advance\business@longtables\@ne
|
||||
\business@tableneed\business@longtablestart}}}
|
||||
\AtEndDocument{%
|
||||
\ifbusiness@rerun
|
||||
\PackageWarningNoLine{business-suite}{%
|
||||
|
||||
Reference in new issue
Block a user