I have seen some similar posts, but none of the suggested solutions worked in my case, so I need to post the question.
The problem seems simple, but somehow I mess it up. I have a minipage on my front cover and within this minipage I have two titles of parts of my thesis, followed by the advisor. The advisor should be aligned right and if the title does not exceed one line, then the advisor should be put in the next line (and flushed right). For long titles this works, but not for short ones.
I have first tried \\ \hfill
, and although this did not produce vertical space (as expected), it also did not flush the advisor to the right. I then tried flushright (see MWE), but this produces the vertical space seen in the output.
How do I flush the advisor to the right if the line is empty, without producing additional vertical white space?
MWE:
\documentclass{book}
\begin{document}
\begin{minipage}[t]{1\textwidth}
{Part \textrm{I}: This is a very very very very very very very very very very very long title name \hfill Advisor: First Name \textsc{Second Name}}\vspace{0.5\baselineskip}
{Part \textrm{II}: This is a very very very long title name}\\%
{\begingroup\setlength\topsep{0pt}
\begin{flushright}
Advisor: First Name \textsc{Second Name}
\end{flushright}
\endgroup}
\end{minipage}
\end{document}
Current output:
Desired output:
Any help is very appreciated!