Fix TeX page breaking issues caused by hypertarget

This commit is contained in:
RunasSudo 2019-09-22 03:43:36 +10:00
parent dad59c3d3d
commit 7a7227e309
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A

View File

@ -96,7 +96,7 @@ class LaTeXRenderer(mistletoe.latex_renderer.LaTeXRenderer):
if token.full_label(): if token.full_label():
sha = hashlib.sha256() sha = hashlib.sha256()
sha.update(token.full_label().encode('utf-8')) sha.update(token.full_label().encode('utf-8'))
hyperlink = format(r'\hypertarget{<linkname>}{}', hyperlink = format(r'\makebox[0pt]{\hypertarget{<linkname>}{}}',
linkname=sha.hexdigest() linkname=sha.hexdigest()
) )
else: else:
@ -161,7 +161,7 @@ class LaTeXRenderer(mistletoe.latex_renderer.LaTeXRenderer):
if token.full_label(): if token.full_label():
sha = hashlib.sha256() sha = hashlib.sha256()
sha.update(token.full_label().encode('utf-8')) sha.update(token.full_label().encode('utf-8'))
hyperlink = format(r'\hypertarget{<linkname>}{}', hyperlink = format(r'\makebox[0pt]{\hypertarget{<linkname>}{}}',
linkname=sha.hexdigest() linkname=sha.hexdigest()
) )
else: else: