When formatting object dot notation ("x.next") in math mode I want to combine a math-mode variable (x) with a field name (next), separated by a period. For this I've been using code $x.\textit{next}
. LaTeX, however, makes the spacing look poor depending on the variable name preceding the field. With a variable named "f" it looks quite bad . Adding negative space helps, but the amount of negative space needed to fix it seems to depend on the variable itself. For example, one
\!
is not quite sufficient for "f" , but two looks ok
, whereas if the variable name is "e" one is a little tight but maybe ok
, and two is quite bad
.
Putting both the variable and the field name in the \textit
works, but the font for the variable name is then different from normal made mode, so that's not a solution. Is there any way to fix the spacing between the variable and the period, without needing to make separate macros for each different variable name?
\textit{f.next}
? I would probably not typeset such things in italics, but this might be a matter of taste.\textit
, so mixing$f$
and\textit{f.next}
makes the "f"s look like subtly different symbols. I'd really rather not have to change every single variable use to\textit
just to accommodate the few places where object notation is used.