예제 #1
0
def init_module(parser, options):
    parms = parser.parms

    macros_latex = ''

    macros_python = [

        # the following is for \end{otherlanguage}
        Macro(parms, '\\babel@skip@space', args='', repl=''),
        Macro(parms, '\\foreignlanguage', args='OAA', repl=h_foreignlanguage),
        Macro(parms, '\\selectlanguage', args='A', repl=h_selectlanguage),

    ]

    environments = [

        Environ(parms, 'otherlanguage', args='A', repl=h_begin_otherlang,
                                add_pars=False, end_func=h_end_otherlang),
        Environ(parms, 'otherlanguage*', args='A', repl=h_begin_otherlang,
                                add_pars=False, end_func=h_end_otherlang_star),

    ]

    inject_tokens = get_language_token(parser.global_latex_options + options)

    return InitModule(macros_latex=macros_latex, macros_python=macros_python,
                        environments=environments, inject_tokens=inject_tokens)
예제 #2
0
파일: cleveref.py 프로젝트: torik42/YaLafi
def init_module(parser, options, position):
    parms = parser.parms
    parms.newcommand_ignore.append(macro_read_sed)

    macros_latex = r'''
        \newcommand{\crefname}[3]{}
        \newcommand{\Crefname}[3]{}
    '''

    macros_python = [
        Macro(parms, macro_read_sed, args='A', repl=h_read_sed),
        Macro(parms, '\\label', args='OA', repl=''),

        # Define functions which warn the User, whenever cleveref
        # is used without invoking \YYCleverefInput. These will be overwritten
        # by invoking \YYCleverefInput.
        Macro(parms, '\\cref', args='*A', repl=h_cref_warning),
        Macro(parms, '\\Cref', args='*A', repl=h_cref_warning),
        Macro(parms, '\\crefrange', args='*AA', repl=h_cref_warning),
        Macro(parms, '\\Crefrange', args='*AA', repl=h_cref_warning),
    ]

    environments = []

    # Warn the user, whenever cleveref is used
    # without the poorman option:
    inject_tokens = []
    if not is_poorman_used(options):
        inject_tokens = utils.latex_error(parser, msg_poorman_option, position)

    return InitModule(macros_latex=macros_latex,
                      macros_python=macros_python,
                      environments=environments,
                      inject_tokens=inject_tokens)
예제 #3
0
def init_module(parser, options):
    parms = parser.parms

    macros_latex = r"""

        \newcommand{\geometry}[1]{}

    """

    return InitModule(macros_latex=macros_latex)
예제 #4
0
def init_module(parser, options):
    parms = parser.parms

    parser.global_latex_options += options

    macros_latex = r"""

        \newcommand{\KOMAoption}[1]{}
        \newcommand{\KOMAoptions}[1]{}

    """

    return InitModule(macros_latex=macros_latex)
예제 #5
0
파일: pgfplots.py 프로젝트: torik42/YaLafi
def init_module(parser, options, position):
    parms = parser.parms

    macros_latex = r"""

        \newcommand{\pgfplotsset}[1]{}

    """

    macros_python = []

    environments = []

    return InitModule(macros_latex=macros_latex, macros_python=macros_python,
                        environments=environments)
예제 #6
0
파일: xspace.py 프로젝트: torik42/YaLafi
def init_module(parser, options, position):
    parms = parser.parms

    macros_latex = ""

    macros_python = [

        Macro(parms, '\\xspace', args='', repl=h_xspace),

    ]

    environments = []

    return InitModule(macros_latex=macros_latex, macros_python=macros_python,
                        environments=environments)
예제 #7
0
파일: amsmath.py 프로젝트: torik42/YaLafi
def init_module(parser, options, position):
    parms = parser.parms

    parms.math_text_macros.append('\\text')

    macros_latex = r"""

        \newcommand{\eqref}[1]{(0)}
        \newcommand{\medspace}{\:}
        \newcommand{\negmedspace}{}
        \newcommand{\negthickspace}{}
        \newcommand{\negthinspace}{}
        \newcommand{\notag}{}
        \newcommand{\numberwithin}[2]{}
        \newcommand{\thickspace}{\;}
        \newcommand{\thinspace}{\,}

    """

    macros_python = [

        Macro(parms, '\\DeclareMathOperator', args='*AA'),
        Macro(parms, '\\substack', args='A', repl=h_substack),

    ]

    environments = [

        EquEnv(parms, 'align'),
        EquEnv(parms, 'align*'),
        EquEnv(parms, 'alignat', args='A'),
        EquEnv(parms, 'alignat*', args='A'),
        EquEnv(parms, 'equation'),
        EquEnv(parms, 'equation*'),
        EquEnv(parms, 'flalign'),
        EquEnv(parms, 'flalign*'),
        EquEnv(parms, 'gather'),
        EquEnv(parms, 'gather*'),
        EquEnv(parms, 'multiline'),
        EquEnv(parms, 'multiline*'),

    ]

    inject_tokens = []      # this list of tokens is used as replacement
                            # for '\documentclass...' or '\usepackage...'

    return InitModule(macros_latex=macros_latex, macros_python=macros_python,
                    environments=environments, inject_tokens=inject_tokens)
예제 #8
0
def init_module(parser, options):
    parms = parser.parms

    macros_latex = r"""

        \newcommand{\includegraphics}[2][]{}

    """

    macros_python = []

    environments = []

    return InitModule(macros_latex=macros_latex,
                      macros_python=macros_python,
                      environments=environments)
예제 #9
0
def init_module(parser, options):
    parms = parser.parms

    macros_python = [
        # test_macros.py
        Macro(parms, '\\delim', args='*OA', repl=h_delim),
    ]

    environments = [

        # test_environments.py
        Environ(parms, 'comment', repl='', remove=True, add_pars=False),
        # test_display.py
        EquEnv(parms, 'flalign', repl='  relation', remove=True),
    ]

    return InitModule(macros_python=macros_python, environments=environments)
예제 #10
0
def init_module(parser, options, position):
    parms = parser.parms

    macros_latex = ''

    macros_python = [
        Macro(parms,
              '\\newabbreviation',
              args='AAA',
              repl=r'\newacronym{#1}{#2}{#3}'),
    ]

    environments = []

    return InitModule(macros_latex=macros_latex,
                      macros_python=macros_python,
                      environments=environments)
예제 #11
0
def init_module(parser, options):
    parms = parser.parms

    macros_latex = r"""

        \newcommand{\href}[3][]{#3}
        \newcommand{\texorpdfstring}[2]{#1}
        \newcommand{\url}[1]{#1}

    """

    macros_python = []

    environments = []

    return InitModule(macros_latex=macros_latex,
                      macros_python=macros_python,
                      environments=environments)
예제 #12
0
def init_module(parser, options, position):
    parms = parser.parms

    macros_latex = r"""

        \newcommand{\ctikzset}[1]{}

    """

    macros_python = []

    environments = [
        Environ(parms, 'circuitikz', remove=True, add_pars=False),
    ]

    return InitModule(macros_latex=macros_latex,
                      macros_python=macros_python,
                      environments=environments)
예제 #13
0
def init_module(parser, options):
    parms = parser.parms

    macros_latex = r"""

        \newcommand{\qedhere}{}
        \newcommand{\theoremstyle}[1]{}

    """

    macros_python = []

    environments = [
        Environ(parms, 'proof', args='O', repl=h_proof),
    ]

    return InitModule(macros_latex=macros_latex,
                      macros_python=macros_python,
                      environments=environments)
예제 #14
0
파일: tikz.py 프로젝트: mfbehrens99/YaLafi
def init_module(parser, options):
    parms = parser.parms

    macros_latex = r"""

        \newcommand{\tikzset}[1]{}
        \newcommand{\usetikzlibrary}[1]{}

    """

    macros_python = []

    environments = [
        Environ(parms, 'tikzpicture', remove=True, add_pars=False),
    ]

    return InitModule(macros_latex=macros_latex,
                      macros_python=macros_python,
                      environments=environments)
예제 #15
0
def init_module(parser, options):
    parms = parser.parms

    macros_latex = ''

    macros_python = [

        Macro(parms, '\\gls', args='OA', repl=h_gls('text', [])),
        Macro(parms, '\\glspl', args='OA', repl=h_gls('plural', [])),
        Macro(parms, '\\Gls', args='OA', repl=h_gls('text', [cap_first])),
        Macro(parms, '\\Glspl', args='OA', repl=h_gls('plural', [cap_first])),
        Macro(parms, '\\GLS', args='OA', repl=h_gls('text', [cap_all])),
        Macro(parms, '\\GLSpl', args='OA', repl=h_gls('plural', [cap_all])),

        Macro(parms, '\\glsdesc', args='OA',
                                    repl=h_gls('description', [])),
        Macro(parms, '\\Glsdesc', args='OA',
                                    repl=h_gls('description', [cap_first])),
        Macro(parms, '\\GLSdesc', args='OA',
                                    repl=h_gls('description', [cap_all])),

        Macro(parms, '\\glsdisp', args='OAA', repl='#3'),
        Macro(parms, '\\glslink', args='OAA', repl='#3'),

        Macro(parms, '\\glstext', args='OA', repl=h_gls('text', [])),
        Macro(parms, '\\Glstext', args='OA', repl=h_gls('text', [cap_first])),
        Macro(parms, '\\GLStext', args='OA', repl=h_gls('text', [cap_all])),

        Macro(parms, '\\longnewglossaryentry', args='AAA', repl=h_newacronym),
        Macro(parms, '\\newacronym', args='AAA', repl=h_newacronym),
        Macro(parms, '\\newglossaryentry', args='AA', repl=h_newglossaryentry),

        # this is for reading the .glsdefs database
        Macro(parms, '\\gls@defglossaryentry', args='AA',
                                                    repl=h_parse_glsdefs),

    ]

    environments = []

    return InitModule(macros_latex=macros_latex, macros_python=macros_python,
                        environments=environments)
예제 #16
0
def init_module(parser, options):
    parms = parser.parms

    macros_latex = r"""

        \newcommand{\lstinputlisting}[2][]{\par}
        \newcommand{\lstset}[1]{}

    """

    macros_python = []

    environments = [

        Environ(parms, 'lstlisting', remove=True),

    ]

    return InitModule(macros_latex=macros_latex, macros_python=macros_python,
                        environments=environments)
예제 #17
0
def init_module(parser, options, position):
    parms = parser.parms

    macros_latex = r"""

        \newcommand{\href}[3][]{#3}
        \newcommand{\texorpdfstring}[2]{#1}
        \newcommand{\url}[1]{#1}

    """

    macros_python = [
        Macro(parms, '\\ref', args='*A', repl='0'),
    ]

    environments = []

    return InitModule(macros_latex=macros_latex,
                      macros_python=macros_python,
                      environments=environments)
예제 #18
0
def init_module(parser, options):
    parms = parser.parms

    parms.math_text_macros.append('\\text')

    macros_latex = r"""

        \newcommand{\eqref}[1]{(0)}
        \newcommand{\medspace}{\:}
        \newcommand{\negmedspace}{}
        \newcommand{\negthickspace}{}
        \newcommand{\negthinspace}{}
        \newcommand{\notag}{}
        \newcommand{\numberwithin}[2]{}
        \newcommand{\thickspace}{\;}
        \newcommand{\thinspace}{\,}

    """

    macros_python = [
        Macro(parms, '\\DeclareMathOperator', args='*AA'),
    ]

    environments = [
        EquEnv(parms, 'align'),
        EquEnv(parms, 'align*'),
        EquEnv(parms, 'alignat', args='A'),
        EquEnv(parms, 'alignat*', args='A'),
        EquEnv(parms, 'equation'),
        EquEnv(parms, 'equation*'),
        EquEnv(parms, 'flalign'),
        EquEnv(parms, 'flalign*'),
        EquEnv(parms, 'gather'),
        EquEnv(parms, 'gather*'),
        EquEnv(parms, 'multiline'),
        EquEnv(parms, 'multiline*'),
    ]

    return InitModule(macros_latex=macros_latex,
                      macros_python=macros_python,
                      environments=environments)
예제 #19
0
def init_module(parser, options, position):
    parms = parser.parms

    macros_latex = ''

    macros_python = [
        Macro(parms, '\\addbibresource', args='OA', repl=''),
        Macro(parms, '\\cite', args='*OOA', repl=h_cite),
        Macro(parms, '\\Cite', args='*OOA', repl=h_cite),
        Macro(parms, '\\footcite', args='*OOA', repl=h_footcite),
        Macro(parms, '\\footcitetext', args='*OOA', repl=h_footcite),
        Macro(parms, '\\parencite', args='*OOA', repl=h_cite),
        Macro(parms, '\\Parencite', args='*OOA', repl=h_cite),
        Macro(parms, '\\printbibliography', args='O', repl=''),
    ]

    environments = []

    return InitModule(macros_latex=macros_latex,
                      macros_python=macros_python,
                      environments=environments)
예제 #20
0
def init_module(parser, options):
    parms = parser.parms

    macros_latex = r"""

        \newcommand{\color}[2][]{}
        \newcommand{\colorbox}[3][]{#3}
        \newcommand{\definecolor}[4][]{}
        \newcommand{\textcolor}[3][]{#3}

    """

    macros_python = [
        Macro(parms, '\\fcolorbox', args='OAOAA', repl='#5'),
    ]

    environments = []

    return InitModule(macros_latex=macros_latex,
                      macros_python=macros_python,
                      environments=environments)
예제 #21
0
def init_module(parser, options, position):
    parms = parser.parms

    math_operators = [
        '≤', '≥', '→', '∩', '∪', '⇒', '⇐',  '⇔', '⊂',
    ]

    parms.math_operators.extend(math_operators)

    macros_latex = r"""

        \newcommand{\unimathsetup}[1]{}

    """

    macros_python = [
        Macro(parms, '\\setmathfont', args='AO', repl='')
    ]

    environments = []

    return InitModule(macros_latex=macros_latex, macros_python=macros_python,
                        environments=environments)
예제 #22
0
파일: article.py 프로젝트: torik42/YaLafi
def init_module(parser, options, position):
    parms = parser.parms

    parser.global_latex_options += options

    return InitModule()