Discussion:
Graphics vector data format
Peter Flynn
2020-05-31 21:15:41 UTC
I'm sorry to wander slightly off-topic, but a colleague has handed me a
web page which needs converting to LaTeX. All the text and images are
straightforward to automate, but some of the icons are done with a
drawing language I don't recognise, generated by a framework I don't use
(I believe Angular) eg a plant with two leaves, similar to the one in
FontAwesome:

M734.417,
1001.26c-2.54-.74-9.867-3.864-1.564-14.26,
4.49,2.963,6.22,5.571,6.54,
7.725-2.147.748-3.626,2.2-3.441,
4.834a42.979,42.979,0,0,1-2.481-8.78A40.825,
40.825,0,0,0,734.417,1001.26Zm2.874,0.65c-0.618-1.67-1.9-7.105,
7.694-6.806,0.282,8.536-4.366,8.216-6.478,
7.646a15.406,15.406,0,0,1,3.423-4.409A17.807,
17.807,0,0,0,737.291,1001.91Z translate(-729 -987)

I'd like to find a way to understand it enough to get TikZ to replicate
it inside LaTeX. Has anyone encountered it?

Peter
Scott Pakin
2020-06-01 19:33:28 UTC
Peter,
Post by Peter Flynn
I'm sorry to wander slightly off-topic, but a colleague has handed me a
web page which needs converting to LaTeX. All the text and images are
straightforward to automate, but some of the icons are done with a
drawing language I don't recognise, generated by a framework I don't use
(I believe Angular) eg a plant with two leaves, similar to the one in
M734.417,
1001.26c-2.54-.74-9.867-3.864-1.564-14.26,
4.49,2.963,6.22,5.571,6.54,
7.725-2.147.748-3.626,2.2-3.441,
4.834a42.979,42.979,0,0,1-2.481-8.78A40.825,
40.825,0,0,0,734.417,1001.26Zm2.874,0.65c-0.618-1.67-1.9-7.105,
7.694-6.806,0.282,8.536-4.366,8.216-6.478,
7.646a15.406,15.406,0,0,1,3.423-4.409A17.807,
17.807,0,0,0,737.291,1001.91Z translate(-729 -987)
I'd like to find a way to understand it enough to get TikZ to replicate
it inside LaTeX. Has anyone encountered it?
This looks to me like SVG or a very close derivative. See, for example,

https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths

In short, "M" is move; "c" is a cubic Bézier curve; "a" is an arc; and
"Z" closes the path. Uppercase letters denote absolute coordinates, and
lowercase letters specify denote relative coordinates. Commas are
treated like spaces, and spaces can be omitted where the separation
between items is unambigious (e.g., "-0.618-1.67-1.9-7.105" is parsed
like "-0.618 -1.67 -1.9 -7.105"). I wouldn't think it would be too hard
to port this to TikZ.

-- Scott
samcarter8
2020-06-01 20:21:38 UTC
Actually you can use most of this directly in TikZ:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary {svg.path}

\begin{document}

\begin{tikzpicture}

\draw svg {M734.417,
1001.26c-2.54-.74-9.867-3.864-1.564-14.26,
4.49,2.963,6.22,5.571,6.54,
7.725-2.147.748-3.626,2.2-3.441,
4.834a42.979,42.979,0,0,1-2.481-8.78A40.825,
40.825,0,0,0,734.417,1001.26Zm2.874,0.65c-0.618-1.67-1.9-7.105,
7.694-6.806,0.282,8.536-4.366,8.216-6.478,
7.646a15.406,15.406,0,0,1,3.423-4.409A17.807,
17.807,0,0,0,737.291,1001.91Z
};
\end{tikzpicture}

\end{document}
Post by Scott Pakin
Peter,
Post by Peter Flynn
I'm sorry to wander slightly off-topic, but a colleague has handed me
a web page which needs converting to LaTeX. All the text and images
are straightforward to automate, but some of the icons are done with a
drawing language I don't recognise, generated by a framework I don't
use (I believe Angular) eg a plant with two leaves, similar to the one
M734.417,
1001.26c-2.54-.74-9.867-3.864-1.564-14.26,
4.49,2.963,6.22,5.571,6.54,
7.725-2.147.748-3.626,2.2-3.441,
4.834a42.979,42.979,0,0,1-2.481-8.78A40.825,
40.825,0,0,0,734.417,1001.26Zm2.874,0.65c-0.618-1.67-1.9-7.105,
7.694-6.806,0.282,8.536-4.366,8.216-6.478,
7.646a15.406,15.406,0,0,1,3.423-4.409A17.807,
17.807,0,0,0,737.291,1001.91Z translate(-729 -987)
I'd like to find a way to understand it enough to get TikZ to
replicate it inside LaTeX. Has anyone encountered it?
This looks to me like SVG or a very close derivative.  See, for example,
https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths
In short, "M" is move; "c" is a cubic Bézier curve; "a" is an arc; and
"Z" closes the path.  Uppercase letters denote absolute coordinates, and
lowercase letters specify denote relative coordinates.  Commas are
treated like spaces, and spaces can be omitted where the separation
between items is unambigious (e.g., "-0.618-1.67-1.9-7.105" is parsed
like "-0.618 -1.67 -1.9 -7.105").  I wouldn't think it would be too hard
to port this to TikZ.
-- Scott
Peter Flynn
2020-06-01 21:41:05 UTC