-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Allow use of a function for fig, eq or tab labels #1120
Conversation
This is due for latex support that requires only a label name and not with a number already inserted
if (type %in% names(theorem_abbr)) { | ||
if (type %in% theorem_abbr) { |
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.
It is not part of the feature request but I think it was not working as expected before, and the span was never inserted. So I fixed it here.
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.
Sounds good. Thanks for catching it!
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 think it is much more common for users to customize figure and table names. We can consider theorems in the future if someone asks for the feature. Thanks!
if (type %in% names(theorem_abbr)) { | ||
if (type %in% theorem_abbr) { |
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.
Sounds good. Thanks for catching it!
Co-authored-by: Yihui Xie <[email protected]>
Thank you! Unfortunately theorem is the same story in Hungarian ( |
Yes theorem was trickier to support. |
This will solves #1114
For now I only added support for
fig
,eq
andtab
. Support for theorem or proof env is a bit trickier becauselabel_prefix
is used for find the label to use for\newtheorem
inpreamble
where number is not usedbookdown/R/latex.R
Line 239 in cec8efb
and for proof env too
bookdown/R/latex.R
Line 248 in cec8efb
This means it can't be a function of reference number, and case is different between LaTeX and non LaTeX.
I wanted to support all because for non LaTeX output this is the same mechanism: label is prepended by default. However, I did not find an easy way to do it because of the constraint mention above. But also I am not sure that what I have done currently is a lot easier.
@yihui you may want to review that more closely in case you see a way to also allow the use of a function for all
theorem_abbr
andlabel_names_math2
.