 					staticSnippets.splice(ind, 1)
 			else
 				staticSnippets.push documentSnippet
+
+			if hasBibliographyEnvironment(docText)
+				ind = staticSnippets.indexOf(bibliographySnippet)
+				if ind != -1
+					staticSnippets.splice(ind, 1)
+			else
+				staticSnippets.push bibliographySnippet
 
 			parsedItemsMap = {}
 			for environment in customEnvironments


	hasDocumentEnvironment = (text) ->
		re = /^\\begin{document}/m
		envs = []
		iterations = 0
		return re.exec(text) != null

			\\end{thebibliography}
		"""
		meta: "env"
	}
	staticSnippets.push(documentSnippet)

	parseCustomEnvironments = (text) ->
