]> git.donarmstrong.com Git - xtable.git/blob - pkg/inst/doc/margintable.Rnw
Implemented request #2168 for the inclusion of margintable as a floating environment...
[xtable.git] / pkg / inst / doc / margintable.Rnw
1 %\VignetteIndexEntry{xtable margintable}\r
2 %\VignetteKeywords{LaTeX, HTML, table, margintable}\r
3 \r
4 \r
5 \documentclass{tufte-handout}\r
6 \r
7 \r
8 \title{\r
9 A Margin Table Example\r
10 }\r
11 \author{David J. Scott}\r
12 \r
13 \usepackage{Sweave}\r
14 \SweaveOpts{prefix.string=figdir/fig,debug=TRUE,eps=FALSE,echo=TRUE}\r
15 \usepackage{rotating}\r
16 \usepackage{longtable}\r
17 \usepackage{booktabs}\r
18 \usepackage{tabularx}\r
19 \usepackage{hyperref}\r
20 \usepackage{fancyvrb}\r
21 \fvset{fontsize=\normalsize}\r
22 \r
23 \begin{document}\r
24 \r
25 \section{The Example}\r
26 \label{sec:example}\r
27 \r
28 This document uses the Tufte handout \LaTeX\ document style. This is\r
29 specified by the use of the document class as\r
30 \Verb|\documentclass{tufte-handout}|.\r
31 \r
32 The Tufte-\LaTeX\ document classes define a style similar to the\r
33 style Edward Tufte uses in his books and handouts.  Tufte's style is known\r
34 for its extensive use of sidenotes, tight integration of graphics with\r
35 text, and well-set typography.\r
36 \r
37 One of the most prominent and distinctive features of this style is the\r
38 extensive use of sidenotes.  There is a wide margin to provide ample room\r
39 for sidenotes and small figures.  Any \Verb|\footnote|s will automatically\r
40 be converted to sidenotes.\r
41 \r
42 Here is an example of a margin table, suggested by Felix Sch\"onbrodt\r
43 \Verb|<nicebread@gmx.net>|. I am not sure about its usefullness in\r
44 practice however. Note that \Verb|latex.environments = ""| avoids the\r
45 default option of tables being centered, which in this example would\r
46 lead to the caption not being directly under the table. Most\r
47 importantly, \Verb|table.placement = NULL| is required to ensure that\r
48 the default table placement options \Verb|[ht]| being inserted after\r
49 \Verb|\begin{margintable}|. This is necessary because the margintable\r
50   environment does not allow placement options like \Verb|[ht]|.\r
51 \r
52 <<>>=\r
53 library(xtable)\r
54 x <- matrix(rnorm(6), ncol = 2)\r
55 x.small <- xtable(x, label = 'tabsmall', caption = 'A margin table')\r
56 @\r
57 \r
58 <<results=tex>>=\r
59 print(x.small,floating.environment='margintable',\r
60       latex.environments = "",\r
61       table.placement = NULL)\r
62 @\r
63 \r
64 \end{document}\r