Copy link to clipboard
Copied
A couple years ago I found a set of GREP Styles to display text as title case (as described here), but still allow me to cross-reference it in sentence case. I can't seem to dig up where I had gotten it from, but putting it to work in a new document I found it capitalizing things it shouldn't, so I've started to revise the expressions to better reflect "proper" title casing. Originally posting here to seek assistance, I eventually scrapped together enough comprehension of GREP to fix it on my own. Here's what I came up with, maybe you know a better way?
Apply Style: All Caps (style only contains Case set to All Caps)
To Text: ^\S
Apply Style: All Caps
To Text: /\S
Apply Style: All Caps
To Text: :\s\l|[-\s]\l(?!(f|he|nd?|o|y|rom|or|r|ut)?\b)
Apply Style: Normal Case (style only contains Case set to Normal)
To Text: \s(a)\s|\s(an)\s|\s(and)\s|\s(are)\s|\s(but)\s|\s(down)\s|\s(in)\s|\s(is)\s|\s(of)\s|\s(on)\s|\s(or)\s|\s(the)\s|\s(to)\s|\s(up)\s|\s(up,)\s|\s(with)\s
Copy link to clipboard
Copied
I think you can (rather vastly) simplify in the following way:
Apply All Caps to:
(?<!\w')\b\l
which means "word break, lower case, unless preceded by a word character and apostrophe" -- the latter to prevent "I'Ll Be Back".
Apply Normal to:
\b(a|an|the|it|of|with|at|from|into|during|including|until|against|among|throughout|despite|towards|upon|concerning|to|in|for|on|by|about|like|through|over|before|between|after|since|without|under|within|along|following|across|behind|beyond|plus|except|but|up|out|around|down|off|above|near)\b
which is the common definitie and indefinite articles, plus the 75-or-so most common prepositions, preceded and succeeded by a word break and separated by the vertical bar for OR.
Compare yours against mine: I can spot a few minor differences, such as "as", but the overall format of the GREP style is easy enough to add these if you want.
sample use
Copy link to clipboard
Copied
Just what I was looking for, thank you!