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 am trying to squeeze in a lot of book entries (#, title, author) into one page for printing. I am not sure if I am nesting \tabular correctly, but here is what I came up with:

\documentclass[10pt,a4paper]{article}
\usepackage[margin=0.2in]{geometry}

\usepackage{array}
\usepackage{color}
\usepackage[usenames,dvipsnames]{xcolor}

% define command for book entry
\newcommand{\bookentry}[3]{
  \begin{tabular}{cp{1.25in}}
    \textcolor{gray}{\textbf{#1}} &
           {\tiny \textsc{#2}} \newline
           {\tiny \textbf{#3}} 
  \end{tabular}
}

\begin{document}

\begin{tabular}{cc}

  \begin{tabular}{|l|l|} 
    \hline
    \bookentry{1}{Siddhartha}{Herman Hesse} & 
    \bookentry{2}{Old Man And The Sea}{Ernest Hemingway} \\ \hline
    \bookentry{3}{Catch 22}{Joseph Heller} & 
    \bookentry{4}{The Elements of Style}{Strunk \& White} \\ \hline
  \end{tabular} &

  \begin{tabular}{|l|l|}
    \hline
    \bookentry{1}{The Latex Companion}{Mittelbach \& Goossens} & 
    \bookentry{2}{The Elements of Typographic Style}{Robert Bringhurst} \\ \hline
    \bookentry{3}{Feynman Lectures On Computation}{Richard P. Feynman \& Anthony Hey} &
    \bookentry{4}{The TeXbook}{Donald Knuth} \\ \hline
  \end{tabular}

\end{tabular}

\end{document}

Here is the output:

book entries

  1. How can I change the line spacing between the title and author? I think it's using the 10pt spacing, but I am using \tiny for the text.
  2. How can I format the numbers so that they fill the height of the cell, and are centered vertically and horizontally?
share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

One way to do this would be use a \parbox instead for the bookentry:

\newcommand{\bookentry}[3]{%
    \textbf{#1}~\parbox{1.35in}{\tiny\textsc{#2} \\ \textbf{#3}}%
}

which yields:

enter image description here

Another change you should consider is using automatic numbering:

\newcounter{BookCount}
\newcommand{\bookentry}[2]{%
    \stepcounter{BookCount}%
    \textbf{\arabic{BookCount}}~\parbox{1.35in}{\tiny\textsc{#1} \\ \textbf{#2}}%
}

Code: Manual Numbering

\documentclass[10pt,a4paper]{article}
\usepackage[margin=0.2in]{geometry}

\usepackage{array}
\usepackage{color}
\usepackage[usenames,dvipsnames]{xcolor}

% define command for book entry
\newcommand{\bookentry}[3]{%
           \textbf{#1}~\parbox{1.35in}{\tiny\textsc{#2} \\ \textbf{#3}}%
}


\begin{document}

\begin{tabular}{cc}

  \begin{tabular}{|l|l|} 
    \hline
    \bookentry{1}{Siddhartha}{Herman Hesse} & 
    \bookentry{2}{Old Man And The Sea}{Ernest Hemingway} \\ \hline
    \bookentry{3}{Catch 22}{Joseph Heller} & 
    \bookentry{4}{The Elements of Style}{Strunk \& White} \\ \hline
  \end{tabular} &

  \begin{tabular}{|l|l|}
    \hline
    \bookentry{1}{The Latex Companion}{Mittelbach \& Goossens} & 
    \bookentry{2}{The Elements of Typographic Style}{Robert Bringhurst} \\ \hline
    \bookentry{3}{Feynman Lectures On Computation}{Richard P. Feynman \& Anthony Hey} &
    \bookentry{4}{The TeXbook}{Donald Knuth} \\ \hline
  \end{tabular}

\end{tabular}

\end{document}

Code: Automatic Numbering

\documentclass[10pt,a4paper]{article}
\usepackage[margin=0.2in]{geometry}

\usepackage{array}
\usepackage{color}
\usepackage[usenames,dvipsnames]{xcolor}

% define command for book entry
\newcounter{BookCount}
\newcommand{\bookentry}[2]{%
    \stepcounter{BookCount}%
    \textbf{\arabic{BookCount}}~\parbox{1.35in}{\tiny\textsc{#1} \\ \textbf{#2}}%
}


\begin{document}

\begin{tabular}{cc}
  \begin{tabular}{|l|l|} 
    \hline
    \bookentry{Siddhartha}{Herman Hesse} & 
    \bookentry{Old Man And The Sea}{Ernest Hemingway} \\ \hline
    \bookentry{Catch 22}{Joseph Heller} & 
    \bookentry{The Elements of Style}{Strunk \& White} \\ \hline
  \end{tabular} &

  \setcounter{BookCount}{0}%
  \begin{tabular}{|l|l|}
    \hline
    \bookentry{The Latex Companion}{Mittelbach \& Goossens} & 
    \bookentry{The Elements of Typographic Style}{Robert Bringhurst} \\ \hline
    \bookentry{Feynman Lectures On Computation}{Richard P. Feynman \& Anthony Hey} &
    \bookentry{The TeXbook}{Donald Knuth} \\ \hline
  \end{tabular}
\end{tabular}

\end{document}
share|improve this answer
    
Looks nice, thanks! –  M-V Oct 20 '12 at 5:12
    
I need to use manual numbering, as they are different for the 2 main columns, and come from a ranking. But it's nice to see the code as I can learn from it. –  M-V Oct 20 '12 at 5:20
    
Ok. But you could use two different counters, one for each column. Manual numbering is very error prone. –  Peter Grill Oct 20 '12 at 5:22
    
How about using \refstepcounter instead just in case referencing becomes relevant later on? –  azetina Oct 20 '12 at 5:27
    
@azetina: Since the OP wants to manually number them, I will leave it as such. –  Peter Grill Oct 20 '12 at 5:32
add comment

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.