[Tex/LaTex] flushright with hspace

spacing

I want to place my name at the bottom of an article, a few cm-s from the right margin. I thought that this might work, but the \hspace is pretty much ignored, unless I put a space after it, which seems like a total hack. How would this be done a bit more nice?

\documentclass{article}
\begin{document}

\begin{flushright}
{My name \hspace{10cm} }
\end{flushright}

\begin{flushright}
{My name \hspace{10cm}}
\end{flushright}

\begin{flushright}
{My name \hspace{2cm}}
\end{flushright}

\begin{flushright}
{My name }
\end{flushright}

\end{document}

enter image description here

Best Answer

Use the starred version of \hspace.

enter image description here

\documentclass{article}
\begin{document}

\begin{flushright}
{My name \hspace*{10cm} }
\end{flushright}

\begin{flushright}
{My name \hspace*{10cm}}
\end{flushright}

\begin{flushright}
{My name \hspace*{2cm}}
\end{flushright}

\begin{flushright}
{My name }
\end{flushright}

\end{document}
Related Question