# Left align text inside figure environment

The following code produces a bit of text where the first line is not aligned with respect to the second line, i.e. the word 'city' and the horizontal line are not indented by the same distance.
I want to align the first line to the second, without changing the indentation of the second line, since this bit is contained in a custom package and I want to change as little as possible inside the package.

\documentclass{amsbook}
\usepackage[utf8]{inputenc}
\usepackage{tabularx}

\begin{document}
\begin{figure}[b]
City, June 6, 2022

\vspace{2em}
\begin{tabularx}{\linewidth}{@{}XX@{}}
\hrule&\\
John Cena & \\
\end{tabularx}
\end{figure}
\end{document}


• If I understand what you want, you can just add \flushleft (or \raggedright) right after \begin{figure}[b]. Jun 6 at 20:21
• @frabjous \raggedright (\flushleft is just the internal start form of \begin{flushleft} and shouldn't be used on its own) (but yes:-) Jun 6 at 20:24
• amsbook applies \centering to floats so City is not "indented", just the whole line is centred, Jun 6 at 20:26

Here you are: a simple \hfill is enough.

    \documentclass{amsbook}
\usepackage{tabularx}

\begin{document}

\begin{figure}[b]
City, June 6, 2022\hfill
\vspace{2em}\\
\begin{tabularx}{\linewidth}{@{}XX@{}}
\hrule&\\
John Cena & \\
\end{tabularx}
\end{figure}

\end{document}