Esempio n. 1
0
                 The filename {0} contains a problematic character: {1}<br>
                 Please remove all occurrences of {1} in the filename.
                 </strong></p>
              '''.format(filename, problematic_characters.group(0)))
    # Run the command passed on the command line or modified by preferences
    elif command == 'latexmk':
        engine_options = construct_engine_options(typesetting_directives,
                                                  tm_engine_options, synctex)
        write_latexmkrc(engine, engine_options, '/tmp/latexmkrc')
        latexmkrc_path = "{}/config/latexmkrc".format(tm_bundle_support)
        command = "latexmk -pdf{} -f -r /tmp/latexmkrc -r {} {}".format(
            'ps' if engine == 'latex' else '', shellquote(latexmkrc_path),
            shellquote(filename))
        process = Popen(command, shell=True, stdout=PIPE, stdin=PIPE,
                        stderr=STDOUT, close_fds=True, universal_newlines=True)
        command_parser = LaTexMkParser(process.stdout, verbose, filename)
        status = command_parser.parse_stream()
        update_marks(cache_filename, command_parser.marks)
        fatal_error, number_errors, number_warnings = status
        tex_status = process.wait()
        remove("/tmp/latexmkrc")
        if tm_autoview and number_errors < 1 and not suppress_viewer:
            viewer_status = run_viewer(
                viewer, filepath, pdffile_path,
                number_errors > 1 or number_warnings > 0 and
                tm_preferences['latexKeepLogWin'],
                'pdfsync' in packages or synctex, line_number)
        number_runs = command_parser.number_runs

    elif command == 'bibtex':
        use_biber = exists('{}.bcf'.format(file_without_suffix))
Esempio n. 2
0
    elif command == 'latexmk':
        engine_options = construct_engine_options(typesetting_directives,
                                                  tm_engine_options, synctex)
        write_latexmkrc(engine, engine_options, '/tmp/latexmkrc')
        latexmkrc_path = "{}/config/latexmkrc".format(tm_bundle_support)
        command = "latexmk -pdf{} -f -r /tmp/latexmkrc -r {} {}".format(
            'ps' if engine == 'latex' else '', shellquote(latexmkrc_path),
            shellquote(filename))
        process = Popen(command,
                        shell=True,
                        stdout=PIPE,
                        stdin=PIPE,
                        stderr=STDOUT,
                        close_fds=True,
                        universal_newlines=True)
        command_parser = LaTexMkParser(process.stdout, verbose, filename)
        status = command_parser.parse_stream()
        update_marks(cache_filename, command_parser.marks)
        fatal_error, number_errors, number_warnings = status
        tex_status = process.wait()
        remove("/tmp/latexmkrc")
        if tm_autoview and number_errors < 1 and not suppress_viewer:
            viewer_status = run_viewer(
                viewer, filepath, pdffile_path, number_errors > 1
                or number_warnings > 0 and tm_preferences['latexKeepLogWin'],
                'pdfsync' in packages or synctex, line_number)
        number_runs = command_parser.number_runs

    elif command == 'bibtex':
        use_biber = exists('{}.bcf'.format(file_without_suffix))
        status = (run_biber(file_without_suffix)
Esempio n. 3
0
                        or number_warnings > 0
                        and tm_preferences['latexKeepLogWin'], use_pdfsync,
                        line_number)
                if number_errors > 0:  #bring html output window to front
                    command = '''/usr/bin/osascript -e 'tell application "System Events" to perform action "AXRaise" of (first window whose name contains "…") of process "TextMate"' '''

                    process = Popen(command,
                                    shell=True,
                                    stdout=PIPE,
                                    stdin=PIPE,
                                    stderr=STDOUT,
                                    close_fds=True)

                    process.wait()

            command_parser = LaTexMkParser(process.stdout, verbose, filename,
                                           use_pvc, round_finished)

            status = command_parser.parse_stream()

            tex_status = process.wait()
            #wait until user kills latexmk

            if (tex_status == -2):
                #latexmk interrupted, everything is ok
                tex_status = 0

            fatal_error, number_errors, number_warnings = status
            number_runs = command_parser.number_runs

            remove("/tmp/latexmkrc")
Esempio n. 4
0
     try:
         # Try to read from cache
         with open(cachefile, 'rb') as storage:
             typesetting_data = load(storage)
             messages = typesetting_data['messages']
         notification_token = None
     except:
         # Fail silently
         exit(0)
 else:
     # Depending on the error the tex engine might return a log file in a
     # different encoding.
     for encoding in encodings:
         try:
             texparser = LaTexMkParser(open(logfile, encoding=encoding),
                                       verbose=False,
                                       filename=texfile)
             texparser.parse_stream()
             break
         except UnicodeDecodeError:
             continue
     # Sort marks by line number
     marks = sorted(texparser.marks, key=lambda marks: marks[1])
     update_marks(cachefile, marks)
     messages = [
         "{:<7} {}:{} — {}".format(severity.upper(), basename(filename),
                                   line, message)
         for (filename, line, severity, message) in marks
     ]
     if not messages:
         messages = [
Esempio n. 5
0
 if notification_token == 'reload':
     try:
         # Try to read from cache
         with open(cachefile, 'rb') as storage:
             typesetting_data = load(storage)
             messages = typesetting_data['messages']
         notification_token = None
     except:
         # Fail silently
         exit(0)
 else:
     # Depending on the error the tex engine might return a log file in a
     # different encoding.
     for encoding in encodings:
         try:
             texparser = LaTexMkParser(open(logfile, encoding=encoding),
                                       verbose=False, filename=texfile)
             texparser.parse_stream()
             break
         except UnicodeDecodeError:
             continue
     # Sort marks by line number
     marks = sorted(texparser.marks, key=lambda marks: marks[1])
     update_marks(cachefile, marks)
     messages = ["{:<7} {}:{} — {}".format(severity.upper(),
                 basename(filename), line, message)
                 for (filename, line, severity, message) in marks]
     if not messages:
         messages = [
             "Could not find any messages containing line information.",
             "Please take a look at the log file {}.latexmk.log ".format(
                 basename(arguments.file)) +