無法擺脫未滿的 \hboxs

無法擺脫未滿的 \hboxs

我一直在努力消除\hbox履歷中的一堆不完整的警告。我正在處理的一個最小示例如下:

\documentclass{article}
\usepackage{calc}
\setlength{\parindent}{0pt}

\newcommand\Job[3]{{\bf #1}, #2\\ #3}

\newcommand\LongestDate{\widthof{7777 (Spring)}}
\newcommand\DatedItem[2]{
    \begin{tabular*}{\linewidth}[t]{@{\hspace{0.25in}}p{\LongestDate}@{\hspace{0.125in}}p{\linewidth - \LongestDate - 0.375in}@{}}
            #1 & {\raggedright #2}
    \end{tabular*}}

\begin{document}

\DatedItem{2013--}{\Job{Rice University}{Houston, TX}{Associate Professor}}

\end{document}

我已經嘗試\hfill在不同的地方插入 's (就像在所有 之前\\),並且還添加了一堆\raggedright's。但似乎沒有什麼可以消除這些警告。我應該指出,所有內容都按照我想要的方式排版 - 我只是希望它能夠在沒有警告的情況下進行編譯!

答案1

我使用\parnot \\(通常),使用\textbfnot \bf(不應該在乳膠中使用)並\par在範圍內添加缺失\raggedright(否則它什麼也不做)和 use tabularnot tabular*tabular*什麼都不做,除非你在列之間添加拉伸膠水)。

\documentclass{article}
\usepackage{calc}
\setlength{\parindent}{0pt}

\newcommand\Job[3]{\textbf{#1}, #2\par #3}

\newcommand\LongestDate{\widthof{7777 (Spring)}}
\newcommand\DatedItem[2]{%
    \begin{tabular}[t]{@{\hspace{0.25in}}p{\LongestDate}@{\hspace{0.125in}}p{\linewidth - \LongestDate - 0.375in}@{}}
            #1 & {\raggedright #2\par}
    \end{tabular}}

\begin{document}

\DatedItem{2013--}{\Job{Rice University}{Houston, TX}{Associate Professor}}

\end{document}

答案2

也許您可以考慮這個更簡單的選擇。enumitem如果您願意,可以使用該包自訂清單的外觀。

\documentclass{article}

\newcommand{\Job}[3]{%
    \textbf{#1}, #2\newline #3%
}

\begin{document}

\begin{itemize}
\item[2013--] \Job{Rice University}{Houston, TX}{Associate Professor}
\item[2000--2012] \Job{Harvard University}{Boston, MA}{Assistant Professor}
\end{itemize}

\end{document}

在此輸入影像描述

相關內容