3

I have a document with TikZ figure are included like this:

\begin{figure}[ht!]
    \centering
    \begin{tikzpicture}
        \draw (-1, 1) -- (1,1);
    \end{tikzpicture}
\end{figure}

When I copy this code from the document to a beamerpresentation and compile it, the size of the picture seems to be adapted to fill the entire slide.

How can I change this such that the figure in the presentation looks the same as in my document?

Karlo
  • 3,257
  • Hm, this should not happen, image is only 2cm wide ... By the way, float environments hasn't sense in beamer. Try to include your image in \begin{center} ... <your image > ... \end{center} – Zarko Oct 07 '15 at 22:33
  • 1
    Please provide a complete document and a screenshot of the undesired behaviour. – Gonzalo Medina Oct 07 '15 at 23:38
  • 2
    @Zarko Why do you say floating environments have no sense in beamer? beamer internally suppresses flotation, so one can use figure and table safely with no flotation, just in case one wants a \caption (I know it's weird to have captions in presentations but it happens). What doesn't have any effect is using float positioning specifiers (such as [ht!]) since, as I mentioned, beamer suppresses flotation for figure and table. – Gonzalo Medina Oct 07 '15 at 23:52
  • @GonzaloMedina, as you say, beamer supres floating. So, why than use them?To be honest, I use them in cases when I add captions (usulay without of caption text) to them (as you give an example). This depends on intention of presentation. – Zarko Oct 07 '15 at 23:59
  • 1
    @Zarko For example, some people use the beamerarticle package to turn the presentation into an article; having figure and table with \caption in the beamer code then simplifies the work when passing to article mode. – Gonzalo Medina Oct 08 '15 at 00:01
  • @GonzaloMedina, I agree. I newer use beamerarticle, my problem have been oposite: how to make presentation from article or book :-) – Zarko Oct 08 '15 at 00:17

2 Answers2

1

This is not realy answer, I just like to show, that your problem with provided code for image, cannot happen:

enter image description here

For above image I use the following MWE:

\documentclass{beamer}
    \usepackage{tikz}

    \begin{document}
\begin{frame}{Illustration of phenomena}
\begin{figure}
    \centering
    \begin{tikzpicture}
        \draw (-1, 1) -- (1,1);
    \end{tikzpicture}
\end{figure}

or
\begin{center}
    \begin{tikzpicture}
        \draw[thick,double, red] (-3, 1) -- (3,1);
    \end{tikzpicture}
\end{center}
\end{frame}
    \end{document}

Normal beamer slide size is 128 mm x 96mm, so any image, smaller from this length (minus margins and heights of slide header and footer) should fit on the slide.

Zarko
  • 296,517
0

I was confused and I just included a tikzpicture that is bigger then my slide size. The solution is to rescale the tikzpicture. More information can be found here.

Karlo
  • 3,257
  • your answer more belong to comment than answer. With deleting your question you will delete received answer too. Better idea seems to be copied your answer into comment, delete answer and accept received answer (which indicate solution for your problem). However, decision is in your hand. – Zarko Oct 08 '15 at 11:31