Change citations to before or after punctuation
Moderators: Eyal Redler, redlers, Ori Redler
-
- Got the styles thing figured out
- Posts: 6
- Joined: Sun Jun 28, 2020 4:32 pm
Change citations to before or after punctuation
Is there a way to change all citations to before or after punctations? I have all after punctuations, but my supervisor would like me to switch to before. I could do it manually, of course, but it could save me a ton of time by automating it.
Thanks!
Thanks!
Re: Change citations to before or after punctuation
Hi,
I'm afraid I don't understand the question. Are you talking about the reference symbols in the body text?
Can you give us some examples?
I'm afraid I don't understand the question. Are you talking about the reference symbols in the body text?
Can you give us some examples?
-
- Got the styles thing figured out
- Posts: 6
- Joined: Sun Jun 28, 2020 4:32 pm
Re: Change citations to before or after punctuation
Hi Icelander,
I have: ;{Kenyon and Tseng, 1989, #117507}
I want: {Kenyon and Tseng, 1989, #117507};
(the difference is the position of the semicolon)
But for all citations. So, I was wondering if there is something generic that I could put in the "Find and Replace" function so that it can detect any citation followed by a comma, semicolon, dot, and then replace it with the comma/dot after the citation, while still keeping the citations intact.
Is it clear now? Thanks
I have: ;{Kenyon and Tseng, 1989, #117507}
I want: {Kenyon and Tseng, 1989, #117507};
(the difference is the position of the semicolon)
But for all citations. So, I was wondering if there is something generic that I could put in the "Find and Replace" function so that it can detect any citation followed by a comma, semicolon, dot, and then replace it with the comma/dot after the citation, while still keeping the citations intact.
Is it clear now? Thanks
Re: Change citations to before or after punctuation
OK, I now understand.
You can do this for the whole document with one mouse click. Here is a screenshot which shows the elements you must enter into the Find & Replace boxes:
https://www.mediafire.com/view/3vzn7rt2 ... 9.png/file
Enter the elements and then click on Replace All. The "Any Character" icon has the repetition 'Once or more' and Greedy is enabled.
This is how it works: The Find box consists of two *groups* which, in the Replace box, are swapped!
You can do this for the whole document with one mouse click. Here is a screenshot which shows the elements you must enter into the Find & Replace boxes:
https://www.mediafire.com/view/3vzn7rt2 ... 9.png/file
Enter the elements and then click on Replace All. The "Any Character" icon has the repetition 'Once or more' and Greedy is enabled.
This is how it works: The Find box consists of two *groups* which, in the Replace box, are swapped!
-
- Got the styles thing figured out
- Posts: 6
- Joined: Sun Jun 28, 2020 4:32 pm
Re: Change citations to before or after punctuation
Hi Icelander,
Thanks a lot for trying to solve it for me!!
I'm glad you showed me these symbols, I haven't paid attention to them before, but it seems to be a lot useful. I reproduced it as in your photo, but it didn't work. I tried both Greedy on and off (in the image you attached, it was off). I also tried without {}, which selected all texts between punctuations, but it was not what I wanted.
I will keep trying different rules, but if you would know another way, I'd appreciate it. Thanks!
Thanks a lot for trying to solve it for me!!
I'm glad you showed me these symbols, I haven't paid attention to them before, but it seems to be a lot useful. I reproduced it as in your photo, but it didn't work. I tried both Greedy on and off (in the image you attached, it was off). I also tried without {}, which selected all texts between punctuations, but it was not what I wanted.
I will keep trying different rules, but if you would know another way, I'd appreciate it. Thanks!
Re: Change citations to before or after punctuation
Yes, don't worry. I'll prepare a FindSet for you with all the necessary elements.
Do you know how to import a FindSet?
Re: Change citations to before or after punctuation
I just uploaded a FindSet as a Compressed Archive (.ZIP) for you.
https://www.mediafire.com/file/nrdfl587 ... l.zip/file
Unzip the file, and you'll find 3 files inside:
a) jvictorcabral.pfs
b) a TEST file
c) screenshot
The .pfs file is the FileSet. All you need to do is to import it. Don't double-click on it! That might cause another program to open it. Follow instead these instructions from the Mellel Guide on p. 252:
F. Importing a Find Set
To import an external Find Set to use in your documents:
1 Choose Edit > Find > FindSet from the menu bar, or press Cmd + Shift + F to open the Find Set window.
2 Click the Settings button (in the lower left corner).
3 Choose Import Find Set from file.
4 Locate and select the Find Set file (with a .pfs extension).
5 Click Open.
After you have imported the FindSet, look at the screenshot. It shows what you need to do.
https://www.mediafire.com/file/nrdfl587 ... l.zip/file
Unzip the file, and you'll find 3 files inside:
a) jvictorcabral.pfs
b) a TEST file
c) screenshot
The .pfs file is the FileSet. All you need to do is to import it. Don't double-click on it! That might cause another program to open it. Follow instead these instructions from the Mellel Guide on p. 252:
F. Importing a Find Set
To import an external Find Set to use in your documents:
1 Choose Edit > Find > FindSet from the menu bar, or press Cmd + Shift + F to open the Find Set window.
2 Click the Settings button (in the lower left corner).
3 Choose Import Find Set from file.
4 Locate and select the Find Set file (with a .pfs extension).
5 Click Open.
After you have imported the FindSet, look at the screenshot. It shows what you need to do.
Re: Change citations to before or after punctuation
The Find&Replace set suggested by @Icelander works perfectly for the OP case i.e. citations as "normal" text delimited by curly braces.
Problem is, using Bookends as reference manager you'll have all your citations as Mellel citation objects (blue background, no delimiters) and I can't seem to be able to use the F&R approach.
I can search for citation objects (using the specific token) but as soon as I try to search for the citation objects + some other literal text Mellel doesn't return any matches.
Problem is, using Bookends as reference manager you'll have all your citations as Mellel citation objects (blue background, no delimiters) and I can't seem to be able to use the F&R approach.
I can search for citation objects (using the specific token) but as soon as I try to search for the citation objects + some other literal text Mellel doesn't return any matches.
Re: Change citations to before or after punctuation
Hi Johseb,
You can change citation objects with the blue background to text, then do the F&R, and then convert the text back to citations by executing the menu command Edit > Bibliography > Convert Text to Citations…
At this stage the citations should be blue with a red dashed line above and below the citations. Click on the "Verify Citations" button in the Bibliography pane to make them all blue again. You can now scan the document.
To change a citation with a blue background to text, you can just click on the citation to select it, then hold down the Command key and press "c" (= copy) and paste as a plain text. You can do this with multiple citations in one go if you select large portions of the document (or even the whole document) and then paste again as a plain text. All citations will miraculously be converted to text.
If you select parts containing formatted text (bold, italic, etc.) the formatting will get lost. To prevent that from happening, don't select parts with formats you don't want to change.
Problem is, using Bookends as reference manager you'll have all your citations as Mellel citation objects (blue background, no delimiters) and I can't seem to be able to use the F&R approach.
You can change citation objects with the blue background to text, then do the F&R, and then convert the text back to citations by executing the menu command Edit > Bibliography > Convert Text to Citations…
At this stage the citations should be blue with a red dashed line above and below the citations. Click on the "Verify Citations" button in the Bibliography pane to make them all blue again. You can now scan the document.
To change a citation with a blue background to text, you can just click on the citation to select it, then hold down the Command key and press "c" (= copy) and paste as a plain text. You can do this with multiple citations in one go if you select large portions of the document (or even the whole document) and then paste again as a plain text. All citations will miraculously be converted to text.
If you select parts containing formatted text (bold, italic, etc.) the formatting will get lost. To prevent that from happening, don't select parts with formats you don't want to change.
Re: Change citations to before or after punctuation
Hi Icelander,
thanks for showing me how to convert citation objects back to normal text.
It' good to have alternative plans but I would consider this an emergency procedure and I still think that the F&R should work directly on citations objects.
To be clear, the Find expression is essentially the same proposed by Icelander where the content of the second capturing group is simply a token for the citation objects (the one showing a quotation mark).
thanks for showing me how to convert citation objects back to normal text.
It' good to have alternative plans but I would consider this an emergency procedure and I still think that the F&R should work directly on citations objects.
To be clear, the Find expression is essentially the same proposed by Icelander where the content of the second capturing group is simply a token for the citation objects (the one showing a quotation mark).
Re: Change citations to before or after punctuation
Hi Johsep,
jvictorcabral, the original poster, wrote:
I call upon the original poster to clarify the situation.
1) How exactly does a citation look by him and
2) how exactly is it embedded in the surrounding text?
3) Is he dealing with temporary or final citations?
Please upload a screenshot.
He also wrote he has:
;{Kenyon and Tseng, 1989, #117507}
Why would anyone place the citation immediately after the semicolon without a SPACE between??? That looks ugly, and I have never seen anyone do that before.
jvictorcabral, the original poster, wrote:
so obviously his citations are text and not citation objects, unless he erroneously typed the Citation delimiters {} and thus threw us off the track.I have: ;{Kenyon and Tseng, 1989, #117507}
I want: {Kenyon and Tseng, 1989, #117507};
I call upon the original poster to clarify the situation.
1) How exactly does a citation look by him and
2) how exactly is it embedded in the surrounding text?
3) Is he dealing with temporary or final citations?
Please upload a screenshot.
He also wrote he has:
;{Kenyon and Tseng, 1989, #117507}
Why would anyone place the citation immediately after the semicolon without a SPACE between??? That looks ugly, and I have never seen anyone do that before.
-
- Got the styles thing figured out
- Posts: 6
- Joined: Sun Jun 28, 2020 4:32 pm
Re: Change citations to before or after punctuation
Dear Johseb,
Thank you for your input. You were quicker than me; I intended to come here to clarify my mistake concerning the citation. When I copied from Mellel and pasted it here, it converted the blue citation to {citation}. I didn't consider this potential problem, but it clearly was the reason why Icelander's (first) solution didn't work for me. My apologies, Icelander.
I also agree with Johseb that F&R misses the option to include Citations; then Icelander's solution would work without workarounds.
Anyway, thanks for the second solution; it should work after converting all citations to { }. But in my defense, in Bookends, I have set { } as a temporary citation delimiter, so I thought in Mellel, it would be "hidden," and the blue rectangle would be to visualize the temporary citations. Again, my apologies
Thank you for your input. You were quicker than me; I intended to come here to clarify my mistake concerning the citation. When I copied from Mellel and pasted it here, it converted the blue citation to {citation}. I didn't consider this potential problem, but it clearly was the reason why Icelander's (first) solution didn't work for me. My apologies, Icelander.
I also agree with Johseb that F&R misses the option to include Citations; then Icelander's solution would work without workarounds.
Anyway, thanks for the second solution; it should work after converting all citations to { }. But in my defense, in Bookends, I have set { } as a temporary citation delimiter, so I thought in Mellel, it would be "hidden," and the blue rectangle would be to visualize the temporary citations. Again, my apologies
Re: Change citations to before or after punctuation
jvictorcabral, johseb et al,
This isn't quite correct. I have created a new FindSet where the citation objects are used in F&R. This time, after jvictorcabral's clarification, I assume that all citations are citation objects, and now there should be no need for a workaround. The whole process can be done with just one mouse click.
The new FindSet comes with a test file and a screenshot. The procedure is slightly different this time, so make sure you read the "Read me" file (the screenshot).
The test file contains colored text: Red punctuation is supposed to change during the F&R operation, orange punctuation should not change.
The test document is set up exactly according to the OP's description, i.e. with no space between the punctuation and the citation.
https://www.mediafire.com/file/edr8cb7z ... b.zip/file
@jvictorcabral
Please let me know if this solves your problem.
jvictorcabral wrote: ↑Tue Jul 25, 2023 3:54 pm I also agree with Johseb that F&R misses the option to include Citations; then Icelander's solution would work without workarounds.
This isn't quite correct. I have created a new FindSet where the citation objects are used in F&R. This time, after jvictorcabral's clarification, I assume that all citations are citation objects, and now there should be no need for a workaround. The whole process can be done with just one mouse click.
The new FindSet comes with a test file and a screenshot. The procedure is slightly different this time, so make sure you read the "Read me" file (the screenshot).
The test file contains colored text: Red punctuation is supposed to change during the F&R operation, orange punctuation should not change.
The test document is set up exactly according to the OP's description, i.e. with no space between the punctuation and the citation.
https://www.mediafire.com/file/edr8cb7z ... b.zip/file
@jvictorcabral
Please let me know if this solves your problem.
Re: Change citations to before or after punctuation
I don't want to hijack the thread but I'll chime in again just to make a remark: @Icelander's solution for docs containing citation object is ingenious but solve a problem that is different from the one posed in the OP.
The test doc with citations objects already has the punctuation marks duplicated after the citation objects (the orange ones) while the original post required the F&R procedure to duplicate the punctuation mark (i.e. start from a doc with punctuation marks in front of the citations only).
The difference is not a minor one and shows what I was trying to state in my first post: a Find expression containing a Citation token cannot contain anything else (if you add a single character to the token the Find will no longer work).
My point is that:
1. the described behaviour should be considered a bug
2. without that bug, the OP problem could be solved in one step with a F&R like the one proposed by @Icelander in the 4th post (the F&R for the doc without citations objects).
The test doc with citations objects already has the punctuation marks duplicated after the citation objects (the orange ones) while the original post required the F&R procedure to duplicate the punctuation mark (i.e. start from a doc with punctuation marks in front of the citations only).
The difference is not a minor one and shows what I was trying to state in my first post: a Find expression containing a Citation token cannot contain anything else (if you add a single character to the token the Find will no longer work).
My point is that:
1. the described behaviour should be considered a bug
2. without that bug, the OP problem could be solved in one step with a F&R like the one proposed by @Icelander in the 4th post (the F&R for the doc without citations objects).
Re: Change citations to before or after punctuation
Thank you for chiming in again, Johseb, your contribution is much appreciated.
Again, why did I add the orange punctuation marks? Because sometimes a citation is followed by a punctuation mark which needs to be ignored during the Find & Replace process.
Anyway, I must say, the original poster has proved to be very uncooperative. I asked him to upload a screenshot so that we can see how the citations are embedded in the surrounding text, but he completely ignored that, so I feel we are actually poking around in the dark.
I don't see where the problem is. In the test document the citation objects are AFTER the red punctuation marks. The OP wants them to be BEFORE the red punctuation marks, and that's what the FindSet does. The orange punctuation marks were added by me in order to demonstrate that the FindSet is clever enough to distinguish between punctuation marks that should be a part of the operation and those who should be ignored.The test doc with citations objects already has the punctuation marks duplicated after the citation objects (the orange ones) while the original post required the F&R procedure to duplicate the punctuation mark (i.e. start from a doc with punctuation marks in front of the citations only).
Again, why did I add the orange punctuation marks? Because sometimes a citation is followed by a punctuation mark which needs to be ignored during the Find & Replace process.
That's correct. Therefore my first FindAction doesn't contain anything else than the token for a citation object. :–)a Find expression containing a Citation token cannot contain anything else (if you add a single character to the token the Find will no longer work).
Did you install and run the (second) FindSet? It adds placeholders (xyz) before all citation objects and then deletes the placeholders and the punctuation marks before them.without that bug, the OP problem could be solved in one step with a F&R like the one proposed by @Icelander in the 4th post (the F&R for the doc without citations objects).
Anyway, I must say, the original poster has proved to be very uncooperative. I asked him to upload a screenshot so that we can see how the citations are embedded in the surrounding text, but he completely ignored that, so I feel we are actually poking around in the dark.