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 have a table with many rows, but only a single column. The column itself is a coefficient for an algorithm, hence just a number.

Currently, when typeset with the longtable package it looks somewhat suboptimal. I wish to typeset it so that the table appears to have two columns with semantics similar to a two-column document layout (text goes top to bottom, left column to right column).

While I could try to emulate the effect manually (by having a two columned table) this would require an immense amount of manual adjustment every time the pagination is changed.

Is there a way of going about this?

Update I've attached an example of what I mean (the image is taken from an old scientific paper). The data itself spans two pages (only the first of which is shown).

Sample

share|improve this question
    
If the two-column table could fit on a page an easy way to do it is by nesting two tabular environments within another one. If you post an image of what you want to achieve it would be easier to get an answer. –  Yiannis Lazarides Dec 24 '10 at 15:58
add comment

2 Answers

up vote 2 down vote accepted

use the tabbing environment instead of a longtable. It can be set in a \twocolumnmode. The first line is killed after defining the tabstops. However, if you can set all lines in \ttfamily, then you need nothing, all will be fine. Alternatively put the first "C(..) = " in a box of a fixed width. The it is also formatted, because all digits are of the same width.

\documentclass[11pt]{article} 
\usepackage[utf8]{inputenc} 
\textheight=5cm
\def\Z{\phantom{0}}
\begin{document}
\twocolumn

\small\ttfamily
\begin{tabbing}
   C(10) \== \=5.0000000000000-001 \\\kill   
   C(\Z1) \>=\> 0.0000000000000+000 \\
   C(\Z2) \>=\> 5.0000000000000-001 \\     
   C(\Z3) \>=\> 0.0000000000000+000 \\
   C(\Z4) \>=\> 5.0000000000000-001 \\
   C(\Z5) \>=\> 0.0000000000000+000 \\
   C(\Z6) \>=\> 5.0000000000000-001 \\     
   C(\Z7) \>=\> 0.0000000000000+000 \\
   C(\Z8) \>=\> 5.0000000000000-001 \\
   C(\Z9)  \>=\> 0.0000000000000+000 \\
   C(10) \>=\> 5.0000000000000-001 \\  
   C(11) \>=\> 0.0000000000000+000 \\
   C(12) \>=\> 5.0000000000000-001 \\
   C(13) \>=\> 0.0000000000000+000 \\
   C(14) \>=\> 5.0000000000000-001 \\     
   C(15) \>=\> 0.0000000000000+000 \\
   C(16) \>=\> 5.0000000000000-001 \\ 
   C(17) \>=\> 5.0000000000000-001 \\   
   C(18) \>=\> 5.0000000000000-001 \\
   C(19) \>=\> 5.0000000000000-001 \\
   C(20) \>=\> 5.0000000000000-001 \\
\end{tabbing}
\end{document}
share|improve this answer
add comment

This is a solution utilizing nested tabular environments.

\documentclass[11pt]{article} 
\usepackage[utf8]{inputenc} 
\usepackage{xspace}
%% tables
\RequirePackage{array}
\RequirePackage{booktabs}
\RequirePackage{longtable, graphicx}
\usepackage{amsmath}[2000/07/18]
\gdef\Z{\phantom{0}}
\begin{document}
\small
\begin{tabular}{|l|c|}
\begin{tabular}[t]{rlr}
   C(\Z1) & = & 0.0000000000000+000 \\
   C(\Z2) & = & 5.0000000000000-001 \\     
   C(\Z3) & = & 0.0000000000000+000 \\
   C(\Z4) & = & 5.0000000000000-001 \\
   C(\Z5) & = & 0.0000000000000+000 \\
   C(\Z6) & = & 5.0000000000000-001 \\     
   C(\Z7) & = & 0.0000000000000+000 \\
   C(\Z8) & = & 5.0000000000000-001 \\
   C(\Z9)  & = & 0.0000000000000+000 \\
   C(10) & = & 5.0000000000000-001 \\  

\end{tabular}&
\begin{tabular}[t]{rlll}

   C(11) & = & 0.0000000000000+000 \\
   C(12) & = & 5.0000000000000-001 \\
   C(13) & = & 0.0000000000000+000 \\
   C(14) & = & 5.0000000000000-001 \\     
   C(15) & = & 0.0000000000000+000 \\
   C(16) & = & 5.0000000000000-001 \\ 
   C(17) & = & 5.0000000000000-001 \\   
   C(18) & = & 5.0000000000000-001 \\
   C(19) & = & 5.0000000000000-001 \\
   C(20) & = & 5.0000000000000-001 \\
\end{tabular}
\end{tabular}
\end{document}

If you generating the coefficients programmatically you will need to device some means for paging. You can also improve on the code above which I kept as simple as possible for clarity by using formatting commands to align the decimal and the sign of the numbers. I have used a macro \Z that uses \phantom to align the numbers in C( 1) with C(10).

share|improve this answer
    
I'm not convinced it is an improvement over manual emulation using a single tabular with additional columns; pagination is still the main issue. –  Freddie Witherden Dec 24 '10 at 20:50
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.