当前位置:网站首页>Vs code configuration latex environment nanny level configuration tutorial (dual system)
Vs code configuration latex environment nanny level configuration tutorial (dual system)
2022-07-08 01:04:00 【Sleepy without water】
as everyone knows , Microsoft recently launched its own programming software visual studio code , This lightweight open source programming software , It's really adorable , It can not only be used on it python, It can also carry various operating environments , For example, it is often used Latex、Matlab、Freefem、C++ Such as software , Can be in vs code Upper use , It's just too powerful , The configuration tutorial function of relevant software will be updated later .
Every time before using these third-party software , You need to configure its running environment , also vs code The frequency of updates is also very fast , So some languages of the code also need to be updated in real time , The author is a little white , So put these easy-to-use tutorials (windows Version and mac edition ) And programming records , Easy to modify later hahahaha .
One 、vs code Download, install and configure the locale
1.1 vs code Download and install
vs code Installation is very simple, no more , Search official website [1], Choose a suitable version to install .
1.2 vs code Language environment
After installing this lightweight software, the interface is as follows :
For general software, we set the language , Directly find the language options in the settings , Find Chinese and switch back , but vs code The language setting of requires this operation :
Shortcut key 【control + shift + p】 The following search box will pop up
Enter... In the search box 【language】 This option appears 【Configure Display Language】, Click ok .
Then choose 【zh-cn】, Follow the prompts to restart , It switches to the Chinese interface .
The Chinese interface is as follows :
Come here , We will take vs code Installation and configuration complete .
1.3 install Sumatra PDF
find Sumatra PDF Official website [4], This software installation is the simplest , Most software installation processes are similar , But be sure to remember the installation path , Because the installation path is required below , We need to configure to vs code On .
1.4 Download and install textlive compiler
If you want to install textive compiler (windows), There are two image websites Alibaba cloud open source image websites [2]、 Huawei open source [3] Can download . The interfaces are as follows :
find 【textlive2021】 download , The download time is about ten minutes .
After the download is completed, the installation process .
- open 【textlive2021】 Image file , find 【install-tl-windows】, Right click 【 Open as administrator 】.
- Wait a few seconds and the interface will appear : Click on the bottom left corner 【advanced】;
- Click on the bottom left corner 【customize】;
- The left column is the language column , Only choose what we need 【 chinese 】 and 【 english 】 that will do , Other language packs can be removed , This can save 1G File memory . After clicking on 【 determine 】.
- Find the one in the lower right corner 【 install texworks front end 】, This option can be cancelled , You can also keep , But now that they have chosen to use vs code edit latex 了 , I don't think I can use it 【texworks】 edit .
- Then comes the long installation time , The installation time is about half an hour , After installation, turn off the software .
1.5 stay vs code On the configuration latex Environmental Science
Next comes the key step , stay vs code On the configuration latex Environmental Science , The first step has been latex Adjust to Chinese interface , Next, open your vscode.
First, we need to install the plug-in 【latex workshop】, Find the column on the left of the interface 【 expand 】;
Search for 【latex workshop】 And install ;
- next step , Click on the gear in the lower left corner ️ open 【 Set up 】
- stay 【 Set up 】 Medium 【 expand 】 find 【JSON】, Click on 【 stay setting.json Editor in chief 】.
- Copy the following code to the input box ; Save and close . Then the configuration process is completed !
The configuration code is as follows :
The commands on each line of code have comments , Unclear can also be in vs code Put the cursor on the program ,vs code It will also explain the meaning of the code , Be careful , Where the code needs to be changed is the location of your software , This is very important , Be sure to change it to the path of the software on your computer .
{
// Use SumatraPDF Preview compiled PDF file
// Set up VScode Internal view generated pdf file
// PDF The viewer is used in \ref Upper [View on PDF] link
"latex-workshop.view.pdf.ref.viewer":"auto",
// Commands to execute when using an external viewer . This feature is not officially supported .
"latex-workshop.view.pdf.external.viewer.command": "C:/SumatraPDF/SumatraPDF.exe", // Pay attention to modifying the path
// When using an external viewer ,latex-workshop.view.pdf.external.view .command Parameters of . This feature is not officially supported .%PDF% Is used to generate PDF Placeholder for the absolute path of the file .
"latex-workshop.view.pdf.external.viewer.args": [
"%PDF%"
],
// take synctex The command to execute when forwarding to an external viewer . This feature is not officially supported .
"latex-workshop.view.pdf.external.synctex.command": "C:/SumatraPDF/SumatraPDF.exe", // Pay attention to modifying the path
// latex-workshop.view.pdf.external.synctex Parameters of . When syncing to an external viewer .%LINE% Is the line number ,%PDF% Is to generate PDF Placeholder for the absolute path of the file ,%TEX% Is triggered syncTeX The extension of is .tex Of LaTeX File path .
"latex-workshop.view.pdf.external.synctex.args": [
"-forward-search",
"%TEX%",
"%LINE%",
"-reuse-instance",
"-inverse-search",
"\"C:/Microsoft VS Code/Code.exe\"\" \"C:/Microsoft VS Code/resources/app/out/cli.js\" -r -g \"%f:%l\"", // Pay attention to modifying the path
"%PDF%"
],
"editor.minimap.enabled": true, // Controls whether thumbnails are displayed .
// Define the... To be used in the recipe LaTeX Compiler tools . Each tool is marked with its name .
// Invocation time , The command will use args Parameters and defined in env The environment variables defined in generate .
// Usually , Unless in the path , Otherwise, no spaces should appear in each parameter .
// Place holder %DOC%、%DOC_W32%、%DOC_EXT%、%DOC_EXT_W32%、%DOCFILE%、%DOCFILE_EXT%、%DIR%、%DIR_W32%、%TMPDIR% and %OUTDIR%、%OUTDIR_W32% You can use .
"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",
"args": [
"%DOCFILE%"
]
}
],
"latex-workshop.latex.recipes": [
{
"name": "xelatex",
"tools": [
"xelatex"
]
},
{
"name": "latexmk",
"tools": [
"latexmk"
]
},
{
"name": "pdflatex -> bibtex -> pdflatex*2",
"tools": [
"pdflatex",
"bibtex",
"pdflatex",
"pdflatex"
]
}
],
"latex-workshop.view.pdf.viewer": "tab",
"latex-workshop.latex.clean.enabled": true,
"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"
],
// Set to onFaild Clear auxiliary files after build failure
"latex-workshop.latex.autoClean.run": "onFailed",
// Use the last recipe Compilation combination
"latex-workshop.latex.recipe.default": "lastUsed",
// Key binding of internal viewer for reverse synchronization .ctrl/cmd + Click on ( Default ) Or double click
"latex-workshop.view.pdf.internal.synctex.keybinding": "double-click",
// Right-click menu
"latex-workshop.showContextMenu":true,
// Automatically complete commands and environments from the packages you use
"latex-workshop.intellisense.package.enabled": true,
// take glob Mode configuration to editor ( for example "* Hexadecimal ": "hexEditor.hexEdit"). These priorities are higher than the default behavior .
"workbench.editorAssociations": {
"*.ipynb": "jupyter-notebook"
},
"kite.showWelcomeNotificationOnStartup": false, // Need to install kite,show the Kite welcome notification on startup.
"python.defaultInterpreterPath": "E:\\Python\\python.exe", //python route
// Where should the cell toolbar be displayed , Or whether to hide it .
"notebook.cellToolbarLocation": {
"default": "right",
"jupyter-notebook": "left"// Configure the cell toolbar location for a specific file type
},
// If set to true, Automatically from the current Git The default remote library extraction commit for the repository . If set to “ All ”, Extract from all remote libraries .
"git.autofetch": true,
// Always trust the workspace
"security.workspace.trust.untrustedFiles": "open",
// Do not display the new version message
"vsicons.dontShowNewVersionMessage": true,
// For a language , Configure alternate editor settings
"[latex]": {
"editor.formatOnPaste": false,// For a language , Configure alternate editor settings
"editor.suggestSelection": "recentlyUsedByPrefix" // Controls how suggestions are preselected in the suggestion list .recentlyUsedByPrefix: Choose according to the prefixes suggested previously . for example ,co -> console、con -> const.
},
"code-runner.clearPreviousOutput": true,
"code-runner.saveAllFilesBeforeRun": true,
"code-runner.runInTerminal": true,
"workbench.colorTheme": "Solarized Dark",
}
1.6 The test link
Next, let's test it , Whether the debugging is successful .
- Create a new folder on the desktop , And in vs code Open folder on 【test1】;
stay vs code On , find 【test1】 Folder , And click the first option 【 New file 】;
New file 【test.tex】, Be sure to add a suffix 【.tex】, If there is no suffix 【.tex】,vs code Can't identify latex file ;
- Copy the following code into the input box , And save ;
\documentclass[fontset=windows]{article}
\usepackage[zihao=-4]{ctex}
\usepackage[a4paper]{geometry}
\begin{document}
\centering
\LaTeX, How are you? !
\end{document}
- Then I saw a flower in the left column 【tex】 Button , Click on .
- Find the first button 【Build latex project】, Click to expand , find 【Recipe:pdflatex…】, Click on ;
- You will see the compilation progress at the bottom ;
- After success , Then find the upper left corner 【View LaTex Pdf】, Click to expand , find 【View in VSCode tab】 And click OK .
- You can see the following interface ; It means that the test is successful ; Then you can be happy in vs code Knock up latex La ~
Two 、vs code To configure latex course mac edition
mac On the configuration latex Relatively simple , Here is a brief explanation , Also use vs code Download a software
vs code install ; ( see 1.1)
vs code Chinese environment configuration ; ( see 1.2)
vs code Installing a plug-in 【latexworkshop】; (1.5)
download 【MacTex】
mac Upper tex Compile software and windows Not quite the same. , front windows It uses 【textive2021】, here mac It uses 【MacTex】, The configuration process is simple , find 【MacTex】 Official website [5], Download and install . When the download is complete, close .
The test link ;( see 1.6)
Reference websites and materials
[1] visual studio code Official website :https://code.visualstudio.com
[2] Alibaba cloud open source image website : https://mirrors.aliyun.com/CTAN/systems/texlive/Images/
[3] Huawei open source : https://mirrors.huaweicloud.com/CTAN/systems/texlive/Images/
[4] Sumatra PDF Official website : https://www.sumatrapdfreader.org/free-pdf-reader
[5] MacTex Download website :https://tug.org/mactex/
边栏推荐
- How is it most convenient to open an account for stock speculation? Is it safe to open an account on your mobile phone
- Semantic segmentation model base segmentation_ models_ Detailed introduction to pytorch
- Prediction of the victory or defeat of the League of heroes -- simple KFC Colonel
- Codeforces Round #804 (Div. 2)
- 攻防演练中沙盘推演的4个阶段
- Basic mode of service mesh
- Cross modal semantic association alignment retrieval - image text matching
- Mathematical modeling -- knowledge map
- 2.非线性回归
- AI zhetianchuan ml novice decision tree
猜你喜欢
Malware detection method based on convolutional neural network
基于卷积神经网络的恶意软件检测方法
How does starfish OS enable the value of SFO in the fourth phase of SFO destruction?
6. Dropout application
[deep learning] AI one click to change the sky
NVIDIA Jetson test installation yolox process record
3.MNIST数据集分类
y59.第三章 Kubernetes从入门到精通 -- 持续集成与部署(三二)
CVE-2022-28346:Django SQL注入漏洞
图像数据预处理
随机推荐
CVE-2022-28346:Django SQL注入漏洞
《因果性Causality》教程,哥本哈根大学Jonas Peters讲授
7.正则化应用
C # generics and performance comparison
What is load balancing? How does DNS achieve load balancing?
基于卷积神经网络的恶意软件检测方法
ThinkPHP kernel work order system source code commercial open source version multi user + multi customer service + SMS + email notification
Cascade-LSTM: A Tree-Structured Neural Classifier for Detecting Misinformation Cascades(KDD20)
5.过拟合,dropout,正则化
攻防演练中沙盘推演的4个阶段
50Mhz产生时间
[Yugong series] go teaching course 006 in July 2022 - automatic derivation of types and input and output
取消select的默认样式的向下箭头和设置select默认字样
Binder core API
Fofa attack and defense challenge record
They gathered at the 2022 ecug con just for "China's technological power"
手写一个模拟的ReentrantLock
AI遮天传 ML-初识决策树
Tapdata 的 2.0 版 ,开源的 Live Data Platform 现已发布
Serial port receives a packet of data