18

I have this problem:

enter image description here

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?

2 Answers 2

23

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}
0
24

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.