図のキャプション内の余分な単語間隔

図のキャプション内の余分な単語間隔

キャプションに余分な単語間隔がある理由がわかりません。おそらくサブ図のせいでしょうか? ご協力いただければ幸いです。

ここに画像の説明を入力してください

\begin{figure}[H]
\centering
\begin{subfigure}[h]{.45\textwidth}
\centering
    \includegraphics[width=\textwidth]{beest} 
    \caption{ Strandbeest Janson, Theo; hacknmod.com/wp-content/uploads/2013/07/theo-jansen-strandbeest.jpg} 
    \label{beest}
    \end{subfigure}
    \hfill
    \begin{subfigure}[h]{.45\textwidth}
    \centering
    \includegraphics[width=\textwidth]{umbrella}
    \caption{Sample umbrella mechanism;  wiki.ece.cmu.edu/ddl/images/thumb/Umbrella-wikiFrontpage.jpg/500px-Umbrella-wikiFrontpage.jpg}
    \label{umbrella}
    \end{subfigure}
    \caption{}
    \label{}
\end{figure}

答え1

キャプション素材の配置を両端揃えから右揃えに変更する必要があります。subcaptionパッケージはすでにロードされているので、次の命令を発行するだけです。

\captionsetup[subfigure]{justification=raggedright}

この指示を文書全体に適用する場合は、この指示を序文に配置します。または、この指示を\begin{figure}2 つのサブ図にのみ適用する場合は、この指示の直後に配置します。

urlまた、パッケージを(オプション 付きでhyphens)ロードし、キャプション内の URL 文字列をディレクティブで囲むことをお勧めします\url。そうすることで、LaTeX は長い URL 文字列内で追加の改行の可能性を検出できるようになります。

ちょっとした注意点:3つの\centering命令はすべて、それぞれの利用可能な幅全体を占めるエンティティに適用されるため、省略できます。

ここに画像の説明を入力してください

\documentclass{article}
\usepackage[demo]{graphicx} % omit 'demo' version in real document
\usepackage{subcaption}
\usepackage[hyphens]{url}
\begin{document}
\begin{figure}
\captionsetup[subfigure]{justification=raggedright}
\urlstyle{same}
%%%\centering
\begin{subfigure}[t]{.45\textwidth}
    %%%\centering
    \includegraphics[width=\linewidth]{beest} 
    \caption{ Strandbeest Janson, Theo; \url{hacknmod.com/wp-content/uploads/2013/07/theo-jansen-strandbeest.jpg}} 
    \label{beest}
\end{subfigure}
\hfill
\begin{subfigure}[t]{.45\textwidth}
    %%%\centering
    \includegraphics[width=\linewidth]{umbrella}
    \caption{Sample umbrella mechanism;  \url{wiki.ece.cmu.edu/ddl/images/thumb/Umbrella-wikiFrontpage.jpg/500px-Umbrella-wikiFrontpage.jpg}}
    \label{umbrella}
\end{subfigure}
\caption{}
\label{}
\end{figure}
\end{document}

関連情報