Copy link to clipboard
Copied
Im working on a calendar in InDesign. The calendar is a table with four cols. The first one is a single number for the date of the month, the secont is the first letter of the coresponding day. Im trying to turn the text in every row that contains a "s" for sunday, red by applying a GREP paragraph format but i can't seem to get it to work. I can get the "s" red but need help with the rest. Any pointers?
[Saw Scott's response after I posted this] As suggested by @Scott Falkner is to have the date and day both in a cell, separated by a tap, then you can use GREP style ^\d+\t[sS] to make both red.
You can use the SmartCellMerge.js from indiscripts.com to merge across the columns of each row. Find a paragraph return and replace with a tab in those cells.
Copy link to clipboard
Copied
Hi @simon cederholm ,
can you show a screenshot of the GREP Style you are currently using with the paragraph style that is applied to the table's text? What is "the rest"? What are the key characters you want to color? And please show at least some rows of your table with hidden characters showing; also frame edges so that we can see clearly a table cell's boundaries.
Note: You need one character style for each color you want to apply.
And also one GREP Style per used character style and color.
GREP Style pattern for the first character "s" in a given table cell:
^s
Better*, if you only like to do this with sunday, to do a positive look ahead with the rest of the word:
^s(?=unday)
For monday it will go like that:
^m(?=onday)
[*] Of course to make this work the whole word must be present as the first word in the table cell.
Also note, that a GREP Style cannot work beyond a given paragraph. It cannot pick up the contents of an adjacent text cell and react upon it.
Regards,
Uwe Laubender
( Adobe Community Expert )
Copy link to clipboard
Copied
I said:
"[*] Of course to make this work the whole word must be present as the first word in the table cell."
If the whole word cannot be present visually you still can use the whole word in the text cell, but you have to obscure all characters but the first one in the word by applying a character style where the fill color is set to [None], the text is scaled down with a tiny point size like 0.1 Pt and also perhaps scaled to 1% in width and height.
Regards,
Uwe Laubender
( Adobe Community Expert )
Copy link to clipboard
Copied
Heres what the table looks like. The left is how it looks...the right is what u would want.The GREP that im using right now is ^.*\b[sS]\b.*. It works fine when its text only (letter ---tab---letter S). But when i convert it to table it only makes the S red.
Copy link to clipboard
Copied
Hi @simon cederholm ,
thank you for the structure of your table.
The main issue is to get the difference between the "T" in row 5 and the "T" in row 6. Here I assume that both "T"s do not share the same color. Am I right with that?
If yes, the second column's contents should contain the full names of the weekdays.
Could you type them out for me so that I can try something on my side? Thanks.
Hm. And do you want to use one single paragraph style for column 1 and column 2? It would be easier to use two different ones; but let's see if we can do something about it. Maybe an or would do.
Note, that you have to regard every contents, as shown in your screenshot, in every table text cell as a different paragraph. The scope of a GREP Style defined in a paragraph style cannot be outside one single paragraph.
Regards,
Uwe Laubender
( Adobe Community Expert )
Copy link to clipboard
Copied
Hi @simon cederholm ,
below a screenshot from my German InDesign with some GREP Styles; should also work for you:
The Story Editor window is open. As you can see the weekdays' names are written out, but because of a GREP Style where character style "Invisible" is applied, only the first character is visible on the page. "Invisible" is set like that: Point Size: 0.1 Pt, Scaling horizontally and vertically: 1 %, fill color: [None].
Regards,
Uwe Laubender
( Adobe Community Expert )
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Normally I like to see grid lines, table lines, and hidden characters, but in this case I’ll make an exception. Can you show the desired table appearance in preview mode so we know how you want it to look in the finished product? I ask because it looks like there is no vertical break between the first and second columns. If so then you could combine them so the date and day of the week are in one cell, making them one paragraph. With that you can apply a GREP style to both the date and the day of the week.
Copy link to clipboard
Copied
Hi @simon cederholm,
I can't see how GREP style can make the number before the 'S' red, as they are separate paragraphs in different cells.
Can you do a GREP Find/Change and apply a character style to the number and 'S' that makes them red before converting it to tables?
Another way is to use a script to make the contents of the cell red if the next cell contains a letter 'S'.
Copy link to clipboard
Copied
Hi @Thunder-Lightning ,
download my sample InDesign document where the same paragraph style is used in both columns:
https://community.adobe.com/t5/indesign-discussions/grep-in-a-table-row/m-p/13768293#M525563
Explanation here:
https://community.adobe.com/t5/indesign-discussions/grep-in-a-table-row/m-p/13768152#M525558
Regards,
Uwe Laubender
( Adobe Community Expert )
Copy link to clipboard
Copied
Thanks, @Laubender , for the InDesign file.
As far as I understood the question, the number is not always 1 on Sunday in a calendar though so how would they use the GREP style to colour the number?
Copy link to clipboard
Copied
Thanks for this, @Thunder-Lightning .
Thought the numbering is for the weekdays.
In case the numbering are days of months, there is also a solution.
The day's name has to come with the number as well and will be made invisible.
So the data structure could be:
14 Sunday | Sunday
where the red parts are the one for character style "Invisible".
The right color for the number will be determined with one or more digits plus a positive lookahead for a horizontal whitespace and the unique name of the day. The whole name this time, not only the truncated one like in the second column.
Regards,
Uwe Laubender
( Adobe Community Expert )
Copy link to clipboard
Copied
[Saw Scott's response after I posted this] As suggested by @Scott Falkner is to have the date and day both in a cell, separated by a tap, then you can use GREP style ^\d+\t[sS] to make both red.
You can use the SmartCellMerge.js from indiscripts.com to merge across the columns of each row. Find a paragraph return and replace with a tab in those cells.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now