pku-typst / pkuthss-typst

Typst template for dissertations in Peking University (PKU).
MIT License
92 stars 18 forks source link

fix: :bug: Fix issue where booktab cannot be properly referred to #13

Closed TeddyHuang-00 closed 1 year ago

TeddyHuang-00 commented 1 year ago

BREAKING: This breaks the backward compatibility with booktab function, users are expected to change their usage of this function

TeddyHuang-00 commented 1 year ago

See https://github.com/lucifer1004/pkuthss-typst/issues/12 for details

lucifer1004 commented 1 year ago

非常感谢!这块我再考虑一下。

TeddyHuang-00 commented 1 year ago

Sure

TeddyHuang-00 commented 1 year ago

今天 typst 0.4.0 发了,问题仍然存在

lucifer1004 commented 1 year ago

更好的解决办法是在 booktab 函数最后的 figure 部分前面加一个 return 。你可以试一下。

TeddyHuang-00 commented 1 year ago

🐮,确实是,我完全没试这个方法

lucifer1004 commented 1 year ago

原因在于 {} 会在外面加一层 block,导致 label 没有加到 figure 上。但是直接 return figure 的话,booktab 函数的结果就直接是 figure 而不是 block 了。

lucifer1004 commented 1 year ago

我之前也没有意识到 {} 里面用和不用 return 的这个差别。

TeddyHuang-00 commented 1 year ago

好家伙原来是这么个逻辑....难绷了