Couldn't make a table float work inside the preview environment:
\documentclass[fontsize=16pt]{scrartcl}
\usepackage[active,tightpage]{preview}
\setlength{\PreviewBorder}{25pt}
\begin{document}
\begin{preview}
\begin{table}
\centering
\begin{tabular}{c|c}
a & b\\
\hline
c & d\\
\end{tabular}
\caption{testing}
\label{tab:testing}
\end{table}
\end{preview}
\end{document}
gives error "Not in outer par mode". The manual of preview mentions a "floats" option, but adding it makes no difference. I know that making a table "float" don't make much sense in a single preview page, I just want them to become non-float and stay in the place where it's defined and show up in the preview.
And then I found this question. It says that standalone package would work. But I couldn't get it to work either:
\documentclass{standalone}
\begin{document}
\begin{table}
\centering
\begin{tabular}{c|c}
a & b\\
\hline
c & d\\
\end{tabular}
\caption{testing}
\label{tab:testing}
\end{table}
\end{document}
gives error "Something's wrong--perhaps a missing \item". And even if it works, it raises a serious problem, that is, it occupies the documentclass but I must use KOMA-Script. By the way, I use xelatex, don't know if it matters.
Any ideas?
Edit: I think I have mentioned in the post that I know what a "float" means and that it does not make "much" sense. But it does make some sense: I use preview for, literally, preview. So every element in the document should show up in the preview so I can "preview" it. And for a table float the proper way of show up is to become a non-float and stay at where it's defined. This is exactly what this post says standalone is supposed to do. Then after the preview, if I comment out the preview package or make it inactive, every thing should work in the normal way again (table floats float normally, etc). So I'm not asking for a method of making a table float sticky, but how to make it show up in preview/standalone environment.
Solution:The solution turns out to be
\documentclass[preview,class=scrartcl,fontsize=20pt]{standalone}
This will automatically turn table floats into non-float while retaining the original document class. Also see Jesse's answer for a clever but a little more sophisticated solution.


floatpackage and make\begin{table}[H]or don't use table. To have captions usecapt-ofpackage with it\captionofmacr. – Apr 17 '14 at 07:16