First time here? Check out the FAQ!
asked 2012-05-13 21:33:55 +0200ubersoft
I'm in the middle of assembling chapters of a novel together that will eventually be sent out in both eBook and paperback format. When it's sent out for printing, I need the " symbols to be typographic--in other words, I need to use smart quotes (also known as "curly quotes"). This isn't an issue for chapters that I create in LibreOffice, but it is an issue on chapters that I create on other devices--notably my tablet, which currently has no software on it that supports smart quotes at all. When I import text from my tablet, I get the straight inch marks instead of the curled quotation marks.
In Microsoft Word, one trick you can do is simply do a search for (") and replace it with (") -- I know, it's exactly the same symbol, but it will actually go through and replace the straight quotes with the typographic quotes (though not always with 100% accuracy, I'm afraid). I vaguely remember there being a process for LibreOffice, but it was pretty complicated and involved using a lot of regular expressions in a non-intuitive way.
Do you know of any shortcuts, plugins, scripts or add-ons that can simplify replacing straight quotes with typographic quotes? Extra points for ones that handle both the single (') and double (") quotes.
answered 2012-05-13 21:40:30 +0200ubersoft
OK, I'm going to answer my own question. It's a feature I'd never noticed until now.
FIRST, make sure that the replacement of smart quotes is active in your autocorrect settings: Format > Autocorrect > Autocorrect Options...
SECOND, highlight the text that you want to apply your autocorrect options to (including and up to CTRL+A for the entire document.
FINALLY, use Format > Autocorrect > Apply to cause autocorrect to go through and apply it's autocorrect settings to the selected text.
This is a great feature!
answered 2012-10-20 15:28:59 +0200David
Answering my own comment ;) (well, partially)...
Where there are "styles" applied to paragraphs, the "Autocorrect > Apply" solution will not work. However, it is possible to use regex search-replace to speed up this process enormously. The instructions below are based on a very helpful discussion on the OpenOffice forum (do read through to the end, if it's of interest).
Hit CTRL-H to bring up the search/replace dialog; use the "More Options" drop-down, and select [x] Regular expressions. Paste in the following values:
First, Search for:
Click "Replace All".
Then, Search for:
Click "Replace All". Now do a simple search for " (straight double-quote) to see if any have been missed. There shouldn't be many!
Much simpler: Search for
[space]' and replace with
[space]‘ for opener, then simply change all the rest of the
' marks to closer
’ and that should do it. There might be cases of
[' which need to be catered for (my doc didn't have any), but the technique used for the double quotes will take care of those.
There must be a way of putting this all into a macro, but I haven't thought about that yet. So -- if preserving paragraph styles is important (it was to me in a 44-page imported and heavily styled document!), then this regex approach will get the job done very, very quickly.
My earlier reply stepping through the regex/search-replace steps certainly works. But the original question included this:
I vaguely remember there being a process for LibreOffice, but it was pretty complicated and involved using a lot of regular expressions in a non-intuitive way.
My sense about assigning this to a macro proved to be correct. Here is how you can (1) set up the macro, and (2) assign it to the menu bar for 1-click simplicity.
CTRL-Ato select all, then
CTRL-Cto copy to clipboard.
CTRL-Vto paste it in. Press
CTRL-Sto save it.
Now when you go to Tools > Macros > Organise macros > LibreOffice Basic... (and My Macros > Standard > Module 1) again, you will see
StraightQuotes2CurlyQuotes listed below
Main. Good. It worked!
You could just run the macro from Tools > Macros > Organise macros > LibreOffice Basic..., click on
StraightQuotes2CurlyQuotes, then click "Run" (the top button on the right). If you're doing this infrequently, that's probably good enough. If you think you might be using this more often, then it can be assigned to the menus by following these steps:
StraightQuotes2CurlyQuotesmacro as described immediately above, click on it in the "Existing macros" list, and click the "Assign..." button.
StraightQuotes2CurlyQuoteslisted in the right-hand "Commands" box.
‘...’ conversions are only a click away. Take ten minutes (or less!) to set this up, and your next conversions will be done almost instantly.
The commenting tool is not available to me and I can't upvote posts, very strange.
@David solutions work brilliantly when I was under ubuntu, particularly this expression:
However on Mac the above expression is stop working. Not sure why, maybe it has different way of running regex? There is a post related to this.
I posted this and filed a bug, how there is a solution soon.
LibreOffice is made available by volunteers around the globe, backed by a charitable Foundation. Please support our efforts: Your donation helps us to deliver a better product!
Asked: 2012-05-13 21:33:55 +0200
Seen: 2,276 times
Last updated: Feb 18