 	class Boundary
 		length: () ->
 			return @end - @start
+
+		extract: (str) ->
+			return str.substr @start, @length()
 
 	# Returns the outer and inner boundaries of the latex block starting
 	# at the given opening delimiter


	# Searches for the first latex block in the given string
	find_latex: (str) ->
		unless str.length and (opening_delimiter_match = @find_opening_delimiter str)?
			return null
		
		match = @get_latex_boundaries str, opening_delimiter_match

		match?.options = opening_delimiter_match.options

		return match

	# Breaks a message to what comes before, after and to the content of a
	# matched latex block

			# the rendered latex content
			rendered = @render_latex parts.latex, match.options.displayMode
			result += parts.before + rendered

			# Set what comes after the latex block to be examined next
			str = parts.after

