Skip to content
Snippets Groups Projects

Minted 2023 update

Open Bernardo Borges requested to merge minted-2023-update into master
1 unresolved thread

Update Minted Configuration for TeX Live 2023+ Compatibility

The Alethe document handles code highlighting via the minted package, with a custom lexer for "smt-lib", defined in highlight.py. Due to the update of the package, the new minted (version 3.0.0 and later) no longer supports overriding \MintedPygmentize for custom lexers.

Instead, we now reference our custom lexer directly using ./highlight.py:SMTLibLexer in the minted environment definitions. A conditional mechanism in the LaTeX preamble detects whether the legacy \MintedPygmentize command is defined. If it is, the document falls back to the older configuration (for TeX Live 2022 or earlier). This ensures that users on both old and new TeX distributions can compile the document without modifications.

The changes include guidance on setting up a .latexminted_config file with the correct SHA256 hash for highlight.py. This is required by minted 3.0.0+ to securely load custom lexers.

The GitLab CI config was also updated, what needed to copy the .latexminted_config into the global configuration (e.g., $HOME/.latexminted_config) to ensure the custom lexer is registered during the build.


Thank you for reviewing these changes. Your feedback and any suggestions for further improvements are welcome.

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Bernardo Borges added 2 commits

    added 2 commits

    • 23ea8984 - Add global latexminted config file
    • 4152b442 - Remove settings and debug

    Compare with previous version

  • Bernardo Borges requested review from @hbarbosa

    requested review from @hbarbosa

    • I tried to compile the project from within this branch, and noted that, also in my system, I need to copy first .latexminted_config into my home, for the compilation to find it. Would it be possible to configure the tool such that .latexminted_config can be put just together with the main .tex file?

      By the way, many thanks for this much-needed fix!

      Edited by Mallku Soldevila
    • Hello, happy to help!

      I don't think it's possible in the new security protocol for the library. It needs the enable_cwd_config flag to be true in the home directory file to even consider the current working directory configuration to overload latexminted and allow the custom syntax highlight of smt-lib. You can read more about it in page 12 of the minted documentation.

    • Please register or sign in to reply
  • Maintainer

    This is not a good solution.

    Like Mallku, I would avoid asking the user to generate a new file in their home directory. Note that we don't even get the security benefit, because --shell-escape is still needed for the fallback.

    The documentation says that with minted 3 there is also a package minted2 available that behaves like the old minted version. I just pushed a change to main that implements a fallback to this library if it is available. Could you test whether this works for you?

    When we eventually adapt minted 3, we should document the required file in the README rather than provide a .global file. In any case, we might want to reconsider the usage of minted.

Please register or sign in to reply
Loading