regexlatextextmateoniguruma

TextMate Edit Latex Bundle Snippet, regex to replace non ascii-characters


I'm trying to modify the code from a TextMate snippet in the LaTeX Bundle. This is the code:

\section{${1:section name}} % (fold)
\label{sec:${2:${1/\\\\\w+\{(.*?)\}|\\\\(.)|(\w+)|([^\w\\\\]+)/(?4:_:\L$1$2$3)/g}}}
${0:$TM_SELECTED_TEXT}
% section $2 (end)

I want it to also change unicode accented characters into their non accented counterparts, like:

a into a

é into e

í into i

ó into o

ú into u

ñ into n

This is what it does:

\section{Configuración de diseño} % (fold)
\label{sec:configuración_de_diseño}

% section configuración_de_diseño (end)

This is what I want it to do since latex labels don't support these characters:

\section{Configuración de diseño} % (fold)
\label{sec:configuracion_de_diseno}

% section configuracion_de_diseno (end)

Solution

  • changing the code of the labels to this works

    \label{ssub:${2:${1/(\w+)(\W+$)?|\W+/${1:?${1:/asciify/downcase}:_}/g}}}
    

    This is the link Issue #87