1

I am trying to type:

C:\\Users\\Reymi\\Downloads\\imagen.png 

all in one line. The problem is that because of \\ it skips a line between each word.

David Carlisle
  • 757,742

1 Answers1

2

You can use the url package for this:

\documentclass{article}
\usepackage{url}

\DeclareUrlCommand\file{%
    % Set monospace font
    \def\UrlFont{\ttfamily}%
    % Set characters to break after but not in between
    \def\UrlBigBreaks{\do\:\do\\}
}

\begin{document}

\file|C:\\Users\\Reymi\\Downloads\\imagen.png|

Here's some long sentence that shows that the path \file|C:\\Users\\Reymi\\Downloads\\imagen.png| is also broken across lines.

\end{document}

Output:

enter image description here

siracusa
  • 13,411