Skip to content

TeXstudio配置 #23

Description

@iTomxy
  • xelatex/texlive 版本:XeTeX 3.141592653-2.6-0.999993 (TeX Live 2021/W32TeX)
  • TeXstudio 版本:4.2.2

TeXstudio 可以用 user command 集成命令行编译并刷新其自带的 pdf viewer。

  1. 手写 compile.bat 装编译命令:
    @echo off
    
    if (%1) == () (
        REM 模板默认的主 tex 文件是 main.tex
        set MAIN=main
    ) else (
        REM 启用命令行参数,接收 TeXstudio 命令的 `%` 参数,见下文第 2 点
        set MAIN=%1
    )
    
    REM 删旧辅助文件
    del /q *.aux > nul 2>&1
    del /q *.log > nul 2>&1
    del /q *.out > nul 2>&1
    del /q *.toc > nul 2>&1
    del /q *.tec > nul 2>&1
    del /q *.synctex.gz > nul 2>&1
    del /q *.bbl > nul 2>&1
    del /q *.blg > nul 2>&1
    
    REM 删旧 pdf
    del /q %MAIN%.pdf
    
    xelatex -synctex=1 -interaction=nonstopmode -file-line-error %MAIN%.tex
    bibtex %MAIN%.aux
    xelatex -synctex=1 -interaction=nonstopmode -file-line-error %MAIN%.tex
    xelatex -synctex=1 -interaction=nonstopmode -file-line-error %MAIN%.tex
  2. 创建 user command:在 TeXstudio 顶部 Options -> Configure TeXstudio... -> Build -> User Commands,添加命令:compile.bat % | txs:///view。上方 Meta Commands -> PDF Viewer 那里是 txs:///view-pdf-internal --embedded 就是 TeXstudio 自带的界面右侧那个 pdf viewer。
  3. 创建完之后,在 Tools -> User 的菜单下可以看到,点它就行,或者用快捷键 Alt + Shift + F1。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions