15

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?

19

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}
18

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
  • 1
    \null\hfill somehow didn't work for me. However, \hglue0.00001pt\hfill did – Thomas Rebele Apr 28 '18 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.