Index: /trunk/tools/generic_tools.py
===================================================================
--- /trunk/tools/generic_tools.py	(revision 1228)
+++ /trunk/tools/generic_tools.py	(revision 1229)
@@ -37,4 +37,5 @@
 ####### Content
 # ASCII_LaTeX: Function to transform from an ASCII character to LaTeX codification
+# ASCII_to: Function to provide the equivalence text to a given lenguage omitting certain characters
 # Capturing: Class to capture the standard output from a function
 # CFmonthU_daysU: Function to transform from a CF date series with units as 'months since [DATE]' to 'days since [DATE]'
@@ -9395,4 +9396,65 @@
     return newmat
 
+def ASCII_to(text,to,nochg=None):
+    """ Function to provide the equivalence text to a given lenguage omitting certain characters
+      text= text to transform
+      to= language to use
+        'tex': LaTeX
+      nochg: a list with characters to be omitted
+    >>> ASCII_to('Ã $353\pol', 'tex')
+    \`a\$353\textbackslashpol
+    >>> ASCII_to('Ã $353\pol', 'tex', ['$'])
+    \`a$353\textbackslashpol
+    """
+    fname = 'ASCII_to'
+    langs = ['tex']
+
+
+    texchars = {'\\': '\\textbackslash', \
+      'Ã¡': "\\'a", 'Ã©': "\\'e", 'Ã­': "\\'i", 'Ã³': "\\'o", 'Ãº': "\\'u",               \
+      'Ã ': "\\`a", 'Ãš': "\\`e", 'Ã¬': "\\`i", 'Ã²': "\\`o", 'Ã¹': "\\`u",               \
+      'Ã¢': "\\^a", 'Ãª': "\\^e", 'Ã®': "\\^i", 'ÃŽ': "\\^o", 'Ã»': "\\^u",               \
+      'Ã€': '\\"a', 'Ã«': '\\"e', 'Ã¯': '\\"i', 'Ã¶': '\\"o', 'ÃŒ': '\\"u',               \
+      'Ã§': '\c{c}', 'Ã±': '\~{n}',                                                    \
+      'Ã': "\\'A", 'Ã': "\\'E", 'Ã': "\\'I", 'Ã': "\\'O", 'Ã': "\\'U",               \
+      'Ã': "\\`A", 'Ã': "\\`E", 'Ã': "\\`I", 'Ã': "\\`O", 'Ã': "\\`U",               \
+      'Ã': "\\^A", 'Ã': "\\^E", 'Ã': "\\^I", 'Ã': "\\^O", 'Ã': "\\^U",               \
+      'Ã': '\\"A', 'Ã': '\\"E', 'Ã': '\\"I', 'Ã': '\\"O', 'Ã': '\\"U',               \
+      'Ã': '\\c{C}', 'Ã': '\\~{N}',                                                  \
+      'Â¡': '!`', 'Â¿': 'Â¿`', '%': '\\%', '#': '\\#', '&': '\\&', '$': '\\$',          \
+      '_': '\\_', 'Â·': '\\textperiodcentered', '<': '$<$', '>': '$>$',               \
+      'ï­': '*', 'Âª': '$^{a}$', 'Âº': '$^{o}$', 'Â°': '$^{\\circ}$', '\n': '\\\\\n',   \
+      '\t': '\\medskip', 'â': '``', 'â': '\'\'', '^': '\^'}
+
+    if to == 'tex':
+        chars = texchars
+        # Specific first characters to change
+        firstchars = ['\\']
+    else:
+        print errormsg
+        print '  ' + fname + ": language '" + to + "' not ready !!"
+        print '    available languages:', langs
+        quit(-1)
+
+    if nochg is not None:
+        for noc in nochg:
+            if  not chars.has_key(noc):
+                print errormsg
+                print '  ' + fname + ": language '" + to + "' does not have '" +     \
+                  noc + "' to change !!"
+                quit(-1)
+            chars.pop(noc)
+            if searchInlist(firstchars,noc): firstchars.remove(noc)
+
+    newtext = text + ''
+    for char in firstchars:
+        newtext = newtext.replace(char,chars[char])
+        chars.pop(char)
+
+    for char in chars.keys():
+        newtext = newtext.replace(char,chars[char])
+
+    return newtext
+
 def ASCII_LaTeX(ln):
     """ Function to transform from an ASCII character to LaTeX codification
@@ -9417,4 +9479,5 @@
     newln = newln.replace('Ã¢', "\\^a")
     newln = newln.replace('Ãª', "\\^e")
+
     newln = newln.replace('Ã®', "\\^i")
     newln = newln.replace('ÃŽ', "\\^o")
@@ -9488,4 +9551,6 @@
       >>> latex_text('WRF_LMDZ$_{current}^{AR40}$')
       WRF\_LMDZ$_{current}^{AR40}$
+      >>> latex_text('LluÃ­s Fita$_{1976/02/17}$')
+      Llu\'is Fita$_{1976/02/17}$
     """
     fname = 'latex_text'
@@ -9587,4 +9652,7 @@
         latextext = headtxt + '\\$' + tailtxt
 
+    NOchange = ['_', '^', '\\', '&', '$']
+    latextext = ASCII_to(latextext, 'tex', NOchange)
+
     return latextext
 
