How to get the opposite of {?x} and {?y}?

You should be able to transform the coordinate space so that you don't need to negate the values.

These two transforms do the same thing.

enter image description here

\documentclass{article}

\begin{document}


===

\vspace{2cm}
aaa
\special{dvisvgm:raw <g id='myGroup' transform='translate(-10,-20)'>}%
xyz
\special{dvisvgm:raw </g>}%
bbb

\vspace{2cm}
aaa
\special{dvisvgm:raw <g id='myGroup2' transform='scale(-1)'>}%
\special{dvisvgm:raw <g transform='translate(10,20)'>}%
\special{dvisvgm:raw <g transform='scale(-1)'>}%
xyz
\special{dvisvgm:raw </g>}%
\special{dvisvgm:raw </g>}%
\special{dvisvgm:raw </g>}%
bbb

\end{document}

Inspired by David Carlisle's answer, I dug a bit deeper in existing SVG files and discovered that transformations can be concatenated within the same transform attribute. This allows for an even more compact formulation without additional group levels:

\special{dvisvgm:raw <g id='myGroup' transform='scale(-1)translate({?x},{?y})scale(-1)'>}%
xyz
\special{dvisvgm:raw </g>}%

Tags:

Dvisvgm