Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

latex : tables : backslash like separators : is it possible?

759 views
Skip to first unread message

Neil Zanella

unread,
Jan 19, 1999, 3:00:00 AM1/19/99
to

Is there a proper way to have LaTeX draw a backslash-like separator as in the

"x \ y" part of the following table?

x \ y | 0 | 1 | 2
-----------------
0 | 0 | 1 | 2
-----------------
1 | 1 | 2 | 0
-----------------
2 | 2 | 0 | 1

Thanks,

Neil Zanella
nzan...@cs.mun.ca

Neil Zanella

unread,
Jan 19, 1999, 3:00:00 AM1/19/99
to

> > Is there a proper way to have LaTeX draw a backslash-like separator as in the
> >
> > "x \ y" part of the following table?
>
> \( x \backslash y \)

Ok, you can do it that way, but it doesn't look very good at all when you
use it in a table like this:

\begin{tabular}{c|c|c|c}
\( x \backslash y \) & 0 & 1 & 2 \\ \hline
0 & 0 & 1 & 2 \\ \hline
1 & 1 & 2 & 0 \\ \hline
2 & 2 & 0 & 1
\end{tabular}

Is there anything better than the \backslash command that can be used

here? I want the backslash to originate at the intersection of the leftmost

vertical line with the uppermost horizontal line in the table.

I would be surprised if there were no way of doing this.

Thanks,

Neil Zanella
nzan...@cs.mun.ca

Christophe Broult

unread,
Jan 20, 1999, 3:00:00 AM1/20/99
to
Neil Zanella <nzan...@cs.mun.ca> writes:

> > > Is there a proper way to have LaTeX draw a backslash-like
> separator as in the
> > >
> > > "x \ y" part of the following table?
> >
> > \( x \backslash y \)
>

[...]

> Ok, you can do it that way, but it doesn't look very good at all when you
> use it in a table like this:
>
> \begin{tabular}{c|c|c|c}
> \( x \backslash y \) & 0 & 1 & 2 \\ \hline
> 0 & 0 & 1 & 2 \\ \hline
> 1 & 1 & 2 & 0 \\ \hline
> 2 & 2 & 0 & 1
> \end{tabular}
>
> Is there anything better than the \backslash command that can be used

[...]
You may try the slashbox package. Here's an excerpt from CTAN/help/Catalogue:

@TeXIndex{slashbox,
texlive = {latex3},
abstract = {Draw an oblique (slash) line in a `tabular' column in
\LaTeX.},
author = {Toru Sato},
email = {ts...@kuee.kyoto-u.ac.jp},
ctan = {macros/latex/contrib/other/slashbox/},
modified = {20 Feb 1998 14:26:38 Graham....@cmis.csiro.au}
}

--
Looking for a cutting edge | Christophe Broult
software validation technology? | <mailto:bro...@info.unicaen.fr>
Check http://www.info.unicaen.fr/lpv | ``Smile, chuckle, giggle''

Neil Zanella

unread,
Jan 22, 1999, 3:00:00 AM1/22/99
to

On 20 Jan 1999, Christophe Broult wrote:

> You may try the slashbox package.

[...]

Thanks for pointing that out.
I tried it with an example similar to the one below.
It seems that for tables involving mathematics the
\backslashbox{x}{y} command consumes too much horizontal
space. If you saw the dvi output for the file below then
I think you'd agree. I can fit 3 or 4 other columns into the first one!

I wish there was a better version of this package that did
not consume column space like this one.

I guess that's all that can be done.

Thanks again.

Neil Zanella
nzan...@ganymede.cs.mun.ca

\documentclass{article}
\usepackage{slashbox}
\begin{document}

\begin{tabular}{*{9}{c|}}
\backslashbox{x}{y} & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 \\ \hline
0 & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 \\ \hline
1 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 0 \\ \hline
2 & 2 & 3 & 4 & 5 & 6 & 7 & 0 & 1 \\ \hline
3 & 3 & 4 & 5 & 6 & 7 & 0 & 1 & 2 \\ \hline
4 & 3 & 5 & 6 & 7 & 0 & 1 & 2 & 3 \\ \hline
5 & 3 & 6 & 7 & 0 & 1 & 2 & 3 & 4 \\ \hline
6 & 3 & 7 & 0 & 1 & 2 & 3 & 4 & 5 \\ \hline
7 & 3 & 0 & 1 & 2 & 3 & 4 & 5 & 6 \\ \hline
\end{tabular}

\end{document}

> [...]
>
> > Ok, you can do it that way, but $x\backslash y$ doesn't look very

> > good at all when you use it in a table like this:
> >
> > \begin{tabular}{c|c|c|c}
> > \( x \backslash y \) & 0 & 1 & 2 \\ \hline
> > 0 & 0 & 1 & 2 \\ \hline
> > 1 & 1 & 2 & 0 \\ \hline
> > 2 & 2 & 0 & 1
> > \end{tabular}
> >

> [...]


0 new messages