# Extra space after custom texttt

I am currently using the below codes for auto line breaking in Latex. However, below code places an extra space behind the /texttt. How can I remove the extra space being placed after the /texttt command? The spacing looks like the below image.

Code:

\makeatletter
\newcommand\aepath[1]{%%
\bgroup
\ttfamily
\ae@path#1\relax\@nil
\egroup}
\def\ae@path#1#2\@nil{%%
\def\ae@continue{}%%
\detokenize{#1}\unskip\penalty\z@
\ifx\relax#2
\else
\def\ae@continue{\ae@path#2\@nil}%%
\fi
\ae@continue}
\makeatother

\let\texttt\aepath

• Welcome to TeX.SX! Probably a % after \ifx\relax#2 will do. – Phelype Oleinik Jun 8 '19 at 19:37
• The code you used (from tex.stackexchange.com/a/219454/4427) had an unprotected end-of-line. I fixed it. – egreg Jun 8 '19 at 19:39
• @egreg Impressive! (how fast you found it, I mean.) – Phelype Oleinik Jun 8 '19 at 19:41
• @PhelypeOleinik I searched aepath – egreg Jun 8 '19 at 19:42
• @PhelypeOleinik Thank you! Your suggestion works! – Deep Mind Jun 9 '19 at 4:22