summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-07-17 19:52:16 +0200
committerGeorg Brandl <georg@python.org>2010-07-17 19:52:16 +0200
commit3f01087461a21970bf98f6c374d1df33f53a4bbd (patch)
treedd1ad73a6cdf269b17b5a776de80aa593a0e9bf2
parent95992afb2000de2afe66ea4aafc6d6140463f352 (diff)
downloadsphinx-3f01087461a21970bf98f6c374d1df33f53a4bbd.tar.gz
Fix bug in LaTeX label writing: do not generate \phantomsections in \section{}.
-rw-r--r--sphinx/writers/latex.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py
index ea12f003..15e55b15 100644
--- a/sphinx/writers/latex.py
+++ b/sphinx/writers/latex.py
@@ -963,8 +963,11 @@ class LaTeXTranslator(nodes.NodeVisitor):
def add_target(id):
# indexing uses standard LaTeX index markup, so the targets
# will be generated differently
- if not id.startswith('index-'):
- self.body.append(self.hypertarget(id))
+ if id.startswith('index-'):
+ return
+ # do not generate \phantomsection in \section{}
+ anchor = not self.in_title
+ self.body.append(self.hypertarget(id, anchor=anchor))
# postpone the labels until after the sectioning command
parindex = node.parent.index(node)