-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 I'm hoping that someone can help with this problem I have. I have several org-mode files which have some specific formatting in individual items, specifically - - --8<---------------cut here---------------start------------->8--- \uuline{foo} - --8<---------------cut here---------------end--------------->8--- This gives a double-underling of 'foo' when exported to latex and built into a pdf file. I'm now in the situation when the double underlining also needs to be italicised, and in org-mode its showing as - - --8<---------------cut here---------------start------------->8--- /\uuline{foo}/ - --8<---------------cut here---------------end--------------->8--- This gives a double-underling and italicised of 'foo' when exported to latex and built into a pdf file. I would like to change about 150+ 'foos' and possibly using 'replace-string' to do it. Also, 'foo' is lots of different words which includes spaces between some of them. So how can I do it please? Thanks Sharon. - -- Debian 10.5, fluxbox 1.3.7, emacs 27.1, org 9.3.7 -----BEGIN PGP SIGNATURE----- iQJPBAEBCgA5FiEELSc/6QwVBIYugJDbNoGAGQr4g1sFAl9OZCcbHGJvdWRpY2Nh c0Bza2ltYmxlLnBsdXMuY29tAAoJEDaBgBkK+INbIKoP/jPRMgczyaMVbAYxoBco 1xnfZk6LNX3kdXxBgyFMDJIkkwGeBsPoLeC6zsW42uDe6N+Hr0+1bTI/E2uSg/I4 PybZLDAtKlWyFqjOVQASo1DC3CqHCzfr0Z66JkMj05qBJTGbIPm88PZxBSxs5ieQ PluJYNHjcNO78AeQrY1IrrDaNco5HAqVi0pWOCjykkCQHmmTB3wrY4S4YvOmeGAF m4SF6713o7VB2+VMgmWITSge6iHCwxHGqlabT6wRNhiZDSJHQQuEzxdg1SxaFsfe BH7YECjDmaAP60sXbOcbLnU882QtH2qXiCFwTUchjpmQ5fGH7fUE/kKPQnnjjD7W vq91skF1I0BMVoLuTT5FkNucMOpzxAw4RuHLZ4yWnXcrflXZPaurFnDlRTYFaA88 VkCkhxWf7WtbmcnSg3YNfP6T/nq4XLVu3zuE0DBjmRXobzULmM/ptSoydpnleawz G7HQmSrUyBPMGX9kX7ggTWY5IvkF27CclEQL0tAR8Cui1GNBiQj9xEnWzVFcmTww wIP3RoCAloa1RnF2OIOBlXY0w38EI+O5/F8uNogoUpHQTGWD8eSE6uhjSIXzhyC7 RtlZLSsVttpJv3uxIXOcfUFXTOMKr7wmBij9RsKSkkAbi7SabgWpeL6W+aJzR70J Hqxr914+M4k3eEOSw197TEiJ =WUuK -----END PGP SIGNATURE-----
[-- Attachment #1: Type: text/plain, Size: 1753 bytes --] On Tue, Sep 01, 2020 at 04:09:27PM +0100, Sharon Kimble wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA512 > > I'm hoping that someone can help with this problem I have. > > I have several org-mode files which have some specific formatting in > individual items, specifically - > > - --8<---------------cut here---------------start------------->8--- > \uuline{foo} > - --8<---------------cut here---------------end--------------->8--- > > This gives a double-underling of 'foo' when exported to latex and built > into a pdf file. > > I'm now in the situation when the double underlining also needs to be > italicised, and in org-mode its showing as - > > - --8<---------------cut here---------------start------------->8--- > /\uuline{foo}/ > - --8<---------------cut here---------------end--------------->8--- > > This gives a double-underling and italicised of 'foo' when exported to > latex and built into a pdf file. > > I would like to change about 150+ 'foos' and possibly using > 'replace-string' to do it. Also, 'foo' is lots of different words which > includes spaces between some of them. So how can I do it please? Hm. From your description it's unclear what exactly are you after. A couple of questions to try to zoom into that: - You want to change the text in the curly braces, i.e. what you call 'foo' above? Is this text always different? Is it possible to state a rule describing how this text looks like and by what you want to replace it? Or is the process going to be manual? - All that stuff: is it in one file or scattered across multiple files? I'm sure there are a couple of other questions I just forget now, But we'll get there :) Cheers - t [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 198 bytes --]
On Tuesday, 1 Sep 2020 at 16:09, Sharon Kimble wrote:
> I would like to change about 150+ 'foos' and possibly using
> 'replace-string' to do it. Also, 'foo' is lots of different words which
> includes spaces between some of them. So how can I do it please?
You may wish to use replacement with regular expressions: Check info
manual for emacs, (emacs) Regexp Replace
--
: Eric S Fraga via Emacs 28.0.50, Org release_9.3.7-725-g7bc18e
On 2020-09-01, at 18:19, Eric S Fraga <e.fraga@ucl.ac.uk> wrote: > On Tuesday, 1 Sep 2020 at 16:09, Sharon Kimble wrote: >> I would like to change about 150+ 'foos' and possibly using >> 'replace-string' to do it. Also, 'foo' is lots of different words which >> includes spaces between some of them. So how can I do it please? > > You may wish to use replacement with regular expressions: Check info > manual for emacs, (emacs) Regexp Replace Maybe you could also use keyboard macros for that. Hth, -- Marcin Borkowski http://mbork.pl
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Thanks for replying Tomas. <tomas@tuxteam.de> writes: > On Tue, Sep 01, 2020 at 04:09:27PM +0100, Sharon Kimble wrote: >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA512 >> >> I'm hoping that someone can help with this problem I have. >> >> I have several org-mode files which have some specific formatting in >> individual items, specifically - >> >> - --8<---------------cut here---------------start------------->8--- >> \uuline{foo} >> - --8<---------------cut here---------------end--------------->8--- >> >> This gives a double-underling of 'foo' when exported to latex and built >> into a pdf file. >> >> I'm now in the situation when the double underlining also needs to be >> italicised, and in org-mode its showing as - >> >> - --8<---------------cut here---------------start------------->8--- >> /\uuline{foo}/ >> - --8<---------------cut here---------------end--------------->8--- >> >> This gives a double-underling and italicised of 'foo' when exported to >> latex and built into a pdf file. >> >> I would like to change about 150+ 'foos' and possibly using >> 'replace-string' to do it. Also, 'foo' is lots of different words which >> includes spaces between some of them. So how can I do it please? > > Hm. From your description it's unclear what exactly are you > after. A couple of questions to try to zoom into that: > > - You want to change the text in the curly braces, i.e. what > you call 'foo' above? Is this text always different? Is it > possible to state a rule describing how this text looks like > and by what you want to replace it? Or is the process going > to be manual? > - All that stuff: is it in one file or scattered across multiple > files? Okay, being very specific, all of '\uuline{foo}' remains, but with a forward slash at the beginning and end of '\uuline{foo}' to achieve this '/\uuline{foo}/' Thanks Sharon. > > I'm sure there are a couple of other questions I just forget now, > But we'll get there :) > > Cheers > - t > - -- Debian 10.5, fluxbox 1.3.7, emacs 27.1, org 9.3.7 -----BEGIN PGP SIGNATURE----- iQJPBAEBCgA5FiEELSc/6QwVBIYugJDbNoGAGQr4g1sFAl9OgzobHGJvdWRpY2Nh c0Bza2ltYmxlLnBsdXMuY29tAAoJEDaBgBkK+INb0cYP/iJ65wP+ZIA2nPXnxZLK OZebw3ghKx1xTFQvCXc3m5UXCjkDUgAk9sJpGdpx/FvzzHWvpmpkQkPybnyRXBwM Ogc1PlEJRjhXMbAwyocvNmpoBMzF90c5xa3ge7qmbn9ogNr61l4oD0ZMaIjwA30k Rsz2lzuv4GRCv3R7r6W1Y3H11ks9bt0QE3vZKgnUb7veKW50bZcJMqRwL1xGIYB4 HnuG7GNOAnTuf2dGF1BMco2NBONEYQhhL5WUksGb5nqLKDqa664BhTPHT1L6jPay TeBfSc3gSQHU2hPp2/iiaYlvkiQFKsS6Q7wQ1+IwrYKNkbaszkRvjS9wmzV6CMc9 so4N/Dbx9LsTXlA/8YbjYbYWUGDuCBot5MJc9OjX27+uP0BqhoIux93UsjpWKAFB e721RTLewXDtQLV/uoVxEfWGUxOKBEw7VDhyPOZ72Gxk8c7EhUQC3bLRLHDe3mZi Y99JKXYbfL0Mcfl+5/wbD91L1BJt29+KZAqzvrYRKaU8AAHrBZcStgn1en/m5JS0 fPTXDOvTHedIdpqLz3oQIU7FAQs+RD/PbbVf+8vXcaq6k8MZeuNki2E0lBxVo/cu FHJBnbY7o3vUDwDXMyV23IUBMLLDy4ug0dK2+NBGTM7SosJazNq4mWdMgAtWVfYi 0ARNlhp4bixDDlOwtfTkS3lQ =kqHe -----END PGP SIGNATURE-----
[-- Attachment #1: Type: text/plain, Size: 1900 bytes --] On Tue, Sep 01, 2020 at 06:22:02PM +0100, Sharon Kimble wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA512 > > Thanks for replying Tomas. > <tomas@tuxteam.de> writes: You're welcome :-) [...] > >> - --8<---------------cut here---------------start------------->8--- > >> \uuline{foo} > >> - --8<---------------cut here---------------end--------------->8--- [...] > >> - --8<---------------cut here---------------start------------->8--- > >> /\uuline{foo}/ > >> - --8<---------------cut here---------------end--------------->8--- [...] > Okay, being very specific, all of '\uuline{foo}' remains, but with a > forward slash at the beginning and end of '\uuline{foo}' to achieve this > '/\uuline{foo}/' Ah, got it now. Regular expressions seem to be your friends here. I'm assuming your foo is a placeholder, and varies from instance to instance. I'm further assuming the "foo"s don't contain a closing curly brace (we'd have to refine things otherwise). Try M-x (i.e. Meta-x) and then "query-replace-regexp". It asks you first for the regular expression, which will be \\uuline{[^}]*} (note the double backslash: that's because a backslash has a special meaning in regular expressions, and you have to "escape" it with another backslash; this regexp roughly states: "a backslash followed by uuline, followed by an opening curly, followed by zero or more (that's the star) characters which aren't a closing curly followed by a closing curly). You finish that part with ENTER. Then you're asked for the replacement. You enter /\&/ Which means: "a slash, followed by whatever you just matched (that's the "\&" part, only one backslash this time) and a slash. Make a backup of your file first :-) Regular expressions are very powerful, but sometimes confusing. It pays off big time to wrangle them! Good luck - t [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 198 bytes --]