0

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.

1

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

  • Sorry, I realized that but that was a typo that I made while adding that part in so I know that the \usepackage commands weren't causing the issue. I have edited the mistake I typed. But following the suggested use of \usepackage{mwe}, it still does not seem to provide my figure – PutsandCalls Mar 3 '16 at 6:04
  • The mwe package is useful for minimal examples (such as provide these dummy pictures) and doesn't do anything more, so that won't be fixing the issue. Are you sure that LaTeX is finding the picture? The log file will have something like LaTeX Error: File '<filename>' not found. if it can't find it. – JP-Ellis Mar 3 '16 at 6:07
  • Ah yes, I have found out the problem now. Thank you for your help. – PutsandCalls Mar 3 '16 at 6:12

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.