Basically, I would like to something like \xspace
does, i.e. the meaning of the macro should depend on what is following it. So for example if I say
\mymacro a
it might expand to foo
, and if any other character is following, it should expand to bar
. In my specific case I'll try to match a unicode character, if that makes a difference.
Edit: Specifically, I want to influence the spacing after an integral. When it stands alone, the default spacing is fine. If it is the first of multiple integrals, the space became too wide. Here is what I cobbled together from the previous answer:
\newcommand\timeintegral[1]{
∫_{t_0}^{t_1} \if ∫#1 \!\!\! \fi #1
}
This is how it looks in use:
\timeintegral E \, dt = \timeintegral ∫_z ∫_φ f \, dφ dz dt
pdflatex
it's different than withxelatex
orlualatex
. Knowledge of the character is needed; also a “real world” use case would be nice.pdflatex
and tested for a Unicode character beyond the ASCII block.