from pathvalidate import validate_filename
helper.path_accepted_string
latex_to_path_accepted_string
latex_to_path_accepted_string (latex:str)
Convert a latex string to a path accepted string
The latex_to_path_accepted_string
function “cleans” a latex str into a path-valid string for the purposes of making files.
= r'\mathcal{O}_X'
sample_1 = latex_to_path_accepted_string(sample_1)
output_1 print(output_1)
assert 'O' in output_1 and 'X' in output_1
validate_filename(output_1)
= r'\operatorname{Gal}(L/K)'
sample_2 = latex_to_path_accepted_string(sample_2)
output_2 print(output_2)
assert 'Gal' in output_2 and 'L' in output_2 and 'K' in output_2
validate_filename(output_2)
# Example found in https://arxiv.org/abs/1607.04471
= r'\begin{equation} \label{escape rate} G_{F_t}(z,w) = \lim_{n\to\infty} \frac{1}{d^n} \log \| F_t^n(z,w) \|, \end{equation}'
sample_3 = latex_to_path_accepted_string(sample_3)
output_3 print(output_3)
validate_filename(output_3)
O_X
Gal_L_K
label_escape_rate_G_F_t_z_w_lim_n_to_infty_frac_1_d_n_log_F_t_n_z_w