-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Set LaTeX bibitem id to citation node id #4213
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
Conversation
In the unusual case that the textual label differs from the ID, the ID should be preferred.
I could add a test, but it might involve hacking doctrees. |
@@ -919,7 +919,7 @@ def depart_document(self, node): | |||
target = self.hypertarget(bi[2] + ':' + bi[3], | |||
withdoc=False) | |||
self.body.append(u'\\bibitem[%s]{%s}{%s %s}\n' % | |||
(self.encode(bi[0]), self.idescape(bi[0]), | |||
(self.encode(bi[3]), self.idescape(bi[0]), |
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 seems the labels of \cite
are not changed. Is this really correct?
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.
oh, sorry. Please forget my comment above.
Please add a test for this. in addition, please rebase this to stable branch. |
test will have to be over a modified doctree. I'll try get to it...
Sphinx doesn't use these ids to reference. It uses a separate \label etc.
but TeX expects them to have certain properties.
|
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.
This can not be merged, as bi[3]
has already been normalized (converted to lowercase, stripped of diacritics (é
becomes e
), ...) hence although indeed the link works, this normalizes too much the look of the reference tag in the bibliography in an unexpected by user way.
@jnothman for background could you add a comment here with a link to numpydoc relevant thread? |
Sorry, perhaps I got this backwards. In [] should be the display text, i.e. This relates to numpy/numpydoc#136 |
Yes it is
and the I observe that Sphinx
a priori, this looks sub-optimal. In The |
@tk0miya I have started to work on getting LaTeX to use standard
now generates in latex file: Lorem ipsum \cite{\detokenize{RefTTT__xe9_xe9}} dolor sit amet. and \begin{sphinxthebibliography}{RefTTT\_éé}
\bibitem[RefTTT\_éé]{\detokenize{RefTTT__xe9_xe9}}
Book or article reference, URL or whatever.
\end{sphinxthebibliography} which is much lighter mark-up than in current Sphinx, with same functionality. |
@jfbu +1 |
@jnothman any other proposal on this PR? for reasons explained it can not be merged as is. FYI, I will refactor latex writer to use standard LaTeX |
Sorry, I've not had much attention for this one. If you have an alternative fix, feel free to put one in. |
@jnothman thanks for update, issue is that I don't know what is to fix from your point of view. As mentioned it is planned for LaTeX writer to use |
Finally, in #4904, I replaced Thanks, |
Subject: LaTeX writer uses
\bibitem[label]{label}
when it should use\bibitem[id]{label}
Feature or Bugfix
Purpose
In the unusual case that the textual label differs from the ID, the ID should be preferred. This comes up in a proposed change to numpydoc.
These IDs are not currently used for referencing within sphinx-produced TeX documents, as sphinx explicitly adds a
\label
to reference text.