Two-column flushed-right aligned-left text with linebreak

alignmenthorizontal alignmentline-breaking

I want my text in title (executor and supervisor fields) to be flushed right and aligned left. Also I need to have line breaks in it. For now, I've made it using flushright, tabular and parbox

\documentclass{article}
\begin{document}    
\begin{flushright}
\begin{tabular}{ll}
    executor:     & \textit{\parbox[l]{6cm}{\vspace*{1em} Name  \\ some text} }\vspace{0.5em} \\
    supervisor :  & \textit{Name}       \\
\end{tabular}
\end{flushright}
\end{document}

so it looks like this now:
so it looks like this now

But maybe there is more elegant solution.

Best Answer

You can use a \parbox or better as Dan showed a p column, however this requires you to fix a width of the box so if the text is shorter, the resulting block will not look flush right. In some contexts that is OK, but if you want the block flush to the right margin with its longest line, then it is easier not to use a parbox, as in the second example here.

enter image description here

\documentclass{article}
\begin{document}

\noindent X\dotfill filler text\dotfill X

\begin{flushright}
\begin{tabular}{lp{6cm}}
executor:    & \textit{Name\newline Some text}\\
supervisor : & \textit{Name}\\
\end{tabular}
\end{flushright}

\noindent X\dotfill filler text\dotfill X

\begin{flushright}
\begin{tabular}{ll@{}}
executor:    & \textit{Name}\\
             & \textit{Some text}\\
supervisor : & \textit{Name}\\
\end{tabular}
\end{flushright}

\noindent X\dotfill filler text\dotfill X
\end{document}