I'm trying to do this:
\documentclass{article}
\begin{document}
\begin{minipage}{2in}
\ttfamily
https://www.stackoverflow.com/questions/ask
\end{minipage}
\end{document}
The URL is not being hyphenated (because LaTeX doesn't hyphenate monospace fonts) and I'm getting "Overfull \hbox". The only solution I've found is to redefine the forward-slash to "forward-slash with a space" (maybe also do this with the dot). How can I do this?
PS. For some reason, this question was closed, while the answer is provided in this one.
\documentclass{article} \usepackage{xurl} \begin{document} \begin{minipage}{2in} \url{https://www.stackoverflow.com/questions/ask} \end{minipage} \end{document}it breaks the url (betweenstackoverflow.andcom). – Marijn Aug 28 '21 at 17:30\urlcommand in my example above – yegor256 Aug 29 '21 at 04:06\urlcommand but you can change your code to start using this command, because it is an easy way to allow for line breaks in urls. Do you have a reason for not wanting to use this command? If so then there may be a solution that addresses that reason while still using\url. – Marijn Aug 29 '21 at 07:24