
Problema:
Estou tentando alinhar três figuras próximas uma da outra com o texto centralizado em cada figura. Isso está indo bem até que a caixa da terceira caixa não se ajuste à largura do texto.
Exemplo mínimo de trabalho (MWE):
\documentclass{article}
\usepackage{graphicx}
\usepackage{caption}
\begin{document}
\begin{figure}[!tbp]
\centering
\begin{minipage}[b]{0.2\textwidth}
\includegraphics[width=\textwidth]{icon-password.eps}
\caption*{Login system}
\end{minipage}
\hfill
\begin{minipage}[b]{0.2\textwidth}
\includegraphics[width=\textwidth]{icon-shopping.eps}
\caption*{Shopping cart}
\end{minipage}
\hfill
\begin{minipage}[b]{0.2\textwidth}
\includegraphics[width=\textwidth]{icon-clock.eps}
\caption*{Temporary information}
\end{minipage}
\end{figure}
\end{document}
Saídas:
Para ajustar a largura após o texto, para que "Informações temporárias" possam ser escritas em uma linha em vez de duas.
Responder1
Aqui está uma solução
\documentclass{article}
\usepackage{graphicx}
\usepackage{caption}
\newlength{\mtfiglength}
\newcommand{\mtfigure}[3][\textwidth]{% #1 optional with of figure #2 caption #3 image filename
\settowidth{\mtfiglength}{#2}%
\begin{minipage}[b]{\mtfiglength}
\centering
\includegraphics[width=#1]{#3}
\caption*{#2}
\end{minipage}}
\begin{document}
\begin{figure}[!tbp]
\centering
\mtfigure{Login system}{example-image-a}\hfill
\mtfigure{Shopping cart}{example-image-b}\hfill
\mtfigure{Temporary information}{example-image}
\end{figure}
\begin{figure}[!tbp]
\centering
\mtfigure{Login system}{example-image-a}\hfill
\mtfigure{Shopping cart}{example-image-b}\hfill
\mtfigure[3cm]{Temporary information}{example-image}
\end{figure}
\end{document}