Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Tectonic.toml #3773

Open
thangleiter opened this issue Nov 26, 2024 · 3 comments
Open

Support for Tectonic.toml #3773

thangleiter opened this issue Nov 26, 2024 · 3 comments
Labels
enhancement New feature or (non bug related) change to the program.

Comments

@thangleiter
Copy link

Tectonic is moving towards a file-based build configuration specified in a Tectonic.toml file. Would it be possible to support this in the plugin?

The current issues I encounter are:

  1. Several inputs can be specified in the config file which are then concatenated while building. This also allows inline inputs, for example (from the docs):
    [[output]]
    inputs = [
      { inline = "\\documentclass[a4paper]{article}" },
      "main.tex"
    ] 
    This naturally breaks the linting in Texify because the plugin doesn't know, for instance, about packages included in files concatenated like this.
  2. Building using tectonic -X build does not work using the standard tectonic run configuration. This is because the latter passes some command line arguments by default (like --synctex), which do not apply to tectonic -X, and it also expects for instance a target file to compile, which does not apply in the Tectonic.toml configuration.

I think the second point should be easy to solve but I'm not sure how straightforward the first one is. I'd appreciate any effort towards this end though!

@thangleiter thangleiter added enhancement New feature or (non bug related) change to the program. untriaged Issue type still needs to be triaged or verified. labels Nov 26, 2024
@PHPirates
Copy link
Collaborator

Thanks for asking! As long as the tectonic.toml is within the project, I think we should be able to find all toml files which have the current file included in their inputs. Maybe we can even parse the toml using the jackson library.
After I figured out which unreleased version of Tectonic I should install, it looks like this is the minimal toml that actually works:

[doc]
name = "main"
bundle = "https://relay.fullyjustified.net/default_bundle_v33.tar"
[[output]]
name = "main"
type = "pdf"
# Paths relative to ./src
inputs = [
    { inline = "\\documentclass[a4paper]{article}" },
    "main.tex"
]

I guess we should just use the V2 CLI by default if a Tectonic.toml is found in the project. If the toml is in a parent directory outside of the project, then I don't know.

@PHPirates PHPirates removed the untriaged Issue type still needs to be triaged or verified. label Nov 27, 2024
@thangleiter
Copy link
Author

thangleiter commented Dec 3, 2024

Thanks for asking! As long as the tectonic.toml is within the project, I think we should be able to find all toml files which have the current file included in their inputs. Maybe we can even parse the toml using the jackson library.

Could the language server be told which source files are included in inputs besides the main file so that linting etc works?

I guess we should just use the V2 CLI by default if a Tectonic.toml is found in the project. If the toml is in a parent directory outside of the project, then I don't know.

Sounds reasonable. From what I gleam from the docs, I don't think the Tectonic.toml being outside the project directory is something that is supported.

@PHPirates
Copy link
Collaborator

We do keep track within TeXiFy what files are in the same file set (included by the same main file), and I think it should be possible to get this information from the tectonic.toml. For direct LaTeX input that is in there, it is more difficult because we need to run our LaTeX parser on it to make sense out of it. I'm not sure how Tectonic handles it, maybe we can hack a temporary file together with all the inputs concatenated, then parse it? I'm not sure if that would work, because this information will not be indexed if the file does not exist on disk as such.

https://tectonic-typesetting.github.io/book/latest/v2cli/build.html?highlight=tectonic.toml#remarks

This command builds the current document, as identified by searching for a Tectonic.toml file in the current directory or one of its parents.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or (non bug related) change to the program.
Projects
None yet
Development

No branches or pull requests

2 participants