8

Simple code (new to LaTeX). Receiving these errors:

Underfull \hbox (badness 10000) in paragraph at lines 13--14
Underfull \hbox (badness 10000) in paragraph at lines 15--26
Underfull \hbox (badness 10000) in paragraph at lines 15--26
Underfull \hbox (badness 10000) in paragraph at lines 15--26
Underfull \hbox (badness 10000) in paragraph at lines 27--28

Here is code

\documentclass[11pt]{article}

\usepackage[top=1in, bottom=1in, left=1in, right=1in]{geometry}
\usepackage{verbatim}

\begin{document}

\title{Homework 1}
\author{Joshua Hazel}
\date{\today}
\maketitle

\textbf{2.3 Suppose that the values for a given set of data are grouped into intervals.  The intervals and corresponding frequencies are as follows:} \\ 

\indent
\begin{tabular}
{|l r|} \hline
age & frequency \\ \hline
1-5 & 200 \\
6-15 & 450 \\
16-20 & 300 \\
21-50 & 1500 \\
51-80 & 700 \\
81-110 & 44 \\ \hline
\end{tabular} \\ \\ \\

\textbf{Compute an \textit{approximate median} value for the data.}\\

My answer here.

\end{document}

The line numbers are pointing to the 2 sections where i used \textbf and the other is pointing to the start/end of the tabular.

What is wrong with the code?

ShreevatsaR
  • 45,428
  • 10
  • 117
  • 149
Kairan
  • 183
  • 7
    Welcome to TeX.sx! Don't use \\ for "leaving an empty line" – egreg Apr 14 '13 at 20:43
  • 6
    delete the \\ at the ends of your paragraphs. They just cause an empty spurious "underfull" line and a warning message. – David Carlisle Apr 14 '13 at 20:43
  • Since you have the same margin all the way around, you can use \usepackage[margin=1in]{geometry}. – Svend Tveskæg Apr 14 '13 at 20:48
  • @egreg Thanks that works - what is the appropriate method to add some extra spacing before and after the table so it doesnt look odd? – Kairan Apr 14 '13 at 21:03
  • @DavidCarlisle Thanks that works - what is the appropriate method to add some extra spacing before and after the table so it doesnt look odd? – Kairan Apr 14 '13 at 21:04
  • @SvendTveskæg Thank you that is good information! – Kairan Apr 14 '13 at 21:04
  • 3
    @Kairan -- if you really must have extra vertical spacing, then \vspace{<dimen>} is the proper way to add it. This should only be added after a paragraph break or an environment that places latex in vertical mode when it ends. – barbara beeton Apr 14 '13 at 21:33

1 Answers1

9

You should try to avoid explicit spacing within the document, markup the document structure and then globally arrange that the structural elements make the right layout.

Something like this might be closer (and produces no warnings)

enter image description here

\documentclass[11pt]{article}

\usepackage[margin=1in]{geometry}
\usepackage{verbatim}
\usepackage{parskip}
\setlength\parskip{\baselineskip}
\setlength\parindent{0pt}

\begin{document}

\title{Homework 1}
\author{Joshua Hazel}
\date{\today}
\maketitle
\setcounter{section}{2}
\setcounter{subsection}{2}

\subsection{Suppose that the values for a given set of data are grouped into intervals.  The intervals and corresponding frequencies are as follows:}


\begin{tabular}
{|l r|} \hline
age & frequency \\ \hline
1-5 & 200 \\
6-15 & 450 \\
16-20 & 300 \\
21-50 & 1500 \\
51-80 & 700 \\
81-110 & 44 \\ \hline
\end{tabular}

\textbf{Compute an \textit{approximate median} value for the data.}

My answer here.

\end{document}
David Carlisle
  • 757,742