FIX: {end_ang} and {radi} not seen as variables #181
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
In this line:
svg2tikz/svg2tikz/tikz_export.py
Line 1152 in 5069a1e
The formatted string literal (f-string) is interrupted by the line break. So in the next line:
svg2tikz/svg2tikz/tikz_export.py
Line 1153 in 5069a1e
The variables
end_ang
,radi
and the escape characters{}
were not recognised correctly, but were recognised as constant strings, generating the errorPackage PGF Math Error: Unknown function 'end_ang'/'radi' (in 'end_ang'/'radi')
in LaTeX.Adding the f-string alias
f
before the string":{end_ang}:{radi})" + "}"
solves the problem.I did not find an associated GitHub issue for this.
Type of change
How Has This Been Tested?
Visual inspection of the output.
For example:
Uses as input a svg file containing a path with an arc:
test.svg
Then run
svg2tikz
as a Python module:Previously, the script returned this output:
The
arc(94.9855:{end_ang}:{radi})}
command produces errorsPackage PGF Math Error: Unknown function 'end_ang' (in 'end_ang')
andPackage PGF Math Error: Unknown function 'radi' (in 'radi')
in LaTeX.After the fix, this output is returned:
And now the command
arc(94.9855:183.7884:0.0106 and 0.0103)
contains the correct values.Checklist: