[Solved] Replacing Quotation marks?

Discuss the word processor
Post Reply
Dave Combattelli
Posts: 6
Joined: Sun Jun 15, 2008 5:15 pm

[Solved] Replacing Quotation marks?

Post by Dave Combattelli »

Hi Folks,

This quotation mark thing has my head done in, I've read so much about it and still can't get it to work on ooo writer 2.4

Here's the problem. I was a manuscript with a lot of "" Straight quote marks. I would like to change them to “Quotation” curly quotation marks and visa versa too if need be.

I have gone to tools - auto correct and click the boxes etc and I can change to that when I type a quotation mark it can be either straight or curly. Which is fine, but I want to change all the previous Quotation marks.

I have also followed the open wiki about inserting special character then Format, Auto format and Apply. It does nothing

Is what I want possible?

If Yes, How do I do it?

I am told it's possible on Word and on Mac, surely it must be true here too?
Last edited by Hagar Delest on Mon Jun 16, 2008 2:20 pm, edited 1 time in total.
Reason: tagged the thread as Solved.
OOo 2.3.X on MS Windows Vista
TerryE
Volunteer
Posts: 1401
Joined: Sat Oct 06, 2007 10:13 pm
Location: UK

Re: Replacing Quotation marks?

Post by TerryE »

How about using replace with regular expressions? For example \>" => , etc.
You may also need to pick up the punctuation cases "Like this!" but bulk regular expression substitutes for \>","\<, and normal substitutes for ?", ." should get 95%. Then all you need to do is search for any residual " and do them manually.

Not perfect but at least this should reduce the manual exercise by at least an order of magnitude.
Ubuntu 11.04-x64 + LibreOffice 3 and MS free except the boss's Notebook which runs XP + OOo 3.3.
Dave Combattelli
Posts: 6
Joined: Sun Jun 15, 2008 5:15 pm

Re: Replacing Quotation marks?

Post by Dave Combattelli »

Thanks for the reply terry. But I am sorry I don't follow you at all?

I tried putting "\< into find and it came up with nothing?

Grah, and now someone just told me it is easy to do on word??!!! Surely there's an option somewhere in Writer???? :twisted:
OOo 2.3.X on MS Windows Vista
User avatar
Villeroy
Volunteer
Posts: 31292
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Replacing Quotation marks?

Post by Villeroy »

It's so easy. Fire up Word and do whatever your frieds tell you to do. Never use any other software than everybody else. It could be that it provides 200 options when you need 201.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Dave Combattelli
Posts: 6
Joined: Sun Jun 15, 2008 5:15 pm

Re: Replacing Quotation marks?

Post by Dave Combattelli »

I did, its the replace straight quotations with curly quotations in Tools - Auto correct.

Nothing happens in Writer?!! So I presume I am doing something wrong? Question is I don't know as what ever I have tried is not doing a thing!
OOo 2.3.X on MS Windows Vista
User avatar
AndrewZ
Volunteer
Posts: 633
Joined: Mon Oct 08, 2007 1:25 am
Location: Colorado, USA

Re: Replacing Quotation marks?

Post by AndrewZ »

Dave Combattelli wrote:I did, its the replace straight quotations with curly quotations in Tools - Auto correct.
That only affects new typing. To change the old text, try the regular expression in "Example regular expressions for Writer".
I tried putting "\< into find and it came up with nothing?
Did you check the box for regular expressions?
* Did you solve your problem? Do others a favor: Post the solution
* Visit OpenOffice.org Ninja (blog) and OpenOffice.org Ninja Wiki for news, previews, troubleshooting, etc.
OOo 3.0.X on Fedora 9 + XP
User avatar
Bhikkhu Pesala
Posts: 1253
Joined: Mon Oct 08, 2007 1:27 am

Re: Replacing Quotation marks?

Post by Bhikkhu Pesala »

Dave Combattelli wrote:I have also followed the open wiki about inserting special character then Format, Auto format and Apply. It does nothing
Autoformat apply works only on the Default paragraph style to replace straight quotes with smart quotes.

If you're document is formatted with only a few different styles, you can take this route:
  • Find all Body Text (Find styles, Find All)
  • Apply Default style
  • Format, Autoformat, Apply
  • Reapply the Body Text style
  • Repeat for other styles
Don't ask why, but this is the only way that Autoformat, Apply seems to work.
Idiot Compassion
LibreOffice 6.0.4 on Windows 10
Dave Combattelli
Posts: 6
Joined: Sun Jun 15, 2008 5:15 pm

Re: Replacing Quotation marks?

Post by Dave Combattelli »

Did you check the box for regular expressions?
Nope! And that solved the problem!!

Thanks very much for saving me a headache and several hours or days doing it the other way.

I am still sure there must be another way to do this though!
OOo 2.3.X on MS Windows Vista
Dave Combattelli
Posts: 6
Joined: Sun Jun 15, 2008 5:15 pm

Re: Replacing Quotation marks?

Post by Dave Combattelli »

* Find all Body Text (Find styles, Find All)
* Apply Default style
* Format, Autoformat, Apply
* Reapply the Body Text style
* Repeat for other styles
Tried that.... it did something as the progress bar went hyper for 20 seconds. All straight quotes stayed the same
OOo 2.3.X on MS Windows Vista
User avatar
Villeroy
Volunteer
Posts: 31292
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Replacing Quotation marks?

Post by Villeroy »

This works for me:
Find&Replace by regular expressions
Search: "\<(.+)\>" (straight quotes)
Replace with: “$1" (curly quotes)

Search expression is a quote followed by the start of a word \< followed by at least one element of any char .+, the end of a word \> and a quote. The dot in .+ stands for "any single char", the plus stands for "at least one of the preceeding".
Replace expression is a leading quote, followed by what has been matched in the first pair of braces (.+), followed by a trailing quote.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Dave Combattelli
Posts: 6
Joined: Sun Jun 15, 2008 5:15 pm

Re: Replacing Quotation marks?

Post by Dave Combattelli »

Many thanks for all the help folks, the suggested find and replace comments is what I will use.

ooo is great and I have been using it for years. But really I think the ooo developers need to work more on issues on ease of usability for the general public. Using commands like .>$/ and so has most people running for the hills, or at least a counterfeit copy of Word. Ubuntu proved this with it's user friendly Linux, though not perfect at least new users don't run so fast. Unfortunately ooo 3 beta looks like Lotus word pro 97, with little done in writer. Shame.

Thanks again for all the help, much appreciated.
TerryE
Volunteer
Posts: 1401
Joined: Sat Oct 06, 2007 10:13 pm
Location: UK

Re: Replacing Quotation marks?

Post by TerryE »

In the spirit of fairness, the main improvement of usability in Word vs Writer here is that Word applies the smart quotes algorithm to any text in a replace output, so replacing " for " achieves the smart quoting throughout. Writer only applies smart quotes to typed text, hence the need to use patterns.

Is it worth changing Writer to enable auto correction to apply to replace output. I'm not sure on that one. I would prefer to improve the help on using regular expressions.
Ubuntu 11.04-x64 + LibreOffice 3 and MS free except the boss's Notebook which runs XP + OOo 3.3.
sybille
Volunteer
Posts: 122
Joined: Sat Jan 05, 2008 12:21 pm
Location: France

Re: Replacing Quotation marks?

Post by sybille »

Here's a macro that you can use to change all straight quotes to curly quotes. It doesn't work in the other direction, but I haven't found much of a need for that myself. I tend to write the sort of text that needs straight quotes in a text editor that uses them by default.

Macro source: http://www.oooforum.org/forum/viewtopic.phtml?t=58604

Code: Select all

rem **********************************************************************
rem TYPOGRAPHIC QUOTES
rem **********************************************************************

rem   ---- this macro changes dumb quotes to curlies regardless of styles
rem   ---- (unlike OOo's in-built "Autoformat" function)

Sub TypographicQuotes
   oDoc = thisComponent
      ' character codes used in this macro
      ' Chr(34)   double quote
      ' Chr(39)   single quote
      ' Chr(8216)   single quote left
      ' Chr(8217)   single quote right
      ' Chr(8220)   double quote left
      ' Chr(8221)   double quote right
   aFind = Array(""+_
      Chr(34)+"\<",_
      Chr(34),_
      Chr(39)+"\<",_
      Chr(39),_
      "[0-9A-Za-zÀ-Ö\x00D8-\x00F6\x00F8-\x021B\x1E80-\x1EF3\xF730-\xF739\xFB00-\xFB06]\>"+Chr(8216)+"\<",_
      Chr(8216)+"OOoRegExSucks"_
      )
      ' The line beginning "[0-9 and ending +"\<",_ should be on one line.
      ' It's a workaround for OOo's lack of substring matching in RegEx when using find/replace.
      ' It appends a temporary tag to left single quotes when following words or numbers
      ' To avoid another bug/limitation, characters allowed at word-ends are defined in hex ranges
      ' (includes all Latin characters you're ever likely to need, plus the Unicode range for hanging/oldstyle figures)
   aReplace = Array(""+_
      Chr(8220),_
      Chr(8221),_
      Chr(8216),_
      Chr(8217),_
      "&OOoRegExSucks",_
      Chr(8217)_
      )
   aRayCount = 0
   FandR = oDoc.createReplaceDescriptor
   FandR.SearchCaseSensitive = true
   FandR.SearchRegularExpression = true
   While aRayCount <= uBound(aFind)
      FandR.setSearchString(aFind(aRayCount))
      FandR.setReplaceString(aReplace(aRayCount))
      aRayCount = aRayCount + 1
      oDoc.ReplaceAll(FandR)
   Wend
End Sub
If your problem has been solved, please edit this thread's initial post and add "[Solved]" to the subject line. Thanks!
-------
About Ubuntu Linux
Zotero, for research and bibliography management with OOo.
OOo 2.4.X on Ubuntu 8.x + None needed :)
User avatar
floris v
Volunteer
Posts: 4437
Joined: Wed Nov 28, 2007 1:21 pm
Location: Netherlands

Re: Replacing Quotation marks?

Post by floris v »

Is it worth changing Writer to enable auto correction to apply to replace output. I'm not sure on that one. I would prefer to improve the help on using regular expressions.
I think that it is worth it. It makes life easier for a lot of people who then won't have to use regexp so much. There are also lots of people who can help people with finding the correct regexp. I'd prefer the developers to make the regexp (and the rest of OOo) less buggy.
OpenOffice 4.1.11 on Ubuntu; LibreOffice 6.4 on Linux Mint, LibreOffice 7.6.2.1 on Ubuntu
If your problem has been solved or your question has been answered, please edit the first post in this thread and add [Solved] to the title bar.
Nederlandstalig forum
defman
Posts: 1
Joined: Sun Feb 08, 2015 11:18 am
Location: Willagee, W.A., Australia

Re: Replacing Quotation marks?

Post by defman »

sybille wrote:Here's a macro that you can use to change all straight quotes to curly quotes. It doesn't work in the other direction, but I haven't found much of a need for that myself. I tend to write the sort of text that needs straight quotes in a text editor that uses them by default.

Macro source: http://www.oooforum.org/forum/viewtopic.phtml?t=58604

Code: Select all

rem **********************************************************************
rem TYPOGRAPHIC QUOTES
rem **********************************************************************

rem   ---- this macro changes dumb quotes to curlies regardless of styles
rem   ---- (unlike OOo's in-built "Autoformat" function)

Sub TypographicQuotes
   oDoc = thisComponent
      ' character codes used in this macro
      ' Chr(34)   double quote
      ' Chr(39)   single quote
      ' Chr(8216)   single quote left
      ' Chr(8217)   single quote right
      ' Chr(8220)   double quote left
      ' Chr(8221)   double quote right
   aFind = Array(""+_
      Chr(34)+"\<",_
      Chr(34),_
      Chr(39)+"\<",_
      Chr(39),_
      "[0-9A-Za-zÀ-Ö\x00D8-\x00F6\x00F8-\x021B\x1E80-\x1EF3\xF730-\xF739\xFB00-\xFB06]\>"+Chr(8216)+"\<",_
      Chr(8216)+"OOoRegExSucks"_
      )
      ' The line beginning "[0-9 and ending +"\<",_ should be on one line.
      ' It's a workaround for OOo's lack of substring matching in RegEx when using find/replace.
      ' It appends a temporary tag to left single quotes when following words or numbers
      ' To avoid another bug/limitation, characters allowed at word-ends are defined in hex ranges
      ' (includes all Latin characters you're ever likely to need, plus the Unicode range for hanging/oldstyle figures)
   aReplace = Array(""+_
      Chr(8220),_
      Chr(8221),_
      Chr(8216),_
      Chr(8217),_
      "&OOoRegExSucks",_
      Chr(8217)_
      )
   aRayCount = 0
   FandR = oDoc.createReplaceDescriptor
   FandR.SearchCaseSensitive = true
   FandR.SearchRegularExpression = true
   While aRayCount <= uBound(aFind)
      FandR.setSearchString(aFind(aRayCount))
      FandR.setReplaceString(aReplace(aRayCount))
      aRayCount = aRayCount + 1
      oDoc.ReplaceAll(FandR)
   Wend
End Sub

Many thanks! This is just what I was looking for! :D What kind of font is the curlies from?

I am using David.ttf, version 5.02, which I liked very much but the quotes was abysmal, and the question mark, and exclamation marks are too small. I'm wondering how to replace those as well, same way with the quotes?

Many thanks in advance, :D
OpenOffice 4.1.1, Windows 8.1
Post Reply