         console.info 'LaTeX clean did not find: ' + fileToRemove
 
   sync: ->
-    unless @pdfFile?
-      console.info 'File needs to be TeXified before SyncTeX can work.' unless atom.inSpecMode()
+    {filePath, lineNumber} = @getEditorDetails()
+
+    unless outputFilePath = @resolveOutputFilePath(filePath)
+      unless atom.inSpecMode()
+        console.info 'Could not resolve path to output file associated with the current file.'
       return
 
-    {filePath, lineNumber} = @getEditorDetails()
-    opener = @getOpener()
-    opener?.open(@pdfFile, filePath, lineNumber)
+    if opener = @getOpener()
+      opener.open(outputFilePath, filePath, lineNumber)
 
   isTexFile: (filePath) ->
     # TODO: Improve; will suffice for the time being.

        @showError(error)
        return false

      @pdfFile = result.outputFilePath
      @moveResult(result, rootFilePath) if @shouldMoveResult()
      @showResult(result)


    return new OpenerImpl()

  moveResult: (result, filePath) ->
    originalFilePath = result.outputFilePath
    result.outputFilePath = @alterParentPath(filePath, result.outputFilePath)
    fs.moveSync(originalFilePath, result.outputFilePath)

    syncFilePath = originalFilePath.replace(/\.pdf$/, '.synctex.gz')
    if fs.existsSync(syncFilePath)
      fs.moveSync(syncFilePath, @alterParentPath(filePath, syncFilePath))

  resolveRootFilePath: (filePath) ->
    finder = new MasterTexFinder(filePath)
    finder.getMasterTexPath()

  resolveOutputFilePath: (filePath) ->
    rootFilePath = @resolveRootFilePath(filePath)

    unless outputFilePath = @outputLookup?[filePath]
      builder = @getBuilder()
      result = builder.parseLogFile(rootFilePath)
      unless outputFilePath = result?.outputFilePath
        console.info 'Log file parsing failed!' unless atom.inSpecMode()
        return
      @outputLookup ?= {}
      @outputLookup[filePath] = outputFilePath

    outputFilePath = @alterParentPath(rootFilePath, outputFilePath) if @shouldMoveResult()
    outputFilePath

  alterParentPath: (targetPath, originalPath) ->
    targetDir = path.dirname(targetPath)
    path.join(targetDir, path.basename(originalPath))

  shouldMoveResult: ->
    atom.config.get('latex.moveResultToSourceDirectory')
