# unwanted space after a command

Gray, Gary L. euler at psu.edu
Mon Oct 25 18:34:59 CEST 2021

Hi Hartmut,

That did it! Thank you.

Gary

> On Oct 25, 2021, at 10:43 AM, Hartmut Henkel <hartmut_henkel at gmx.de> wrote:
>
> Hi Gary,
>
> On Mon, 25 Oct 2021, Gray, Gary L. wrote:
>> I have defined several commands that look like:
>>
>> \providecommand{\fn}[1]{\textcolor{DarkOrange3}{\texttt{\detokenize{#1}}}}
>>
>> to use when entering computer code in documents for the classes I
>> teach. I like the command because it allows me to put underscores or
>> anything else I need in it. The command works nicely if I do something
>> like:
>>
>> \fn{legendreP(n,x)}
>>
>> but if I have a backslash in the command, an extra space is added
>> after the command. For example, with
>>
>> \fn{w = A\b}.
>>
>> there is a space between the "b" and the period. How can I define a
>> command like this that doesn't add that extra space?
>
> e. g.,
>
> \documentclass{article}
> \usepackage{color}
> \providecommand{\fn}[1]{\textcolor{red}{\texttt{\detokenize{#1}\unskip}}}
> \begin{document}
> \fn{legendreP(n,x)}
> \fn{w = A\b}.
> \end{document}
>
> ...but not checked what's the cause of the space, in \detokenize.
>
> Best Regards, Hartmut