I have made a system to list a lot of LaTeX files, and I wanted to include the path to all the files, in order to be able to quickly copy-paste it. These paths can get quite long, and fiddling around with some settings gave me the following setup that works well for most paths:
\documentclass{article}
\usepackage{url}
\begin{document}
\begin{sloppypar}
\noindent\path{C:/Folder/Subfolder/Subsubfolder/EvenMoreSubfoldernames/filename.tex}
\end{sloppypar}
\end{document}
This will give nice line breaks for most of my files. In this specific example (and also for some actual files I have), the line breaks only at the file extension, so we would get
C:/Folder/Subfolder/Subsubfolder/EvenMoreSubfoldernames/filename
.tex
as output. Is it possible to avoid line breaks at the file extensions? There should be no dots elsewhere in the path, so avoiding line breaks at dots would also work. I originally used Steven B. Segletes' answer here with \texttt
, but this does not combine with the sloppypar
environment, and hence usually goes into the margin before breaking.
In summary:
Is it possible to avoid line breaks at the extension of a file path, using \url
or \texttt
?
\texttt
is just a font command -- your solution wil be independent of this. I think the reason it's used in the linked answer is just to match the style of the\url
macro. – Chris H Aug 12 '15 at 10:42url
, as it discusses the definition of which characters can allow breaking -- though I don't see.
in the list. – Chris H Aug 12 '15 at 10:47