Emkay
Emkay

Reputation: 25

VSCode Snippets for Latex: Combining placeholders and curly braces

I'm in the process of setting up a file for personal snippets in VSCode for LaTeX. Is there a way to combine placeholders (Syntax: ${1:foo}) and normal curly braces? In my example I want my code to output: \fcolorbox {frame}{background}{text} where every variable is a placeholder. My generated snippet code (.json) looks as follows:

    "Colorbox fcolorbox": {
  "prefix": "colbox",
  "body": [
    "\\fcolorbox ${{1:frame}}${{2:background}}${{3:text}}"
  ],
  "description": "Colorbox fcolorbox"
}

but doesn't work since it outputs and interprets the $ and {} as LaTeX symbols. Is there a way to fix this and make the placeholders work?

Upvotes: 1

Views: 468

Answers (1)

rioV8
rioV8

Reputation: 28763

This produces the requested result: \fcolorbox {frame}{background}{text}

"Colorbox fcolorbox": {
    "prefix": "colbox",
    "body": [
      "\\fcolorbox {${1:frame}}{${2:background}}{${3:text}}"
    ],
    "description": "Colorbox fcolorbox"
  }

Upvotes: 1

Related Questions