     @lastFile = @latex.mainFile
 
   trimLatexmk: (log) ->
-    log = log.replace(/(.{78}(\w|\s|\d|\\|\/))(\r\n|\n)/g, '$1')
     lines = log.replace(/(\r\n)|\r/g, '\n').split('\n')
     finalLine = -1
     for index of lines

{ Disposable } = require 'atom'
path = require 'path'

latexFile = /^.*?\(\.\/(.*?\.\w+)/
latexPattern = /^Output\swritten\son\s(.*)\s\(.*\)\.$/gm
latexFatalPattern = /Fatal error occurred, no output PDF file produced!/gm
latexError = /^(?:(.*):(\d+):|!)(?: (.+) Error:)? (.+?)\.?$/
latexBox = /^((?:Over|Under)full \\[vh]box \([^)]*\)) in paragraph at lines (\d+)--(\d+)$/
latexWarn = /^((?:(?:Class|Package) \S+)|LaTeX) (Warning|Info):\s+(.*?)(?: on input line (\d+))?\.$/

latexmkPattern = /^Latexmk:\sapplying\srule/gm
latexmkPatternNoGM = /^Latexmk:\sapplying\srule/

    return lines.slice(araraRunIdx.slice(-1)[0]).join('\n')

  parseLatex: (log) ->
    files = []
    fileInds = []
    i = 0
    while i < log.length
      if log[i] == "("
        name = log.slice(i).match fileName
        if name && log.match ///#{name[1]}\.aux///g
          fileInds.push [files.length, 0]
          files.push "("
        else
          if fileInds.length > 0
            fileInds[fileInds.length - 1][1] += 1
            files[fileInds[fileInds.length - 1][0]] += "("
      else
        if log[i] == ")"
          if fileInds.length > 0
            files[fileInds[fileInds.length - 1][0]] += ")"
            if fileInds[fileInds.length - 1][1] > 0
              fileInds[fileInds.length - 1][1] -= 1
            else
              fileInds.pop()
        else
          if fileInds.length > 0
            files[fileInds[fileInds.length - 1][0]] += log[i]
      i += 1

    items = []
    for file in files
      @lastFile = path.resolve(path.dirname(@latex.mainFile), file.match(latexFile)[1])

      while result = latexBox.exec file
        items.push
          type: 'typesetting',
          text: result[1].replace /\s\s+/g, ' '
          file: @lastFile
          line: parseInt result[2], 10

      while result = latexWarn.exec file
        items.push
          type: 'warning',
          text: result[3].replace /\s\s+/g, ' '
          file: @lastFile
          line: parseInt result[4]

      while result = latexError.exec file
        items.push
          type: 'error',
          text: if result[3] and result[3] != 'LaTeX' then \
