From: dscott Date: Thu, 16 Aug 2012 13:54:26 +0000 (+0000) Subject: Added test file for margintable floating environment X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=840dfb78cd2fdfe5f4bc59de0ecf595288d2651b;p=xtable.git Added test file for margintable floating environment git-svn-id: svn://scm.r-forge.r-project.org/svnroot/xtable@37 edb9625f-4e0d-4859-8d74-9fd3b1da38cb --- diff --git a/pkg/tests/test.margintable.R b/pkg/tests/test.margintable.R new file mode 100644 index 0000000..8311558 --- /dev/null +++ b/pkg/tests/test.margintable.R @@ -0,0 +1,47 @@ +### Test of feature request #2168 implementation +### Enables use of margintable floating environment +### DJS, 17/08/2012 +library(xtable) +x <- matrix(rnorm(6), ncol = 2) +x.small <- xtable(x, label='tabsmall', caption = 'A margin table') +print(x.small, floating.environment = 'margintable', + table.environments = "", + table.placement = NULL) +## % latex table generated in R 2.15.0 by xtable 1.7-1 package +## % Fri Aug 17 01:42:42 2012 +## \begin{margintable} +## \centering +## \begin{tabular}{rrr} +## \hline +## & 1 & 2 \\ +## \hline +## 1 & 1.42 & -1.11 \\ +## 2 & -0.57 & 0.23 \\ +## 3 & -0.67 & -0.60 \\ +## \hline +## \end{tabular} +## \caption{A margin table} +## \label{tabsmall} +## \end{margintable} +print(x.small, floating.environment = 'margintable', + table.environments = "") +## % latex table generated in R 2.15.0 by xtable 1.7-1 package +## % Fri Aug 17 01:42:46 2012 +## \begin{margintable} +## \centering +## \begin{tabular}{rrr} +## \hline +## & 1 & 2 \\ +## \hline +## 1 & 1.42 & -1.11 \\ +## 2 & -0.57 & 0.23 \\ +## 3 & -0.67 & -0.60 \\ +## \hline +## \end{tabular} +## \caption{A margin table} +## \label{tabsmall} +## \end{margintable} +## Warning message: +## In print.xtable(x.small, floating.environment = "margintable", table.environments = "") : +## margintable does not allow for table placement; setting table.placement to NULL + diff --git a/pkg/tests/test.xtable.R b/pkg/tests/test.xtable.R index d39e328..6f62cab 100644 --- a/pkg/tests/test.xtable.R +++ b/pkg/tests/test.xtable.R @@ -1,3 +1,6 @@ +### Test of implementation of request #2104 +### Use of \centering rather that center environment when centering tables +### DJS, 16/8/2012 require(xtable) ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)