doc2json/tex2json/tex_to_xml.py
def convert_latex_to_s2orc_json(
        latex_zip: str,
        base_temp_dir: str,
        cleanup_after: bool=True
) -> str:
    """
    Convert a LaTeX zip file to S2ORC JSON
    :param latex_zip:
    :param base_temp_dir:
    :param cleanup_after:
    :return:
    """
    if not os.path.exists(latex_zip):
        raise FileNotFoundError("Input LaTeX ZIP file doesn't exist")

    # temp directories
    latex_expand_dir = os.path.join(base_temp_dir, 'latex')
    latex_norm_dir = os.path.join(base_temp_dir, 'norm')
    latex_xml_dir = os.path.join(base_temp_dir, 'xml')
    latex_log_dir = os.path.join(base_temp_dir, 'log')

    os.makedirs(base_temp_dir, exist_ok=True)
    os.makedirs(latex_expand_dir, exist_ok=True)
    os.makedirs(latex_norm_dir, exist_ok=True)
    os.makedirs(latex_xml_dir, exist_ok=True)
    os.makedirs(latex_log_dir, exist_ok=True)

    # convert to XML
    xml_file = convert_latex_to_xml(
        latex_zip, latex_expand_dir, latex_norm_dir, latex_xml_dir, latex_log_dir, cleanup_after
    )
    return xml_file

    Convert a LaTeX zip file to S2ORC JSON
    :param latex_zip:
    :param base_temp_dir:
    :param cleanup_after:
    :return:
    
Convert a LaTeX zip file to S2ORC JSON
Convert a LaTeX zip file to S2ORC JSON
def convert_latex_to_s2orc_json(
        latex_zip: str,
        base_temp_dir: str,
        cleanup_after: bool=True
) -> str:
    if not os.path.exists(latex_zip):
        raise FileNotFoundError("Input LaTeX ZIP file doesn't exist")
    latex_expand_dir = os.path.join(base_temp_dir, 'latex')
    latex_norm_dir = os.path.join(base_temp_dir, 'norm')
    latex_xml_dir = os.path.join(base_temp_dir, 'xml')
    latex_log_dir = os.path.join(base_temp_dir, 'log')
    os.makedirs(base_temp_dir, exist_ok=True)
    os.makedirs(latex_expand_dir, exist_ok=True)
    os.makedirs(latex_norm_dir, exist_ok=True)
    os.makedirs(latex_xml_dir, exist_ok=True)
    os.makedirs(latex_log_dir, exist_ok=True)
    xml_file = convert_latex_to_xml(
        latex_zip, latex_expand_dir, latex_norm_dir, latex_xml_dir, latex_log_dir, cleanup_after
    )
    return xml_file
def convert_latex_to_s2orc_json ( latex_zip : str , base_temp_dir : str , cleanup_after : bool = True ) -> str : if not os . path . exists ( latex_zip ) : raise FileNotFoundError ( "Input LaTeX ZIP file doesn't exist" ) latex_expand_dir = os . path . join ( base_temp_dir , 'latex' ) latex_norm_dir = os . path . join ( base_temp_dir , 'norm' ) latex_xml_dir = os . path . join ( base_temp_dir , 'xml' ) latex_log_dir = os . path . join ( base_temp_dir , 'log' ) os . makedirs ( base_temp_dir , exist_ok = True ) os . makedirs ( latex_expand_dir , exist_ok = True ) os . makedirs ( latex_norm_dir , exist_ok = True ) os . makedirs ( latex_xml_dir , exist_ok = True ) os . makedirs ( latex_log_dir , exist_ok = True ) xml_file = convert_latex_to_xml ( latex_zip , latex_expand_dir , latex_norm_dir , latex_xml_dir , latex_log_dir , cleanup_after ) return xml_file
Convert a LaTeX zip file to S2ORC JSON
Convert a LaTeX zip file to S2ORC JSON
"""
    Convert a LaTeX zip file to S2ORC JSON
    :param latex_zip:
    :param base_temp_dir:
    :param cleanup_after:
    :return:
    """ # temp directories # convert to XML
None
latex_zip
str
None
base_temp_dir
str
None
cleanup_after
bool
None