Skip to content

Conversation

@henrikmidtiby
Copy link
Contributor

Overview: What does this pull request change?

This is a work in progress for being able to access groups in objects created from SVG files.
I hope that this could be useful for addressing the following issues and pull requests:

When reading data from a SVG file, maintain the groupings of the document, which also allows the user to select (groups of) elements by their id.

Motivation and Explanation: Why and how do your changes improve the library?

Links to added or changed documentation pages

Further Information and Comments

The following example demonstrates how custom grouping of elements inside a latex equation can be achieved. This is based on an idea presented by @behackl in the discord dev-chat the 18th of august 2025.

from manim import *

class SvgTest3(Scene):
    def construct(self):
        t = MathTex(r'\frac{a}{b \special{dvisvgm:raw <g id="unique02">}\cdot c \special{dvisvgm:raw </g>}}')
        t.set_color(WHITE)
        t.id_to_vgroup_dict['unique02'].set_color(RED)
        self.add(t)

renders like

SvgTest3_ManimCE_v0 19 0

Reviewer Checklist

  • The PR title is descriptive enough for the changelog, and the PR is labeled correctly
  • If applicable: newly added non-private functions and classes have a docstring including a short summary and a PARAMETERS section
  • If applicable: newly added functions and classes are tested

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🆕 New

Development

Successfully merging this pull request may close these issues.

1 participant