Forum Replies Created
-
AuthorPosts
-
March 25, 2010 at 8:19 pm in reply to: How to get white letters on a black background in a paragraph style? #52325
Theunis De Jong
MemberDepending on your exact needs, you can or you can't do that with InDesign.
InDesign does not support “setting a background color” for text. Fortunately, there are a few tricks that do work in some circumstances. The most popular is the Paragraph Rule.
This only works with single line stuff (like your heading!). In your heading style, define a Paragraph Rule Below. Make it thick enough for your text plus some more — about the height of the leading. Set the Offset to about minus half that value. Enable “Preview” so you can tinker with it until you are satisfied.
Unfortunately, if you run into the odd multi-line heading, the Paragraph Rule thing will not seem to work. Actually, it does but exclusively with a fixed number of lines, so you have to define separate styles for 1-line headings, 2-line headings, etc., each with a different line thickness and vertical offset.
Theunis De Jong
MemberCalvin:
find: a glyph followed by an em-dash followed by a glyph
apply: character style to the em-dash and the preceding glyph (since the tracking only applies to the space after a glyph when highlighting a single glyph)
Ehm… That's what this GREP does
.~_
I admit it's a tiny one, so perhaps that's why you didn't notice it. It's “any character followed by an em dash”. As you noticed, it's not necessary to apply it to the next character as well. It's therefore also not necessary to include it in the GREP style.
I've not quite wrapped my head around “look for this pattern but only apply the character style to these sub-elements of what you found”…any kind souls willing to point me in the right direction?
That can be done in two ways. The first way only works with find-and-replace, and to use it you have to “mark” groups of characters to find with parentheses, (like) (this) — two groups. In the Replace With field, you refer to the found groups using $1, $2, $3 etc. (“$0″ is a special code for the entire found expression). So you can switch these two words around by putting “$2 $1″ into the Replace field. It's especially handy if you need to find “abc” and change only the “b” part. But —
The other way to do it, is with Lookahead and Lookbehind. They are pretty cool features, with some amazing capabilities. What they do is look for text before and/or after what you want to find, but without marking them — they do not get highlighted when you press “Find Next”. Hence, they are not touched by anything you put in the Replace With field. Subscripting the “2″ in “H2O” is a good example, as you cannot do that with one regular Find/Replace. However, when Looking Behind for an “H”, searching for a “2″, and Looking Ahead for an “O”, you can do it in one go! This particular example would look like this:
(?<=H)2(?=O)
with this full explanation, provided by something I am (or should be) working on:
(?<= Lookbehind Group
H Literal text ‘H’
) End Lookbehind Group
2 Literal text ‘2’
(?= Lookahead Group
O Literal text ‘O’
) End Lookahead Group
Theunis De Jong
MemberThe slash doesn't :D Backslashes do, but the forward slash seems to be one of the handful non-alphanumerics that doesn't do anything. As far as I can tell, none of the characters in your sample need escaping.
As with your “200 words” thingy, some of the spaces may have been entered as hard (non-breaking) spaces. Select “Show invisible characters” and check for these.
You can also copy one of the lines and paste it into the Find what field of GREP — ID will convert any special characters to its GREP notation. It will not help if sometimes one space is entered as a hard space and on another occasion another space is, though.
You can always change every single space in the string to s, which is a catch-all for “any sort of space at all”.
Theunis De Jong
Member.. I looked into if GREP had it's own Search/Replace built-in ..
Say whuh? You would like to do a Search-and-replace inside a GREP expression or something like that?
You are correct about the GREP styles, though — all they can do is apply formatting. I don't think it would be a wise move to “automagically” have it replace text … see also the discussion in one of the GREP Style threads on why it's a bad, bad idea to use GREP to “hide” double spaces and typos.
You can try this: apply a style with lots of tracking (+100 or more) to
.~_
Theunis De Jong
MemberCalvin:
find: a glyph followed by an em-dash followed by a glyph
apply: character style to the em-dash and the preceding glyph (since the tracking only applies to the space after a glyph when highlighting a single glyph)
Ehm… That's what this GREP does
.~_
I admit it's a tiny one, so perhaps that's why you didn't notice it. It's “any character followed by an em dash”. As you noticed, it's not necessary to apply it to the next character as well. It's therefore also not necessary to include it in the GREP style.
I've not quite wrapped my head around “look for this pattern but only apply the character style to these sub-elements of what you found”…any kind souls willing to point me in the right direction?
That can be done in two ways. The first way only works with find-and-replace, and to use it you have to “mark” groups of characters to find with parentheses, (like) (this) — two groups. In the Replace With field, you refer to the found groups using $1, $2, $3 etc. (“$0″ is a special code for the entire found expression). So you can switch these two words around by putting “$2 $1″ into the Replace field. It's especially handy if you need to find “abc” and change only the “b” part. But —
The other way to do it, is with Lookahead and Lookbehind. They are pretty cool features, with some amazing capabilities. What they do is look for text before and/or after what you want to find, but without marking them — they do not get highlighted when you press “Find Next”. Hence, they are not touched by anything you put in the Replace With field. Subscripting the “2″ in “H2O” is a good example, as you cannot do that with one regular Find/Replace. However, when Looking Behind for an “H”, searching for a “2″, and Looking Ahead for an “O”, you can do it in one go! This particular example would look like this:
(?<=H)2(?=O)
with this full explanation, provided by something I am (or should be) working on:
(?<= Lookbehind Group
H Literal text ‘H’
) End Lookbehind Group
2 Literal text ‘2’
(?= Lookahead Group
O Literal text ‘O’
) End Lookahead Group
Theunis De Jong
MemberThe slash doesn't :D Backslashes do, but the forward slash seems to be one of the handful non-alphanumerics that doesn't do anything. As far as I can tell, none of the characters in your sample need escaping.
As with your “200 words” thingy, some of the spaces may have been entered as hard (non-breaking) spaces. Select “Show invisible characters” and check for these.
You can also copy one of the lines and paste it into the Find what field of GREP — ID will convert any special characters to its GREP notation. It will not help if sometimes one space is entered as a hard space and on another occasion another space is, though.
You can always change every single space in the string to , which is a catch-all for “any sort of space at all”.
Theunis De Jong
Member.. Adobe InDesign some of the time, but just InDesign at other times. We don't want to bold the company name every time it's used, only when it's combined with the product name.
You started out good, but made it a bit more complicated than necessary with the lookbehinds (as in: you are first checking if there is a “Company” before, then if there is not!).
This works just fine:
((Adobe )?(InDesign|Illustrator|Photoshop))|((Quark )?(XPress|Promote))
but it might be better to use separate GREP styles for each firm. Less hard work for poor Indy! Easier to maintain, as well. Like this:
(Adobe )?(InDesign|Illustrator|Photoshop)
(Quark )?(XPress|Promote)
Theunis De Jong
MemberHow, in GREP, do you search for a string of specific words?
You type them :-) Without any lookahead/lookbehind or other GREP conditions, what you enter is what it'll search. (At least for regular text and digits — other symbols may need escaping, because they might be GREP instructions.)
It appears you want to find (and mark) this text and only when it's preceded by a digit. Well, the digit can be taken care of with a lookbehind, and the rest is a “regular” find. Try this:
(?<=d) words in optional trims
Theunis De Jong
Member.. I looked into if GREP had it's own Search/Replace built-in ..
Say whuh? You would like to do a Search-and-replace inside a GREP expression or something like that?
You are correct about the GREP styles, though — all they can do is apply formatting. I don't think it would be a wise move to “automagically” have it replace text … see also the discussion in one of the GREP Style threads on why it's a bad, bad idea to use GREP to “hide” double spaces and typos.
You can try this: apply a style with lots of tracking (+100 or more) to
.~_
Theunis De Jong
Member.. Adobe InDesign some of the time, but just InDesign at other times. We don't want to bold the company name every time it's used, only when it's combined with the product name.
You started out good, but made it a bit more complicated than necessary with the lookbehinds (as in: you are first checking if there is a “Company” before, then if there is not!).
This works just fine:
((Adobe )?(InDesign|Illustrator|Photoshop))|((Quark )?(XPress|Promote))
but it might be better to use separate GREP styles for each firm. Less hard work for poor Indy! Easier to maintain, as well. Like this:
(Adobe )?(InDesign|Illustrator|Photoshop)
(Quark )?(XPress|Promote)
Theunis De Jong
MemberHow, in GREP, do you search for a string of specific words?
You type them :-) Without any lookahead/lookbehind or other GREP conditions, what you enter is what it'll search. (At least for regular text and digits — other symbols may need escaping, because they might be GREP instructions.)
It appears you want to find (and mark) this text and only when it's preceded by a digit. Well, the digit can be taken care of with a lookbehind, and the rest is a “regular” find. Try this:
(?<=d) words in optional trims
Theunis De Jong
MemberI think the only way is to save them as INX (or, since this is CS4, its bigger cousin IDML) and then open that. Saving in these “compatible” formats strips out everything that's not actually used (and — very occasionally — sometimes stuff that was in use so don't delete your original files just yet).
Theunis De Jong
MemberOr adobe wants only smart intelligent people to script …
They might — or they might want to scare off everyone (see their implementation of what should have been a simple programmer's editor…). I disliked their complicated Help system so much I rewrote it in friendly HTML, and since it allows backtracking from one object to another, I found this with relative ease:
newframe is a TextFrame, so entered that in Search. Nothing useful there on columns, but I noticed TextFramePreferences (Adobe's preferred way of adding yet even more properties to objects). Clicked that, found this: textColumnCount. TextFramePreferences is used as a property value for a few things, and one of them is TextFrame.textFramePreferences. Adding all together, I think you can safely say:
newframe.textFramePreferences.textColumnCount = 1;
at any place you find convenient.
By the way, yes! I was lazy, putting in that Fit Frame quick hack, and your solution is way better! It now works the way I envisioned it, 'cutting' right through the frame and leaving everything else intact.
Theunis De Jong
MemberI think the only way is to save them as INX (or, since this is CS4, its bigger cousin IDML) and then open that. Saving in these “compatible” formats strips out everything that's not actually used (and — very occasionally — sometimes stuff that was in use so don't delete your original files just yet).
Theunis De Jong
MemberOr adobe wants only smart intelligent people to script …
They might — or they might want to scare off everyone (see their implementation of what should have been a simple programmer's editor…). I disliked their complicated Help system so much I rewrote it in friendly HTML, and since it allows backtracking from one object to another, I found this with relative ease:
newframe is a TextFrame, so entered that in Search. Nothing useful there on columns, but I noticed TextFramePreferences (Adobe's preferred way of adding yet even more properties to objects). Clicked that, found this: textColumnCount. TextFramePreferences is used as a property value for a few things, and one of them is TextFrame.textFramePreferences. Adding all together, I think you can safely say:
newframe.textFramePreferences.textColumnCount = 1;
at any place you find convenient.
By the way, yes! I was lazy, putting in that Fit Frame quick hack, and your solution is way better! It now works the way I envisioned it, 'cutting' right through the frame and leaving everything else intact.
-
AuthorPosts
