[Tex/LaTex] 2 columns with graphics but picture not appearing

beamergraphicstwo-column

I am having trouble with the following code whereby it compiles okay but the problem is that the the picture is not showing up in a slide of two columns. So the code is as follows where I have tried using the figure and the centering suggested in this post: Creating two columns in beamer, but both are producing the same result.

\documentclass{beamer}

\usepackage{pgfpages}
\usepackage{stmaryrd}
\usepackage{multicol}
\usepackage[english]{babel}
\usepackage{units}
\usepackage{tikz}
\newcommand{\pic}[2] {\begin{center}\includegraphics[height = #1]{#2}\end{center}}
\newcommand{\cip}[2] {\begin{center}\includegraphics[width = #1]{#2}\end{center}}
\usepackage{bmpsize}
\usepackage{multicol}
\begin{document}
\begin{frame}{Example}    
\begin{columns} 
    \begin{column}{0.5\textwidth}    
    some text here some text here some text here some text here some text here 
    \end{column} 
    \begin{column}{0.5\textwidth}       
        \begin{figure}[p]
            \caption{a}
            \includegraphics[width=0.5\textwidth]{test} %This is my picture
        \end{figure}
    \end{column} 
    \end{columns} 
\end{frame}
\end{document}

and the second one that I have tried is:

\documentclass{beamer}

\usepackage{pgfpages}
\usepackage{stmaryrd}
\usepackage{multicol}
\usepackage[english]{babel}
\usepackage{units}
\usepackage{tikz}
\newcommand{\pic}[2] {\begin{center}\includegraphics[height = #1]{#2}\end{center}}
\newcommand{\cip}[2] {\begin{center}\includegraphics[width = #1]{#2}\end{center}}
\usepackage{bmpsize}
\usepackage{multicol}
\begin{document}
\begin{frame}{Example}    
\begin{columns} 
    \begin{column}{0.5\textwidth}    
    some text here some text here some text here some text here some text here 
    \end{column} 
    \begin{column}{0.5\textwidth}       
        \begin{center}

            \includegraphics[width=0.5\textwidth]{test} %This is my picture
        \end{center}
    \end{column} 
    \end{columns} 
\end{frame}
\end{document}

Would someone please help me take a look at where the bug is ? I know that it is not the picture's problem so it must be somewhere within my code. A screen shot of the output slide looks as follows (where there is just a blank area below and above the caption).

enter image description here

Thank you.

Best Answer

If you have a look at the .log file produced, it will tell where where errors are happening. Admittedly, it can look a bit daunting the first you look in that file but have a go and it'll slowly start making sense. The error are usually near the end of the file.

In particular, you'll see that it is warning you that \usepackage cannot be used here. This is because the \usepackage commands need to go in the preamble--that is, the area after \documentclass but before \begin{document}.

Here's your example adapted (note that I removed package which weren't being explicitly used):

\documentclass{beamer}
\usepackage[english]{babel}
\usepackage{mwe}

\begin{document}
\begin{frame}{Example}    
  \begin{columns} 
    \begin{column}{0.5\textwidth}    
      Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
      vestibulum ut, placerat ac, adipiscing vitae, felis.  Curabitur dictum
      gravida mauris.  Nam arcu libero, nonummy eget, consectetuer id, vulputate
      a, magna. Donec vehicula augue eu neque.
    \end{column} 

    \begin{column}{0.5\textwidth}       
        \begin{figure}[p]
            \includegraphics[width=0.9\textwidth]{example-image-a} %This is my picture
            \caption{a}
        \end{figure}
    \end{column} 
  \end{columns} 
\end{frame}
\end{document}

output