Skip to content

[0800] 图片/表格 preview-ref 的编号不正确#3315

Merged
da-liii merged 3 commits into
mainfrom
ty/051102
May 12, 2026
Merged

[0800] 图片/表格 preview-ref 的编号不正确#3315
da-liii merged 3 commits into
mainfrom
ty/051102

Conversation

@AXeonV
Copy link
Copy Markdown
Contributor

@AXeonV AXeonV commented May 11, 2026

[0800] 图片/表格 preview-ref 的编号不正确

如何测试

  1. 插入两个大表格,两个大图片,在第二个大表格、第二个大图片的题注里打上 label
  2. ref 这个 label,鼠标悬浮在上面,观察 preview-ref 里面对这个图片/表格的编号是否与文档中的实际编号一致

2026/5/11

What

preview-ref 预览气泡中图片/表格的编号总是显示 1,与文档中的实际编号不一致。

Why

preview-ref 会把引用目标片段取出来,在 tooltip 的临时文档中单独排版。

图片/表格宏在展开时会调用 next-figure / next-table,而临时文档中的 figure-nr / table-nr 从 0 开始,所以预览里的编号总是变成 1。

How

  1. 在生成预览内容时,将 label id 传入 label-preview
  2. 在预览根节点是 small/big-figuresmall/big-table 时,局部覆盖 the-figure / the-table(get-binding id)

这样保留原有图片/表格宏的渲染流程,只让 tooltip 中显示编号读取原文档已计算好的真实 binding。

Copilot AI review requested due to automatic review settings May 11, 2026 13:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

该 PR 修复 preview-ref 悬浮预览气泡中,图片/表格编号总是显示为 1、与正文实际编号不一致的问题;通过在生成预览内容时复用原文档已计算好的 label binding 来保证编号一致。

Changes:

  • 在生成预览内容时将 label id 传入预览生成逻辑,并尝试对 figure/table 的编号宏进行局部覆盖以读取原文档 binding。
  • 新增开发记录文档 devel/0800.md,描述问题背景、原因与测试步骤。

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
TeXmacs/progs/link/ref-edit.scm 调整 preview-ref 的预览内容生成流程,新增对 figure/table 编号在 tooltip 临时排版环境下的修正逻辑。
devel/0800.md 新增问题说明与手工测试步骤文档。

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread TeXmacs/progs/link/ref-edit.scm Outdated
`(,(tm-label t) ,@(map clean-preview (tm-children t))))
(else t)))

(define (fix-fig_or_tb-number doc id)
Copy link
Copy Markdown
Contributor

@da-liii da-liii left a comment

Choose a reason for hiding this comment

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

LGTM

@da-liii da-liii merged commit 42818ee into main May 12, 2026
@da-liii da-liii deleted the ty/051102 branch May 12, 2026 02:38
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.

3 participants