I'm writing documentation that makes frequent reference to Windows-style paths, eg "K:\Folder1\folder2\filename". I see in a badly organized LaTeX user's guide that some special characters can be displayed by preceding them with '\' itself—'\#', for example—but that doesn't work for the backslash itself. How do I produce that character?
Part 2: I tried using the \verb command, and it seems to work: I can use "K:\verb-\-Folder1\verb-\-folder2\verb-\-filename" and get what I want. But this morning I decided that I should put that path into my first \newcommand, and I can't figure out how to avoid the error message "\verb ended by end of line".
I have tried shorter \newcommands with a backslash in them, enough to satisfy myself that this error message is certainly untrue; even with short lines I get this message. But I notice in the user's guide that the very next error message listed is "\verb illegal in command argument". LaTeX isn't showing me that message, but is it true? Is there no way to use \verb inside a \newcommand? Because if so, it seems kind of odd; a line of text with a lot of \verb commands seems an ideal candidate for a \newcommand shortcut.
\verb
isn't allowed in\newcommand
(I think because it's a fairly messy command to begin with). But in your particular case, have you tried\verb-K:\Folder1\folder2\filename-
?