The document that I am writing includes lots of paths to files. Many of them have blank spaces that I am powerless to remove since they originate outside of my domain of control. But the \path{} command that this document uses actually butchers those paths by removing blank spaces. \path{C:\My Documents} outputs MyDocuments`. I am not sure who thought that it was a good idea or even acceptable to alter the command's argument.

I cannot simply switch to \texttt{} because this would require escaping lots of backslashes, underscores, dollar signs, etc, all over the document.

How can I fix the result of the \path{} command?

  • It is very hard to answer this because you do not post any code. The only \path command I know is in TikZ, obviously you are not referring to this one.
    – user228539
    Nov 21, 2020 at 17:43
  • What package defines the \path command? I don't think it's part of standard LaTeX. Nov 21, 2020 at 17:43
  • 1
    \usepackage[obeyspaces]{url} Nov 21, 2020 at 17:43

1 Answer 1

\usepackage[obeyspaces]{url} %before hyperref if hyperref is used

\path{C:\My Documents}


enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .