How to use the pylatexenc.latex2text.EnvironmentTextSpec function in pylatexenc

To help you get started, we’ve selected a few pylatexenc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github phfaist / pylatexenc / pylatexenc / latex2text / _defaultspecs.py View on Github external
EnvironmentTextSpec('align', simplify_repl=fmt_equation_environment),
        EnvironmentTextSpec('multline', simplify_repl=fmt_equation_environment),
        EnvironmentTextSpec('gather', simplify_repl=fmt_equation_environment),
        EnvironmentTextSpec('dmath', simplify_repl=fmt_equation_environment),

        EnvironmentTextSpec('array', simplify_repl=fmt_placeholder_node),
        EnvironmentTextSpec('pmatrix', simplify_repl=fmt_placeholder_node),
        EnvironmentTextSpec('bmatrix', simplify_repl=fmt_placeholder_node),
        EnvironmentTextSpec('smallmatrix', simplify_repl=fmt_placeholder_node),

        EnvironmentTextSpec('center', simplify_repl='\n%s\n'),
        EnvironmentTextSpec('flushleft', simplify_repl='\n%s\n'),
        EnvironmentTextSpec('flushright', simplify_repl='\n%s\n'),

        EnvironmentTextSpec('exenumerate', discard=False),
        EnvironmentTextSpec('enumerate', discard=False),
        EnvironmentTextSpec('list', discard=False),
        EnvironmentTextSpec('itemize', discard=False),
        EnvironmentTextSpec('subequations', discard=False),
        EnvironmentTextSpec('figure', discard=False),
        EnvironmentTextSpec('table', discard=False),

    ],
    'specials': [
        SpecialsTextSpec('&', '   '), # ignore tabular alignments, just add a little space
    ],

    'macros': [
        # NOTE: macro will only be assigned arguments if they are explicitly defined as
        #       accepting arguments in latexwalker.py.
        MacroTextSpec('emph', discard=False),
        MacroTextSpec('textrm', discard=False),
github phfaist / pylatexenc / pylatexenc / latex2text / _defaultspecs.py View on Github external
def _format_uebung(n, l2t):
    s = '\n' + l2t.nodelist_to_text([n.nodeargs[0]]) + '\n'
    optarg = n.nodeargs[1]
    if optarg is not None:
        s += '[{}]\n'.format(l2t.nodelist_to_text([optarg]))
    return s


# construct the specs structure, more than the just the following definition

latex_base_specs = {
    
    'environments': [

        EnvironmentTextSpec('equation', simplify_repl=fmt_equation_environment),
        EnvironmentTextSpec('eqnarray', simplify_repl=fmt_equation_environment),
        EnvironmentTextSpec('align', simplify_repl=fmt_equation_environment),
        EnvironmentTextSpec('multline', simplify_repl=fmt_equation_environment),
        EnvironmentTextSpec('gather', simplify_repl=fmt_equation_environment),
        EnvironmentTextSpec('dmath', simplify_repl=fmt_equation_environment),

        EnvironmentTextSpec('array', simplify_repl=fmt_placeholder_node),
        EnvironmentTextSpec('pmatrix', simplify_repl=fmt_placeholder_node),
        EnvironmentTextSpec('bmatrix', simplify_repl=fmt_placeholder_node),
        EnvironmentTextSpec('smallmatrix', simplify_repl=fmt_placeholder_node),

        EnvironmentTextSpec('center', simplify_repl='\n%s\n'),
        EnvironmentTextSpec('flushleft', simplify_repl='\n%s\n'),
        EnvironmentTextSpec('flushright', simplify_repl='\n%s\n'),

        EnvironmentTextSpec('exenumerate', discard=False),
        EnvironmentTextSpec('enumerate', discard=False),
github phfaist / pylatexenc / pylatexenc / latex2text / _defaultspecs.py View on Github external
# construct the specs structure, more than the just the following definition

latex_base_specs = {
    
    'environments': [

        EnvironmentTextSpec('equation', simplify_repl=fmt_equation_environment),
        EnvironmentTextSpec('eqnarray', simplify_repl=fmt_equation_environment),
        EnvironmentTextSpec('align', simplify_repl=fmt_equation_environment),
        EnvironmentTextSpec('multline', simplify_repl=fmt_equation_environment),
        EnvironmentTextSpec('gather', simplify_repl=fmt_equation_environment),
        EnvironmentTextSpec('dmath', simplify_repl=fmt_equation_environment),

        EnvironmentTextSpec('array', simplify_repl=fmt_placeholder_node),
        EnvironmentTextSpec('pmatrix', simplify_repl=fmt_placeholder_node),
        EnvironmentTextSpec('bmatrix', simplify_repl=fmt_placeholder_node),
        EnvironmentTextSpec('smallmatrix', simplify_repl=fmt_placeholder_node),

        EnvironmentTextSpec('center', simplify_repl='\n%s\n'),
        EnvironmentTextSpec('flushleft', simplify_repl='\n%s\n'),
        EnvironmentTextSpec('flushright', simplify_repl='\n%s\n'),

        EnvironmentTextSpec('exenumerate', discard=False),
        EnvironmentTextSpec('enumerate', discard=False),
        EnvironmentTextSpec('list', discard=False),
        EnvironmentTextSpec('itemize', discard=False),
        EnvironmentTextSpec('subequations', discard=False),
        EnvironmentTextSpec('figure', discard=False),
        EnvironmentTextSpec('table', discard=False),

    ],
    'specials': [
github phfaist / pylatexenc / pylatexenc / latex2text / _defaultspecs.py View on Github external
EnvironmentTextSpec('dmath', simplify_repl=fmt_equation_environment),

        EnvironmentTextSpec('array', simplify_repl=fmt_placeholder_node),
        EnvironmentTextSpec('pmatrix', simplify_repl=fmt_placeholder_node),
        EnvironmentTextSpec('bmatrix', simplify_repl=fmt_placeholder_node),
        EnvironmentTextSpec('smallmatrix', simplify_repl=fmt_placeholder_node),

        EnvironmentTextSpec('center', simplify_repl='\n%s\n'),
        EnvironmentTextSpec('flushleft', simplify_repl='\n%s\n'),
        EnvironmentTextSpec('flushright', simplify_repl='\n%s\n'),

        EnvironmentTextSpec('exenumerate', discard=False),
        EnvironmentTextSpec('enumerate', discard=False),
        EnvironmentTextSpec('list', discard=False),
        EnvironmentTextSpec('itemize', discard=False),
        EnvironmentTextSpec('subequations', discard=False),
        EnvironmentTextSpec('figure', discard=False),
        EnvironmentTextSpec('table', discard=False),

    ],
    'specials': [
        SpecialsTextSpec('&', '   '), # ignore tabular alignments, just add a little space
    ],

    'macros': [
        # NOTE: macro will only be assigned arguments if they are explicitly defined as
        #       accepting arguments in latexwalker.py.
        MacroTextSpec('emph', discard=False),
        MacroTextSpec('textrm', discard=False),
        MacroTextSpec('textit', discard=False),
        MacroTextSpec('textbf', discard=False),
        MacroTextSpec('textsc', discard=False),
github phfaist / pylatexenc / pylatexenc / latex2text / _defaultspecs.py View on Github external
EnvironmentTextSpec('gather', simplify_repl=fmt_equation_environment),
        EnvironmentTextSpec('dmath', simplify_repl=fmt_equation_environment),

        EnvironmentTextSpec('array', simplify_repl=fmt_placeholder_node),
        EnvironmentTextSpec('pmatrix', simplify_repl=fmt_placeholder_node),
        EnvironmentTextSpec('bmatrix', simplify_repl=fmt_placeholder_node),
        EnvironmentTextSpec('smallmatrix', simplify_repl=fmt_placeholder_node),

        EnvironmentTextSpec('center', simplify_repl='\n%s\n'),
        EnvironmentTextSpec('flushleft', simplify_repl='\n%s\n'),
        EnvironmentTextSpec('flushright', simplify_repl='\n%s\n'),

        EnvironmentTextSpec('exenumerate', discard=False),
        EnvironmentTextSpec('enumerate', discard=False),
        EnvironmentTextSpec('list', discard=False),
        EnvironmentTextSpec('itemize', discard=False),
        EnvironmentTextSpec('subequations', discard=False),
        EnvironmentTextSpec('figure', discard=False),
        EnvironmentTextSpec('table', discard=False),

    ],
    'specials': [
        SpecialsTextSpec('&', '   '), # ignore tabular alignments, just add a little space
    ],

    'macros': [
        # NOTE: macro will only be assigned arguments if they are explicitly defined as
        #       accepting arguments in latexwalker.py.
        MacroTextSpec('emph', discard=False),
        MacroTextSpec('textrm', discard=False),
        MacroTextSpec('textit', discard=False),
        MacroTextSpec('textbf', discard=False),
github phfaist / pylatexenc / pylatexenc / latex2text / _defaultspecs.py View on Github external
EnvironmentTextSpec('eqnarray', simplify_repl=fmt_equation_environment),
        EnvironmentTextSpec('align', simplify_repl=fmt_equation_environment),
        EnvironmentTextSpec('multline', simplify_repl=fmt_equation_environment),
        EnvironmentTextSpec('gather', simplify_repl=fmt_equation_environment),
        EnvironmentTextSpec('dmath', simplify_repl=fmt_equation_environment),

        EnvironmentTextSpec('array', simplify_repl=fmt_placeholder_node),
        EnvironmentTextSpec('pmatrix', simplify_repl=fmt_placeholder_node),
        EnvironmentTextSpec('bmatrix', simplify_repl=fmt_placeholder_node),
        EnvironmentTextSpec('smallmatrix', simplify_repl=fmt_placeholder_node),

        EnvironmentTextSpec('center', simplify_repl='\n%s\n'),
        EnvironmentTextSpec('flushleft', simplify_repl='\n%s\n'),
        EnvironmentTextSpec('flushright', simplify_repl='\n%s\n'),

        EnvironmentTextSpec('exenumerate', discard=False),
        EnvironmentTextSpec('enumerate', discard=False),
        EnvironmentTextSpec('list', discard=False),
        EnvironmentTextSpec('itemize', discard=False),
        EnvironmentTextSpec('subequations', discard=False),
        EnvironmentTextSpec('figure', discard=False),
        EnvironmentTextSpec('table', discard=False),

    ],
    'specials': [
        SpecialsTextSpec('&', '   '), # ignore tabular alignments, just add a little space
    ],

    'macros': [
        # NOTE: macro will only be assigned arguments if they are explicitly defined as
        #       accepting arguments in latexwalker.py.
        MacroTextSpec('emph', discard=False),
github phfaist / pylatexenc / pylatexenc / latex2text / _defaultspecs.py View on Github external
EnvironmentTextSpec('array', simplify_repl=fmt_placeholder_node),
        EnvironmentTextSpec('pmatrix', simplify_repl=fmt_placeholder_node),
        EnvironmentTextSpec('bmatrix', simplify_repl=fmt_placeholder_node),
        EnvironmentTextSpec('smallmatrix', simplify_repl=fmt_placeholder_node),

        EnvironmentTextSpec('center', simplify_repl='\n%s\n'),
        EnvironmentTextSpec('flushleft', simplify_repl='\n%s\n'),
        EnvironmentTextSpec('flushright', simplify_repl='\n%s\n'),

        EnvironmentTextSpec('exenumerate', discard=False),
        EnvironmentTextSpec('enumerate', discard=False),
        EnvironmentTextSpec('list', discard=False),
        EnvironmentTextSpec('itemize', discard=False),
        EnvironmentTextSpec('subequations', discard=False),
        EnvironmentTextSpec('figure', discard=False),
        EnvironmentTextSpec('table', discard=False),

    ],
    'specials': [
        SpecialsTextSpec('&', '   '), # ignore tabular alignments, just add a little space
    ],

    'macros': [
        # NOTE: macro will only be assigned arguments if they are explicitly defined as
        #       accepting arguments in latexwalker.py.
        MacroTextSpec('emph', discard=False),
        MacroTextSpec('textrm', discard=False),
        MacroTextSpec('textit', discard=False),
        MacroTextSpec('textbf', discard=False),
        MacroTextSpec('textsc', discard=False),
        MacroTextSpec('textsl', discard=False),
github phfaist / pylatexenc / pylatexenc / latex2text / _defaultspecs.py View on Github external
s += '[{}]\n'.format(l2t.nodelist_to_text([optarg]))
    return s


# construct the specs structure, more than the just the following definition

latex_base_specs = {
    
    'environments': [

        EnvironmentTextSpec('equation', simplify_repl=fmt_equation_environment),
        EnvironmentTextSpec('eqnarray', simplify_repl=fmt_equation_environment),
        EnvironmentTextSpec('align', simplify_repl=fmt_equation_environment),
        EnvironmentTextSpec('multline', simplify_repl=fmt_equation_environment),
        EnvironmentTextSpec('gather', simplify_repl=fmt_equation_environment),
        EnvironmentTextSpec('dmath', simplify_repl=fmt_equation_environment),

        EnvironmentTextSpec('array', simplify_repl=fmt_placeholder_node),
        EnvironmentTextSpec('pmatrix', simplify_repl=fmt_placeholder_node),
        EnvironmentTextSpec('bmatrix', simplify_repl=fmt_placeholder_node),
        EnvironmentTextSpec('smallmatrix', simplify_repl=fmt_placeholder_node),

        EnvironmentTextSpec('center', simplify_repl='\n%s\n'),
        EnvironmentTextSpec('flushleft', simplify_repl='\n%s\n'),
        EnvironmentTextSpec('flushright', simplify_repl='\n%s\n'),

        EnvironmentTextSpec('exenumerate', discard=False),
        EnvironmentTextSpec('enumerate', discard=False),
        EnvironmentTextSpec('list', discard=False),
        EnvironmentTextSpec('itemize', discard=False),
        EnvironmentTextSpec('subequations', discard=False),
        EnvironmentTextSpec('figure', discard=False),
github phfaist / pylatexenc / pylatexenc / latex2text / _defaultspecs.py View on Github external
'environments': [

        EnvironmentTextSpec('equation', simplify_repl=fmt_equation_environment),
        EnvironmentTextSpec('eqnarray', simplify_repl=fmt_equation_environment),
        EnvironmentTextSpec('align', simplify_repl=fmt_equation_environment),
        EnvironmentTextSpec('multline', simplify_repl=fmt_equation_environment),
        EnvironmentTextSpec('gather', simplify_repl=fmt_equation_environment),
        EnvironmentTextSpec('dmath', simplify_repl=fmt_equation_environment),

        EnvironmentTextSpec('array', simplify_repl=fmt_placeholder_node),
        EnvironmentTextSpec('pmatrix', simplify_repl=fmt_placeholder_node),
        EnvironmentTextSpec('bmatrix', simplify_repl=fmt_placeholder_node),
        EnvironmentTextSpec('smallmatrix', simplify_repl=fmt_placeholder_node),

        EnvironmentTextSpec('center', simplify_repl='\n%s\n'),
        EnvironmentTextSpec('flushleft', simplify_repl='\n%s\n'),
        EnvironmentTextSpec('flushright', simplify_repl='\n%s\n'),

        EnvironmentTextSpec('exenumerate', discard=False),
        EnvironmentTextSpec('enumerate', discard=False),
        EnvironmentTextSpec('list', discard=False),
        EnvironmentTextSpec('itemize', discard=False),
        EnvironmentTextSpec('subequations', discard=False),
        EnvironmentTextSpec('figure', discard=False),
        EnvironmentTextSpec('table', discard=False),

    ],
    'specials': [
        SpecialsTextSpec('&', '   '), # ignore tabular alignments, just add a little space
    ],

    'macros': [
github phfaist / pylatexenc / pylatexenc / latex2text / _defaultspecs.py View on Github external
def _format_uebung(n, l2t):
    s = '\n' + l2t.nodelist_to_text([n.nodeargs[0]]) + '\n'
    optarg = n.nodeargs[1]
    if optarg is not None:
        s += '[{}]\n'.format(l2t.nodelist_to_text([optarg]))
    return s


# construct the specs structure, more than the just the following definition

latex_base_specs = {
    
    'environments': [

        EnvironmentTextSpec('equation', simplify_repl=fmt_equation_environment),
        EnvironmentTextSpec('eqnarray', simplify_repl=fmt_equation_environment),
        EnvironmentTextSpec('align', simplify_repl=fmt_equation_environment),
        EnvironmentTextSpec('multline', simplify_repl=fmt_equation_environment),
        EnvironmentTextSpec('gather', simplify_repl=fmt_equation_environment),
        EnvironmentTextSpec('dmath', simplify_repl=fmt_equation_environment),

        EnvironmentTextSpec('array', simplify_repl=fmt_placeholder_node),
        EnvironmentTextSpec('pmatrix', simplify_repl=fmt_placeholder_node),
        EnvironmentTextSpec('bmatrix', simplify_repl=fmt_placeholder_node),
        EnvironmentTextSpec('smallmatrix', simplify_repl=fmt_placeholder_node),

        EnvironmentTextSpec('center', simplify_repl='\n%s\n'),
        EnvironmentTextSpec('flushleft', simplify_repl='\n%s\n'),
        EnvironmentTextSpec('flushright', simplify_repl='\n%s\n'),

        EnvironmentTextSpec('exenumerate', discard=False),