[Solved] How to find for italic typface next to regular?

Discuss the word processor
Post Reply
ImMoist
Posts: 9
Joined: Sun Jul 01, 2018 2:55 pm

[Solved] How to find for italic typface next to regular?

Post by ImMoist »

I'm currently editing a web novel into an ebook and everything has gone good so far, or so I thought. After reading it through I've noticed that there are parts where single words that are italic are next to (in front or after) a regular word have no space, so I end up with something like this:
testtest or testtest
Is there a way to use the find and replace function to add a space in between these instances? I'm editing a 1256 page document with 600k words.

Im using OpenOffice 4.1.5 on Windows 10 if that helps.
Last edited by ImMoist on Thu Jul 05, 2018 5:57 am, edited 1 time in total.
OpenOffice 4.1.5 Window 10
User avatar
Zizi64
Volunteer
Posts: 11358
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: How to find for italic typface next to regular?

Post by Zizi64 »

Try the AltSearch extension. It can find various formatting parameters.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
ImMoist
Posts: 9
Joined: Sun Jul 01, 2018 2:55 pm

Re: How to find for italic typface next to regular?

Post by ImMoist »

Zizi64 wrote:Try the AltSearch extension. It can find various formatting parameters.
Thanks, I'm been trying it right now for about an hour and I still can't get the search for to work as intended. I was also thinking that maybe I could use the spell check system to find these joined words (thinking they're misspelled or something) however it says everything in the document is fine.

If anyone could please help me that would be very much appreciated.
OpenOffice 4.1.5 Window 10
User avatar
Zizi64
Volunteer
Posts: 11358
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: How to find for italic typface next to regular?

Post by Zizi64 »

I was also thinking that maybe I could use the spell check system to find these joined words (thinking they're misspelled or something) however it says everything in the document is fine.
Please upload a short ODF type sample document here with some misplelled words and with same structure (same paragraph style settings) as the original one. (Delete the most of the text from a copy of the original document, and upload it here.) The file size limit is 128 KiB in this forum.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
ImMoist
Posts: 9
Joined: Sun Jul 01, 2018 2:55 pm

Re: How to find for italic typface next to regular?

Post by ImMoist »

Actually it does work, I just had to change the language for all text before trying the spell check. However, cycling through the various made up names/places and simplified words and exclamation/expressions just to find these combined words is proving to be a very long task. So I'm still looking for a simpler way to find these joined words. Oh and as it turns out its not just two words joined together there are times when its three or four.
OpenOffice 4.1.5 Window 10
User avatar
robleyd
Moderator
Posts: 5078
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: How to find for italic typface next to regular?

Post by robleyd »

Is it possible to utilise the method of getting from HTML to whatever format you are bringing into Writer, to resolve the duplication, rather than trying to post-process the text?

Obviously, I don't know what your process is, so this is a bit of a guess.
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
John_Ha
Volunteer
Posts: 9584
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: How to find for italic typface next to regular?

Post by John_Ha »

See [Tutorial] How to record a macro (and Regular Expressions) for help on Regular Expressions which are used to find things you define and not just "any characters".

Using Alternative Find and Replace

1. Click the arrow by Properties and select Italic
2. Tick Regular expressions
3. Click Find.
Clipboard01.gif
Click Help for extensive Help. For some reason clicking Find All says it finds two, but it only highlights the second instance. For some other reason clicking Replace then crashes.

Using AOO Find and Replace

1. Edit > Find and replace
2. Click More. Tick Regular expressions
3. Click Format. Choose Italic
4. Place (.*) in Search. This finds any number of consecutive characters in Italic
5. Place $1space in Replace. This replaces what was found with what was found followed by a space.
Clipboard02.gif
6. Click Find. If you have found testtest, click replace and it will replace "test" with "test " adding the space

7. If you have found fredfred, change Replace to space$1 so that you replace what was found with itself preceded by a space. It will replace "fred" with " fred" when you click Replace.

It may be easier to do two passes, one searching for occurrences of preceding italics such as testtest, replacing each with $1space; and a second searching for following italics such as testtest, replacing each with space$1.

As a new poster you will find much useful information in the Writer FAQ, the Writer Tutorials, the up to date Writer guide and the Writer Manual, which tells you how to use Find and Replace. May I suggest you bookmark the pages.

Press F1 to access the Help screen and search for your problem

The chapter headings in the manual are:

1 - Introducing Writer
2 - Setting up Writer
3 - Working with Text
4 - Formatting Pages
5 - Printing, Exporting, Faxing and E-Mailing
6 - Introduction to Styles
7 - Working with Styles
8 - Working with Graphics
9 - Working with Tables
10 - Working with Templates
11 - Using Mail Merge
12 - Tables of Contents, Indexes and Bibliographies
13 - Working with Master Documents
14 - Working with Fields
15 - Using Forms in Writer
16 - Customizing Writer – Keyboard shortcuts.

When a pop-up window opens, click the Help button for extensive help on that function - it is often more comprehensive than the manual.

Showing that a problem has been solved helps others searching so, if your problem is now solved, please view your first post in this thread and click the Edit button (top right in the post) and add [Solved] in front of the subject.
Last edited by John_Ha on Mon Jul 02, 2018 12:10 pm, edited 1 time in total.
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
User avatar
robleyd
Moderator
Posts: 5078
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: How to find for italic typface next to regular?

Post by robleyd »

I think the OP has given a misleading example in the first post; from the description I think the meaning is that different words, one having italic font, have no space between them. So I think the example should be:
single words that are italic are next to (in front or after) a regular word have no space, so I end up with something like this:
foobarwibble or foobarwibble
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
John_Ha
Volunteer
Posts: 9584
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: How to find for italic typface next to regular?

Post by John_Ha »

robleyd wrote:I think the OP has given a misleading example in the first post; from the description I think the meaning is that different words, one having italic font, have no space between them.
David

That is exactly what my Search does. The search does not look for a given word - it looks for any consecutive characters (including spaces) which are rendered in italic.

It then replaces that sequence with itself, either preceded by, or followed by, a space. This converts foobarwibble to foobar wibble, and converts foobarwibbleto foobar wibble.
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
ImMoist
Posts: 9
Joined: Sun Jul 01, 2018 2:55 pm

Re: How to find for italic typface next to regular?

Post by ImMoist »

robleyd wrote:Is it possible to utilise the method of getting from HTML to whatever format you are bringing into Writer, to resolve the duplication, rather than trying to post-process the text?

Obviously, I don't know what your process is, so this is a bit of a guess.
I wouldn't say its duplication more like a issue when I initially copied and pasted the text from the website to OpenOffice. Some parts of the text had these "grey spaces" which weren't spaces with a background colour, highlighter or anything like that so I used the find and replace function to remove them with no spaces because sometimes those "grey spaces" had another normal space before or after, so I figured that would work. I only noticed the issue long after completing the ebook and then from reading it.
John_Ha wrote:
robleyd wrote:I think the OP has given a misleading example in the first post; from the description I think the meaning is that different words, one having italic font, have no space between them.
David

That is exactly what my Search does. The search does not look for a given word - it looks for any consecutive characters (including spaces) which are rendered in italic.

It then replaces that sequence with itself, either preceded by, or followed by, a space. This converts foobarwibble to foobar wibble, and converts foobarwibbleto foobar wibble.
I appreciate the tutorials however I should've probably mentioned in the opening post that when certain characters speak in this web novel they are always italic so you can differentiate between the two (humans and reapers), so the examples you gave me don't really work too well since it also finds the normal italic conversations.

Heres an example chapter which has once instance of joined words at the beginning. (someonewas)
example.odt
(33.36 KiB) Downloaded 97 times
OpenOffice 4.1.5 Window 10
User avatar
robleyd
Moderator
Posts: 5078
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: How to find for italic typface next to regular?

Post by robleyd »

The grey spaces are most likely non-breaking spaces ( ) in the HTML file(s) - Ctrl-Shift_Space in Writer. Rather than deleting them perhaps you should have replaced them with normal spaces in Writer, then if needed go through and replace multiple spaces with one space. However if publishing in epub format, multiple spaces most likely wouldn't be an issue.
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
John_Ha
Volunteer
Posts: 9584
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: How to find for italic typface next to regular?

Post by John_Ha »

Searching with AOO Find and Replace, using (.*), Italic and Regular expressions, finds every instance of italic strings in your .odt file.
Clipboard01.gif
You can probably modify the regular expression so as to choose only to find "italic strings followed by a normal character which is not a space" but it probably isn't worth it - just skip the wrong ones and jump to the next instance. I cannot see an easy way to do it with AOO because the Italic applies to all the contents of the search box. You may be able to do it with Alternative Find and Replace by entering two search arguments in the search box (italic string followed by non italic character) but I have not experimented.

Incidentally, you should now see why applying Direct Formatting is not a good idea. Had you defined a Style for alien_speech as italic, and applied it as a style, then you could have searched for everything in that style.

There are (countless) other workarounds - you need to use some imagination.
For example, if you do not use double spaces, replace all italic strings by the found string with a preceding and a following space. Now search for all double spaces and replace them with a single space.
Or, if you do use double spaces, search for all double spaces and replace them with xq85#. Now replace all italic strings by the string with a preceding and a following space. Now search for all double spaces and replace them with a single space. Now replace all xq85# with a double space.

May I make a suggestion? Text reads much more easily with a small gap below a paragraph. Edit your default (Text body) style by Format > Paragraph > Indents and Spacing. Set Gap after paragraph to be 1.5 or 2mm. You may then also decide that indenting the paragraph is no longer necessary - remove it by setting the first line indent to 0mm.
Clipboard04.gif
Showing that a problem has been solved helps others searching so, if your problem is now solved, please view your first post in this thread and click the Edit button (top right in the post) and add [Solved] in front of the subject.
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
John_Ha
Volunteer
Posts: 9584
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: How to find for italic typface next to regular?

Post by John_Ha »

Another point. Spellcheck does not find someonewas because its (and lots of other text) language is set to Unknown so AOO does not have a dictionary against which to check it. Set all your text to the correct language (UK English, US English etc), and install that dictionary and spellcheck with find someonewas.
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
ImMoist
Posts: 9
Joined: Sun Jul 01, 2018 2:55 pm

Re: How to find for italic typface next to regular?

Post by ImMoist »

robleyd wrote:The grey spaces are most likely non-breaking spaces ( ) in the HTML file(s) - Ctrl-Shift_Space in Writer. Rather than deleting them perhaps you should have replaced them with normal spaces in Writer, then if needed go through and replace multiple spaces with one space. However if publishing in epub format, multiple spaces most likely wouldn't be an issue.
Ah yes you're right, that's exactly what they are. I'll have to remember that for next time. Cheers! Why is that? Do multiple spaces not show when converting to say azw3 format etc?
John_Ha wrote:Searching with AOO Find and Replace, using (.*), Italic and Regular expressions, finds every instance of italic strings in your .odt file.
The attachment Clipboard01.gif is no longer available
You can probably modify the regular expression so as to choose only to find "italic strings followed by a normal character which is not a space" but it probably isn't worth it - just skip the wrong ones and jump to the next instance. I cannot see an easy way to do it with AOO because the Italic applies to all the contents of the search box. You may be able to do it with Alternative Find and Replace by entering two search arguments in the search box (italic string followed by non italic character) but I have not experimented.

Incidentally, you should now see why applying Direct Formatting is not a good idea. Had you defined a Style for alien_speech as italic, and applied it as a style, then you could have searched for everything in that style.
You say it isn't worth it and I should just skip to the next instance however, this is how many next instances i'd have to go through.
Capture.PNG
I guess it is a solution however not really an efficient one, though if this is the closest I can get to narrowing the search then I guess i'd have to set the thread as solved.
John_Ha wrote:There are (countless) other workarounds - you need to use some imagination.
For example, if you do not use double spaces, replace all italic strings by the found string with a preceding and a following space. Now search for all double spaces and replace them with a single space.
Or, if you do use double spaces, search for all double spaces and replace them with xq85#. Now replace all italic strings by the string with a preceding and a following space. Now search for all double spaces and replace them with a single space. Now replace all xq85# with a double space.
Interesting. I never thought about it that way.
John_Ha wrote:May I make a suggestion? Text reads much more easily with a small gap below a paragraph. Edit your default (Text body) style by Format > Paragraph > Indents and Spacing. Set Gap after paragraph to be 1.5 or 2mm. You may then also decide that indenting the paragraph is no longer necessary - remove it by setting the first line indent to 0mm.
The attachment Clipboard04.gif is no longer available
This was very much intentional. Based on all the ebooks I've come across this type of indention and paragraph spacing is what they all use. I guess I just wanted it to look more professional, personally.
John_Ha wrote:Another point. Spellcheck does not find someonewas because its (and lots of other text) language is set to Unknown so AOO does not have a dictionary against which to check it. Set all your text to the correct language (UK English, US English etc), and install that dictionary and spellcheck with find someonewas.
Yeah figured that out in comment above :oops: . Thanks though.
OpenOffice 4.1.5 Window 10
John_Ha
Volunteer
Posts: 9584
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: How to find for italic typface next to regular?

Post by John_Ha »

ImMoist wrote:You say it isn't worth it and I should just skip to the next instance however, this is how many next instances i'd have to go through.
12,000 x 1 sec per skip = 12,000 seconds = 3 hours and 20 minutes which is not very long. It has probably taken you that long to create this thread, add your posts and read the replies. 600k words at 6 chars plus a space per word is 4,200,000 keystrokes - 12,000 isn't very many in comparison.
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
User avatar
robleyd
Moderator
Posts: 5078
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: How to find for italic typface next to regular?

Post by robleyd »

Do multiple spaces not show when converting to say azw3 format etc?
I can't speak for azw3 as I haven't worked with it, or any of the Amazon/Kindle formats, but epub is basically HTML where all whitespace - spaces, tabs, newlines etc. - are treated as spaces and multiple occurrences are ignored.

Given the extent of your problem, and hoping that you have created the necessary styles for formatting your document which you can re-use, perhaps starting from afresh might be an easier option?
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
ImMoist
Posts: 9
Joined: Sun Jul 01, 2018 2:55 pm

Re: How to find for italic typface next to regular?

Post by ImMoist »

John_Ha wrote:
ImMoist wrote:You say it isn't worth it and I should just skip to the next instance however, this is how many next instances i'd have to go through.
12,000 x 1 sec per skip = 12,000 seconds = 3 hours and 20 minutes which is not very long. It has probably taken you that long to create this thread, add your posts and read the replies. 600k words at 6 chars plus a space per word is 4,200,000 keystrokes - 12,000 isn't very many in comparison.
Touché.
robleyd wrote:
Do multiple spaces not show when converting to say azw3 format etc?
I can't speak for azw3 as I haven't worked with it, or any of the Amazon/Kindle formats, but epub is basically HTML where all whitespace - spaces, tabs, newlines etc. - are treated as spaces and multiple occurrences are ignored.

Given the extent of your problem, and hoping that you have created the necessary styles for formatting your document which you can re-use, perhaps starting from afresh might be an easier option?
Hmm, I see. Yeah I'm planning on starting again however now I'm having issues copy and pasting. I'm trying to the chapter from this page however every time I paste, it doesn't keep any of the italics. Yet if I copy only this part only from the chapter
Well,’ said Garovel at length, ‘now we can get to Capaporo safely. It may take us another day or two, but at least there isn’t a feldeath and an army of worms in the way. As far as I know, that is.
It pastes fine into the document, and the italics are there. Why is this happenig?
OpenOffice 4.1.5 Window 10
User avatar
robleyd
Moderator
Posts: 5078
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: How to find for italic typface next to regular?

Post by robleyd »

You know you can get the eBooks for a small cost - https://thezombieknight.blogspot.com/p/e-books.html
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
ImMoist
Posts: 9
Joined: Sun Jul 01, 2018 2:55 pm

Re: How to find for italic typface next to regular?

Post by ImMoist »

I know that, however why pay when I can just make them myself (I've already made my own ebooks for books 1 -5 and the only issue left for them to be 100% is the initial one I made this thread about). Also Book 5-6 (6 because it isn't even completed yet) aren't available.

This will also help me learn new things and how to go about editing when I make more ebooks in the future.
OpenOffice 4.1.5 Window 10
ImMoist
Posts: 9
Joined: Sun Jul 01, 2018 2:55 pm

Re: How to find for italic typface next to regular?

Post by ImMoist »

Alright well then, one final query before closing the thread. I'm trying to use the "Find & Replace" to find all text inside single quotation marks and this is what I've got so far is this:

Code: Select all

\‘[^’]*\’
However, that doesn't account for the single quotes used as an apostrophe mark inside those single quotes. Don't ask me why the author does this, its just what it is.

Example:
‘Of course we’re kidding,’
will end up being highlighted as
‘Of course we’re kidding,’
(the underscore/bold is the text being highlighted/selected)

I suppose if I could use the "Find & Replace" to find single quotes between text I could change them all to actual apostrophe marks then use the code above to finish the job and everything would be well. Is there a Find and Replace expression that can do this or can the code above be altered to account for this?
OpenOffice 4.1.5 Window 10
John_Ha
Volunteer
Posts: 9584
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: How to find for italic typface next to regular?

Post by John_Ha »

Regular expressions are universal so Google for it.

Be sure to work on a copy of the file as a small mistake with a regular expression can go spectacularly wrong :crazy:

I quickly found C# Regex: matching anything between single quotes (except single quotes) [duplicate] which links to Regular Expression Except this Characters.

see [Tutorial] How to record a macro (and Regular Expressions) for references for regular expressions.

Showing that a problem has been solved helps others searching so, if your problem is now solved, please view your first post in this thread and click the Edit button (top right in the post) and add [Solved] in front of the subject.
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
ImMoist
Posts: 9
Joined: Sun Jul 01, 2018 2:55 pm

Re: How to find for italic typface next to regular?

Post by ImMoist »

John_Ha wrote:Regular expressions are universal so Google for it.

Be sure to work on a copy of the file as a small mistake with a regular expression can go spectacularly wrong :crazy:

I quickly found C# Regex: matching anything between single quotes (except single quotes) [duplicate] which links to Regular Expression Except this Characters.

see [Tutorial] How to record a macro (and Regular Expressions) for references for regular expressions.

Showing that a problem has been solved helps others searching so, if your problem is now solved, please view your first post in this thread and click the Edit button (top right in the post) and add [Solved] in front of the subject.
Alright sweet, got it working. Thanks a lot!
OpenOffice 4.1.5 Window 10
Post Reply