1

我有一个用于运行乳胶的崇高文本构建系统。我正在使用 shell 脚本(不带参数)来删除乳胶生成的各种扩展。问题是 sublime-text 认为 filename.tex 是脚本的参数。

所以我尝试了以下脚本:

    {

// General settings
"target": "make_pdf",
"selector": "text.tex.latex",


"cmd": ["latexmk", "-e","\\$dvipdf = 'dvipdfmx %O -o %D %S'", "-e", "\\$latex = 'latex %O -interaction=nonstopmode -synctex=1 %S'","-f", "-pdfdvi"],

"variants":
[

    { "cmd":["my_script.sh"],
      "name": "clean"
    }
  ]
}

这里我用 ls 代替脚本来说明。当我运行构建文件时,它会尝试运行

my_script.sh filename.tex

而不仅仅是 my_script.sh。我该怎么做才能从构建文件中运行它?

4

1 回答 1

0

I have been there and done that . . . there and back again . . . and visited again and again . . .

The solution is to use a custom plugin (not necessarily relying upon a .sublime-build, but that is possible too) so that you can refer to the *.tex file that is open. I have some solutions you are probably unaware of, one of which is my own, and one where I modify the popular plugin LaTexTools.

latexmk cleans with a big -C (everything) or a little -c (some things that are pre-defined, and additional things that can be user-defined) -- so there is no need to use a separate custom cleaner script.

https://github.com/lawlist/LaTexTools-Unofficial-Modification

https://github.com/lawlist/ST2-plugin-latexmk-save-build-clean

FYI: I recommend putting latex (or something like that) in your subject line of the question -- I almost missed your question . . . and just happened to see the short summary and realized I knew something about this issue.


SAMPLE -- for MultiTaskBuild plugin located here: https://github.com/bizoo/MultiTaskBuild

{
    "cmd": {

        "latexmk -pvc . . .": {
            "cmd": ["latexmk", "-r", "/Users/HOME/.latexmkrc", "$file"]
        },

        "latexmk -pv . . .": {
            "cmd": ["latexmk",
        "-e", "\\$pdflatex = 'pdflatex -enable-write18 %O -interaction=nonstopmode -synctex=1 %S'",
         "-recorder-", "-pvc-", "-f", "-pdf", "-pv", "$file"]
        },

        "latexmk -c": {
            "cmd": ["latexmk", "-c", "$file"]           
        },

        "latexmk -C": {
            "cmd": ["latexmk", "-C", "$file"]
        }
    },
"path": "$PATH:/usr/texbin:/usr/local/bin",
    "file_regex": "^(...*?):([0-9]+): ([0-9]*)([^\\.]+)",
    "selector": "text.tex.latex",
    "default_task": "latexmk -pv . . .",
    "target": "multi_task_exec"
}
于 2013-04-21T16:01:41.213 回答