Avoiding floating xxtable in knitr hides table header

I use knitr to create table output. The problem here is that when I try to avoid the float for xtable, the signature does not appear. The option I used to prevent float is floating="F" in print(xtable)

I have the following sample code used for knitr.

 \documentclass[12pt,Arial]{article} \usepackage[sc]{mathpazo} \usepackage[T1]{fontenc} \usepackage[left=0.7in, right=0.8in, bottom=0.6in, top=0.8in]{geometry} \usepackage{float} \begin{document} \section{start} <<comment=NA,results='asis',echo=FALSE>>= library(xtable) jd1 <- structure(c(23.16, 27.14, 31.03, 30.11, 33.03, 38.78, 23.45, 26.96, 30.93, 29.85, 32.53, 35.99, -2.965, -0.1998, 0.08065, 0.2588, 0.5829, 6.042, 0.0001466, 0.1369, 0.3252, 0.629, 0.9057, 6.042), .Dim = c(6L, 4L), .Dimnames = list(c("Min.", "1st Qu.", "Median", "Mean", "3rd Qu.", "Max."), c("observed", "modeled", "obsdmod", "aobsdmod"))) names(jd1)<- c("Observed","Modeled","Observed-Modeled","|Observed-Modeled|") print(xtable(jd1,caption="Summary of table for observed and modeled temperatures at station T1"),type="latex",floating="F") @ \end{document} 
+6
source share
1 answer

Yes, only floats have signatures. If it does not float, you will have to use some other mechanism to document it. Maybe just put the text just before it tells you what it is?

It really is as if you are not asking the question you want to ask. Why don't you want him to swim? If you want it to look like a float, but don't want LaTeX to have any word in the placement, there are better methods.

EDIT: Yeah, I thought so. You can reach \begin{table}[H] with the table.placement option.

 > print(xtable(cbind(1,2)), table.placement="H") % latex table generated in R 2.15.1 by xtable 1.7-0 package % Sat Jul 6 08:06:52 2013 \begin{table}[H] ... 
+11
source

Source: https://habr.com/ru/post/948825/


All Articles