Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want my document to be a really long (multiple page) list if definitions. I want to do it in a table format. Here is what I have at the moment:

\documentclass{article}

\usepackage{fancyhdr}
\usepackage{array}
\usepackage{tabularx}
\usepackage{pbox}
\pagestyle{fancyplain}

\title{Definitions \\ \large{G484 - Newtonian World}}
\author{Todd Davies}
\date{\today}

\begin{document}

\rhead{Definitions}
\lhead{\today}

\maketitle

\thispagestyle{empty}

\begin{tabularx}{\textwidth}{>{\bf\centering\arraybackslash}m{1in} | X}
  \large{Name} & \large{\textbf{Definition}}\\ \hline
  Newton's first law & An object will remain at rest or keep 
    travelling at a constant velocity unless it is acted upon by an external 
    force.\\ \hline
  Newton's second law & The net force acting on an object is equal
    to the rate of change of it's momentum. The net force and change in momentum
    are in the same direction.\\ \hline
  Newton's third law & When two bodies interact, the forces they
    exert on each other are equal and opposite.\\ \hline
  Linear momentum & The product of an object's mass and velocity
    ($p=mv$). Momentum is a vector quantity.\\ \hline
  Net force on a body & Is said to be equal to the rate of change
    of the momentum of the body (Impulse).\\ \hline
  Impulse of a force & The product of the force ($F$) and the time ($\Delta t$)
    for which it acts ($impulse = F \Delta t$).\newline \newline This is the
    area under a force time graph.\newline \newline Impulse = change in momentum
    ($impulse = \Delta p$)\\ \hline
  Principle of conservation of momentum & In a closed system, when bodies
    interact, the total momentum in any specified direction remains constant.\\
    \hline
  Perfectly elastic collision & A collision is perfectly elastic
    when kinetic energy is conserved. Momentum and total energy are always
    conserved.\\ \hline
  Inelastic collision & A collision is inelastic when the kinetic
    energy is not conserved, and some is transferred to other forms such as
    heat. Momentum and total energy are always conserved.\\ \hline
  Radian & $\pi$ radians = $180^\circ$\\ \hline
  Gravitational field strength & The gravitational force 
    experienced by an object per unit mass ($g = \frac{F}{m}$).\\ \hline
  Newton's law of gravitation & Any two point masses attract each other with a force that is directly proportional to the square of their masses and inversely proportional to the square of their seperation\\ \hline
\end{tabularx}

\end{document}

This is the output: enter image description here

I have two problems:

  1. I want the table to span multiple pages. This doesn't seem to be happening
  2. Notice the top padding on cells in the right column when the corresponding cell on the left runs onto multiple lines. How do I get rid of this?

I suspect that I'm doing the whole thing wrong, and am open to a new suggestion of how I achieve my desired layout or just fixes for these two problems.

Many thanks!

share|improve this question
    
for table spanning multiple pages use longtable or longtabu –  mythealias Jan 12 '13 at 21:58
    
But then I can't use the features of tabularx can I? The new lines in the right hand column for example. Could you provide an example answer? –  Todd Davies Jan 12 '13 at 21:59
    
The "padding" is due to a missing \noindent before \begin{tabularx}, which LaTeX considers just as a "big letter", so it starts a paragraph. By contrast, longtable hasn't this problem. –  egreg Jan 12 '13 at 22:27

2 Answers 2

up vote 4 down vote accepted

Using longtable and calc package.

enter image description here

\documentclass{article}

\usepackage{fancyhdr}
\usepackage{array}
\usepackage{longtable}
\usepackage{calc}
\pagestyle{fancyplain}

\title{Definitions \\ \large{G484 - Newtonian World}}
\author{Todd Davies}
\date{\today}

\begin{document}

\rhead{Definitions}
\lhead{\today}

\maketitle

\thispagestyle{empty}

\begin{longtable}{>{\bf\centering\arraybackslash}p{1in} | p{\textwidth-4\tabcolsep-1in}}
  \large{Name} & \large{\textbf{Definition}}\\ \hline
  Newton's first law & An object will remain at rest or keep 
    travelling at a constant velocity unless it is acted upon by an external 
    force.\\ \hline
  Newton's second law & The net force acting on an object is equal
    to the rate of change of it's momentum. The net force and change in momentum
    are in the same direction.\\ \hline
  Newton's third law & When two bodies interact, the forces they
    exert on each other are equal and opposite.\\ \hline
  Linear momentum & The product of an object's mass and velocity
    ($p=mv$). Momentum is a vector quantity.\\ \hline
  Net force on a body & Is said to be equal to the rate of change
    of the momentum of the body (Impulse).\\ \hline
  Impulse of a force & The product of the force ($F$) and the time ($\Delta t$)
    for which it acts ($impulse = F \Delta t$).\newline \newline This is the
    area under a force time graph.\newline \newline Impulse = change in momentum
    ($impulse = \Delta p$)\\ \hline
  Principle of conservation of momentum & In a closed system, when bodies
    interact, the total momentum in any specified direction remains constant.\\
    \hline
  Perfectly elastic collision & A collision is perfectly elastic
    when kinetic energy is conserved. Momentum and total energy are always
    conserved.\\ \hline
  Inelastic collision & A collision is inelastic when the kinetic
    energy is not conserved, and some is transferred to other forms such as
    heat. Momentum and total energy are always conserved.\\ \hline
  Radian & $\pi$ radians = $180^\circ$\\ \hline
  Gravitational field strength & The gravitational force 
    experienced by an object per unit mass ($g = \frac{F}{m}$).\\ \hline
  Newton's law of gravitation & Any two point masses attract each other with a force that is directly proportional to the square of their masses and inversely proportional to the square of their seperation\\ \hline
\end{longtable}

\end{document}

With some improvements using booktabs package to replace hline by midrule.

enter image description here

\documentclass{article}

\usepackage{fancyhdr}
\usepackage{array}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage{calc}
\pagestyle{fancyplain}

\title{Definitions \\ \large{G484 - Newtonian World}}
\author{Todd Davies}
\date{\today}

\begin{document}

\rhead{Definitions}
\lhead{\today}

\maketitle

\thispagestyle{empty}

\begin{longtable}{>{\bf\centering\arraybackslash}p{1in} p{\textwidth-4\tabcolsep-1in}}

\large{Name} & \large{\textbf{Definition}}\\ \midrule
\endfirsthead
\large{Name} & \large{\textbf{Definition}}\\ \midrule
\endhead
\bottomrule
\multicolumn{2}{r}{continued \ldots}
\endfoot
\bottomrule
\endlastfoot

  Newton's first law & An object will remain at rest or keep 
    travelling at a constant velocity unless it is acted upon by an external 
    force.\\ \midrule
  Newton's second law & The net force acting on an object is equal
    to the rate of change of it's momentum. The net force and change in momentum
    are in the same direction.\\ \midrule
  Newton's third law & When two bodies interact, the forces they
    exert on each other are equal and opposite.\\ \midrule
  Linear momentum & The product of an object's mass and velocity
    ($p=mv$). Momentum is a vector quantity.\\ \midrule
  Net force on a body & Is said to be equal to the rate of change
    of the momentum of the body (Impulse).\\ \midrule
  Impulse of a force & The product of the force ($F$) and the time ($\Delta t$)
    for which it acts ($impulse = F \Delta t$).\newline \newline This is the
    area under a force time graph.\newline \newline Impulse = change in momentum
    ($impulse = \Delta p$)\\ \midrule
  Principle of conservation of momentum & In a closed system, when bodies
    interact, the total momentum in any specified direction remains constant.\\
    \midrule
  Perfectly elastic collision & A collision is perfectly elastic
    when kinetic energy is conserved. Momentum and total energy are always
    conserved.\\ \midrule
  Inelastic collision & A collision is inelastic when the kinetic
    energy is not conserved, and some is transferred to other forms such as
    heat. Momentum and total energy are always conserved.\\ \midrule
  Radian & $\pi$ radians = $180^\circ$\\ %\midrule
  Gravitational field strength & The gravitational force 
    experienced by an object per unit mass ($g = \frac{F}{m}$).\\ \midrule
  Newton's law of gravitation & Any two point masses attract each other with a force that is directly proportional to the square of their masses and inversely proportional to the square of their seperation\\
\end{longtable}

\end{document}
share|improve this answer
    
I used the second one in the end, that is very helpful, thankyou! –  Todd Davies Jan 13 '13 at 7:41
    
When trying this with \begin{tabular}{|c|c} the \midrule breaks the vertical lines. How can I make them continuos again? –  Crowley Dec 5 at 10:08

I think that the other answer gives you what you were originally intending.

However, for your task I would be tempted to use a simple itemize environment instead, and use the enumitem to help with the formatting.

screenshot

I have used

\begin{itemize}[font=\bfseries,align=parleft,labelwidth=3cm]

in the MWE below, but you could use

\setlist[itemize]{font=\bfseries,align=parleft,labelwidth=3cm}

in your preamble and then simply

\begin{itemize}

in your document- the choice is yours.

\documentclass{article}
\usepackage{enumitem}
\usepackage{fancyhdr}

\title{Definitions \\ \large{G484 - Newtonian World}}
\author{Todd Davies}
\date{\today}

\begin{document}

\rhead{Definitions}
\lhead{\today}

\maketitle

\thispagestyle{empty}

\begin{itemize}[font=\bfseries,align=parleft,labelwidth=3cm]
    \item[Name] {\bfseries Definition}
    \item[Newton's first law] An object will remain at rest or keep 
    travelling at a constant velocity unless it is acted upon by an external 
    force.
    \item[Newton's second law] The net force acting on an object is equal
    to the rate of change of it's momentum. The net force and change in momentum
    are in the same direction.
    \item[Newton's third law] When two bodies interact, the forces they
    exert on each other are equal and opposite.
    \item[Linear momentum]  The product of an object's mass and velocity
    ($p=mv$). Momentum is a vector quantity.
    \item[Net force on a body] Is said to be equal to the rate of change
    of the momentum of the body (Impulse).
    \item[Impulse of a force] The product of the force ($F$) and the time ($\Delta t$)
    for which it acts ($impulse = F \Delta t$).

    This is the area under a force time graph.

    Impulse = change in momentum
    ($impulse = \Delta p$)
    \item[Principle of conservation of momentum] In a closed system, when bodies
    interact, the total momentum in any specified direction remains constant.
    \item[Perfectly elastic collision] A collision is perfectly elastic
    when kinetic energy is conserved. Momentum and total energy are always
    conserved.
    \item[Inelastic collision] A collision is inelastic when the kinetic
    energy is not conserved, and some is transferred to other forms such as
    heat. Momentum and total energy are always conserved.
    \item[Radian] $\pi$ radians = $180^\circ$
    \item[Gravitational field strength] The gravitational force 
    experienced by an object per unit mass ($g = \frac{F}{m}$).
    \item[Newton's law of gravitation] Any two point masses attract each other with a 
    force that is directly proportional to the square of their masses and 
    inversely proportional to the square of their seperation.
\end{itemize}

\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.