tecosaur / LaTeX-Utilities

An add-on to LaTeX Workshop that provides some features that go beyond the bare essentials
MIT License
474 stars 28 forks source link

Inline string replacement syntax as used in the demo template doesn't work. #400

Open Guscccc opened 3 months ago

Guscccc commented 3 months ago

Bug Report

Disable all the other extensions except for LaTeX Workshop and LaTeX Utilities, and check that you still see this issue.

You still see this issue?: Yes

Describe the bug

Inline string replacement syntax as used in the demo template doesn't work. In the wiki there is an example showing the demo setting for formattedPaste:

"latex-utilities.formattedPaste.image.template": [
    "\\begin{figure}[!htb]",
    "\t\\centering",
    "\t\\includegraphics[$1]{${imageFilePath}}",
    "\t\\caption{${imageFileNameWithoutExt/[-]/ /}}",
    "\t\\label{fig:${imageFileNameWithoutExt}}",
    "\\end{figure}",
    ""
]

But the \caption{${imageFileNameWithoutExt/[-]/ /}} part doen't really work as expected, as the caption is left blank when format paste is triggered. It seems the inline replacement part /[-]/ / doesn't work, because removing it restores the function (except for the replacement of - to space.

To Reproduce

Steps to reproduce the behaviour:

  1. set the "latex-utilities.formattedPaste.image.template" in the setting as above.
  2. format paste and see that the caption is left blank.