* Changed implementation of centering of tables. Instead of
inserting a centred environment, now a \centering command is
inserted. Response to request #2104.
+ * Implemented request #2168 which allows for margin tables as
+ possible with document class tufte-handout. An example of usage is
+ found in the vignette produced by margintable.Rnw which is in
+ inst/doc.
1.7-0
* Added some vectorization code to improve performance.
stop("\"type\" must be in {\"latex\", \"html\"}")\r
}\r
if (!all(!is.na(match(floating.environment,\r
- c("table","table*","sidewaystable"))))) {\r
- stop("\"type\" must be in {\"table\", \"table*\", \"sidewaystable\"}")\r
+ c("table","table*","sidewaystable",\r
+ "margintable"))))) {\r
+ stop("\"type\" must be in {\"table\", \"table*\", \"sidewaystable\", \"margintable\"}")\r
+ }\r
+ if ((match(floating.environment,\r
+ c("table","table*","sidewaystable","margintable"))\r
+ == "margintable") & (!is.null(table.placement))) {\r
+ warning("margintable does not allow for table placement; setting table.placement to NULL")\r
+ table.placement <- NULL\r
}\r
if (!is.null(table.placement) &&\r
!all(!is.na(match(unlist(strsplit(table.placement, split = "")),\r
--- /dev/null
+%\VignetteIndexEntry{xtable margintable}\r
+%\VignetteKeywords{LaTeX, HTML, table, margintable}\r
+\r
+\r
+\documentclass{tufte-handout}\r
+\r
+\r
+\title{\r
+A Margin Table Example\r
+}\r
+\author{David J. Scott}\r
+\r
+\usepackage{Sweave}\r
+\SweaveOpts{prefix.string=figdir/fig,debug=TRUE,eps=FALSE,echo=TRUE}\r
+\usepackage{rotating}\r
+\usepackage{longtable}\r
+\usepackage{booktabs}\r
+\usepackage{tabularx}\r
+\usepackage{hyperref}\r
+\usepackage{fancyvrb}\r
+\fvset{fontsize=\normalsize}\r
+\r
+\begin{document}\r
+\r
+\section{The Example}\r
+\label{sec:example}\r
+\r
+This document uses the Tufte handout \LaTeX\ document style. This is\r
+specified by the use of the document class as\r
+\Verb|\documentclass{tufte-handout}|.\r
+\r
+The Tufte-\LaTeX\ document classes define a style similar to the\r
+style Edward Tufte uses in his books and handouts. Tufte's style is known\r
+for its extensive use of sidenotes, tight integration of graphics with\r
+text, and well-set typography.\r
+\r
+One of the most prominent and distinctive features of this style is the\r
+extensive use of sidenotes. There is a wide margin to provide ample room\r
+for sidenotes and small figures. Any \Verb|\footnote|s will automatically\r
+be converted to sidenotes.\r
+\r
+Here is an example of a margin table, suggested by Felix Sch\"onbrodt\r
+\Verb|<nicebread@gmx.net>|. I am not sure about its usefullness in\r
+practice however. Note that \Verb|latex.environments = ""| avoids the\r
+default option of tables being centered, which in this example would\r
+lead to the caption not being directly under the table. Most\r
+importantly, \Verb|table.placement = NULL| is required to ensure that\r
+the default table placement options \Verb|[ht]| being inserted after\r
+\Verb|\begin{margintable}|. This is necessary because the margintable\r
+ environment does not allow placement options like \Verb|[ht]|.\r
+\r
+<<>>=\r
+library(xtable)\r
+x <- matrix(rnorm(6), ncol = 2)\r
+x.small <- xtable(x, label = 'tabsmall', caption = 'A margin table')\r
+@\r
+\r
+<<results=tex>>=\r
+print(x.small,floating.environment='margintable',\r
+ latex.environments = "",\r
+ table.placement = NULL)\r
+@\r
+\r
+\end{document}\r