jlelong/LaTeX-Workshop-wiki

documentation on project-dependent building recipe

Closed this issue · 2 comments

Currently, all latex projects without magic comments, are built using the default recipe (the first recipe). I find this behavior not so satisfactory since different project uses different compilers. In my case, many available English-version paper templates use pdflatex as its compiler, and I have to use xelatex to write Chinese.

Thus, I'm wondering if any of the following two options are possible, or already implemented but not documented:

  • when called Build Latex Project, change the default recipe to the last called recipe Build with recipe.
  • provide a project-only configuration file to override the global building settings.

Thanks

A quick note on the second solution:

provide a project-only configuration file to override the global building settings.

I find out that we can override the recipe setting using VSCode's workspace settings and still keep the default recipe latexmk

My setting

master-thesis.code-workspace

{
    "folders": [
        {
            "path": "/Volumes/jc/Documents/ECNU/masters_dissertation"
        }
    ],
    "settings": {
        "latex-workshop.latex.recipes": [
            {
                "name": "xelatex -> biber -> xelatex*2",
                "tools": [
                    "xelatex",
                    "biber",
                    "xelatex",
                    "xelatex"
                ]
            }
        ]
    }
}

I'll find time to add a note of this to the wiki after finishing my dissertation.

It is a classic way to proceed in vscode. From vscode's docs

VS Code provides two different scopes for settings:

  • User Settings - Settings that apply globally to any instance of VS Code you open.
  • Workspace Settings - Settings stored inside your workspace and only apply when the workspace is opened.

Workspace settings override user settings.

You can also simply create a .vscode/settings.json inside the top level directory of your LaTeX project and put there the settings specific to the current LaTeX project. So, you can define recipes and the default recipe per LaTeX project.