I have an (inconsistent) issue with menukeys. I don't know why it inserts spaces in the path.
Tex-file:
\documentclass{scrreprt}
% Language setting
\usepackage[english]{babel}
% Set page size and margins
\usepackage[a4paper,top=2cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}
% % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% MENUKEYS, für Pfade und Tasten-Symbole
\usepackage{menukeys}
\makeatletter
% --- macro for changing path sep ---
\newcommand\setnewpathsep[1]
{%
\tw@declare@style@simple*{paths}{%
{\ttfamily\CurrentMenuElement}%
}[#1]{blacknwhite}
}
\setnewpathsep{\textbackslash}
\makeatother
% % % % %
\begin{document}
\begin{enumerate}
\item \directory[bslash]{.\3D_Some.Path\somemore\3D_More-FileNames_V2.wbpj} \ - Why is this correct?
\item \directory[bslash]{.\3D_Some.Path\even more\3D_More-FileNames.wbpj} \ - Why is this correct?
\item \directory[bslash]{.\3D_Some.Path\More\Main.wbpj} \ - Why is there a space before the extension?
\item \directory[bslash]{.\3D_Some.Path\More\Ma_in.wbpj} \ - Why is there a space after Ma?
\item \directory[bslash]{.\3D_Some.Path\More\2D_Main.wbpj} \ - Why is this correct?
\item \directory[bslash]{.\3D_Some.Path\More\xD_Ma_in.wbpj} \ - Why is there a space after xD?
\end{enumerate}
\end{document}
I have uploaded it to overleaf: https://www.overleaf.com/read/zfmdmjbmwwtp The same issue with TeXstudio...

\More,\mabut not after control symbols like\2– David Carlisle Mar 30 '22 at 12:08