• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

InDesign Italic words issue

Contributor ,
Feb 23, 2023 Feb 23, 2023

Copy link to clipboard

Copied

Hi,

 

I have a manuscript layout in InDesign. It has unfortunately words with starting letter as italic. Is there any way to find out such words using the GREP styles or any other method. There are lot of words. So, it seems impossible to manually look for each of them.

 

Example:

Test

 

Thanks and Regards,

Eswari

TOPICS
How to , Print , Scripting , Type

Views

1.0K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Feb 23, 2023 Feb 23, 2023

Okay, I'm going to assume that you want to keep the italics if the whole word is italic. So here's a revised script that should work with your test. And screen shots of my test results.

- Mark

demo.gif

/**
 * Removes italics fontStyle in an any word that is not completely italicized.
 * @author m1b
 * discussion https://community.adobe.com/t5/indesign-discussions/indesign-italic-words-issue/m-p/13601388
 */
function main() {

    var findFontStyle = 'Italic',
        changeToFontStyle = 'Regular';

    
...

Votes

Translate

Translate
Community Expert ,
Feb 23, 2023 Feb 23, 2023

Copy link to clipboard

Copied

Hi @Eshu153, I've written a script that might help in your case. It will find italicized first letters (of words longer than one letter) and apply the 2nd character's fontStyle to it. See if that covers your situation.

- Mark

 

/**
 * Removes italics fontStyle in the first character
 * of a word, where the word is longer than one letter
 * and the first character is italicized.
 * discussion https://community.adobe.com/t5/indesign-discussions/indesign-italic-words-issue/m-p/13601388
 */
function main() {

    app.findGrepPreferences = NothingEnum.NOTHING;
    app.changeGrepPreferences = NothingEnum.NOTHING;
    app.findGrepPreferences.findWhat = '\\b[\\l\\u]';
    app.findGrepPreferences.fontStyle = 'Italic';

    app.findChangeGrepOptions.includeFootnotes = true;
    app.findChangeGrepOptions.includeHiddenLayers = true;
    app.findChangeGrepOptions.includeLockedLayersForFind = false;
    app.findChangeGrepOptions.includeLockedStoriesForFind = false;
    app.findChangeGrepOptions.includeMasterPages = true;

    var doc = app.activeDocument,
        found = doc.findGrep(),
        counter = 0;

    for (var i = 0; i < found.length; i++) {
        var word = found[i].words.item(0),
            nextChar = word.characters.item(1);
        if (
            nextChar.isValid
            && nextChar.fontStyle != 'Italic'
            && word.length > 1
        ) {
            found[i].fontStyle = nextChar.fontStyle;
            counter++;
        }
    }

    alert('Changed ' + counter + ' italicized characters.');

} // end main

app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'Un-italicize First Letters');

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Feb 23, 2023 Feb 23, 2023

Copy link to clipboard

Copied

Thanks, Mark.

 

The script throwing error. I saved it as .vbs.

\\b[\\l\\u]

this I tried in GREP find box and could not find any italics.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 23, 2023 Feb 23, 2023

Copy link to clipboard

Copied

Hi @Eshu153, please save my script as .jsx (it is ExtendScript, which is a flavour of Javascript).

If you are using Grep in Indesign via the UI, you also need to set the font style:Screenshot 2023-02-23 at 20.58.07.png

Screenshot 2023-02-23 at 21.00.29.png

But please try script first—it will be much easier. 🙂

 

P.S. here is instructions to install a script:

1. Select the text from my post - just the "code" styled part.
2. Make a new text file in Notepad or TextEdit (IMPORTANT: must be plain text—not rich text).
3. Paste the code from step 1.
4. Save as "Script name here.jsx" (note: file extension is ".jsx") to your desktop.
5. In Indesign, open the Script panel, right-click on on User folder and choose "Reveal".
6. Move the file you saved in step 4 to the User folder that should now be visible.
7. Back in Indesign, the script should appear in the User folder of Scripts Panel (see Window menu > Utility).
8. Double click script name to run the script.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Feb 23, 2023 Feb 23, 2023

Copy link to clipboard

Copied

I did use the italic style while searching. Could not find any.

 

I ran the script with your instructions. It says changed 12 italics. But, I see the italics followed by regular characters still not changed. 😞

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Feb 23, 2023 Feb 23, 2023

Copy link to clipboard

Copied

Now, When I search, it shows the first character italic words. But, what I need is show only those words which first character is italic and next characters followed are not italic. It shows every italic word.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 23, 2023 Feb 23, 2023

Copy link to clipboard

Copied

Okay, can you please post a sample .indd file showing some examples that the script didn't change. Then I'll be able to see why and adjust the script.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Feb 23, 2023 Feb 23, 2023

Copy link to clipboard

Copied

Okay. Sorry. I didn't being specific. Its changing the first character to normal. But, the occurrences sometimes, more than one letter in the word.

 

For example,

Test

"Test

"Test

 

These scenario texts are not getting affected. Maybe the code needs some updation.

 

Thanks and Regards,

Eswari

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 23, 2023 Feb 23, 2023

Copy link to clipboard

Copied

Okay, I'm going to assume that you want to keep the italics if the whole word is italic. So here's a revised script that should work with your test. And screen shots of my test results.

- Mark

demo.gif

/**
 * Removes italics fontStyle in an any word that is not completely italicized.
 * @author m1b
 * discussion https://community.adobe.com/t5/indesign-discussions/indesign-italic-words-issue/m-p/13601388
 */
function main() {

    var findFontStyle = 'Italic',
        changeToFontStyle = 'Regular';

    app.findGrepPreferences = NothingEnum.NOTHING;
    app.changeGrepPreferences = NothingEnum.NOTHING;
    app.findGrepPreferences.findWhat = '[[:punct:]]?\\b[\\l\\u]+';
    app.findGrepPreferences.fontStyle = findFontStyle;

    app.findChangeGrepOptions.includeFootnotes = true;
    app.findChangeGrepOptions.includeHiddenLayers = true;
    app.findChangeGrepOptions.includeLockedLayersForFind = false;
    app.findChangeGrepOptions.includeLockedStoriesForFind = false;
    app.findChangeGrepOptions.includeMasterPages = true;

    var doc = app.activeDocument,
        found = doc.findGrep(),
        lettersOfWord = /[A-Za-z]+/,
        counter = 0;

    for (var i = 0; i < found.length; i++) {

        var word = found[i].words.item(0);

        if (!word.isValid)
            continue;

        var wordLettersMatch = word.contents.match(lettersOfWord);

        if (wordLettersMatch && wordLettersMatch[0].length > found[i].contents.length) {
            found[i].fontStyle = changeToFontStyle;
            counter++;
        }
    }

    alert('Changed ' + counter + ' partially italicized words.');

} // end main

app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'Un-italicize Partial Words');

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Feb 23, 2023 Feb 23, 2023

Copy link to clipboard

Copied

Just For Comments!

[thinking personally a global treatment could be a wrong approach…]

 

https://youtu.be/HCy3rIQ1Y4s

 

(^/)  The Jedi

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 23, 2023 Feb 23, 2023

Copy link to clipboard

Copied

Yeah @FRIdNGE that looks great for the ability to step forwards and backwards. Nice!

- Mark

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Feb 24, 2023 Feb 24, 2023

Copy link to clipboard

Copied

LATEST

Thanks Mark. It works. But, its always better to search and change would be more better as sometimes we don't know what authors want to convey with the letters. But, this still resolves my issue.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines