Latex—-vscode+texlive环境配置

1 下载安装texlive

使用清华镜像源,选择一个.iso文件进行下载清华镜像

file

也可以使用官方的安装包,下载window安装包链接
file

双击bat文件进行安装
file

修改路径,点击advance-Customize,修改安装的语言,只选择英语和中文即可
file

file

安装完成后添加一下环境变量,找到系统高级设置-环境变量-用户变量Path,添加上你安装的texlive路径E:\texlive\2024\bin\windows
file

打开cmd输入tex -v查看安装的版本如果有显示那就是安装成功了
file

2 配置VScode

首先下载插件latex workshop

file

新建一个.tex文件就会出现扩展,说明安装成功
file

此时我们按F1,输入Open Settings,打开这个选项,将下边的代码加入保存(搬运大佬的)
file

    "latex-workshop.latex.tools": [
        {
            "name": "latexmk",
            "command": "latexmk",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "-pdf",
                "%DOC%"
            ]
        },
        {
            "name": "xelatex",
            "command": "xelatex",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "%DOC%"
            ]
        },
        {
            "name": "pdflatex",
            "command": "pdflatex",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "%DOC%"
            ]
        },
        {
            "name": "bibtex",
            "command": "bibtex",
            // "command": "biber",
            "args": [
                // "%DOC%"
                "%DOCFILE%"
            ]
        }
    ],
    "latex-workshop.latex.recipes": [
        {
            "name": "xelatex",
            "tools": ["xelatex"]
        },
        {
            "name": "latexmk",
            "tools": ["latexmk"]
        },
        {
            "name": "pdflatex -> bibtex",
            "tools": ["pdflatex","bibtex"]
        },
        // {
        //     "name": "pdflatex -> bibtex -> pdflatex*2",
        //     "tools": [
        //         "pdflatex",
        //         "bibtex",
        //         "pdflatex",
        //         "pdflatex"
        //     ]
        // },
        {
            "name": "xelatex -> bibtex -> xelatex*2",
            "tools": [
            "xelatex",
            "bibtex",
            "xelatex",
            "xelatex"
            ]

        }
    ],
    //设置在编译完成后所需要删除的文件格式
    "latex-workshop.latex.clean.fileTypes": [
        "*.aux",
        "*.bbl",
        "*.blg",
        "*.idx",
        "*.ind",
        "*.lof",
        "*.lot",
        "*.out",
        "*.toc",
        "*.acn",
        "*.acr",
        "*.alg",
        "*.glg",
        "*.glo",
        "*.gls",
        "*.ist",
        "*.fls",
        "*.log",
        "*.fdb_latexmk"
    ],
     //取消编译出错时的烦人气泡
    "latex-workshop.message.error.show": false,
    "latex-workshop.message.warning.show": false,

    "latex-workshop.showContextMenu": true, //添加LaTex Workshop右键菜单。
    "latex-workshop.intellisense.package.enabled": true, //根据加载的包,自动完成命令或包。  
    "latex-workshop.latex.autoBuild.run": "onSave", //保存文件时自动build(也就是说,点击保存文件或者按快捷键Ctrl+S的时候,除了会保存Tex文件,还会帮你编译LaTex为Pdf。

在文件中输入一些代码,点击xlatex运行,可以看到结果.

\documentclass{article}
\begin{document}
    123
    你好
    hello world
\end{document}

file

问题1 中文无法显示

在开头加入中文字体,加载宏

\usepackage{xeCJK} % 加载 xeCJK 宏包以支持中文
\setCJKmainfont{SimSun} % 设置中文字体

file

问题2 一行的内容无法在一页内显示

如下图所示,必须得滚动过去才能看到感觉不是很方便

file

vscode-文件-首选项-设置,输入Editor: Word Wrap,将他打开即可,这样一行里边的内容会自动换行在页面里显示
file

如果觉得本文对您有所帮助,可以支持下博主,—分也是缘。
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇

超多性价比流量卡,扫码查看

这将关闭于 20