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

crossref, latex - correctly table env for raw table produced by computations #12103

Merged
merged 2 commits into from
Feb 18, 2025

Conversation

cderv
Copy link
Collaborator

@cderv cderv commented Feb 17, 2025

This is a follow up of previous adaptation to take into account table options in environment done in #11921

So this is the same fix using new patterns matching, but in different places - when RawBlock are produced within a output .cell Div.

closes #12085

…tations

This is a follow up of previous adaptation to take into account table options in environment done in #11921
Comment on lines +552 to +553
-- FIXUP: We don't go here for a `#tbl-` id as it is matched as a FigureDiv above
-- TO REMOVE ?
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cscheid unrelated to this PR but I added this note because while debugging, I found that we don't go there as tbl- prefixed id will always be matched by isFigureDiv()

So I figured we should remove this part, but for now at least mark it as stale to avoid spending much time wondering if we go there at next debugging.

Hopefully the fact that isTableDiv() is now no more useful when isFigureDiv() is used before is expected.

Though, it may not as the isFigureDiv() is used to do a fixup on nested Image - maybe we don't want do that on all type of crossref ?

For reference isFigureDiv() is

-- is this a Div containing a figure
function isFigureDiv(el, captionRequired)
if is_regular_node(el, "Div") and hasFigureRef(el) then
if captionRequired == nil then
captionRequired = true
end
if not captionRequired then
return true
end
return el.attributes[kFigCap] ~= nil or refCaptionFromDiv(el) ~= nil
else
return discoverLinkedFigureDiv(el) ~= nil
end
end

and uses hasFigureRef() using isFigureRef()
-- does this element have a figure label?
function hasFigureRef(el)
return isFigureRef(el.identifier)
end
function isFigureRef(identifier)
if identifier == nil then
return nil
end
local ref = refType(identifier)
return crossref.categories.by_ref_type[ref] ~= nil
end

where isFigureRef() matches all known crossref type.

Sharing in case this is raising question to you too. I added as topic for next Thursday meeting as not urgent. I can merge current PR with the note, and remove it later if necessary

@cderv cderv merged commit ad03947 into main Feb 18, 2025
47 checks passed
@cderv cderv deleted the floatref/fixup-tablenv-in-cell branch February 18, 2025 13:14
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

Successfully merging this pull request may close these issues.

Incorrect modification of \begin{table} environment with labeled table in LaTeX
1 participant