310 reputation
17
bio website
location Maryland
age 32
visits member for 3 years, 4 months
seen Mar 25 at 4:56

Jun
27
awarded  Nice Question
May
8
awarded  Yearling
Oct
21
awarded  Commentator
Oct
21
accepted Can I make some vertical material disappear if it occurs next to a page break?
Oct
21
comment Can I make some vertical material disappear if it occurs next to a page break?
Actually, this works even without the \needspace if I redefine \@secpenalty to be 10000 to really prevent a break between the rule and the heading. The real insight here, for me, is the use of \leaders to produce the rule: that makes TeX treat it as glue, so it's automatically discarded when it follows a page break.
Oct
12
comment Kerning between bold and non-bold text
Oh, that's using 12-point text. The numbers will probably be different for the default 10-point font.
Oct
12
comment Kerning between bold and non-bold text
Try \highlight{why}ever. With the \/ I get a kern of 0.1875 (\textbf's italic correction) followed by a kern of -0.5625 from the \dimexpr. If I change \/ to {}, the second kern becomes -0.375, the same as what TeX puts automatically in \textbf{whyever}.
Oct
12
comment Kerning between bold and non-bold text
That's because the \/ in the \sbox0 adds an italic correction, which cancels out some of the implicit kern and reduces the width difference between the two boxes. The italic correction added by \textbf is effectively canceled out by the reduced size of the \kern that follows it. That's OK if \hl@next is a period or comma, but if it's anything else, you don't want that correction canceled out.
Oct
12
asked Can I make some vertical material disappear if it occurs next to a page break?
Oct
11
comment Kerning between bold and non-bold text
One other issue I encountered in my version (and probably in yours, though I haven't tested it) is that when \textbf looks ahead to decide whether to add italic correction, it sees macro stuff instead of the "real" next character, so it adds the correction even when it shouldn't. I ended up using \unkern to remove that, then doing another box-width comparison to decide whether to add it back. (It'd be more straightforward to just check \hl@next against \nocorrlist to decide whether to \unkern, but I'm not sure how to do that and haven't researched it yet.)
Oct
11
comment Kerning between bold and non-bold text
In your \highlight, why the special case to check whether the next character is a space? The box width comparison seems to work fine on spaces; you just get a difference of zero. (In my implementation I calculate the width difference using \@tempdima, and use \ifdim to skip inserting the kern if its size would be zero.) Am I overlooking something?
Oct
11
awarded  Scholar
Oct
11
comment Kerning between bold and non-bold text
I also found that it looks better if I use \bfseries in the two boxes, so I get the (larger) kern from the bold font.
Oct
11
accepted Kerning between bold and non-bold text
Oct
11
comment Kerning between bold and non-bold text
I took the basic approach you demonstrated (comparing the width of boxes with and without the kern) and made a \highlight command that sets its argument in bold, but uses \futurelet to peek at the next token and insert an appropriate kern for it. So I can just write \highlight{why}, blah and I get a properly-kerned comma.
Oct
10
awarded  Nice Question
Oct
10
revised Kerning between bold and non-bold text
Retitle to reflect the real nature of the problem; grouping turns out to be a side issue
Oct
10
comment Kerning between bold and non-bold text
Hmm. I think my situation is most similar to the first three examples in section 6.3, which do put the punctuation in bold. I used simplified dummy text in the question because I wanted to focus on the technical issue, but it's actually a bullet point in a resumé: Foobar University, Anytown, USA.
Oct
10
awarded  Supporter
Oct
10
asked Kerning between bold and non-bold text