diff --git a/sympy/printing/pretty/stringpict.py b/sympy/printing/pretty/stringpict.py index c7eb44279b9c..5db76dc2f940 100644 --- a/sympy/printing/pretty/stringpict.py +++ b/sympy/printing/pretty/stringpict.py @@ -328,6 +328,27 @@ def chunks(line): # Add spacers between sub-pictures return "\n\n".join(pictures) + + def subindex(self, index): + """ + Add a `sub index`. + """ + with_self = self.width() + width_index = index.width() + extended_self = self.right(width_subindex*stringPict(" ")) + index = index.left(width_self*stringPict(" ")) + return extended_self.bellow(index) + + def superindex(self, index): + """ + Add a `super index`. + """ + with_self = self.width() + width_index = index.width() + extended_self = self.right(width_subindex*stringPict(" ")) + index = index.left(width_self*stringPict(" ")) + return extended_self.above(index) + def terminal_width(self): """Return the terminal width if possible, otherwise return 0. """