[Tex/LaTex] Floating figures and tikzposter

floatspositioningposterstikzposter

I'm trying to use the class tikzposter to write a scientific poster. I need to link the figures to my text, therefore I need to use \caption and \label commands. It seems impossible to use floating figures inside blocks (maybe they are also floating objects?). It is possible to avoid this problem (still use the caption command, without using a floating figure)?

Thank you very much for any help.

PS: This is the code that reproduce my problem.

\documentclass[25pt, a0paper, portrait, margin=0mm, innermargin=15mm,
     blockverticalspace=15mm, colspace=15mm, subcolspace=8mm]{tikzposter}

 \title{Title}
 \author{Name}
 \institute{University}

\usetheme{Default} % Default, Basic, Rays, Simple, Envelope, Wave, Board, Autumn, Desert
\usecolorstyle[colorPalette=BrownBlueOrange]{Germany}

\usepackage[version=3]{mhchem}

\usepackage{graphicx}

\begin{document}

\maketitle

\begin{columns}
    \column{.5}
    \block[roundedcorners=40]{Fist block}{
    Some text: bla, bla, bla.
    \begin{figure}
    \includegraphics{MyImage.pdf}
    \caption{}\label{}
    \end{figure}
    }

 \end{columns}

 \end{document}

Best Answer

You can load the capt-of or caption package, remove the figure environment (or replace it with e.g. center) and use \captionof{figure}{<caption text>}.

\documentclass[25pt, a0paper, portrait, margin=0mm, innermargin=15mm,
     blockverticalspace=15mm, colspace=15mm, subcolspace=8mm]{tikzposter}

 \title{Title}
 \author{Name}
 \institute{University}

\usetheme{Default} % Default, Basic, Rays, Simple, Envelope, Wave, Board, Autumn, Desert
\usecolorstyle[colorPalette=BrownBlueOrange]{Germany}

\usepackage[version=3]{mhchem}

\usepackage{graphicx}
\usepackage{capt-of}
\begin{document}

\maketitle

\begin{columns}
    \column{.5}
    \block[roundedcorners=40]{First block}{
    Some text: bla, bla, bla. See figure~\ref{fig:fog}.
    \begin{center}
    \includegraphics{example-image}
    \captionof{figure}{Figure caption.}\label{fig:fog}
    \end{center}
    }

 \end{columns}

 \end{document}

enter image description here