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

Text Annotation

New Here ,
Jul 12, 2021 Jul 12, 2021

Copy link to clipboard

Copied

I need to create annotations below single words and groups of words, like you see in a grammar book: a noun phrase would be underlined and directly below the horizontal line, a label such as NP (noun phrase) is inserted. I've tried grep and subscript but there must be a better solution! 

TOPICS
How to , Scripting , Type

Views

300

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 , Jul 12, 2021 Jul 12, 2021

I'm guessing that you're after something like this:

PeterKahrel_0-1626093864621.png

You can't do that with styles only. The NP label sits in an anchored text frame (a custom anchor). Most of the work is done by an object style. You can insert the label manually (here, in front od the 'a'), then size the frame manually so that the rule appears. The rule is a paragraphrule on the label. Inserting the labels can be made much easier (and more precise) with a simple script.

 

P.

 

 

Votes

Translate

Translate
Community Expert ,
Jul 12, 2021 Jul 12, 2021

Copy link to clipboard

Copied

I would suggest you look into Nested Styles Drop caps and nested styles in InDesign (adobe.com)

I don't see any easy fix

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 ,
Jul 12, 2021 Jul 12, 2021

Copy link to clipboard

Copied

Can you please supply an example? 

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 ,
Jul 12, 2021 Jul 12, 2021

Copy link to clipboard

Copied

I'm guessing that you're after something like this:

PeterKahrel_0-1626093864621.png

You can't do that with styles only. The NP label sits in an anchored text frame (a custom anchor). Most of the work is done by an object style. You can insert the label manually (here, in front od the 'a'), then size the frame manually so that the rule appears. The rule is a paragraphrule on the label. Inserting the labels can be made much easier (and more precise) with a simple script.

 

P.

 

 

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
New Here ,
Jul 13, 2021 Jul 13, 2021

Copy link to clipboard

Copied

Yes, this seems to work.  Here's how: 

I defined a custom paragraph style for the annotation, including a top border, called "Annotation".

Paragraph_Style.pngI then create an example frame and duplicated it for each of the most common annotations (Verb Phrase, Prepositional Phrase, etc.)

Anchor_Position.png

I simply drag from the library and specify the anchor point. The anchor option I chose was "anchor position"; that way as text is added anywhere in the frame, the anchor floats up, down, right or left. 

Placement-Example.png

Final Result: 

FinalResult.png

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 ,
Jul 14, 2021 Jul 14, 2021

Copy link to clipboard

Copied

LATEST

The library is a neat solution. But I would still use a script. It uses an object style, which is an advantage because it makes it easy to fine-tune annotations that you already placed. And it's quicker: all you do is select a phrase and run the script. The script places the annotation frame and places the cursor in it, so that you can now type the category label. The script is also consistent and more precise because it takes the frame's width from the selection.

 

Just for insterest's sake here it is.

 

First create an object style and name it Annotation. Set your Annotation paragraph style in the object style, and set its Auto-Size to height only. The other settings are the same as what you had in your frames (anchor point etc.).

 

To use the script, three steps:

1. Select a phrase

2. Run the script

3. Type the category label

 

 

(function () {
  var ostyle = app.documents[0].objectStyles.item('Annotation');
  var sel = app.selection[0];
  var w = sel.endHorizontalOffset - sel.horizontalOffset;
  var tag = sel.insertionPoints[0].textFrames.add ({
    geometricBounds: [0, 0, '30pt', w],
    appliedObjectStyle: ostyle,
  });
  tag.insertionPoints[0].select();
}());

 

 

Ideally you create a keyboard shortcut to run the script.

 

P.

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