I use LaTeX for creating PDF output from R - not to create long documents. Hence the automatic Table 1: <caption> above the table is rather annoying. How can I remove the automatically generated Table 1:? Is it at all possible?

-

## migrated from stackoverflow.comJan 26 '12 at 2:29

This question came from our site for professional and enthusiast programmers.

Maybe you could include some more information on how you generate your document? Do you use the xtable package, or Sweave, or do you export the data from R into a CSV file that you then import into LaTeX? – Jake Jan 26 '12 at 3:05

Use the caption package with the labelformat=empty option:

\documentclass[10pt,letterpaper]{article}

\usepackage[labelformat=empty]{caption}

\begin{document}

\begin{table}
\centering
\begin{tabular}{lll}
1 & 2 & 3 \\
a & b & c
\end{tabular}
\caption{Some super-secret data.}
\end{table}

\end{document}

-

This will do the trick, as sometimes the caption package does not cooperate:

\makeatletter
%You may (un-)comment this line to improve the looks.
\renewcommand{\@seccntformat}[1]{{\csname the#1\endcsname}.\hspace{0.5em}}

%Here is the crucial part:
\long\def\@maketblcaption#1#2{
}
\renewcommand{\table}{\let\@makecaption\@maketblcaption\@float{table}}
\makeatother

-

In the standard document class (article, book and report), \@makecaption actually prints the float caption based on two arguments: The first is the float type (\@captype) and the second is the actual caption. If the removal of the float-specific addition is general (that is, for table, figure and others), then a redefinition of \@makecaption would suffice:

\documentclass{article}
\makeatletter
% Taken from http://mirrors.ctan.org/macros/latex/unpacked/article.cls
\long\def\@makecaption#1#2{%
\vskip\abovecaptionskip
\sbox\@tempboxa{#2}% \sbox{\@tempboxa{#1: #2}
\ifdim \wd\@tempboxa >\hsize
#2\par% #1: #2\par
\else
\global \@minipagefalse
\hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
\fi
\vskip\belowcaptionskip}
\makeatother
\begin{document}

\begin{table}
\centering
\begin{tabular}{lll}
1 & 2 & 3 \\
a & b & c
\end{tabular}
\caption{Some super-secret data.}
\end{table}

\end{document}


In the above redefinition, the first argument #1 is still read, but not used, and therefore removed from the caption.

-