           for graphic in figure.graphics
             for label in graphic.labels
               figures[label] = figure
+
+  formatLabel = (label) ->
+    "``#{label.replace /^fig:/, ''}''"
 
   ## Extract sections.
   for filename, content of zip.files

                published: now
              if file.graphic.labels.length > 0
                filerev.title = "Figure " +
                  ("``#{label}''" for label in file.graphic.labels).join " / "
              if file.graphic.subcaption
                filerev.body = file.graphic.subcaption
              filemsg = _.clone filerev

                file.callback = (file2) ->
                  d file2.uniqueIdentifier
              Files.resumable.addFile file
        for figure in attach
          figure.message =
            title: "Figure " +
              (formatLabel label for label in figure.labels).join " / "
            body: figure.caption
            format: 'latex'
            published: now
          rootFiles = (file for file in figure.files when file.graphic.subcaption == false)
          if rootFiles.length == 1
            figure.message.file = rootFiles[0].file2id
            figure.files = _.without figures.files, rootFiles[0]
          frevision = _.clone figure.message
          figure.message.creator = me
          figure.message.created = now
          frevision.updators = [me]
          frevision.updated = now
          await Meteor.call 'messageImport', group, message._id, figure.message, [frevision], defer error, figure.message._id
        await
          for figure in attach
            for file in figure.files
