Table of file names with special characters

tablestabularxurls

For my thesis, I want to create a list/table with the file paths of all data I show in my figures.
What I came up so far is a combination of tabularx and longtable (via ltxtable), and putting the path of the files into the \path command of hyperref. Unfortunately, neither \path nor \url are able to cope with special characters like ä,ö,ü,µ that can be present in the file names. \path{blaµ} inserts broken characters while \url{blaµ} doesn't compile at all.

In total, I have ~200 very long file names. How could I obtain a proper list?

Bonus question: Is there any nicer way to make the table wider than the print area instead of the ugly 1.2\textwidth (which ofc raises an overfull hbox)? For my other tables I used the \centerfloat command of memoir, but this doesn't work for the non-floating longtable.

My MnWE:

\documentclass[a4paper,12pt,ngerman]{memoir}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{babel}
\usepackage{graphicx}
\usepackage{varioref}
\usepackage[hidelinks]{hyperref}
\usepackage{longtable}
\usepackage{ltxtable}
\usepackage[nameinlink]{cleveref}

\addto\captionsngerman{ 
\def\figurename{Abb.}
}


\begin{document}

\begin{figure}
\includegraphics[width=3cm]{example-image-a}
\caption{my figure}
\label{fig:a}
\end{figure}

\LTXtable{1.2\textwidth}{filelist.tex}

\end{document}

The content of filelist.tex:

begin{longtable}{@{}llX@{}}
\caption{List of data files}\\
Fig. & Details & Path \\\midrule
\cref{fig:a} & bla bla & \path{Curry-Charakterisierung/Abbildungsverhältnis/20190402_b_Ne_0,5mMC_KPF_3D_1s_sort.dat} \\ 
\end{longtable}

The result:

enter image description here

Best Answer

enter image description here

This allows breaking just at /

\documentclass[a4paper,12pt,ngerman]{memoir}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{babel}
\usepackage{graphicx}
\usepackage{varioref}
\usepackage[hidelinks]{hyperref}
\usepackage{longtable}
\usepackage{ltxtable}
\usepackage[nameinlink]{cleveref}

\addto\captionsngerman{ 
\def\figurename{Abb.}
}

\catcode`\/=\active
\newcommand\pathsetting{%
\raggedright
\arraybackslash
\catcode`\/=\active
\catcode`\_=12
\let/=\slash
}
\catcode`\/=12


\begin{document}

\begin{figure}
\includegraphics[width=3cm]{example-image-a}
\caption{my figure}
\label{fig:a}
\end{figure}

\noindent X\dotfill X

\noindent\hspace*{-.1\textwidth}X\dotfill X\hspace*{-.1\textwidth}\mbox{}

\setlength\LTleft{-.1\textwidth}
\setlength\LTright{-.1\textwidth}
\LTXtable{1\textwidth}{filelist.tex}

\end{document}

\begin{longtable}{
@{}
ll
>{\pathsetting}X
@{}}
\caption{List of data files}\\
Fig. & Details & Path \\\midrule
\cref{fig:a} & bla bla & \texttt{Curry-Charakterisierung/Abbildungsverhältnis/20190402_b_Ne_0,5mMC_KPF_3D_1s_sort.dat} \\ 
\end{longtable}

If you want to also allow breaking after _ you could adjust to

\catcode`\/=\active
\catcode`\_=\active
\newcommand\pathsetting{%
\raggedright
\arraybackslash
\catcode`\/=\active
\catcode`\_=\active
\let/=\slash
\def_{\string_\linebreak[0]}%
}
\catcode`\/=12
\catcode`\_=8
Related Question