段落错误导致 \hbox 未满(不良率 10000)

段落错误导致 \hbox 未满(不良率 10000)

我有以下源代码来以特定格式显示信息:

\newcommand{\headerrow}[2] {
    \begin{tabular*}{\linewidth}{l@{\extracolsep{\fill}}r}
        #1 & #2
    \end{tabular*}
}

\newcommand{\projectinfobullet}[4] 
{
    \item
    \headerrow{\textbf{#1}}{\textbf{#2}}
    \headerrow{\emph{#3}}{\emph{#4}}
}
\begin{itemize}
    \parskip=0.1em
    \projectinfobullet{A}{B}{C}{D}  %49
    \begin{itemize*}
        \item XXX   %51
        \item YYY
         \item ZZZ
    \end{itemize*}
\end{itemize}

我收到错误: Underfull \hbox (badness 10000) in paragraph at lines 49--51

編輯:MWE

\documentclass[10pt,letterpaper]{article}
\usepackage[letterpaper,margin=0.75in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\usepackage{mdwlist}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
%\usepackage{tgpagella}
\pagestyle{empty}
\setlength{\tabcolsep}{0em}

% format two pieces of text, one left aligned and one right aligned
\newcommand{\headerrow}[2]
{
    \begin{tabular*}{\linewidth}{l@{\extracolsep{\fill}}r}
        \raggedleft{#1} & \raggedright{#2}
    \end{tabular*}
}

\newcommand{\projectinfobullet}[4] 
{
    \item
    \headerrow{\textbf{#1}}{\textbf{#2}}
    \headerrow{\emph{#3}}{\emph{#4}}
}


\begin{document}

%TODO Get Customized date format done for your resume.

\hrule
\vspace{-0.4em}
\subsection*{RR}

\begin{itemize}
    \parskip=0.1em

    \projectinfobullet{A}{H}{S}{A}
    \begin{itemize*}
        \item XXX
        \item YYY
        \item AUU
    \end{itemize*}

\end{itemize}
\subsection*{Education}

\end{document}

答案1

不要忘记%行尾:

\documentclass[10pt,letterpaper]{article}
\usepackage[letterpaper,margin=0.75in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\usepackage{mdwlist}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
%\usepackage{tgpagella}
\pagestyle{empty}
\setlength{\tabcolsep}{0em}

% format two pieces of text, one left aligned and one right aligned
\newcommand{\headerrow}[2]
{%
    \begin{tabular*}{\linewidth}{l@{\extracolsep{\fill}}r}
        \raggedleft{#1} & \raggedright{#2}
    \end{tabular*}%
}

\newcommand{\projectinfobullet}[4] 
{%
    \item
    \headerrow{\textbf{#1}}{\textbf{#2}} % space neeed here
    \headerrow{\emph{#3}}{\emph{#4}}%
}


\begin{document}

%TODO Get Customized date format done for your resume.

\hrule
\vspace{-0.4em}
\subsection*{RR}

\begin{itemize}
    \parskip=0.1em

    \projectinfobullet{A}{H}{S}{A}
    \begin{itemize*}
        \item XXX
        \item YYY
        \item AUU
    \end{itemize*}

\end{itemize}
\subsection*{Education}

\end{document}

请注意,警告(而不是错误)的直接原因是虚假的空白,但定义

\begin{tabular*}{\linewidth}{l@{\extracolsep{\fill}}r}
    \raggedleft{#1} & \raggedright{#2}

没有意义,\raggedleft不接受参数所以不\raggedleft{#1}设置#1不整齐,它设置所有剩余的文档或当前组,在这种情况下,组结束于&所以没有造成伤害,但没有设置不整齐,一l列是单行上下文,就像\mbox段落设置一样\raggedright没有效果,只需使用

\begin{tabular*}{\linewidth}{l@{\extracolsep{\fill}}r}
    #1&#2%

相关内容