                     if err
                         alert_message
                             type    : "error"
-                            message : "Unable to read concordance file -- #{err}"
+                            message : "Unable to read concordance file #{conc_fn} -- #{err}"
                     else
-                        c = res.content
-                        c = c.split('%')[1..].join(' ').replace(/\n/g, '')
-                        c = c[...c.indexOf('}')]
-                        @_rnw_concordance = (parseInt(n) for n in c.split(/[ ]+/))
+                        # concordance file is explained here:
+                        # https://cran.r-project.org/web/packages/patchDVI/vignettes/patchDVI.pdf
+                        try
+                            c = res.content
+                            c = c.split('%')[1..].join(' ').replace(/\n/g, '')
+                            c = c[...c.indexOf('}')]
+                            enc  = (parseInt(n) for n in c.split(/[ ]+/))
+                            # enc is now the list of RLE encoded numbers
+                            line = enc[0] - 1 # start line, zero-based
+                            orig = 0
+                            dec  = []     # decoded RLE encoding
+                            for idx in [1...enc.length] by 2
+                                for i in [0...enc[idx]]
+                                    orig += enc[idx + 1]
+                                    dec.push(orig)
+                            # console.log('@_rnw_concordance', @_rnw_concordance)
+                            @_rnw_concordance = dec
+                        catch e
+                            # don't reset @_rnw_concordance, the old one could be good enough
+                            console.warn("problem reading and processing #{conc_fn}:", e)
+                            console.trace()
                     cb()
         else
             cb()

        if mesg.file?.slice(0,2) == './'
            mesg.file = mesg.file.slice(2)

        if mesg.line and mesg.file == preview.pdflatex.filename_rnw
            mesg.line = @rnw_concordance(mesg.line)

        elt = @_error_message_template.clone().show()
        elt.find("a:first").click () =>


        if p.errors.length
            @number_of_errors.text("  (#{p.errors.length})")
            @element.find('a[href="#errors"]').addClass("btn-danger")
        else
            @number_of_errors.text('')
            @element.find('a[href="#errors"]').removeClass("btn-danger")

        k = p.warnings.length + p.typesetting.length
        if k and p.errors.length == 0  # don't show if there are errors
