我试图列出三个不同的句子:
\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}
但这给出了
因此我对其进行了修改并\resizebox{\textwidth}{!}
从graphicx
包中使用。
\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}
但这使得第三行的文本比上面两行的文本大得多。
在这种情况下,控制字体大小的最佳做法是什么,以便所有行都具有相同的字体大小并同时适合一行?
答案1
\resizebox
如果只对文档的一小部分使用其他字体缩放比例(使用 获得)或另一种字体大小,看起来会很奇怪。我的建议是将最后一个单元格分成两行,然后让 latex 确定最佳列宽:
\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}
如果您坚持使用单行,则可以在列之间节省一些空间,并使最后一列稍微宽一些(因为我不知道您使用的是哪个文档类等,所以我无法说这是否适合您的文本宽度)
\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}