You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在VSCode的LatexWorkshop中禁用特定\include位置警告?

解决LatexWorkshop中"\include should only be used after \begin{document}"警告的方法

这个警告由ChkTeX(LatexWorkshop默认的代码检查工具)触发,对应警告编号为W16。要禁用该特定警告,可按以下步骤操作:

  • 打开VSCode设置:按Ctrl+,(Windows/Linux)或Cmd+,(Mac)快速唤起,或通过菜单栏文件 -> 首选项 -> 设置进入
  • 在设置搜索框输入latex-workshop.linting.chktex.options,点击编辑 in settings.json
  • 在settings.json中添加如下配置,将W16警告加入忽略列表:
"latex-workshop.linting.chktex.options": [
    "-W16"
]

说明:-W后跟警告编号代表禁用该警告,W16正是对应"\include should only be used after \begin{document}"的规则。

额外提示:若你用\include导入的是包引用、全局命令定义这类前置配置,更推荐使用\input{configurations.tex}——\include会自动插入分页符,而\input仅做内容插入,更适配前置配置场景。当然,若你坚持使用\include,上述禁用警告的方法完全有效。

内容的提问来源于stack exchange,提问作者Leonardo_Gomes

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.21 06:45:54