├── .gitignore ├── images ├── icon.png └── syntax-highlight.png ├── .vscodeignore ├── .editorconfig ├── .github ├── pull_request.md └── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md ├── .vscode └── launch.json ├── CONTRIBUTING.md ├── LICENSE.md ├── README.md ├── settings └── configuration.json ├── CHANGELOG.md ├── package.json ├── snippets └── LaTeX.json └── grammars ├── BibTeX.json ├── TeX.json └── LaTeX.json /.gitignore: -------------------------------------------------------------------------------- 1 | *.log 2 | *.vsix 3 | node_modules 4 | package-lock.json -------------------------------------------------------------------------------- /images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/area44/vscode-LaTeX-support/HEAD/images/icon.png -------------------------------------------------------------------------------- /.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode 2 | node_modules 3 | tests 4 | .editorconfig 5 | .gitignore 6 | package-lock.json 7 | build -------------------------------------------------------------------------------- /images/syntax-highlight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/area44/vscode-LaTeX-support/HEAD/images/syntax-highlight.png -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 4 6 | end_of_line = crlf 7 | charset = utf-8 8 | trim_trailing_whitespace = false 9 | insert_final_newline = false -------------------------------------------------------------------------------- /.github/pull_request.md: -------------------------------------------------------------------------------- 1 | 6 | 7 | This PR fixes # -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | --- 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "type": "extensionHost", 6 | "request": "launch", 7 | "name": "Launch Extension", 8 | "runtimeExecutable": "${execPath}", 9 | "args": [ 10 | "--extensionDevelopmentPath=${workspaceFolder}" 11 | ] 12 | } 13 | ] 14 | } -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to LaTeX support 2 | Welcome, and thank you for your interest in contributing to LaTeX support! 3 | 4 | ## Convert `plist` file to `json` file 5 | 6 | If you want to convert `plist` file to `json` file, you can run `build/update-grammar.js`. This is example: 7 | 8 | ```npm 9 | node build/update-grammar.js James-Yu/LaTeX-Workshop syntax/LaTeX.tmLanguage.json grammars/LaTeX.json 10 | ``` -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | --- 5 | 6 | 7 | 8 | 9 | - VSCode Version: 10 | - OS Version: 11 | 12 | Steps to Reproduce: 13 | 14 | 15 | 1. 16 | 2. 17 | 18 | Expected behavior: 19 | 20 | 21 | Logs: 22 | 23 | 24 | Screenshots: 25 | 26 | 27 | Disable all the other extensions except for `LaTeX language support`, and check that you still see this issue? Yes/No. 28 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) AREA44 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LaTeX language support for Visual Studio Code 2 | 3 | [![VS Marketplace Version](https://vsmarketplacebadge.apphb.com/version/torn4dom4n.latex-support.svg)](https://marketplace.visualstudio.com/items?itemName=torn4dom4n.latex-support) 4 | [![VS Code Installs](https://vsmarketplacebadge.apphb.com/installs/torn4dom4n.latex-support.svg)](https://marketplace.visualstudio.com/items?itemName=torn4dom4n.latex-support) 5 | 6 | **From VSCode 1.64, the VS Code team has decided to provide built-in support for the LaTeX grammar. So this extension only supports VSCode <1.64.** 7 | 8 | This extension adds syntax highlighting and snippets for `LaTeX` language. I developed based on [VSCode LaTeX grammars](https://github.com/jlelong/vscode-latex-basics). 9 | 10 | ![LaTeX Preview](./images/syntax-highlight.png) 11 | 12 | ## Features 13 | * Syntax highlighting for `BibTeX`, `LaTeX` and `TeX` language. 14 | * Folding regions have markers defined: `%Region` and `%Endregion`. 15 | * Snippets. 16 | 17 | ## Changelog 18 | 19 | Read the [CHANGLELOG](https://github.com/AREA44/vscode-LaTeX-support/blob/main/CHANGELOG.md) to know what has changed over the last few versions of this extension. 20 | 21 | ## Contributing 22 | 23 | Contributions are greatly appreciated. Please fork this repository and open a 24 | pull request to add snippets, make grammar tweaks, etc. Reads [CONTRIBUTING](https://github.com/AREA44/vscode-LaTeX-support/blob/main/CONTRIBUTING.md) for detail. 25 | 26 | ## License 27 | 28 | Licensed under the [MIT](LICENSE.md) License. 29 | -------------------------------------------------------------------------------- /settings/configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "comments": { 3 | "lineComment": "%" 4 | }, 5 | "brackets": [ 6 | ["{", "}"], 7 | ["[", "]"], 8 | ["(", ")"], 9 | ["\\left(", "\\right)"], 10 | ["\\left(", "\\right."], 11 | ["\\left.", "\\right)"], 12 | ["\\left[", "\\right]"], 13 | ["\\left[", "\\right."], 14 | ["\\left.", "\\right]"], 15 | ["\\left\\{", "\\right\\}"], 16 | ["\\left\\{", "\\right."], 17 | ["\\left.", "\\right\\}"], 18 | ["\\left<", "\\right>"] 19 | ], 20 | "autoClosingPairs": [ 21 | ["\\bigl(", "\\bigr)"], 22 | ["\\bigl[", "\\bigr]"], 23 | ["\\bigl{", "\\bigr}"], 24 | ["\\Bigl(", "\\Bigr)"], 25 | ["\\Bigl[", "\\Bigr]"], 26 | ["\\Bigl{", "\\Bigr}"], 27 | ["\\biggl(", "\\biggr)"], 28 | ["\\biggl[", "\\biggr]"], 29 | ["\\biggl{", "\\biggr}"], 30 | ["\\Biggl(", "\\Biggr)"], 31 | ["\\Biggl[", "\\Biggr]"], 32 | ["\\Biggl{", "\\Biggr}"], 33 | ["\\(", "\\)"], 34 | ["\\[", "\\]"], 35 | ["\\{", "\\}"], 36 | ["\\left(", "\\right)"], 37 | ["\\left[", "\\right]"], 38 | ["\\left{", "\\right}"], 39 | ["{", "}"], 40 | ["[", "]"], 41 | ["(", ")"], 42 | ["`", "'"] 43 | ], 44 | "surroundingPairs": [ 45 | ["{", "}"], 46 | ["[", "]"], 47 | ["(", ")"], 48 | ["\"", "\""], 49 | ["'", "'"], 50 | ["`", "'"], 51 | ["$", "$"] 52 | ], 53 | "indentationRules": { 54 | "increaseIndentPattern": "\\\\begin{(?!document)([^}]*)}(?!.*\\\\end{\\1})", 55 | "decreaseIndentPattern": "^\\s*\\\\end{(?!document)" 56 | }, 57 | "autoCloseBefore": ";:.,=}])>\\` \n\t$", 58 | "wordPattern": "(__)|(\\*\\*)|(@.)|(\\.\\.\\.)|([^\\s`'\"~_!?|$#@%^&*\\-=+;:,.<>(){}[\\]\\\\\\/]{2,})", 59 | "folding": { 60 | "offSide": "true", 61 | "markers": { 62 | "start": "^\\s*%#Region\\b", 63 | "end": "^\\s*%#Endregion\\b" 64 | } 65 | } 66 | } -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # LaTeX language support CHANGELOG 2 | 3 | ## Version 4.0.0: December 31th, 2021 4 | - Updated `LaTeX` grammar from [VSCode LaTeX grammars](https://github.com/jlelong/vscode-latex-basics). 5 | - Only support VSCode < 1.64. From 1.64, VSCode supported `LaTeX` grammar. 6 | 7 | ## Version 3.10.0: October 16th, 2021 8 | - Updated `LaTeX` grammar from [LaTeX Workshop](https://github.com/James-Yu/LaTeX-Workshop). 9 | 10 | ## Version 3.9.0: August 1st, 2021 11 | - [Highlighted `spverbatim`](https://github.com/AREA44/vscode-LaTeX-support/issues/16). 12 | - Updated `LaTeX` and `TeX` grammars from [LaTeX Workshop](https://github.com/James-Yu/LaTeX-Workshop). 13 | 14 | ## Version 3.8.0: July 9th, 2021 15 | - Fixed [rectify typo in description key of snippets](https://github.com/AREA44/vscode-LaTeX-support/pull/15), thanks to [@sabertazimi](https://github.com/sabertazimi). 16 | - Fixed [line comment does not work in `\cite`](https://github.com/AREA44/vscode-LaTeX-support/issues/14). 17 | - Updated `TeX` grammar from [LaTeX Workshop](https://github.com/James-Yu/LaTeX-Workshop). 18 | 19 | ## Version 3.7.0: June 16th, 2021 20 | - Updated grammars from [LaTeX Workshop](https://github.com/James-Yu/LaTeX-Workshop). 21 | - Fixed [snippets for align(ed) and gather(ed)](https://github.com/AREA44/vscode-LaTeX-support/issues/13). 22 | 23 | ## Version 3.6.0: March 8th, 2021 24 | - Updated grammars from [LaTeX Workshop](https://github.com/James-Yu/LaTeX-Workshop). 25 | 26 | ## Version 3.5.0: December 12th, 2020 27 | - Auto-closing pairs with `\left` and `\right`. Fixed [`\left` and `\right` cannot be matched properly](https://github.com/AREA44/vscode-LaTeX-support/issues/9). 28 | - Removed `$` auto-closing causes bad typing behavior. 29 | - Added GitHub template. 30 | 31 | ## Version 3.4.0: November 14th, 2020 32 | - Updated grammars from [LaTeX Workshop](https://github.com/James-Yu/LaTeX-Workshop). 33 | 34 | ## Version 3.0.0: April 14th, 2019 35 | - Used `LaTeX-Workshop`'s grammars. 36 | 37 | ## Version 2.1.0: October 27th, 2018 38 | - Fixed [VerbatimOut not recognized as a verbatim environment](https://github.com/ProAdd-ons/vscode-LaTeX-support/issues/6). 39 | 40 | ## Version 2.0.0: July 10th,2018 41 | - Cleaned and fixed bugs. 42 | - Supported for [Folding regions](https://code.visualstudio.com/updates/v1_17#_folding-regions). The LaTeX language currently have markers defined: `%Region` and `%Endregion`. 43 | 44 | ## Version 1.0.0: September 24th, 2017 45 | - Converted grammars from the [LaTeX TextMate bundle](https://github.com/textmate/latex.tmbundle). 46 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "latex-support", 3 | "version": "4.0.0", 4 | "displayName": "LaTeX language support", 5 | "description": "LaTeX language support for Visual Studio Code", 6 | "repository": { 7 | "type": "git", 8 | "url": "https://github.com/AREA44/vscode-LaTeX-support" 9 | }, 10 | "license": "MIT", 11 | "icon": "images/icon.png", 12 | "publisher": "torn4dom4n", 13 | "categories": [ 14 | "Programming Languages" 15 | ], 16 | "engines": { 17 | "vscode": "1.63.0" 18 | }, 19 | "keywords": [ 20 | "BibTeX", 21 | "LaTeX", 22 | "TeX" 23 | ], 24 | "contributes": { 25 | "languages": [ 26 | { 27 | "id": "bibtex", 28 | "aliases": [ 29 | "BibTeX" 30 | ], 31 | "extensions": [ 32 | ".bib" 33 | ], 34 | "configuration": "./settings/configuration.json" 35 | }, 36 | { 37 | "id": "latex", 38 | "aliases": [ 39 | "LaTeX" 40 | ], 41 | "extensions": [ 42 | ".tex", 43 | ".ltx", 44 | ".ctx" 45 | ], 46 | "configuration": "./settings/configuration.json" 47 | }, 48 | { 49 | "id": "tex", 50 | "aliases": [ 51 | "TeX" 52 | ], 53 | "extensions": [ 54 | ".sty", 55 | ".cls", 56 | ".bbx", 57 | ".cbx" 58 | ], 59 | "configuration": "./settings/configuration.json" 60 | } 61 | ], 62 | "grammars": [ 63 | { 64 | "language": "bibtex", 65 | "scopeName": "text.bibtex", 66 | "path": "./grammars/Bibtex.json" 67 | }, 68 | { 69 | "language": "latex", 70 | "scopeName": "text.tex.latex", 71 | "path": "./grammars/LaTeX.json", 72 | "embeddedLanguages": { 73 | "source.asymptote": "asymptote", 74 | "source.cpp": "cpp", 75 | "source.css": "css", 76 | "source.dot": "dot", 77 | "source.gnuplot": "gnuplot", 78 | "text.html": "html", 79 | "source.java": "java", 80 | "source.js": "javascript", 81 | "source.lua": "lua", 82 | "source.python": "python", 83 | "source.ruby": "ruby", 84 | "source.scala": "scala", 85 | "source.ts": "typescript", 86 | "text.xtml": "xtml", 87 | "source.yaml": "yaml" 88 | } 89 | }, 90 | { 91 | "language": "tex", 92 | "scopeName": "text.tex", 93 | "path": "./grammars/TeX.json" 94 | } 95 | ], 96 | "snippets": [ 97 | { 98 | "language": "latex", 99 | "path": "./snippets/LaTeX.json" 100 | } 101 | ] 102 | }, 103 | "devDependencies": { 104 | "fast-plist": "0.1.2", 105 | "cson-parser": "4.0.2" 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /snippets/LaTeX.json: -------------------------------------------------------------------------------- 1 | { 2 | "Align(ed)": { 3 | "prefix": "ali", 4 | "body": [ 5 | "\\begin{align}", 6 | "\t$0", 7 | "\\end{align}" 8 | ], 9 | "description": "Align(ed)" 10 | }, 11 | "Cases": { 12 | "prefix": "cas", 13 | "body": [ 14 | "\\begin{cases}", 15 | "\t${1:equation}, &\\text{ if }${2:case}\\\\\\\\", 16 | "\t$0", 17 | "\\end{cases}" 18 | ], 19 | "description": "Cases" 20 | }, 21 | "Chapter": { 22 | "prefix": "cha", 23 | "body": [ 24 | "\\chapter{${1:chapter name}} % (fold)", 25 | "\\label{cha:${2:${1/(\\w+)(\\W+$)?|\\W+/${1:?${1:/asciify/downcase}:_}/g}}}", 26 | "${0:$TM_SELECTED_TEXT}", 27 | "% chapter $2 (end)" 28 | ], 29 | "description": "Chapter" 30 | }, 31 | "Description": { 32 | "prefix": "desc", 33 | "body": [ 34 | "\\\\begin{description}", 35 | "\t\\item[$1] $0", 36 | "\\\\end{description}" 37 | ], 38 | "description": "Description" 39 | }, 40 | "Enumerate": { 41 | "prefix": "enum", 42 | "body": [ 43 | "\\\\begin{enumerate}", 44 | "\t\\item $0", 45 | "\\\\end{enumerate}" 46 | ], 47 | "description": "Enumerate" 48 | }, 49 | "Equation": { 50 | "prefix": "eq", 51 | "body": [ 52 | "\\begin{equation}", 53 | "\t$0", 54 | "\\end{equation}" 55 | ], 56 | "description": "Equation" 57 | }, 58 | "Figure": { 59 | "prefix": "figure", 60 | "body": [ 61 | "${1:Figure}~\\ref{${2:fig:}}$0" 62 | ], 63 | "description": "Figure" 64 | }, 65 | "Gather(ed)": { 66 | "prefix": "gat", 67 | "body": [ 68 | "\\begin{gather}", 69 | "\t$0", 70 | "\\end{gather}" 71 | ], 72 | "description": "Gather(ed)" 73 | }, 74 | "Itemize": { 75 | "prefix": "item", 76 | "body": [ 77 | "\\\\begin{itemize}", 78 | "\t\\item $0", 79 | "\\\\end{itemize}" 80 | ], 81 | "description": "Itemize" 82 | }, 83 | "Listing": { 84 | "prefix": "listing", 85 | "body": [ 86 | "${1:Listing}~\\ref{${2:lst:}}$0" 87 | ], 88 | "description": "Listing" 89 | }, 90 | "Matrix": { 91 | "prefix": "mat", 92 | "body": [ 93 | "\\begin{${1:p/b/v/V/B/small}matrix}", 94 | "\t$0", 95 | "\\end{${1:p/b/v/V/B/small}matrix}" 96 | ], 97 | "description": "Matrix" 98 | }, 99 | "Page": { 100 | "prefix": "page", 101 | "body": [ 102 | "${1:page}~\\pageref{$2}$0" 103 | ], 104 | "description": "Page" 105 | }, 106 | "Paragraph": { 107 | "prefix": "par", 108 | "body": [ 109 | "\\paragraph{${1:paragraph name}} % (fold)", 110 | "\\label{par:${2:${1/(\\w+)(\\W+$)?|\\W+/${1:?${1:/asciify/downcase}:_}/g}}}", 111 | "${0:$TM_SELECTED_TEXT}", 112 | "% paragraph $2 (end)" 113 | ], 114 | "description": "Paragraph" 115 | }, 116 | "Part": { 117 | "prefix": "part", 118 | "body": [ 119 | "\\part{${1:part name}} % (fold)", 120 | "\\label{prt:${2:${1/(\\w+)(\\W+$)?|\\W+/${1:?${1:/asciify/downcase}:_}/g}}}", 121 | "${0:$TM_SELECTED_TEXT}", 122 | "% part $2 (end)" 123 | ], 124 | "description": "Part" 125 | }, 126 | "Region Start": { 127 | "prefix": "#region", 128 | "body": [ 129 | "%#Region $0" 130 | ], 131 | "description": "Folding Region Start" 132 | }, 133 | "Region End": { 134 | "prefix": "#endregion", 135 | "body": [ 136 | "%#Endregion" 137 | ], 138 | "description": "Folding Region End" 139 | }, 140 | "Section": { 141 | "prefix": "section", 142 | "body": [ 143 | "${1:Section}~\\ref{${2:sec:}}$0" 144 | ], 145 | "description": "" 146 | }, 147 | "Split": { 148 | "prefix": "spl", 149 | "body": [ 150 | "\\begin{split}", 151 | "\t$0", 152 | "\\end{split}" 153 | ], 154 | "description": "Section" 155 | }, 156 | "Sub Paragraph": { 157 | "prefix": "subp", 158 | "body": [ 159 | "\\subparagraph{${1:subparagraph name}} % (fold)", 160 | "\\label{subp:${2:${1/(\\w+)(\\W+$)?|\\W+/${1:?${1:/asciify/downcase}:_}/g}}}", 161 | "${0:$TM_SELECTED_TEXT}", 162 | "% subparagraph $2 (end)" 163 | ], 164 | "description": "Sub Paragraph" 165 | }, 166 | "Sub Section": { 167 | "prefix": "sub", 168 | "body": [ 169 | "\\subsection{${1:subsection name}} % (fold)", 170 | "\\label{sub:${2:${1/(\\w+)(\\W+$)?|\\W+/${1:?${1:/asciify/downcase}:_}/g}}}", 171 | "${0:$TM_SELECTED_TEXT}", 172 | "% subsection $2 (end)" 173 | ], 174 | "description": "Sub Section" 175 | }, 176 | "Sub Sub Section": { 177 | "prefix": "subs", 178 | "body": [ 179 | "\\subsubsection{${1:subsubsection name}} % (fold)", 180 | "\\label{ssub:${2:${1/(\\w+)(\\W+$)?|\\W+/${1:?${1:/asciify/downcase}:_}/g}}}", 181 | "${0:$TM_SELECTED_TEXT}", 182 | "% subsubsection $2 (end)" 183 | ], 184 | "description": "Sub Sub Section" 185 | }, 186 | "Table": { 187 | "prefix": "table", 188 | "body": [ 189 | "${1:Table}~\\ref{${2:tab:}}$0" 190 | ], 191 | "description": "Table" 192 | }, 193 | "Tabular": { 194 | "prefix": "tab", 195 | "body": [ 196 | "\\begin{table}[${1:htbp}]", 197 | "\t\\centering\\begin{tabular}{${4:}}", 198 | "\t\t$0", 199 | "\t\\end{tabular}", 200 | "\t\\caption{${2:}}", 201 | "\t\\label{${3: