# manim.mobject.svg.text_mobject.Paragraph¶

class Paragraph(*text, line_spacing=- 1, alignment=None, **config)[source]

Display a paragraph of text.

For a given Paragraph par, the attribute par.chars is a VGroup containing all the lines. In this context, every line is constructed as a VGroup of characters contained in the line.

Parameters
• line_spacing (int, optional) – Represents the spacing between lines. Default to -1, which means auto.

• alignment (str, optional) – Defines the alignment of paragraph. Default to “left”. Possible values are “left”, “right”, “center”

Examples

Normal usage:

paragraph = Paragraph('this is a awesome', 'paragraph',
'With \nNewlines', '\tWith Tabs',
'  With Spaces', 'With Alignments',
'center', 'left', 'right')


Remove unwanted invisible characters:

self.play(Transform(remove_invisible_chars(paragraph.chars[0:2]),
remove_invisible_chars(paragraph.chars[3][0:3]))


Methods

 change_alignment_for_a_line Function to change one line’s alignment to a specific value. gen_chars Function to convert plain string to 2d-VGroup of chars. set_all_lines_alignments Function to set all line’s alignment to a specific value. set_all_lines_to_initial_positions Set all lines to their initial positions. set_line_alignment Function to set one line’s alignment to a specific value. set_line_to_initial_position Function to set one line to initial positions.

Attributes

 animate Used to animate the application of a method. depth The depth of the mobject. height The height of the mobject. width The width of the mobject.
change_alignment_for_a_line(alignment, line_no)[source]

Function to change one line’s alignment to a specific value.

Parameters
• alignment (str) – Defines the alignment of paragraph. Possible values are “left”, “right”, “center”.

• line_no (int) – Defines the line number for which we want to set given alignment.

gen_chars(lines_str_list)[source]

Function to convert plain string to 2d-VGroup of chars. 2d-VGroup mean “VGroup of VGroup”.

Parameters

lines_str_list (str) – Plain text string.

Returns

The generated 2d-VGroup of chars.

Return type

VGroup

set_all_lines_alignments(alignment)[source]

Function to set all line’s alignment to a specific value.

Parameters

alignment (str) – Defines the alignment of paragraph. Possible values are “left”, “right”, “center”.

set_all_lines_to_initial_positions()[source]

Set all lines to their initial positions.

set_line_alignment(alignment, line_no)[source]

Function to set one line’s alignment to a specific value.

Parameters
• alignment (str) – Defines the alignment of paragraph. Possible values are “left”, “right”, “center”.

• line_no (int) – Defines the line number for which we want to set given alignment.

set_line_to_initial_position(line_no)[source]

Function to set one line to initial positions.

Parameters

line_no (int) – Defines the line number for which we want to set given alignment.