Add options for bracket spacing in Matrix

This commit is contained in:
Grant Sanderson 2019-03-24 11:33:23 -07:00
parent 22f8e24d41
commit ee04922400

View file

@ -56,6 +56,8 @@ class Matrix(VMobject):
CONFIG = {
"v_buff": 0.8,
"h_buff": 1.3,
"bracket_h_buff": MED_SMALL_BUFF,
"bracket_v_buff": MED_SMALL_BUFF,
"add_background_rectangles_to_entries": False,
"include_background_rectangle": False,
"element_to_mobject": TexMobject,
@ -101,10 +103,12 @@ class Matrix(VMobject):
def add_brackets(self):
bracket_pair = TexMobject("\\big[", "\\big]")
bracket_pair.scale(2)
bracket_pair.stretch_to_fit_height(self.get_height() + 0.5)
bracket_pair.stretch_to_fit_height(
self.get_height() + 2 * self.bracket_v_buff
)
l_bracket, r_bracket = bracket_pair.split()
l_bracket.next_to(self, LEFT)
r_bracket.next_to(self, RIGHT)
l_bracket.next_to(self, LEFT, self.bracket_h_buff)
r_bracket.next_to(self, RIGHT, self.bracket_h_buff)
self.add(l_bracket, r_bracket)
self.brackets = VGroup(l_bracket, r_bracket)
return self