LaTeX-Utilities icon indicating copy to clipboard operation
LaTeX-Utilities copied to clipboard

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

Open Guscccc opened this issue 1 year ago • 0 comments

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.

Guscccc avatar Apr 30 '24 10:04 Guscccc