Open celdorwow opened 1 year ago
I solved it using a Python interpolation:
snippet tabu "Regular tabular" b
\\begin{tabular$1}`!p if t[1] == "x" or t[1] == "*": snip.rv=r"{\linewidth}"`{${2:cc}}
$0X & X \\\\
\\end{tabular$1}
endsnippet
However, I am going to leave it open because I don't know if what happens with the transformation above is a bug or intended.
Expected behavior: \begin{tabularx}{\linewidth}{cc} X & X \\ \end{tabularx}
Actual behavior: \begin{tabularx}{inewidth}{cc} X & X \\ \end{tabularx}
Steps to reproduce
Create a snippet
Write
tabu
in a LaTeX file and press<TAB>
The snippet displays
\begin{tabular}{cc}
and holds on position afterr
Appending
*
orx
inserts{inewidth}
in the middle but it should insert\linewidth
.As a comment, it doesn't matter how many times I escape
\
in front oflinewidth
in the snippetor
or
the effect is the same.
:py import sys; print(sys.version)
: 3.8.10 (default, Jun 22 2022, 20:18:18) [GCC 9.4.0], and:py3 import sys; print(sys.version)
: 3.8.10 (default, Jun 22 2022, 20:18:18) [GCC 9.4.0]