Skip to content

Instantly share code, notes, and snippets.

@huaminghuangtw
Last active April 28, 2022 12:34
Show Gist options
  • Save huaminghuangtw/5364fd2e87146206966366bf8e7ba087 to your computer and use it in GitHub Desktop.
Save huaminghuangtw/5364fd2e87146206966366bf8e7ba087 to your computer and use it in GitHub Desktop.
Configuration for LaTeX-Workshop (VS Code Extension)
[
{
"key": "ctrl+shift+B",
"command": "editor.action.insertSnippet",
"when": "editorHasSelection && resourceExtname == .tex",
"args": {
"snippet": "\\textbf{${TM_SELECTED_TEXT}}$0"
}
},
{
"key": "ctrl+shift+I",
"command": "editor.action.insertSnippet",
"when": "editorHasSelection && resourceExtname == .tex",
"args": {
"snippet": "\\textit{${TM_SELECTED_TEXT}}$0"
}
},
{
"key": "ctrl+shift+U",
"command": "editor.action.insertSnippet",
"when": "editorHasSelection && resourceExtname == .tex",
"args": {
"snippet": "\\underline{${TM_SELECTED_TEXT}}$0"
}
},
{
"key": "ctrl+shift+R",
"command": "editor.action.insertSnippet",
"when": "editorHasSelection && resourceExtname == .tex",
"args": {
"snippet": "\\autoref{${TM_SELECTED_TEXT}}$0"
}
},
{
"key": "ctrl+shift+C",
"command": "editor.action.insertSnippet",
"when": "editorHasSelection && resourceExtname == .tex",
"args": {
"snippet": "\\cite{${TM_SELECTED_TEXT}}$0"
}
},
{
"key": "ctrl+shift+B",
"command": "editor.action.insertSnippet",
"when": "!editorHasSelection && resourceExtname == .tex",
"args": {
"snippet": "\\textbf{$0}"
}
},
{
"key": "ctrl+shift+I",
"command": "editor.action.insertSnippet",
"when": "!editorHasSelection && resourceExtname == .tex",
"args": {
"snippet": "\\textit{$0}"
}
},
{
"key": "ctrl+shift+U",
"command": "editor.action.insertSnippet",
"when": "!editorHasSelection && resourceExtname == .tex",
"args": {
"snippet": "\\underline{$0}"
}
},
{
"key": "ctrl+shift+R",
"command": "editor.action.insertSnippet",
"when": "!editorHasSelection && resourceExtname == .tex",
"args": {
"snippet": "\\autoref{$0}"
}
},
{
"key": "ctrl+shift+C",
"command": "editor.action.insertSnippet",
"when": "!editorHasSelection && resourceExtname == .tex",
"args": {
"snippet": "\\cite{$0}"
}
},
]
"latex-workshop.latex.autoClean.run": "onBuilt",
"latex-workshop.view.pdf.viewer": "tab",
"latex-workshop.view.pdf.internal.synctex.keybinding": "double-click",
"latex-workshop.latex.autoBuild.run": "onSave",
"files.autoSave": "afterDelay",
"files.autoSaveDelay": 30000,
"latex-workshop.latex.recipes": [
{
"name": "pdflatex ➞ biber ➞ pdflatex ➞ makeglossaries ➞ pdflatex × 2",
"tools": [
"pdflatex",
"biber",
"pdflatex",
"makeglossaries",
"pdflatex",
"pdflatex",
]
},
{
"name": "latexmk 🔃",
"tools": [
"latexmk"
]
},
{
"name": "lualatex ➞ biber ➞ lualatex",
"tools": [
"lualatex",
"biber",
"lualatex"
]
},
],
"latex-workshop.latex.tools": [
{
"name": "pdflatex",
"command": "pdflatex",
"args": [
"-shell-escape",
"-interaction=nonstopmode",
"-file-line-error",
"-aux-directory=.",
"-output-directory=./..",
"%DOC%"
]
},
{
"name": "latexmk",
"command": "latexmk",
"args": [
"-shell-escape",
"-interaction=nonstopmode",
"-file-line-error",
"-aux-directory=.",
"-output-directory=./..",
"-pdf",
"%DOC%"
]
},
{
"name": "lualatex",
"command": "lualatex",
"args": [
"-interaction=nonstopmode",
"-file-line-error",
"-aux-directory=.",
"-output-directory=./..",
"%DOC%"
]
},
{
"name": "biber",
"command": "biber",
"args": [
"%DOCFILE%"
]
},
{
"name": "makeglossaries",
"command": "makeglossaries",
"args": [
"%DOCFILE%"
]
},
],
@huaminghuangtw
Copy link
Author

huaminghuangtw commented Apr 26, 2022

Comments for settings.json

  • Line 1: Clean auxiliary files
  • Line 2: Set default PDF viewer
  • Line 3: Synctex from PDF to source via double-clicking (originally it's by default set to Ctrl + left-clicking) ↔️ Synctex from source to PDF via Ctrl + Alt + J
  • Line 4,5,6 : Auto build LaTeX
  • After Line 7 (latex-workshop.latex.recipes & latex-workshop.latex.tools): Specify paths for auxiliary files and pdf document with -aux-directory and -output-directory options (Then you can put -aux-directory in the .gitignore file)

@huaminghuangtw
Copy link
Author

huaminghuangtw commented Apr 26, 2022

Comments for keybindings.json

Keyboard shortcuts for the following LaTeX commands:

  • \textbf
  • \textit
  • \underline
  • \autoref
  • \cite

@huaminghuangtw
Copy link
Author

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