3

I have the following source code to display a information in a specific format:

\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}

I get the error: Underfull \hbox (badness 10000) in paragraph at lines 49--51

EDIT: 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}
  • Unless you provide a complete MWE, what use is it giving us an error referring to line numbers we don't have? – cfr Nov 11 '14 at 19:08
  • @cfr I already provided the line number in comments. I will work on the MWE and post it soon. – Aman Deep Gautam Nov 11 '14 at 19:11
  • @cfr Please see the edit. – Aman Deep Gautam Nov 11 '14 at 19:19
  • You didn't provide the line numbers before i.e. you gave the line numbers themselves but, without an MWE which generates the error, nobody knows which lines those are! But thank you for providing an MWE - that makes things much easier. – cfr Nov 11 '14 at 21:48
2

Don't forget % at ends of lines:

\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}

Note that the immediate cause of the warning (not an error) was the spurious white space, but the definition

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

makes no sense, \raggedleft does not take an argument so \raggedleft{#1} does not set #1 ragged, it sets all the remaining document or current group, in this case the group ends at the & so no harm is done, but nothing is set ragged, an l column is a single line context, like \mbox so paragraph settings like \raggedright have no effect, just use

\begin{tabular*}{\linewidth}{l@{\extracolsep{\fill}}r}
    #1&#2%
  • % space neeed here could you please explain this as well. – Aman Deep Gautam Nov 12 '14 at 7:19
  • @AmanDeepGautam you are relying on a linebreak at a space at that point, if you move that comment forward one character so the % removes the white space as in the other cases you will see the two lines come side by side on a very over-full line – David Carlisle Nov 12 '14 at 8:28

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.