diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-03-02 12:37:20 +0300 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-03-02 12:37:20 +0300 |
commit | ac9e9c0745f0001b3db30611a9a5c298634c3e08 (patch) | |
tree | 7a976fe0ad7f38c1ac182a61580982193e9d58cb /sphinx/writers/latex.py | |
parent | 245b464fac15a0fa2a2ce5ba9e23f032c311b68a (diff) | |
parent | be971c6d385b42524e0660f788abf6399877bc30 (diff) |
Merge branch '1.8' into 2.0
Diffstat (limited to 'sphinx/writers/latex.py')
-rw-r--r-- | sphinx/writers/latex.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index 9ee51f8aa..c5be44b18 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -1533,7 +1533,11 @@ class LaTeXTranslator(SphinxTranslator): # in reverse order post = [] # type: List[str] include_graphics_options = [] - is_inline = self.is_inline(node) + has_hyperlink = isinstance(node.parent, nodes.reference) + if has_hyperlink: + is_inline = self.is_inline(node.parent) + else: + is_inline = self.is_inline(node) if 'width' in attrs: if 'scale' in attrs: w = self.latex_image_length(attrs['width'], attrs['scale']) @@ -1575,7 +1579,7 @@ class LaTeXTranslator(SphinxTranslator): if self.in_parsed_literal: pre.append('{\\sphinxunactivateextrasandspace ') post.append('}') - if not is_inline: + if not is_inline and not has_hyperlink: pre.append('\n\\noindent') post.append('\n') pre.reverse() @@ -1863,6 +1867,8 @@ class LaTeXTranslator(SphinxTranslator): for id in node.get('ids'): anchor = not self.in_caption self.body += self.hypertarget(id, anchor=anchor) + if not self.is_inline(node): + self.body.append('\n') uri = node.get('refuri', '') if not uri and node.get('refid'): uri = '%' + self.curfilestack[-1] + '#' + node['refid'] @@ -1916,6 +1922,8 @@ class LaTeXTranslator(SphinxTranslator): def depart_reference(self, node): # type: (nodes.Element) -> None self.body.append(self.context.pop()) + if not self.is_inline(node): + self.body.append('\n') def visit_number_reference(self, node): # type: (nodes.Element) -> None |