summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Bernoth <erik.bernoth@gmail.com>2013-09-24 16:01:12 +0200
committerErik Bernoth <erik.bernoth@gmail.com>2013-09-24 16:01:12 +0200
commit90b2d0aacf6a4f17b9e9107864db9addb816ba7e (patch)
treef32ba661659c06c578c91cc0203c6cbd88ee5c77
parent1e811efb46886a0e6f18c2c967101ba1b55af1bb (diff)
downloadsphinx-90b2d0aacf6a4f17b9e9107864db9addb816ba7e.tar.gz
writers/latex: debug bibtex hypertarget labels
The LaTeX reference target used to be the bibitem id. But the bibitem id was already rewritten to contain a number instead of the lowercased id name, that is given by the bibtex file. This change adds a new element to the bibitem instantiation which contains the id from the bibtex file. The hypertarget uses this bibitem element now. The alternative fix would be to hyperref the numbered id and leave the target with the id number as it is. We decided against it, because in the html builder both the ref and the target use the bibtex id name and not the number. Signed-off-by: Erik Bernoth <erik.bernoth@gmail.com> Acked-by: Matthias C. M. Troffaes <matthias.troffaes@gmail.com>
-rw-r--r--sphinx/writers/latex.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py
index ce92edfc..d7a52228 100644
--- a/sphinx/writers/latex.py
+++ b/sphinx/writers/latex.py
@@ -379,7 +379,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
widest_label = bi[0]
self.body.append(u'\n\\begin{thebibliography}{%s}\n' % widest_label)
for bi in self.bibitems:
- target = self.hypertarget(bi[2] + ':' + bi[0].lower(),
+ target = self.hypertarget(bi[2] + ':' + bi[3].lower(),
withdoc=False)
self.body.append(u'\\bibitem[%s]{%s}{%s %s}\n' %
(bi[0], self.idescape(bi[0]), target, bi[1]))
@@ -648,6 +648,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
if isinstance(node.parent, nodes.citation):
self.bibitems[-1][0] = node.astext()
self.bibitems[-1][2] = self.curfilestack[-1]
+ self.bibitems[-1][3] = node.parent['ids'][0]
raise nodes.SkipNode
def visit_tabular_col_spec(self, node):
@@ -1271,7 +1272,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
def visit_citation(self, node):
# TODO maybe use cite bibitems
- self.bibitems.append(['', '', '']) # [citeid, citetext, docname]
+ self.bibitems.append(['', '', '', '']) # [id, txt, name, ref]
self.context.append(len(self.body))
def depart_citation(self, node):
size = self.context.pop()