Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am using my figures and tables both in report documents, where I want them to have caption text, an in presentations made with Beamer, where I want them to not have a caption text. I am using the Caption package (2011/08/11) both for my report and presentations.

Is there a simple way to turn off the caption text when I use the figures and tables in my presentations?

share|improve this question
    
Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. It is considered a lot better to put in some code that will compile, as it makes it a lot easier for us to copy it into our text editor and work with it, and see exactly what it is you are trying to do. –  Stephan Lehmke Nov 28 '12 at 10:54
2  
How about \DeclareCaptionFormat{empty}{}\captionsetup{format=empty}? –  cgnieder Nov 28 '12 at 10:55
    
Thanks:) but when I put that string in the preamble I get this: ! Undefined control sequence. l.21 \DeclareCaptionFormat {empty}{}\captionsetup{format=empty} –  Espen Donali Nov 28 '12 at 11:03
2  
They are provided by the caption package (which you said you're using) so you need to put it after \usepackage{caption} –  cgnieder Nov 28 '12 at 11:07
    
It works fine !! (I forgot to put the \DeclareCaptionFormat string AFTER the \usepackage{caption} command . –  Espen Donali Nov 28 '12 at 11:12

2 Answers 2

Since you're using the caption package already you can use its possibilites to define own caption formats to define one that outputs nothing by saying

\DeclareCaptionFormat{empty}{}

You can now use this format by setting it with \captionsetup:

\captionsetup{format=empty}

A complete example:

\documentclass{beamer}
\usepackage{caption}
\DeclareCaptionFormat{empty}{}
\captionsetup{format=empty}
\begin{document} 

\begin{frame}
\begin{figure}
 some figure
 \caption{some caption}
\end{figure}
\end{frame}

\end{document}

As noted by Axel Sommerfeldt in the comments it is probably a good idea also to set the skip above and below the caption to zero. Otherwise you might wonder where the vertical space below the figure comes from... For this just extend the caption setup:

\captionsetup{format=empty,aboveskip=0pt,belowskip=0pt}
share|improve this answer
1  
I would set the skips above and below the caption to 0pt additionally, i.e. \captionsetup{format=empty,aboveskip=0pt,belowskip=0pt} –  Axel Sommerfeldt Nov 29 '12 at 9:10
    
@Axel Good point! –  cgnieder Nov 29 '12 at 9:24
    
If the same document is producing the article and beamer versions you might want to put the caption formatting commands inside \mode<presentation>{...}. –  Loop Space Nov 29 '12 at 10:07
    
@Andrew true, but I thought that wouldn't be too hard to figure out if one already is using one document for both :) –  cgnieder Nov 29 '12 at 10:24

(For reference, without any package.) Put this into your preamble:

\makeatletter
\def\@gobblebracket[#1]{}
\def\caption{\@ifnextchar[{\expandafter\@gobble\@gobblebracket}\@gobble}
\makeatother

or even simpler (credit to Andrew):

\renewcommand \caption [2][]{}
share|improve this answer
2  
\renewcommand{\caption}[2][]{} –  Loop Space Nov 29 '12 at 10:06
    
@AndrewStacey Damn those LaTeXy smarties! –  yo' Nov 29 '12 at 10:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.