summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-slashbox.html
blob: f67b8bc3c20b696f25b35d437eb092d3c2e6a026 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<head>
<title>UK TeX FAQ -- question label slashbox</title>
</head><body>
<h3>Diagonal separation in corner cells of tables</h3>
<!-- tabular -->
<p/>You want to label both the top or bottom row and the left- or
rightmost column, somewhere at the corner of the table where the row
and column meet.  A simple way to achieve the result is to construct
the table with an arrangement of rules (and possibly <code>\</code><code>multicolumn</code>
entries), to look like:
<blockquote>
<pre>
-----------------
x  y
   --------------
   1  2  3  4  5
-----------------
1
2
3
4
5
-----------------
</pre>
</blockquote><p>
However, this doesn&#8217;t satisfy everyone: many want the labelling in a
single cell at the top left of the table.  It sounds a simple enough
requirement, yet it calls for some slightly tricky LaTeX coding.
The <i>slashbox</i> package does the job for you: it defines
commands <code>\</code><code>slashbox</code> and <code>\</code><code>backslashbox</code>, each taking the two
labels as arguments.  It draws a picture with the two labels on either
side of a slanting line; the command (and hence the picture) may be
placed in the corner cell, where the labelled row and column meet.
<p/>The package isn&#8217;t the world&#8217;s neatest: it uses LaTeX
<code>picture</code> mode to draw its line, and picture mode has many
tedious restrictions (and doesn&#8217;t, in all honesty, produce
particularly good pictures).  Load slashbox with the <i>pict2e</i>
package, and at least the picture quality will be improved.
<p/>Documentation of <i>slashbox</i> is less than satisfactory: a
LaTeX source file of rather startling starkness accompanies the
package file in the distribution, and the distribution includes that
file processed to a PDF file for reading over the net, if
necessary.  (The third example in the file shows the effect of
<code>picture</code> mode&#8217;s restrictions: the dividing line doesn&#8217;t
go from corner to corner in the box: to correct this requires revision
of <i>slashbox</i> &#8212; <i>pict2e</i> alone doesn&#8217;t help in this
regard.)
<dl>
<dt><tt><i>pict2e.sty</i></tt><dd><a href="http://mirror.ctan.org/macros/latex/contrib/pict2e.zip">macros/latex/contrib/pict2e</a> (or <a href="http://mirror.ctan.org/macros/latex/contrib/pict2e/">browse the directory</a>); <a href="http://mirror.ctan.org/help/Catalogue/entries/pict2e.html">catalogue entry</a>
<dt><tt><i>slashbox.sty</i></tt><dd><a href="http://mirror.ctan.org/macros/latex/contrib/slashbox.zip">macros/latex/contrib/slashbox</a> (or <a href="http://mirror.ctan.org/macros/latex/contrib/slashbox/">browse the directory</a>); <a href="http://mirror.ctan.org/help/Catalogue/entries/slashbox.html">catalogue entry</a>
</dl>
<p><em>This answer last edited: 2010-11-02</em></p>
<p/><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=slashbox">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=slashbox</a>
</body>