Skip to content

Commit 318708e

Browse files
skotnicznymarijnh
authored andcommitted
Labels after chapter titles
1 parent b439108 commit 318708e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/render_latex.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,16 @@ let renderer = {
9898
paragraph_close() { return "" },
9999

100100
heading_open(token) {
101-
if (token.tag == "h1") return `\\label{${chapter[1]}}${/^00/.test(file) || chapter[1] === "hints" ? "\\addchap" : "\\chapter"}{`
101+
if (token.tag == "h1") return `${/^00/.test(file) || chapter[1] === "hints" ? "\\addchap" : "\\chapter"}{`
102102
if (token.tag == "h2") return `\n\n${id(token)}\\section{`
103103
if (token.tag == "h3") return `\n\n${id(token)}\\subsection{`
104104
if (token.tag == "h4") return `\n\n${id(token)}\\subsubsection{`
105105
throw new Error("Can't handle heading tag " + token.tag)
106106
},
107-
heading_close() { return `}` },
107+
heading_close(token) {
108+
if (token.tag == "h1") return `}\\label{${chapter[1]}}`
109+
return `}`
110+
},
108111

109112
bullet_list_open() { return `\n\n\\begin{itemize}` },
110113
bullet_list_close() { return `\n\\end{itemize}` },

0 commit comments

Comments
 (0)