There seems to be a problem using a hyphen in a URL inside a fancyvrb Verbatim environment when using the hyperref package.
The Problem
The following document:
\documentclass{article}
\usepackage{fancyvrb}
\usepackage{hyperref}
\begin{document}
\begin{Verbatim}[commandchars=\\\{\}]
\url{http://a-z.example}
\end{Verbatim}
\end{document}
produces the following text in the output pdf:
http://a\unhbox\voidb@x\kern\z@\char`\discretionary{-}{}{}z.example
Less than ideal workaround
The best workaround I can come up with is to replace the url
command with
\href{http://a%2dz.example}{http://a-z.example}
. Note the hyphen needs to be percent-encoded. This is not ideal.
Is there a way to solve this problem? Or at least a better workaround?