Re: accented characters and regex ...
On Sat, 27 Sep 2014 08:12:12 -, Albretch Mueller lbrt...@gmail.com wrote: Sometimes I need to write up or edit text in Spanish or German, so I need to be able to replace accented characters at once. A'lgebra I: ?'Do'nde encuentro una gui'a de te'rminos Matema'ticos u'nicos para el an~o? Should become at once: Álgebra I: ¿Dónde encuentro una guía de términos Matemáticos únicos para el año? i have written a macro that does the job. it is in the attached file (tools - macros - organise macros - openoffice basic - replaceAccentedChars.odt - User - replaceAccentedChars - Main). you can transfer it to your 'my macros' folder and run either directly through the 'run macro' dialogue or by assigning a key accelerator. replaceAccentedChars.odt Description: application/vnd.oasis.opendocument.text - To unsubscribe, e-mail: users-unsubscr...@openoffice.apache.org For additional commands, e-mail: users-h...@openoffice.apache.org
Re: accented characters and regex ...
Thank you for sharing kanni lbrtchx - To unsubscribe, e-mail: users-unsubscr...@openoffice.apache.org For additional commands, e-mail: users-h...@openoffice.apache.org
Re: accented characters and regex ...
Here's another macro, somewhat easier to follow and faster: REM * BASIC * Option Explicit Sub Main Dim SearchString(16) As String Dim ReplaceString(16) As String SearchString=Array( a', e', i', o',_ u'',u', n~, ?',_ !', A', E', I',_ O', U'',U', N~) ReplaceString=Array( á, é, í, ó,_ ü, ú, ñ, ¿,_ ¡, Á, É, Í,_ Ó, Ü, Ú, Ñ) Dim oReplace as Object oReplace=ThisComponent.createReplaceDescriptor() oReplace.SearchCaseSensitive=True Dim x As Integer For x=LBound(SearchString()) To UBound(SearchString()) With oReplace .SearchString=SearchString(x) .ReplaceString=ReplaceString(x) End With ThisComponent.ReplaceAll(oReplace) Next x End Sub Most of it was stolen from Andrew Pitonyak's macro document, revision 1126, page 214–215. In this case, it's important to replace u'' with ü before replacing u' with ú. The same with U'' vs U'. To add more possible things to replace, just add them in the arrays. Just make sure that the search- and replace-strings end up at the same places in their arrays. Also, the Dim lines may need to be adjusted. Johnny Rosenberg
accented characters and regex ...
Most of the times I type in English so I don't need to worry about accented characters Sometimes I need to write up or edit text in Spanish or German, so I need to be able to replace accented characters at once. After marking them up with ticks next/right to the character you can search all of them with the regex: (a'|e'|i'|o'|u'|u''|n~|?'|!'|A'|E'|I'|O'|U'|U''|N~) but then, how do you replace them all at once (each correspondingly) by: (á, é, í, ó, ú, ü, ñ, ¿, ¡, Á, É, Í, Ó, Ú, Ü, Ñ) A'lgebra I: ?'Do'nde encuentro una gui'a de te'rminos Matema'ticos u'nicos para el an~o? Should become at once: Álgebra I: ¿Dónde encuentro una guía de términos Matemáticos únicos para el año? Thank you, lbrtchx (users@openoffice.apache.org) - To unsubscribe, e-mail: users-unsubscr...@openoffice.apache.org For additional commands, e-mail: users-h...@openoffice.apache.org
Re: accented characters and regex ...
On Sat, Sep 27, 2014 at 5:12 AM, Albretch Mueller lbrt...@gmail.com wrote: Most of the times I type in English so I don't need to worry about accented characters Sometimes I need to write up or edit text in Spanish or German, so I need to be able to replace accented characters at once. This is the wrong approach, IMHO. The right approach is to type your Spanish characters using your English layout keyboard. How? simple... switch your keyboard configuration to Spanish-Traditional (in Windows XP to 7, this is done from Control Panel, under regional settings, click on the Languages tab and then on the details button. Here is a screenshot: http://ow.ly/i/71NFU From XP to Win7 I know this works and I have tested it, in Linux it depends on your distro how to make the change. Windows 8 and above it should also work too, but I have no idea if Microsoft has shuffled around the configuration like they often do). When you set up your keyboard layout to be Spanish-Tradtional and your keyboard is of US English layout, the accented characters are easily typed by using the ' character, followed by the letter you want accented. For example to type á I have to type first ´ then a, and it becomes á. To type the ñ character, you just type it directly. The ñ chracter is produced by pressing the ; key (next to the L). You will also notice that in this mode, other two important keys change the character produced, namely and which become ; and : But Windows also allows you to configure a hotkey to switch between keyboard layouts, so I set up two layouts, first US/English and second Spanish/Traditional. And I set up the hotkey Ctrl-Shift 1 and Ctrl-Shift-2 to switch between the two. Again, here is a screenshot of what the config looks like: http://ow.ly/i/71NGy Once you get used to this, you'll be switching between the two layouts effortlessly and at will in the middle of your typing without any major interruption or even mouse clicking at all. Note: I live in a Spanish speaking country, Spanish is my native language, yet, I have NEVER owned a Spanish layout keyboard. All my keyboards are of the US English layout. Why? Because the Spanish layout keyboards are a pain to use for programmers like me, the backslash is often in an akward position, and many characters that are used all the time for programming often involve one more keypress or the akward AltGr key to get a character that you get with a single key press in a US English keyboard. Hope this helps. FC -- During times of Universal Deceit, telling the truth becomes a revolutionary act Durante épocas de Engaño Universal, decir la verdad se convierte en un Acto Revolucionario - George Orwell
Re: accented characters and regex ...
At 04:12 27/09/2014 -0400, Albretch Mueller wrote: Most of the times I type in English so I don't need to worry about accented characters. Sometimes I need to write up or edit text in Spanish or German, so I need to be able to replace accented characters at once. After marking them up with ticks next/right to the character you can search all of them with the regex: (a'|e'|i'|o'|u'|u''|n~|?'|!'|A'|E'|I'|O'|U'|U''|N~) but then, how do you replace them all at once (each correspondingly) ... Not easily, I suspect! Try this: o Tools | AutoCorrect Options... | Replace. o Type your code for the character in the Replace field. o Enter your accented character in the With field. o Probably tick Text only. o Click New. o Repeat for each accented character. You may find it simpler to enter or find the accented character in a document and select it before opening the AutoCorrect dialogue: then the With field will already be populated. Note that the replacement table settings are language-dependent. Now tick Format | AutoCorrect | While Typing and you can have your codes translated as you type. For your existing document, you should be able to achieve the effect using Format | AutoCorrect | Apply (or Format | AutoCorrect | Apply and Edit Changes). An alternative approach (I see someone has already mentioned this) is to use one or more alternative keyboard settings, allowing you to type the characters directly. A little time investigating this would provide valuable returns. I trust this helps. Brian Barker - To unsubscribe, e-mail: users-unsubscr...@openoffice.apache.org For additional commands, e-mail: users-h...@openoffice.apache.org
Re: accented characters and regex ...
I often have to do that with Italian accented letters - my simplistic approach is to keep a reference file with all accented (or otherwise modified) letters, which I copy and paste in the Replace with field. This doesn't take as long as I would need for a macro... but then I am not a programmer, and I need a real KISS solution :-) marina On 27/9/14 at 6:12 PM, lbrt...@gmail.com (Albretch Mueller) wrote: Most of the times I type in English so I don't need to worry about accented characters Sometimes I need to write up or edit text in Spanish or German, so I need to be able to replace accented characters at once. After marking them up with ticks next/right to the character you can search all of them with the regex: (a'|e'|i'|o'|u'|u''|n~|?'|!'|A'|E'|I'|O'|U'|U''|N~) but then, how do you replace them all at once (each correspondingly) by: (á, é, í, ó, ú, ü, ñ, ¿, ¡, Á, É, Í, Ó, Ú, Ü, Ñ) A'lgebra I: ?'Do'nde encuentro una gui'a de te'rminos Matema'ticos u'nicos para el an~o? Should become at once: Álgebra I: ¿Dónde encuentro una guía de términos Matemáticos únicos para el año? Thank you, lbrtchx (users@openoffice.apache.org) - To unsubscribe, e-mail: users-unsubscr...@openoffice.apache.org For additional commands, e-mail: users-h...@openoffice.apache.org - To unsubscribe, e-mail: users-unsubscr...@openoffice.apache.org For additional commands, e-mail: users-h...@openoffice.apache.org
Re: accented characters and regex ...
How? simple... switch your keyboard configuration to Spanish-Traditional (in Windows XP to 7, this is done from Control Panel, under regional settings, click on the Languages tab and then on the details button. Simplest are your assumptions. First, I don't use Windows; second, I find myself very often having to use more than one lang in the same text; third, at times I use other editors (for coding, for example); fourth, I teach, so I can't just write in a messy way to my students ... I am sure that many people suffer the same issues and I wonder how they do it without having to go replace for each sequence on each text ... lbrtchx - To unsubscribe, e-mail: users-unsubscr...@openoffice.apache.org For additional commands, e-mail: users-h...@openoffice.apache.org
Re: accented characters and regex ...
G'day Albretch, On 27/9/14 at 12:25 AM, lbrt...@gmail.com (Albretch Mueller) wrote: How? simple... switch your keyboard configuration to Spanish-Traditional (in Windows XP to 7, this is done from Control Panel, under regional settings, click on the Languages tab and then on the details button. Simplest are your assumptions. First, I don't use Windows; second, I find myself very often having to use more than one lang in the same text; third, at times I use other editors (for coding, for example); fourth, I teach, so I can't just write in a messy way to my students ... In your situation, it might be worth your while to find out what accent modifier keys are available for your keyboard in your operating system. Macs with a standard international keyboard layout have a rather wide range of accented/special characters available, which are activated by pressing the Alt key in combination with a number of characters. These special gestures will probably come to you quite naturally after a while, if you use special characters frequently. HTH, marina [message also sent in copy to lbrt...@gmail.com] - To unsubscribe, e-mail: users-unsubscr...@openoffice.apache.org For additional commands, e-mail: users-h...@openoffice.apache.org
Re: accented characters and regex ...
On 09/27/2014 04:12 AM, Albretch Mueller wrote: Most of the times I type in English so I don't need to worry about accented characters Sometimes I need to write up or edit text in Spanish or German, so I need to be able to replace accented characters at once. After marking them up with ticks next/right to the character you can search all of them with the regex: (a'|e'|i'|o'|u'|u''|n~|?'|!'|A'|E'|I'|O'|U'|U''|N~) but then, how do you replace them all at once (each correspondingly) by: (á, é, í, ó, ú, ü, ñ, ¿, ¡, Á, É, Í, Ó, Ú, Ü, Ñ) A'lgebra I: ?'Do'nde encuentro una gui'a de te'rminos Matema'ticos u'nicos para el an~o? Should become at once: Álgebra I: ¿Dónde encuentro una guía de términos Matemáticos únicos para el año? Thank you, lbrtchx (users@openoffice.apache.org) - To unsubscribe, e-mail: users-unsubscr...@openoffice.apache.org For additional commands, e-mail: users-h...@openoffice.apache.org I don't know how to replace them all at once but I know how to make them as you go. Set up a Compose key on your keyboard. I use right alt, but if you have a Microsoft k/b, you could use the right m/s key. Then when you want a foreign character, you make it as you go. ¿Dónde encuentro una guía de térrminos Matemáticos únicos para el año? You hit compose then single quote then the vowel. For the ¿ you hit compose, the ? twice. For ñ it's compose, then ~ then n. It works for capital letters also, and all kinds of accents, for German, French, Italian, and foreign currencies ¥, £, ¢, fractions-- ½ ⅓ ⅔ ¾ degrees: 75°F, and so on. Look up Gtk Compose Table in Google. Your distro ought to have a way to make some key a compose key. the compose key can also be used as its original function; it only works as compose for about a second. - To unsubscribe, e-mail: users-unsubscr...@openoffice.apache.org For additional commands, e-mail: users-h...@openoffice.apache.org
Re: accented characters and regex ... more
On 09/27/2014 01:32 PM, Doug wrote: (See addendum to previous message, below.) I don't know how to replace them all at once but I know how to make them as you go. Set up a Compose key on your keyboard. I use right alt, but if you have a Microsoft k/b, you could use the right m/s key. Then when you want a foreign character, you make it as you go. ¿Dónde encuentro una guía de térrminos Matemáticos únicos para el año? You hit compose then single quote then the vowel. For the ¿ you hit compose, the ? twice. For ñ it's compose, then ~ then n. It works for capital letters also, and all kinds of accents, for German, French, Italian, and foreign currencies ¥, £, ¢, fractions-- ½ ⅓ ⅔ ¾ degrees: 75°F, and so on. Look up Gtk Compose Table in Google. Your distro ought to have a way to make some key a compose key. the compose key can also be used as its original function; it only works as compose for about a second. Linux distros tend to have a keyboard setup routine where you can make a compose key. That's what I was referring to. In Windows, there are a number of programs that will do the same thing, but some of them do not let you pick the key you want to use. I think on a Mac there is an Alt-Gr key, which may already be set up as a compose key, but I'm not sure. for Windows, look at https://code.google.com/p/freecompose/ You might want to look at AllChars, but someone wrote that it's limited. --dm - To unsubscribe, e-mail: users-unsubscr...@openoffice.apache.org For additional commands, e-mail: users-h...@openoffice.apache.org
Re: accented characters and regex ...
2014-09-27 16:25 GMT+02:00 Albretch Mueller lbrt...@gmail.com: How? simple... switch your keyboard configuration to Spanish-Traditional (in Windows XP to 7, this is done from Control Panel, under regional settings, click on the Languages tab and then on the details button. Simplest are your assumptions. First, I don't use Windows; So what do you use instead? If you use Ubuntu, you can choose between 33 different English keyboard layouts and you can configure it to be easy to switch between them. I found at least one which would make it very easy to input Spanish characters using the AltGr key (right Alt key on most US keyboards, I think): AltGr+n → ñ, AltGr+Shift+n → Ñ, and so on. second, I find myself very often having to use more than one lang in the same text; As I said, easy to switch between the different keyboard layouts, either using the mouse or a keyboard shortcut. third, at times I use other editors (for coding, for example); Perfect. Just switch to the keyboard layout you need, using the mouse or a keyboard shortcut. fourth, I teach, so I can't just write in a messy way to my students So stop using a that messy method of yours then… Another method would probably be to use something like AutoKey or similar to convert things like ´a to á on the fly. Or using the Compose key (in Linux/Unix), as already suggested. Or, a more complicated method, to enter the Unicode values directly. In Linux: Ctrl+Shift+u Release keys Enter the character code (Unicode). Hit Enter or Space or Tab. Ctrl+Shift+u 2103 → ℃, for instance. Or Ctrl+Shift+u 21b7 → ↷. ... I am sure that many people suffer the same issues and I wonder how they do it without having to go replace for each sequence on each text ... They just use the right keyboard layout for the right purpose… :P :) If you really REALLY want to search and replace, you could just write a simple macro that searches the whole document for you for one character at a time, replacing them one by one. I could probably make one for you if you are not up to it yourself, but it would probably not be very fast. It would be faster than doing the character replacing manually, though… Johnny Rosenberg lbrtchx - To unsubscribe, e-mail: users-unsubscr...@openoffice.apache.org For additional commands, e-mail: users-h...@openoffice.apache.org
Re: accented characters and regex ...
On Sat, Sep 27, 2014 at 11:25 AM, Albretch Mueller lbrt...@gmail.com wrote: Simplest are your assumptions. First, I don't use Windows; second, I find myself very often having to use more than one lang in the same text; third, at times I use other editors (for coding, for example); fourth, I teach, so I can't just write in a messy way to my students ... I told you that the same is possible in Linux. And I told you you can switch at will between layouts, both in Linux and in Windows by using a hotkey. But not knowing beforehand what Linux distro you use, I cannot provide hand holding and step by step instructions for each. I'm curious however what do you mean about writing in a messy way. Obviously you didn't understand what I wrote. your students will receive text looking perfectly find, it's the keys you have to press to obtain special characters what changes. Obviously this is not what you wanted to hear. So, good luck. FC FC -- During times of Universal Deceit, telling the truth becomes a revolutionary act Durante épocas de Engaño Universal, decir la verdad se convierte en un Acto Revolucionario - George Orwell
Re: accented characters and regex ...
Obviously this is not what you wanted to hear. Maybe not I was kind of thinking of a regex which you can use with some java code so when you hit send it takes your text and works it in one go Of course, you can code such a thing easily with a char map strategy, but I was thinking of a regex, you may also use right from a text editor too Thank you lbrtchx - To unsubscribe, e-mail: users-unsubscr...@openoffice.apache.org For additional commands, e-mail: users-h...@openoffice.apache.org