![]() |
#1 |
Banned
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 640
Karma: 4911
Join Date: Jul 2007
Location: Grapevine, TX
Device: iPad4
|
Macro help - Itals from txt
Can anybody think of a way in Word to convert the conventional "_ital_" in text files to be "ital"? I get lots of text files that use the underscore to annotate stop and start italics.
|
![]() |
![]() |
![]() |
#2 |
eBook Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 85,544
Karma: 93383099
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
|
I just do it manually. I've never come across a book where that takes more than a few minutes.
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,176
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
txt2lrf does this automatically.
|
![]() |
![]() |
![]() |
#4 |
eBook Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 85,544
Karma: 93383099
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
|
I actually prefer to do it manually, because PG texts are far from perfect - they very often leave out the closing underscore, or have it in the wrong place. Just another example of our differing approach, Kovid - you're creating tools for automatic conversion; I prefer the more "personal" approach
![]() |
![]() |
![]() |
![]() |
#5 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,176
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Ah but see you could edit the txt file to your heart's content and then leave the _words_ for txt2lrf to take care of. Thereby reducing the amount of manual labor you need to put in. The *2lrf tools don't force you to do automatic conversion. I don't know if your familiar with TeX, but their philosophy is based on it. Think of them as the last stage of a toolchain, like a compiler. You prepare the sources (TXT or HTML files) and then compile them into machine readable output (LRF file).
Indeed txt2lrf was designed with the goal of allowing perfectionists like you to edit the TXT file to your hearts content and end up with a TXT file that looks good by itself and that can be automatically converted into a pretty LRF with images and a TOC and what have you. |
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Gutenberger
![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 142
Karma: 700
Join Date: Jul 2007
Location: Lisbon, Portugal
Device: Cybook Gen 3
|
Quote:
Then, write _ in the "Find" field (wildchars disabled). Be sure you remove the formatting instructions from the "Replace" field and that you haven't hit space bar in the field. "Replace all". (Edit: ) If something looks wrong after you did this properly, probably the problem is that one of the _italics was not closed in the *.txt. The number of underscores in the *.txt must be a pair. Please report it to PG using errata (at) pglaf (dot) org email address. Last edited by ricdiogo; 08-23-2007 at 09:23 AM. |
|
![]() |
![]() |
![]() |
#7 |
eBook Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 85,544
Karma: 93383099
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
|
Brilliant! Thanks, Ricardo - I've never managed to get wildcard searches to work in Word.
|
![]() |
![]() |
![]() |
#8 |
Banned
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 640
Karma: 4911
Join Date: Jul 2007
Location: Grapevine, TX
Device: iPad4
|
When I tried it Word actually replaced everything with "(*)". Yes, I did check "use wildcards". What did I do wrong?
|
![]() |
![]() |
![]() |
#9 |
Gutenberger
![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 142
Karma: 700
Join Date: Jul 2007
Location: Lisbon, Portugal
Device: Cybook Gen 3
|
You probably didn't use the underscore. It as to be: _(*)_
If you just use (*) you'll get the whole text in italics. |
![]() |
![]() |
![]() |
#10 |
Banned
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 640
Karma: 4911
Join Date: Jul 2007
Location: Grapevine, TX
Device: iPad4
|
I did use the underscore. When I said it replaced everything, I meant it replaced all occurrences of _italics_ with _(*)_.
|
![]() |
![]() |
![]() |
#11 |
Banned
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 640
Karma: 4911
Join Date: Jul 2007
Location: Grapevine, TX
Device: iPad4
|
Ahh, I got it now. I was putting the _(*)_ in the replace field also. Thank you very much for your help.
|
![]() |
![]() |
![]() |
#12 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,064
Karma: 144284144
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
I'm trying _(*)_ in Word 2003 and it just isn't working. what am I doing wrong?
Never mind.. got it working. |
![]() |
![]() |
![]() |
#13 |
Gutenberger
![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 142
Karma: 700
Join Date: Jul 2007
Location: Lisbon, Portugal
Device: Cybook Gen 3
|
No prob edbro
![]() JSWolf describe your steps please. |
![]() |
![]() |
![]() |
#14 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,176
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
|
![]() |
![]() |
![]() |
#15 |
Connoisseur
![]() ![]() Posts: 62
Karma: 133
Join Date: Oct 2007
Location: Minnesota, USA
Device: Kobo Aura Edition 2
|
For some reason, if you use the macro recorder while doing the search and replace described above, the resulting macro doesn't work. Through trial and error I found that you need to insert a line of code into the macro, so that it reads:
Code:
Sub UnderscoreToItal() ' ' Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "_(*)_" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = True .Replacement.Font.Italic = wdToggle .MatchCase = False .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "_" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Replace:=wdReplaceAll End Sub |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Word Formatting Macro (Stingo's Macro) | Stingo | Sony Reader | 75 | 08-24-2010 05:18 AM |
Kindle DX Graphite first look and macro shots of text | MobileTechReview | Amazon Kindle | 31 | 07-09-2010 05:37 PM |
Macro photos of Vizplex E Ink | Magnesus | General Discussions | 4 | 04-23-2010 03:04 PM |
Spelling Macro | PieOPah | Workshop | 36 | 12-13-2008 02:27 AM |
Emdash - punctuation macro | ProDigit | Sony Reader | 8 | 11-28-2008 02:32 AM |