Enabling LaTeX in VSCode
Install LaTeX-Workshop extension, and follow the instruction to setting up the environment.
If your latex installation has an embedded latexindent you don’t need to do anything else. However, if you have MiKTeX installed you should do the following to make the extensions’s formatter work properly:
- Find
latexindent.exefrom this repo You can choose theperlversion with more headache as well. - Also download the file
defaultSettings.yamlfrom the same repo. (I have also uploaded it here) - Put them somewhere together and add their directory to the PATH.
- Go to the MiXTeX bin folder, (probably C:\Program Files\MiKTeX\miktex\bin\x64) and delete
latexindent.exe. Don’t worry! Just delete it. You could simply combine this step with the previous one with replacing the executable file. - In the VS Code, open up latex-workshop settings and search for format.
- Find the one saying
Latex-workshop › Latexindent: Args, and add-mas another item. - Test and enjoy! If the editor raised any error, test it with command line:
latexindent a.tex -m -w - For wrapping the lines, just change the value of the
columnsundertextWrapOptionsindefaultSettings.yamlfile.
