Skip to content
Snippets Groups Projects
Commit 519c5b3d authored by Kipp Cannon's avatar Kipp Cannon
Browse files

plotutil: add latexfilename()

parent 193672b3
No related branches found
No related tags found
No related merge requests found
......@@ -81,3 +81,11 @@ def latexnumber(s):
return s
m, e = floatpattern.match(s).groups()
return r"%s \times 10^{%d}" % (m, int(e))
def latexfilename(s):
"""
Escapes "\\" and "_" characters, and replaces " " with "~"
(non-breaking space).
"""
return s.replace("\\", "\\\\").replace("_", "\\_").replace(" ", "~")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment