-
Notifications
You must be signed in to change notification settings - Fork 101
latex backend: avoid hyperref and longtable destructive interferences #526
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
latex backend: avoid hyperref and longtable destructive interferences #526
Conversation
Welp. |
src/latex/generator.ml
Outdated
(Raw.small_table pp) tbl | ||
Raw.break Line | ||
else | ||
large_table size ppf tbl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure why you now inserts breaks around the small table, but the result is a code that mixes abstraction level, which is not so nice in this function. If it was just then small_table tbl else large_table size tbl
it would be fine, otherwise maybe you could move the whole thing to a single table size tbl
call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not being familiar with this codebase, I find it a bit confusing that there is row_size = Huge|Large|Small|Empty
, and then this new check which sounds related to the column size (or row count) rather than row size, but also appears to call Raw.{small,large}_table
in the same way as width-based distinctions. It looks like small_table
means "small width", but small_table_limit
means "small height". Urgh.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this context, small_table
means essentially any tables that the basic tabular latex environment may render correctly
.
There is indeed two notions of sizes colliding here: the height of the tables, and the maximal "width" of cells. I have renamed small_table_limit
to small_table_height_limit
, does this help?
I have moved the newlines to the raw latex side, with a comment that explains that we don't want the table to be inlined in-between delimiters.
src/latex/generator.ml
Outdated
let matrix ppf m = List.iter (row ppf) m in | ||
match size with | ||
| Huge -> Raw.break ppf Line; matrix ppf tbl | ||
| Large | _ -> Raw.indent matrix ppf tbl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the Huge
case, the output now always begins and ends with a Line break. In the Large|Small|Empty
case, your change to the output guarantees that we always have a Line break at the end, but not at the beginning. On the other hand, small-height small tables get a Line break at both the beginning and end. This sounds a bit inconsistent, but I don't know what the intent is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Huge case is in fact unnecessary, this was probably some scoria from prior implementation of recursive tables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the new implementation I'm still confused by line breaks in the code: if I understand correctly, row
produces a final line break on lists of size 0 or 1, but not 2 and above, and it's not clear to me why.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is probably too much hardwired knowledge about the imbrication of different environments, but here the indentation environment provides the line break for rows with more than one elements.
d355640
to
308a187
Compare
Thanks, this is all clearer with the new changes. Please feel free to go along. |
Thanks everyone! In it goes. |
While compiling the OCaml manual, it may happen (or not) that very large sum types make the hyperref package self-destruct with
due to a bad interaction between the hyperref and longtable package.
There is no clear fix beyond manual edition of the source, which is not reasonable for the generated latex source.
Thus this PR simply limits the number of rows of generated tables, which in turns removes the assumption that there is a reasonable latex package that knows how to handle multi-pages tables.