3

For the sake of using captions I'd like to put my graphics into a \begin{figure} ... environment. Doing that a white space is added before and after the picture, table or whatever.

This answer is actually quite clear on how to avoid this.

But setting all lengths affecting float separation to zero has no effect:

\setlength{\textfloatsep}{0pt plus 0pt minus 0pt}
\setlength{\floatsep}{0pt plus 0pt minus 0pt}
\setlength{\intextsep}{0pt plus 0pt minus 0pt}

How can I insert a picture in using

\begin{figure}
\includegraphics ...
...

without any margins?


MWE:

\documentclass{beamer}

\beamersetrightmargin{0.1\paperwidth}
\beamersetleftmargin{0.1\paperwidth}

\setlength{\textfloatsep}{0pt plus 0pt minus 0pt}
\setlength{\floatsep}{0pt plus 0pt minus 0pt}
\setlength{\intextsep}{0pt plus 0pt minus 0pt}

\begin{document}

\begin{columns}

\column{.5\textwidth}
Some text.
\begin{figure}
\framebox[\textwidth][c]{\strut figure one}
\end{figure}
Some text.

\column{.5\textwidth}
Some text.
\framebox[\textwidth][c]{\strut figure two}
Some text.
\end{columns}

\end{document}

enter image description here


6

In beamer figure is not a float. Its definition is

\newenvironment{figure}[1][]{%
  \def\@captype{figure}%
  \par\nobreak\begin{center}\nobreak}
  {\par\nobreak\end{center}}

and the space you get is inserted by the center environment. You can redefine the environment:

\makeatletter
\renewenvironment{figure}[1][]{%
  \def\@captype{figure}%
  \par\centering}
  {\par}
\makeatother
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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