randy3k / LaTeXBox

A lightweight but deprecated LaTeX Plugin for Sublime Text 3
44 stars 8 forks source link

specification of user defined, latexmk build commands #19

Closed me10240 closed 10 years ago

me10240 commented 10 years ago

Hi Randy, thank you for the excellent plugin. I am frustrated with LatexTools and just discovered your plugin. It works great, except for two features that I am looking for. A) Can I change the "cmd", and "cmd_force" entries in the LatexPlus.settings user file ? I prefer to use a different latexmk command for the build.

B) more build variants A short preamble first. Using latexmk, one can generate a pdf in one of 4 ways: 1) pdflatex 2) xelatex 3) latex--> dvi--> ps --> pdf (using latex, dvips, ps2pdf) 4)latex--> dvi--> pdf (using latex, dvipdfmx). Before LatexTools update this March, I was able to define build variants and choose one of the above 4 build options by the code:

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

        { "cmd": ["latexmk",
        "-e", "\\$pdflatex = 'pdflatex %O -interaction=nonstopmode -synctex=1 %S'",
        "-f", "-pdf"],
        "name": "Run"
        },

        { "cmd": ["latexmk",
        "-e", "\\$latex = 'latex %O -interaction=nonstopmode -synctex=1 %S'",
        "-f", "-pdfps"],
        "name": "LaTeX_PS_PDF"
        },

        { "cmd": ["latexmk",
        "-e", "\\$pdflatex = 'xelatex %O -interaction=nonstopmode -synctex=1 %S'",
        "-f", "-pdf"],
        "name": "xelatex"
        },

    ]

Would you consider my request for such a functionality ? Thank you. Shriram

randy3k commented 10 years ago

hi @me10240,

A) Yes, you can change freely the cmd and cmd_force command in the LaTeX-Plus user settings file.

B) It is not possible to use the internal build system if we want to monitor the build process. However, it is possible to extend the current LaTeX-Plus build system to allow different variant.

One possible implement is to add an item in the command palette, e.g. LaTeX-Plus: Choose Build System. And it allows you to pick the suitable build system.

randy3k commented 10 years ago

I added the "Choose Build System" feature. b0cfa2081e39e271ab7ba3d6e54ec3a604273445

Could you help me to test it and providing more variants?

me10240 commented 10 years ago

Thank you for your prompt response. I would be happy to do so. I tested it on a simple journal article with single bib file. I found that

  1. compilation and producing pdf works fine.
  2. forward search ( jump to pdf works fine) But inverse search (jump from pdf to tex document with C+left click) has stopped working. However, before the change, when you had no variants, inverse search was working very well with the default pdflatex build provided. Unfortunately, I do not understand enough of this to help you fix it, but I will help with testing. Once you can figure out the inverse search part, I shall suggest two more build systems.
randy3k commented 10 years ago

What OS are you using? I didn't have any problems about inverse search on my Mac OS.

me10240 commented 10 years ago

Linux, with evince as viewer.

Best Wishes, Shriram On Oct 8, 2014 10:03 AM, "Randy Lai" notifications@github.com wrote:

What OS are you using? I didn't have any problems about inverse search on my Mac OS.

— Reply to this email directly or view it on GitHub https://github.com/randy3k/LaTeX-Plus/issues/19#issuecomment-58381934.

randy3k commented 10 years ago

Can you confirm that inverse search work/ does not work with the default build setup?

me10240 commented 10 years ago

All right, I figured out the problem. You need to add --shell-escape to have inverse search. It works in both cases when I add --shell-escape, but after the settings get clobbered, the changes are lost in the latex build command.

Some questions and further suggestions : 1) where (which file) do I need to add new build variants so that they are persistent ?

2) I suggest two further builds. Rename the current alternative as LATEX_DVIPDF after adding shell-escape, and

3) define LATEX_PS as

["latexmk", "-e", "\\$latex = 'latex %O -interaction=nonstopmode --shell-escape -synctex=1 %S'", "-f", "-pdfps"] A word of explanation for this requirement; beamer documents cannot be built with dvipdf, so one is forced to go the way of LATEX_PS.

4) Define XELATEX build as

["latexmk", "-e", "\\$pdflatex = 'xelatex %O -interaction=nonstopmode --shell-escape -synctex=1 %S'", "-f", "-pdf"]

5) Define the clean command so that user can control which file extensions are cleaned. It is not necessary for example, to clean the .bbl and .blg files if there is no change in them. In complicated documents with multiple bib files, it is better to preserve those.I advocate something like:

["latexmk", "-e", "\\$clean_ext = 'log snm nav aux fls fdb_latexmk dvi ps synctex.gz out spl'", "-c"]

randy3k commented 10 years ago

@me10240 thx for testing it out.

1) The settings file can be accessed via the menu: Preferences -> Package Settings. You may want to copy all the settings from the default file to the user file.

2-5) done, check the new update (you may have to wait until Package Control refreshes the cache).

PS: you don't have to escape $ in LaTeX-Plus.

me10240 commented 10 years ago

Wow ! Thank you so much. Build seems fine, havent tested xelatex yet though. Will test it further on multibib documents and report if some issue occurs.

randy3k commented 10 years ago

thx, i will close the issue for now.