Adjust heading spacing

This commit is contained in:
RunasSudo 2019-12-15 14:07:07 +11:00
parent 2bf8cbb8d7
commit f83e9cca55
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A

View File

@ -77,14 +77,14 @@ class LaTeXRenderer(mistletoe.latex_renderer.LaTeXRenderer):
def render_heading(self, token): def render_heading(self, token):
if token.level == 1: if token.level == 1:
heading_last, self.heading_last = self.heading_last, True heading_last, self.heading_last = self.heading_last, True
return format(r'{\par\vspace{1cm plus 0.3cm minus 0.3cm}\bfseries\fontsize{13pt}{15pt}\selectfont\centering\uppercase{<content>}\phantomsection\addcontentsline{toc}{section}{<content>}\nopagebreak\par}', return format(r'{\par\vspace{1cm plus 0.3cm minus 0.1cm}\bfseries\fontsize{13pt}{15pt}\selectfont\centering\uppercase{<content>}\phantomsection\addcontentsline{toc}{section}{<content>}\nopagebreak\par}',
content=self.render_inner(token) content=self.render_inner(token)
) )
if token.level == 2: if token.level == 2:
heading_last, self.heading_last = self.heading_last, True heading_last, self.heading_last = self.heading_last, True
return format(r'{\par\vspace{<space_above>}\bfseries\fontsize{13pt}{15pt}\selectfont\centering <content>\phantomsection\addcontentsline{toc}{subsection}{<content>}\nopagebreak\par}', return format(r'{\par\vspace{<space_above>}\bfseries\fontsize{13pt}{15pt}\selectfont\centering <content>\phantomsection\addcontentsline{toc}{subsection}{<content>}\nopagebreak\par}',
space_above='1cm plus 0.3cm minus 0.3cm' if not heading_last else '0cm', space_above='1cm plus 0.3cm minus 0.1cm' if not heading_last else '0cm',
content=self.render_inner(token) content=self.render_inner(token)
) )
@ -113,7 +113,7 @@ class LaTeXRenderer(mistletoe.latex_renderer.LaTeXRenderer):
if token.level == 1: if token.level == 1:
# Part # Part
heading_last, self.heading_last = self.heading_last, True heading_last, self.heading_last = self.heading_last, True
return format(r'{\par\vspace{1cm plus 0.3cm minus 0.3cm}<hyperlink>\bfseries\fontsize{13pt}{15pt}\selectfont\centering\uppercase{Part <label>—<content>}\phantomsection\addcontentsline{toc}{section}{Part <label>—<content>}\nopagebreak\par}', return format(r'{\par\vspace{1cm plus 0.3cm minus 0.1cm}<hyperlink>\bfseries\fontsize{13pt}{15pt}\selectfont\centering\uppercase{Part <label>—<content>}\phantomsection\addcontentsline{toc}{section}{Part <label>—<content>}\nopagebreak\par}',
hyperlink=hyperlink, hyperlink=hyperlink,
label=token.label, label=token.label,
content=self.render_inner(token) content=self.render_inner(token)
@ -124,7 +124,7 @@ class LaTeXRenderer(mistletoe.latex_renderer.LaTeXRenderer):
heading_last, self.heading_last = self.heading_last, True heading_last, self.heading_last = self.heading_last, True
return format(r'{\par\vspace{<space_above>}<hyperlink>\bfseries\fontsize{13pt}{15pt}\selectfont\centering Division <label>—<content>\phantomsection\addcontentsline{toc}{subsection}{Division <label>—<content>}\nopagebreak\par}', return format(r'{\par\vspace{<space_above>}<hyperlink>\bfseries\fontsize{13pt}{15pt}\selectfont\centering Division <label>—<content>\phantomsection\addcontentsline{toc}{subsection}{Division <label>—<content>}\nopagebreak\par}',
hyperlink=hyperlink, hyperlink=hyperlink,
space_above='1cm plus 0.3cm minus 0.3cm' if not heading_last else '0cm', space_above='1cm plus 0.3cm minus 0.1cm' if not heading_last else '0cm',
label=token.label, label=token.label,
content=self.render_inner(token) content=self.render_inner(token)
) )