Load LaTeX2Unicode translation table dictionary.

    Load LaTeX2Unicode translation table dictionary and regular
    expression object from KB to a global dictionary.

    :param kb_file: full path to file containing latex2unicode translations.
                    Defaults to CFG_ETCDIR/bibconvert/KB/latex-to-unicode.kb
    :type kb_file: string

    :return: dict of type: {'regexp_obj': regexp match object,
                            'table': dict of LaTeX -> Unicode mappings}
    :rtype: dict

def _load_latex2unicode_constants(kb_file=None):
    """Load LaTeX2Unicode translation table dictionary.

    Load LaTeX2Unicode translation table dictionary and regular
    expression object from KB to a global dictionary.

    :param kb_file: full path to file containing latex2unicode translations.
                    Defaults to CFG_ETCDIR/bibconvert/KB/latex-to-unicode.kb
    :type kb_file: string

    :return: dict of type: {'regexp_obj': regexp match object,
                            'table': dict of LaTeX -> Unicode mappings}
    :rtype: dict
    """
    if kb_file is None:
        kb_file = get_kb_filename()

    try:
        data = open(kb_file)
    except IOError:
        # File not found or similar
        sys.stderr.write(
            "\nCould not open LaTeX to Unicode KB file. "
            "Aborting translation.\n")
        return CFG_LATEX_UNICODE_TRANSLATION_CONST
    latex_symbols = []
    translation_table = {}
    for line in data:
        # The file has form of latex|--|utf-8. First decode to Unicode.
        line = line.decode('utf-8')
        mapping = line.split('|--|')
        translation_table[mapping[0].rstrip('\n')] = mapping[1].rstrip('\n')
        latex_symbols.append(re.escape(mapping[0].rstrip('\n')))
    data.close()
    CFG_LATEX_UNICODE_TRANSLATION_CONST[
        'regexp_obj'] = re.compile("|".join(latex_symbols))
    CFG_LATEX_UNICODE_TRANSLATION_CONST['table'] = translation_table