[texhax] Simple line numbering for tabular environments

James Smith sf at aleph-one.com
Wed Jul 18 21:58:20 CEST 2007


Hey all,

I have tried to create an enviroment for my more abstract code listings,
the ones that require assertions and maths bits. Here is what I have so
far:

\begin{tabular*}{\linewidth}
{l>{$}l<{$}>{$}l<{$}}
\hline\\
1&\mathsf{process\_file}(*f:file)\{\\
2&\quad l:string\\
3&\quad l=\mathsf{read\_line}(f)\\
4&\quad\mathsf{while}(l\neq\epsilon))\{\\
5&\quad\quad l=\mathsf{read\_line}(f)\\
6&\quad\}\\
7&\}\\
\\
\hline
\end{tabular*}

I'm almost happy with this. I need the maths environment, for a start,
so I can't use any packages that offer line numbering but take away the
maths formatting. I have found, however, that constantly renumbering the
lines when I change the listings becomes tiresome, so can I automate
this process. I'd like to keep the tabular* environment if at all
possible. I've had a look at the lineno package, amognst others, but
find them daunting. Can anyone get me started? I don't need to wrap
these environments over more than one page or anything like that.

Kind regards,

James

No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.476 / Virus Database: 269.10.8/906 - Release Date:
17/07/2007 18:30
 



More information about the texhax mailing list