Balanced columns in table 

Newsgroups:  comp.text.tex
Date:        Mon, 29 Mar 2004 16:46:46 GMT
> I am trying to find a package that can arrange my text in a table
> the same way ls (in Unix) arrange its output. I.e., arrange them
> horizontally or vertically in the given columns.
>
> For example, to arrange the following text in a two-column horizontally,
>
> i001
> i002
> i003
> i004
> i005
> i006
> i007
> i008
> i009
>
> The package can automatically produce output like:
>
> i001 i002
> i003 i004
> i005 i006
> i007 i008
> i009
>
> And the vertically output is something similar to:
>
> i001 i006
> i002 i007
> i003 i008
> i004 i009
> i005
>
> Does such thing exist?

The \autorows and \autocols commands in the memoir class do this.

Peter Wilson

latex: Automate columnizing words in table? 

Newsgroups: comp.text.tex
Date: 2001-08-19 22:48:55 PST

http://groups.google.com/groups?hl=en&selm=9lq8b4%24hdt%241%40slb1.atl.mindspring.net

>I need to include in a paper long lists of sorted words which came out
>of a database. I have to build hundreds of lists (tables?) where each
>one has from a few hundred to a couple of thousand words.
>
>What I want is to get in the output would be some lists (which might
>possibly be tables) where the words are packed into the available
>width depending upon the length of the individual word's length.  This
>would be like the unix "ls" command output, where each column has the
>words going in order down the page and the position of each next
>column is determined by the length of the longest word in past column.
>
>I have been searching the teTeX docs and do not see anything
>applicable yet. I read on how to use two columns but that still leaves
>most of the pages mostly blank/un-used.

It finally happened. There's an actual use for \valign.

An example of a twenty row table of the chemical elements is:

\scrollmode
\def\element#1{\hbox{\strut #1\quad}&}
\valign{#&#&#&#&#&#&#&#&#&#&#&#&#&#&#&#&#&#&#&#\cr
\element{Hydrogen}
\element{Helium}
...
\element{Uranium}
\crcr}\end

TeX will complain every twenty rows but will go to the next column anyway.

Protecting fragile contents 

Newsgroups: comp.text.tex
>I want to define a command to wrap the listing package:
>
>...
>
>\newcommand{\flisting}[4]{
>\begin{lstlisting}[caption={[#1]#1#2} #3]{}
>#4
>\end{lstlisting}
>}
>
>\flisting{Training dataset } { \citep{mitchell:1997:MLbook}}
>{,frame=tb,  basicstyle=\ttfamily,  labelstep=2, label=lst:knn:tds2}{
>   672346       NY     25   Low
>   008301       NY     27   High
>   563482       CA     30   Average
>   127893       CA     60   Average
>   389245       NY     67   Low
>   240389       CA     90   Low
>}

I did not check the listing package, but I am rather sure that it changes some catcodes to reckognize the spaces and newlines (and probably also some other catcodes are changed). With your above macro the last argument is scanned have the `usual' (wrong) catcode.

To say it in other words: It is *in principle* not possible to pass your table as a parameter to the listing package (unless you change catcodes before `by hand' which I would not recommend).

the table is read. For example, you might try (untested!):

\newcommand{\flisting}[3]{\begin{lstlisting}[caption={[#1]#1#2} #3]{}}

which must be called in the strange way:

\flisting{...}{...}{...}
  your table
\end{lstlisting}

As a less `clean' but more intuitive alternative, you could also try

\newenvironment{flisting}[3]{\begin{lstlisting}[caption={[#1]#1#2} #3]{}}%
 {\end{lstlisting}}

which may be called in the more intuitive way

\begin{flisting}{...}{...}{...}
  your table
\end{flisting}

However, whether the latter works depends on the implementation of the listing package (it might be the case that the listing package looks for

(Martin Vaeth)

Verbatim in table 

Newsgroups: comp.text.tex
> Can somebody show me how to use Verbatim inside table?

Your problem is not verbatim in a table, but verbatim in the argument to a command, which is forbidden (see the manual).

> This is the command that I created for floating-table:
>
> % Command \ftable{content}{caption}

You must instead define an environment.

But I don't see that it saves you much typing.

Donald Arseneau