I am generating a LaTeX file, and I got some very long commands containing Windows path, which do not break at line end. For instance, I can have a line like this :

This is a \texttt{very\textbackslash{}long\textbackslash{}command\textbackslash{}that\textbackslash{}will\textbackslash{}not\textbackslash{}break\textbackslash{}at\textbackslash{}textbackslash{}the\textbackslash{}end\textbackslash{}of\textbackslash{}the\textbackslash{}line}.

Is there any way to set the \textbackslash{} (but the question would hold for any character) as a potential hyphenation point ? The generation is automated, so I cannot add a \- manually, which I would do normally.

  • I'm not sure I understand: \textbackslash is a macro. Do you actually mean the macro \textbackslash or rather \ ?
    – cgnieder
    Sep 22 '15 at 7:59
  • In this case it's a macro yes, but I am looking for a generic solution, for instance it would have been a Linux path, and in this case, I'd like the / to be an hyphenation point. So yes, in this case, I mean \textbackslash Sorry for being bad at explaining ^^
    – user64789
    Sep 22 '15 at 8:01
  • Why don't you use the url package? Sep 22 '15 at 8:11
  • Because the above LaTeX code is generated via Pandoc, from an HTML source, so I have to work with that :)
    – user64789
    Sep 22 '15 at 8:13
  • Is the url correctly marked up in the html? Sep 22 '15 at 8:59

If you are able to coerce the generating program to write, say, \bslash{} instead of \textbackslash, you can define


just like \slash is defined (which is the macro you can use for the similar problem with Unix paths).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy