 
 // MARK: -
 class EquationChunk: InternalRmdChunk, Equation {
+	init(parser: SyntaxParser, contents: NSAttributedString, range: NSRange, innerRange: NSRange) {
+		let pchunk = DocumentChunk(chunkType: .equation, docType: .latex, equationType: .display,
+								   range: range, innerRange: innerRange, chunkNumber: 1)
+		super.init(parser: parser, chunk: pchunk)
+		// FIXME: notebook was blowing up with attributed equations
+//		let eqstr = contents.attributedSubstring(from: range)
+		let eqstr = NSAttributedString(string: contents.string.substring(from: innerRange)!)
+		update(text: eqstr)
+	}
+
 	init(parser: SyntaxParser, contents: String, range: NSRange, innerRange: NSRange) {
 		let pchunk = DocumentChunk(chunkType: .equation, docType: .latex, equationType: .display,
 								   range: range, innerRange: innerRange, chunkNumber: 1)

				lastTextChunk = tchunk
				lastWasInline = false
			case .code:
				let cchunk = CodeChunk(parser: parser, contents: parser.textStorage.string, range: parserChunk.innerRange, options: parserChunk.rOps)
				if parserChunk.isInline, let lastChunk = lastTextChunk {
					let achunk = InternalInlineCodeChunk(parser: parser, contents: parser.textStorage.string, range: parserChunk.innerRange, options: parserChunk.rOps)
					attach(chunk: achunk, to: lastChunk.textStorage)
					lastWasInline = true
					return

				case .none: fatalError()
				case .inline:
					guard let lastChunk = lastTextChunk else { throw ParserError.inlineEquationNotInTextChunk }
					let dchunk = InternalInlineEquation(parser: parser, contents: parser.textStorage, range: parserChunk.innerRange)
					lastChunk.inlineElements.append(dchunk)
					attach(chunk: dchunk, to: lastChunk.textStorage)
					lastWasInline = true
				case .display:
					let dchunk = EquationChunk(parser: parser, contents: parser.textStorage, range: parserChunk.parsedRange, innerRange: parserChunk.innerRange)
					append(chunk: dchunk)
					lastTextChunk = nil
					lastWasInline = false
