# Align left and right same line

I have this problem:

Basically on the second line "Matricola: XXXXXX" isn't right aligned.

My latex is:

\begin{minipage}[t]{7cm}
\textsc{Relator}

Prof. NameName\\
\end{minipage}
\hfill
\begin{minipage}[t]{7cm}
\hfill \textsc{Candidato}

\hfill Name Name\\
\hfill Matricola: XXXXX
\end{minipage}


is there any way to fix this?

Don't use \hfill for the alignment, use \flushleft and \flushright:

\begin{minipage}[t]{7cm}
\flushleft
\textsc{Relator}

Prof. NameName\\
\end{minipage}
\hfill
\begin{minipage}[t]{7cm}
\flushright
\textsc{Candidato}

Name Name\\
Matricola: XXXXX
\end{minipage}


A \hfill that occurs at the start of a line will be ignored. To avoid this, use \null\hfill in place of \hfill.

• None of the suggestions I found were working until I saw this and tried using the \null before the \hfill. Thanks a lot! – Guillaume Belanger Apr 20 '16 at 13:26
• \null\hfill somehow didn't work for me. However, \hglue0.00001pt\hfill did – Thomas Rebele Apr 28 '18 at 17:08