Closed piptin closed 10 years ago
You can use ${«var»:/asciify} to strip accents (new in TextMate 2).
I didn’t thoroughly study the existing transformation, but I think you can replace the label part with: \label{ssub:${2:${1/(\w+)(\W+$)?|\W+/${1:?${1:/asciify/downcase}:_}/g}}}
This will convert a sequence of non-alphanumeric characters to a single underscore and otherwise downcase and strip accents (asciify) the input.
On 13 Sep 2014, at 22:54, piptin wrote:
This would be the snippet for a subsubsection, the same goes for section, chapter, etc...
\subsubsection{${1:subsubsection name}} % (fold) \label{ssub:${2:${1/\\\\\w+\{(.*?)\}|\\\\(.)|(\w+)|([^\w\\\\]+)/(?4:_:\L$1$2$3)/g}}} ${0:$TM_SELECTED_TEXT} % subsubsection $2 (end)
The problem with this is that if you typeset with the label containing a non ascii character it gives an error, even with
\usepackage[utf8]{inputenc}
loadedThis is the actual result of the snippet which gives an error when typesetting
\chapter{Hello wórldñ lâétex} % (fold) \label{cha:hello_wórldñ_lâétex} % chapter hello_wórldñ_lâétex (end)
is there a say to change it so that it eliminates the accent, or removes the character completely only in the label? Like this:
\chapter{Hello wórldñ lâétex} % (fold) \label{cha:hello_worldn_laetex} % chapter hello_worldn_laetex (end)
or this
\chapter{Hello wórldñ lâétex} % (fold) \label{cha:hello_wrld_ltex} % chapter hello_wrld_ltex (end)
Reply to this email directly or view it on GitHub: https://github.com/textmate/latex.tmbundle/issues/87
Replacing the label with that one works! It doesn't give a compilation error in the labels now.
This is the actual result but I'm not sure if this is what you want it to do.
\section{THIS is greaáíôófè êÄSFDÑASDFÑ} % (fold)
\label{sec:this_is_grea'a'i^o'of`e_^e"asfd~nasdf~n}
% section this_is_grea'a'i^o'of`e_^e"asfd~nasdf~n (end)
I improved the asciification done by TextMate so it explicitly strips the diacritics (and combining marks). You should see this after next update.
Will you submit a pull request for the section snippet updates?
I think the sectioning snippets should be updated, but why a pull request? Isn't a pull request meant to take something out?
A pull request means a request for pulling in changes from somebody else’s fork of the repository (LaTeX bundle).
See https://help.github.com/articles/using-pull-requests for more details.
So basically I was asking if you will fork/clone the LaTeX bundle, make the desired changes, and then submit a request for us to integrate those changes into the main version.
On 15 Sep 2014, at 20:57, piptin wrote:
I think the sectioning snippets should be updated, but why a pull request? Isn't a pull request meant to take something out?
Reply to this email directly or view it on GitHub: https://github.com/textmate/latex.tmbundle/issues/87#issuecomment-55640175
Sure thing!
This would be the snippet for a subsubsection, the same goes for section, chapter, etc...
The problem with this is that if you typeset with the label containing a non ascii character it gives an error, even with
\usepackage[utf8]{inputenc}
loadedThis is the actual result of the snippet which gives an error when typesetting
is there a say to change it so that it eliminates the accent, or removes the character completely only in the label? Like this:
or this