0

enter image description here

I can't have the title and dates on the same line in the right place just for this, rest of document is ok. I tried adjusting \textwidth in all possible ways and it is still not working

\begin{minipage}{1\textwidth}
\begin{flushleft}
    \textbf{Tianjin Foreign Studies University}, French Language and Literature
\end{flushleft}
\end{minipage}
\begin{minipage}{0.5\textwidth}
\begin{flushright}
  \textbf{Sep 11 - Jul 14} \\%[1.1cm]
\end{flushright}
\end{minipage}


\begin{itemize}[leftmargin=0.5in]
\item \textbf{Obtained 93/100} in the graduation thesis
\end{itemize}
  • 2
    Welcome to TeX.Stackexchange! There is not enough room for a box of linewidth + one of 50% linewidth. Adjust the numbers to be <= 1 in total. – user36296 Nov 15 '17 at 13:56
  • 2
    I'm curious why the minipage. Wouldn't it be simpler to have \textbf{Tianjin Foreign Studies University} etc \hfill \textbf{Sep 11 - Jul 14}? – gusbrs Nov 15 '17 at 14:05
  • you mean the 1 and 0.5? I did before all possible combinations and date still in line below – hec Nov 15 '17 at 14:06
  • 2
    In whatever combination you choose, their sum should not exceed one, as pointed by samcarter. – gusbrs Nov 15 '17 at 14:07
  • 1
    @hec If you would add a minimal working example (MWE) instead of code fragments, it would be easier to help you. – user36296 Nov 15 '17 at 14:10
3

The combined with of the minipages in your example is 150% textwidth, which will not fit on a single line. The result is that you second minipage is moved to the next line.

As soon as the combined with is <= textwidth, they will be placed next to each other. As bonus you can specify that the content of the minipage shall be top aligned using the option [t].

\documentclass{article}

\begin{document}
\noindent\begin{minipage}[t]{.6\textwidth}
\textbf{Tianjin Foreign Studies University}, 

French Language and Literature
\end{minipage}%
\begin{minipage}[t]{.4\textwidth}
\hfill\textbf{Sep 11 - Jul 14}
\end{minipage}

\end{document}

enter image description here

  • 1
    Overfull \hbox (17.22221pt too wide) in paragraph at lines 8--16. (Paragraph indent and space between minipages.) – Torbjørn T. Nov 15 '17 at 14:53
  • @TorbjørnT. very true (I've included your insight in my answer). But the original document seems to have no paragraph indent, and we had no MWE to start with. – gusbrs Nov 15 '17 at 15:05
  • samcarter, I pillaged your MWE, hope you don't mind. – gusbrs Nov 15 '17 at 15:08
  • @gusbrs In return I browned a missing % - guess we are square :) – user36296 Nov 15 '17 at 15:10
  • Thats to TorbjørnT.'s credit though! – gusbrs Nov 15 '17 at 15:11
3

Just complementing samcarter's answer with an alternative for the case mentioned in the comments.

The minipage seems to have been set for a case where the title is long enough not to fit the line along with the right side date. But in cases such as this one, in which that doesn't happen, a simpler alternative with \hfill is available with the same effect.

\documentclass{article}

\begin{document}
\textbf{Tianjin Foreign Studies University} \hfill \textbf{Sep 11 - Jul 14}
\end{document}

enter image description here

The minipage might be needed though, if the title is too long. Provided you take care of indent (probably already done in your document) and the space between the two minipages, you can set them to sum exactly one textwidth, which simplifies things.

\documentclass{article}

\begin{document}
\noindent % <-- if your document doesn't set this globally you should add it, otherwise you will have less than 1 textwidth available
\begin{minipage}[t]{.6\textwidth}
\textbf{Tianjin Foreign Studies University}, French Language and Literature
\end{minipage}% <-- notice the percent sign, so there is no space between minipages, otherwise you will have less than 1 textwidth available
\begin{minipage}[t]{.4\textwidth}
\hfill\textbf{Sep 11 - Jul 14} % here `\hfill` substitutes your `flushright` environment
\end{minipage}
\end{document}

enter image description here

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.