text

Add text to your slide.

By default text is processed by Latex and accept Latex syntax.

from beampy import *

# Remove quiet=True to get beampy compilation outputs
doc = document(quiet=True)

with slide('Text module'):
    text(r'A simple text with \LaTeX syntax so you could write equation:')
    text(r'$$\sqrt{\frac{x}{y}}$$')

    t = text(r'You could align text to center by using the \textbf{align} parameter',
         align='center', width=350)

    # add border to the text to see the effect of center alignment
    t.add_border()

display_matplotlib(gcs())
../_images/sphx_glr_plot_text_001.png

Module arguments

class beampy.text(textin=None, **kwargs)

Add text to the current slide. Input text is by default processed using Latex and could use Latex syntax.

Parameters:
  • textin (str, optional) –

    Text to add. Could contain latex syntax with protected slash either by using double slash or by using the python r before string.

    >>> text(r’\sqrt{x}’)
    
  • x (int or float or {'center', 'auto'} or str, optional) – Horizontal position for the text container (the default is ‘center’). See positioning system of Beampy.
  • y (int or float or {'center', 'auto'} or str, optional) – Vertical position for the text container (the default is ‘auto’). See positioning system of Beampy.
  • width (int or float or None, optional) – Width of the text container (the default is None, which implies that the width is the parent group with).
  • size (int, optional) – The font size (the default theme sets this value to 20).
  • font (str, optional) – The Tex font (the default theme sets this value to ‘CMR’). THIS IS NOT YET IMPLEMENTED!
  • color (str, optional) – The text color (the default theme set this value to ‘#000000’). Color could be html hex values or SVG-COLOR-NAMES.
  • usetex (bool, optional) – Use latex to render text (the default value is true). Latex render could be turned off using `usetex`=False, then the text is rendered as svg.
  • va ({'','baseline'}, optional) – Vertical text alignment (the default value is ‘’, which implies that the alignment reference is the top-left corner of text). When `va`=’baseline’, the base-line of the first text row is computed and used as alignment reference (baseline-left).
  • extra_packages (list of string, optional) – Add latex packages to render the text, like [r’usepackage{name1}’, r’usepackage{name2}’]

Example

>>> text('this is my text', x='20', y='20')

Gallery generated by Sphinx-Gallery