def raw_string(txt):
    """
    Python automatically converts escape characters (i.e. \\n), which causes
    problems when inputing latex strings since they are full of backslashes.  
    This function returns a raw string representation of text
    
    Parameters
    ----------
    txt : string
        string that possibly contains escape characters
    
    Returns
    -------
    new_text : string
        same as 'text' but without any escape characters
    """
    escape_dict={'\a':r'\a',
           '\b':r'\b',
           '\c':r'\c',
           '\f':r'\f',
           '\n':r'\n',
           '\r':r'\r',
           '\t':r'\t',
           '\v':r'\v',
           '\'':r'\'',
           '\"':r'\"'}
    #I used to have '\1' thru '\9' in the list above, but for some strange
    #reason '\a' and '\7' both get mapped to '\x07'.  Thus, when someone inputs 
    #'\alpha', it gets mapped to '\x07lpha'.  If '\7' is listed in the escape 
    #dictionary after '\a', then '\x07lpha' gets translated to '\\7lpha', which 
    #LaTeX cannot understand.  As far as I know, LaTeX never starts a command
    #with a number, so I just got rid of all the numbers in the escape 
    #dictionary.
    new_txt=''
    for char in txt:
        try: new_txt+=escape_dict[char]
        except KeyError: new_txt+=char
    return new_txt