最終更新:2017-09-25 (月) 20:04:59 (56d)

CotEditor

Download

Repository

Changelog

LuaLaTeX

tell application "CotEditor"
    if exists front document then
        set thisfile to path of front document as Unicode text
        set thisdir to (do shell script "/usr/bin/dirname \"" & thisfile & "\"")
        set thisbase to thisdir & "/" & (do shell script "/usr/bin/basename \"" & thisfile & "\" .tex")
        set thistex to thisbase & ".tex"

        tell application "System Events"
            if exists file thistex then
                tell application "Terminal"
                    if (exists window 1) and not busy of window 1 then
                        do script "cd \"" & thisdir & "\" && lualatex -synctex=1 -interaction=nonstopmode \"" & thisbase & "\"" in window 1
                    else
                        do script "cd \"" & thisdir & "\" && lualatex -synctex=1 -interaction=nonstopmode \"" & thisbase & "\""
                        activate                           
                    end if
                end tell
            else
                display alert "It does not appear to be a TeX file."
            end if
        end tell
        activate
    end if
end tell

upLaTeX + dvipdfmx

tell application "CotEditor"
    if exists front document then
        set thisfile to path of front document as Unicode text
        set thisdir to (do shell script "/usr/bin/dirname \"" & thisfile & "\"")
        set thisbase to thisdir & "/" & (do shell script "/usr/bin/basename \"" & thisfile & "\" .tex")
        set thistex to thisbase & ".tex"

        tell application "System Events"
            if exists file thistex then
                tell application "Terminal"
                    if (exists window 1) and not busy of window 1 then
                        do script "cd \"" & thisdir & "\" && uplatex -synctex=1 -interaction=nonstopmode \"" & thisbase & "\" && dvipdfmx \"" & thisbase & "\"" in window 1
                    else
                        do script "cd \"" & thisdir & "\" && uplatex -synctex=1 -interaction=nonstopmode \"" & thisbase & "\" && dvipdfmx \"" & thisbase & "\""
                        activate                           
                    end if
                end tell
            else
                display alert "It does not appear to be a TeX file."
            end if
        end tell
        activate
    end if
end tell

SyncTeX with CotEditor and Skim

☐ Check for file changes
Do not select this when using a script or program that will force a revert.

PDF-TeX Sync support:
Preset:
Custom
Command:
/Applications/CotEditor.app/Contents/SharedSupport/bin/cot
Arguments:
-l %line "%file"