# How to add a long legend in a figure while allowing line-breaking, with or without hyphenation

Hello I encountered a problem with breaking lines using package - \usepackage[hyphens]{url}.

It works perfectly in every situation expect this one where I use it in \textsuperscript{}. Unfortunately \textsuperscript{} was the only way found to include source with smaller font size below a picture.

Here is an example:

\documentclass{article}
\usepackage{graphicx}
\usepackage[hyphens]{url}

\begin{document}

\begin{figure}[!htb]
\begin{center}
\includegraphics[scale=0.64]{example-image-a}
\textsuperscript{Source and some text to reproduce the problem of non-hyphenation: \url{http://google.com/}}
\caption{Schema}
\label{abc}
\end{center}
\end{figure}

\end{document}

• Try {\footnotesize Source: \url{http://google.com/}\par}. – Henri Menke Sep 11 '17 at 2:53
• Henri's approach is reasonable. But you could also try the sloppypar environment: tex.stackexchange.com/a/40521/35642 – Thiago Perrotta Sep 11 '17 at 2:55
• Please try giving a real minimum working example at your questions. I edited just instead of accepting an edit with no changes... – koleygr Sep 11 '17 at 3:03
• @Henri Menke Yea!! The size of the font is a bit bigger but still smaller than caption which resolves my problem. I really appreciate your help! :) – user3613919 Sep 11 '17 at 4:27
• Sorry @koleygr for that. I will try reminding myself that while asking new question – user3613919 Sep 11 '17 at 4:40

\textsuperscript{} was the only way found to include source with smaller font size

Nothing in the argument of a \textsuperscript -- or, for that matter, \textsubscript -- directive is ever line-broken. And this observation pertains not just to URL strings that may occur in the argument of \textsuperscript.

Try a switch such as \footnotesize (20% linear reduction of font size) or \scriptsize (30% linear reduction) instead. Don't use \tiny unless you're prepared to distribute a magnifying glass with each copy of your document...

\documentclass{article}
\usepackage{graphicx}
% just for this example:
\usepackage[textwidth=10cm,showframe,nomarginpar]{geometry}
\usepackage[hyphens]{url}

\begin{document}

\begin{figure}
\centering
\includegraphics[scale=0.64]{example-image-a}

{\scriptsize Source and some text to reproduce the problem

versus % this is typeset at "\normalsize"

\textsuperscript{Source and some text to reproduce the problem

\caption{Schema} % the caption is also typeset at "\normalsize"
\label{abc}
\end{figure}

\end{document}