Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When there is no text or no command after \enumerate, pagebreak error occur. #323

Open
Reyon62 opened this issue Apr 4, 2022 · 3 comments

Comments

@Reyon62
Copy link

Reyon62 commented Apr 4, 2022

Example

Input

@require: stdjareport
@require: itemize

document (|
  title = {bug report};
  author = {syaoshao};
  show-title = true;
  show-toc = true;
|) '<
    +p{
        \enumerate{
            *${aaa}
            *${bbb}
            *${ccc}
        }
    }
>

Output

 ---- ---- ---- ----
  target file: 'bug.pdf'
  dump file: 'bug.satysfi-aux' (already exists)
  parsing 'bug.saty' ...
  parsing 'stdjareport.satyh' ...
  parsing 'pervasives.satyh' ...
  parsing 'gr.satyh' ...
  parsing 'geom.satyh' ...
  parsing 'list.satyg' ...
  parsing 'option.satyg' ...
  parsing 'math.satyh' ...
  parsing 'code.satyh' ...
  parsing 'color.satyh' ...
  parsing 'vdecoset.satyh' ...
  parsing 'annot.satyh' ...
  parsing 'footnote-scheme.satyh' ...
  parsing 'itemize.satyh' ...
 ---- ---- ---- ----
  type checking 'color.satyh' ...
  type check passed.
 ---- ---- ---- ----
  type checking 'pervasives.satyh' ...
  type check passed.
 ---- ---- ---- ----
  type checking 'option.satyg' ...
  type check passed.
 ---- ---- ---- ----
  type checking 'geom.satyh' ...
  type check passed.
 ---- ---- ---- ----
  type checking 'list.satyg' ...
  type check passed.
 ---- ---- ---- ----
  type checking 'gr.satyh' ...
  type check passed.
 ---- ---- ---- ----
  type checking 'annot.satyh' ...
  type check passed.
 ---- ---- ---- ----
  type checking 'footnote-scheme.satyh' ...
  type check passed.
 ---- ---- ---- ----
  type checking 'itemize.satyh' ...
  type check passed.
 ---- ---- ---- ----
  type checking 'math.satyh' ...
  type check passed.
 ---- ---- ---- ----
  type checking 'vdecoset.satyh' ...
  type check passed.
 ---- ---- ---- ----
  type checking 'code.satyh' ...
  type check passed.
 ---- ---- ---- ----
  type checking 'stdjareport.satyh' ...
  type check passed.
 ---- ---- ---- ----
  type checking 'bug.saty' ...
  type check passed. (document)
  preprocessing 'color.satyh' ...
  preprocessing 'pervasives.satyh' ...
  evaluating 'option.satyg' ...
  preprocessing 'geom.satyh' ...
  evaluating 'list.satyg' ...
  preprocessing 'gr.satyh' ...
  preprocessing 'annot.satyh' ...
  preprocessing 'footnote-scheme.satyh' ...
  preprocessing 'itemize.satyh' ...
  preprocessing 'math.satyh' ...
  preprocessing 'vdecoset.satyh' ...
  preprocessing 'code.satyh' ...
  preprocessing 'stdjareport.satyh' ...
  preprocessing 'bug.saty' ...
  evaluating 'color.satyh' ...
  evaluating 'pervasives.satyh' ...
  evaluating 'geom.satyh' ...
  evaluating 'gr.satyh' ...
  evaluating 'annot.satyh' ...
  evaluating 'footnote-scheme.satyh' ...
  evaluating 'itemize.satyh' ...
  evaluating 'math.satyh' ...
  evaluating 'vdecoset.satyh' ...
  evaluating 'code.satyh' ...
  evaluating 'stdjareport.satyh' ...
 ---- ---- ---- ----
  evaluating texts ...
modified version of stdjareport.
  evaluation done.
 ---- ---- ---- ----
  breaking contents into pages ...
page content 1
column start.
Uncaught exception:
  
  "Assert_failure src/backend/pageBreak.ml:108:42"

Raised at Main__PageBreak.chop_single_column.normalize_after_break.omit_redundant_clear in file "src/backend/pageBreak.ml", line 108, characters 42-54
Called from Main__PageBreak.chop_single_column.normalize_after_break in file "src/backend/pageBreak.ml", line 112, characters 12-40
Called from Main__PageBreak.chop_single_column.aux in file "src/backend/pageBreak.ml", line 229, characters 33-62
Called from Main__PageBreak.chop_single_column.aux.(fun) in file "src/backend/pageBreak.ml", line 191, characters 22-422
Called from Main__PageBreak.chop_single_column.aux in file "src/backend/pageBreak.ml", line 146, characters 10-1023
Called from Main__PageBreak.chop_single_column.aux.(fun) in file "src/backend/pageBreak.ml", line 263, characters 20-413
Called from Main__PageBreak.chop_single_column.aux in file "src/backend/pageBreak.ml", line 220, characters 10-1023
Called from Main__PageBreak.chop_single_column.aux.(fun) in file "src/backend/pageBreak.ml", line 191, characters 22-422
Called from Main__PageBreak.chop_single_column.aux in file "src/backend/pageBreak.ml", line 146, characters 10-1023
Called from Main__PageBreak.chop_single_column.aux.(fun) in file "src/backend/pageBreak.ml", line 263, characters 20-413
Called from Main__PageBreak.chop_single_column.aux in file "src/backend/pageBreak.ml", line 220, characters 10-1023
Called from Main__PageBreak.chop_single_column.aux.(fun) in file "src/backend/pageBreak.ml", line 191, characters 22-422
Called from Main__PageBreak.chop_single_column.aux in file "src/backend/pageBreak.ml", line 146, characters 10-1023
Called from Main__PageBreak.chop_single_column.aux.(fun) in file "src/backend/pageBreak.ml", line 263, characters 20-413
Called from Main__PageBreak.chop_single_column.aux in file "src/backend/pageBreak.ml", line 220, characters 10-1023
Called from Main__PageBreak.chop_single_column.aux.(fun) in file "src/backend/pageBreak.ml", line 263, characters 20-413
Called from Main__PageBreak.chop_single_column.aux in file "src/backend/pageBreak.ml", line 220, characters 10-1023
Called from Main__PageBreak.chop_single_column.aux.(fun) in file "src/backend/pageBreak.ml", line 191, characters 22-422
Called from Main__PageBreak.chop_single_column.aux in file "src/backend/pageBreak.ml", line 146, characters 10-1023
Called from Main__PageBreak.chop_single_column.aux.(fun) in file "src/backend/pageBreak.ml", line 263, characters 20-413
Called from Main__PageBreak.chop_single_column.aux in file "src/backend/pageBreak.ml", line 220, characters 10-1023
Called from Main__PageBreak.chop_single_column.aux.(fun) in file "src/backend/pageBreak.ml", line 191, characters 22-422
Called from Main__PageBreak.chop_single_column.aux in file "src/backend/pageBreak.ml", line 146, characters 10-1023
Called from Main__PageBreak.chop_single_column.aux.(fun) in file "src/backend/pageBreak.ml", line 263, characters 20-413
Called from Main__PageBreak.chop_single_column.aux in file "src/backend/pageBreak.ml", line 220, characters 10-1023
Called from Main__PageBreak.chop_single_column.aux.(fun) in file "src/backend/pageBreak.ml", line 191, characters 22-422
Called from Main__PageBreak.chop_single_column.aux in file "src/backend/pageBreak.ml", line 146, characters 10-1023
Called from Main__PageBreak.chop_single_column in file "src/backend/pageBreak.ml", line 538, characters 4-454
Called from Main__PageBreak.main_multicolumn.iter_on_column in file "src/backend/pageBreak.ml", line 744, characters 10-83
Called from Main__PageBreak.main_multicolumn.iter_on_page in file "src/backend/pageBreak.ml", line 774, characters 25-86
Called from Main.eval_document_file.aux in file "src/frontend/main.ml", line 392, characters 16-151
Called from Main.error_log_environment in file "src/frontend/main.ml", line 464, characters 4-16
Called from Satysfi in file "bin/satysfi.ml", line 1, characters 9-21

@ R_O_R_I_J_O also found this error: https://twitter.com/R_O_R_I_J_O/status/1505121840565735424?s=20&t=gukKQDDsyNMagWU_WiHiWQ

I could avoid this error by following ways:

  1. use \listing instead of \enumerate
  2. write some texts or place some commands after \enumerate{}

@ R_O_R_I_J_O checked no error using \listing in place of \enumerate: https://twitter.com/R_O_R_I_J_O/status/1505039343991533571?s=20&t=gukKQDDsyNMagWU_WiHiWQ.

This error occured when \enumerate is placed in +p, +definition, +lemma, +theorem, +corollary commands. However, such document can be compiled in +proof command. For example,

@require: stdjareport
@require: itemize

document (|
  title = {bug report};
  author = {syaoshao};
  show-title = true;
  show-toc = true;
|) '<
    +proof{
        \enumerate{
            *${aaa}
            *${bbb}
            *${ccc}
        }
    }
>

Output

---- ---- ---- ----
  target file: 'bug.pdf'
  dump file: 'bug.satysfi-aux' (already exists)
  parsing 'bug.saty' ...
  parsing 'stdjareport.satyh' ...
  parsing 'pervasives.satyh' ...
  parsing 'gr.satyh' ...
  parsing 'geom.satyh' ...
  parsing 'list.satyg' ...
  parsing 'option.satyg' ...
  parsing 'math.satyh' ...
  parsing 'code.satyh' ...
  parsing 'color.satyh' ...
  parsing 'vdecoset.satyh' ...
  parsing 'annot.satyh' ...
  parsing 'footnote-scheme.satyh' ...
  parsing 'itemize.satyh' ...
 ---- ---- ---- ----
  type checking 'color.satyh' ...
  type check passed.
 ---- ---- ---- ----
  type checking 'pervasives.satyh' ...
  type check passed.
 ---- ---- ---- ----
  type checking 'option.satyg' ...
  type check passed.
 ---- ---- ---- ----
  type checking 'geom.satyh' ...
  type check passed.
 ---- ---- ---- ----
  type checking 'list.satyg' ...
  type check passed.
 ---- ---- ---- ----
  type checking 'gr.satyh' ...
  type check passed.
 ---- ---- ---- ----
  type checking 'annot.satyh' ...
  type check passed.
 ---- ---- ---- ----
  type checking 'footnote-scheme.satyh' ...
  type check passed.
 ---- ---- ---- ----
  type checking 'itemize.satyh' ...
  type check passed.
 ---- ---- ---- ----
  type checking 'math.satyh' ...
  type check passed.
 ---- ---- ---- ----
  type checking 'vdecoset.satyh' ...
  type check passed.
 ---- ---- ---- ----
  type checking 'code.satyh' ...
  type check passed.
 ---- ---- ---- ----
  type checking 'stdjareport.satyh' ...
  type check passed.
 ---- ---- ---- ----
  type checking 'bug.saty' ...
  type check passed. (document)
  preprocessing 'color.satyh' ...
  preprocessing 'pervasives.satyh' ...
  evaluating 'option.satyg' ...
  preprocessing 'geom.satyh' ...
  evaluating 'list.satyg' ...
  preprocessing 'gr.satyh' ...
  preprocessing 'annot.satyh' ...
  preprocessing 'footnote-scheme.satyh' ...
  preprocessing 'itemize.satyh' ...
  preprocessing 'math.satyh' ...
  preprocessing 'vdecoset.satyh' ...
  preprocessing 'code.satyh' ...
  preprocessing 'stdjareport.satyh' ...
  preprocessing 'bug.saty' ...
  evaluating 'color.satyh' ...
  evaluating 'pervasives.satyh' ...
  evaluating 'geom.satyh' ...
  evaluating 'gr.satyh' ...
  evaluating 'annot.satyh' ...
  evaluating 'footnote-scheme.satyh' ...
  evaluating 'itemize.satyh' ...
  evaluating 'math.satyh' ...
  evaluating 'vdecoset.satyh' ...
  evaluating 'code.satyh' ...
  evaluating 'stdjareport.satyh' ...
 ---- ---- ---- ----
  evaluating texts ...
modified version of stdjareport.
  evaluation done.
 ---- ---- ---- ----
  breaking contents into pages ...
page content 1
column start.
LineBreak> UNREACHABLE
  [Warning] a line unable to be broken into a paragraph occurs on page 1
reach last.
column end 1 (last: T, remains: F)
page parts 1
  all cross references were solved.
 ---- ---- ---- ----
  embedding fonts ...
 ---- ---- ---- ----
  writing pages ...
 ---- ---- ---- ----
  output written on 'bug.pdf'.
@Reyon62
Copy link
Author

Reyon62 commented Apr 4, 2022

my SATySFi's version:

$ satysfi -v
  SATySFi version 0.0.6

@leque
Copy link
Contributor

leque commented Jul 29, 2022

The assertion causing this error was introduced at the same time as PBHookPageBreak was introduced (c6699b3). It might suffice to fix the problem to handle PBHookPageBreak properly in Main__PageBreak.chop_single_column.normalize_after_break.omit_redundant_clear

@sankantsu
Copy link
Contributor

sankantsu commented Aug 13, 2022

As @leque pointed out, Main__PageBreak.chop_single_column.normalize_after_break.omit_redundant_clear
is the line where assertion fails.

--- a/src/backend/pageBreak.ml
+++ b/src/backend/pageBreak.ml
@@ -105,7 +105,8 @@ let chop_single_column (pbinfo : page_break_info) (area_height : length) (pbvbls
       | (PBVertSkip(_), _) :: pbvbtail -> omit_redundant_clear pbvbtail
       | (PBVertLine(_), _) :: _
       | (PBVertFrame(_), _) :: _       -> None
-      | (PBHookPageBreak(_), _) :: _   -> assert false
+      | (PBHookPageBreak(_), _) :: _   -> None
       | []                             -> Some([])  (* -- the original `pbvblst` consists only of spaces -- *)
     in

Change like above eliminates the error message and it looks there is no problem in output pdf.

But, I'm not confident that this is the right way to solve this issue.

Also, I did somewhat simplified reproduction of this problem.
I hope it would be helpful.

let text-width = 440pt
let text-height = 630pt
let-inline ctx \math m = embed-math ctx m
let ctx = get-initial-context text-width (command \math)

let bb-main =
    let ib =
        inline-fil
        ++ (embed-block-breakable ctx (block-skip 1pt))
    in
    line-break true true ctx ib

let vhook = hook-page-break-block (fun _ _ -> ())

let bb = bb-main +++ vhook

in

page-break A4Paper
    (fun _ -> (| text-height = text-height; text-origin = (0pt,0pt); |))
    (fun _ -> (| header-content = block-nil; header-origin = (0pt,0pt);
                 footer-content = block-nil; footer-origin = (0pt,0pt); |))
    bb

The assertion was about PBHookPageBreak (which corresponds to hook-page-break-block) but, preceding block-box also matters.
When I change block-skip in the embed-block-breakable to something like block-nil or some paragraph didn't reproduce the problem.

In the original situation, \enumerate have a embed-block-breakable, which contains block-skip as the last element, and it is followed by hook-page-break-block which is introduced in stdjareport class document function.

(edit)

Code like below also reproduces the problem.
embed-block-breakable is not important, but the combination of

  • a candidate for page break (like breakable bottom-margin of a paragraph)
  • a block-skip
  • a hook-page-break-block

is sufficient.

let text-width = 440pt
let text-height = 630pt
let-inline ctx \math m = embed-math ctx m
let ctx = get-initial-context text-width (command \math)

let bb-main =
    let it = {some text} in
    let ib = read-inline ctx it in
    line-break true true ctx ib

let vhook = hook-page-break-block (fun _ _ -> ())

let bb = bb-main +++ (block-skip 1pt) +++ vhook

in

page-break A4Paper
    (fun _ -> (| text-height = text-height; text-origin = (0pt,0pt); |))
    (fun _ -> (| header-content = block-nil; header-origin = (0pt,0pt);
                 footer-content = block-nil; footer-origin = (0pt,0pt); |))
    bb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants