[Tex/LaTex] Alternative of \resizebox{\textwidth}{!} for homogenously fixing font size for multiple lines

fontsfontsizegraphicsline-breakingmicrotype

I am trying to list three different sentences:

 \begin{tabular}{@{}p{0.4in}p{0.3in}p{4in}}
     Fall &2015 &Teaching Assistant, Machine Learning (Andrew Ng)\\
     Winter &2016 &Teaching Assistant, Cryptography (Dan Boneh)\\
     Winter &2017&Teaching Assistant, 
     Probabilistic Graphical Model (Stefano Ermon)\\
\end{tabular}

But this gives

enter image description here

So I changed it and used \resizebox{\textwidth}{!} from graphicx package.

    \begin{tabular}{@{}p{0.4in}p{0.3in}p{4in}}
       Fall &2015 &Teaching Assistant, Machine Learning (Andrew Ng)\\
       Winter &2016 &Teaching Assistant, Cryptography (Dan Boneh)\\
       Winter &2017&\resizebox{\textwidth}{!}{Teaching Assistant, 
       Probabilistic Graphical Model (Stefano Ermon)}\\
\end{tabular}

But this makes text of third line much larger compared to above two.

enter image description here

What's the best practice to control font size in this kind of situation so that all the lines have same font size at the same time fit on one line?

Best Answer

Using another scaling of the font (which you get using \resizebox) or another fontsize for only a small portion of a document will look really strange. My suggestion instead is split the last cell in two lines and let latex determine the optimal columns widths:

\documentclass{article}

\usepackage{tabularx}

\begin{document}

\begin{tabularx}{\linewidth}{@{}llX@{}}
     Fall &2015 &Teaching Assistant, Machine Learning (Andrew Ng)\\
     Winter &2016 &Teaching Assistant, Cryptography (Dan Boneh)\\
     Winter &2017&Teaching Assistant, 
     Probabilistic Graphical Model\newline (Stefano Ermon)\\
\end{tabularx}

\end{document}

enter image description here


If you insist on a single line, you could save a btit of space beteween the columns and make the last one a bit wider (as I don't know which documentclass etc. you are using I cannot say if this will fit in your textwidth or not)

\setlength{\tabcolsep}{3pt}
\begin{tabular}{@{}llp{4.03in}@{}}
     Fall &2015 &Teaching Assistant, Machine Learning (Andrew Ng)\\
     Winter &2016 &Teaching Assistant, Cryptography (Dan Boneh)\\
     Winter &2017&Teaching Assistant, 
     Probabilistic Graphical Model (Stefano Ermon)\\
\end{tabular}

enter image description here