2

I tried following code to place a picture on the left side of a beamer slide.


\documentclass{beamer}

\usetheme[numbering=none]{metropolis}

\begin{document}
\begin{frame}[plain]
    \begin{columns}
    \begin{column}{0.5\textwidth}
            \includegraphics[width=\textwidth, height=\textheight]{test1.png} 
    \end{column}
    \begin{column}{0.5\textwidth}
        \begin{itemize}
            \item Item asdf
            \item Item 2
            \item Item 3
        \end{itemize}
    \end{column}
    \end{columns}
\end{frame}
\end{document}

the pdf file compiled with above code look like this: enter image description here

There are some spaces around the column(or the picture, I'm not sure), how can I make the picture occupy all the left half page of the slide that there has no left/right/top/bottom spaces between picture and slide border? (picture can be scaled without respecting the original aspect ratio)

What I tried to achieve is something like below: enter image description here

PS: I edited the post to include a complete minimal example and a diagram to illustrate what I wanted. thank you for all the commenting.

2
  • \textwidth is always less than \paperwidth. plain doesn't change that. You roughly have two choices: lie to LaTeX or change the width of the text block. But you might also want to just put it as a background image. To give concrete suggestions, we'd need a complete minimal example we can compile. (You can use images from the mwe package so everyone has them.)
    – cfr
    Commented Oct 13, 2023 at 4:08
  • @fad99daf, please try for your code right from the start here: a) to start with \documentclass, b) to end with \end{document}, c) to include what's needed and to omit what's irrelevant, d) i.e. compiles when copied AND shows your problem. // By doing so you: a) make life easier for all of us, b) get better answers faster. // Thank you
    – MS-SPO
    Commented Oct 13, 2023 at 7:10

2 Answers 2

1

You could use tikz to position your image relative to the page:

\documentclass{beamer}

\usepackage{tikz}

\usetheme{moloch}% modern fork of the metropolis theme

\begin{document}
\begin{frame}[plain]
    \begin{columns}
    \begin{column}{0.5\textwidth}
        \begin{tikzpicture}[remember picture,overlay,inner sep=0pt]
          \node[anchor=north west] at (current page.north west) {\includegraphics[width=.5\paperwidth, height=\paperheight]{example-image-duck}};
        \end{tikzpicture}    
    \end{column}
    \begin{column}{0.5\textwidth}
        \begin{itemize}
            \item Item asdf
            \item Item 2
            \item Item 3
        \end{itemize}
    \end{column}
    \end{columns}
\end{frame}
\end{document}

enter image description here

2
5

mwe

Keep it simple. If you make a box to adjust the column content to the text dimensions (not the column dimensions) where there is an image of unknown size, so the result could be ...anything. Just set the image dimensions.

\documentclass{beamer}
\begin{document}
\begin{frame}[plain]
    \begin{columns}
    \begin{column}{0.5\textwidth}
            \includegraphics[width=\textwidth, height=\textheight]{example-image-9x16} 
    \end{column}
    \begin{column}{0.5\textwidth}
        \begin{itemize}
            \item Item asdf
            \item Item 2
            \item Item 3
        \end{itemize}
    \end{column}
    \end{columns}
\end{frame}
\end{document}

Edit

For the comment, if you want the image take the half of the slide without considering margins, you should make the image relative to the page size and take into account also the left margin to remove it or discount it with a negative horizontal space. For the whole presentation, you can remove the left margin in the preamble:

\setbeamersize{text margin left=0cm}

But for a single slide you can simply make the columns relative to the page size:

\documentclass{beamer}
\begin{document}
\begin{frame}[plain]
\begin{columns}
\begin{column}{0.5\paperwidth}
\includegraphics[width=.5\paperwidth, height=\paperheight]{example-image-9x16} 
% consider use keepaspectratio !
\end{column}
\begin{column}{0.5\paperwidth}
\begin{itemize}
\item paperwidth: \the\paperwidth
\item textwidth: \the\columnwidth
\item Left margin:  \rule{\leftmargin}{2pt} \the\leftmargin
\end{itemize}
\end{column}
\end{columns}
\end{frame}
\end{document}

MWE

3
  • Thank you. the code get the result pdf close to what I wanted. there's still small space between picture and top and bottom border of the slide. and a relatively larger space on the left side. Is there any way to remove those spaces too?
    – fad99daf
    Commented Oct 13, 2023 at 8:12
  • 1
    Of course, and without tikz. I edited the answer to show it.
    – Fran
    Commented Oct 13, 2023 at 11:54
  • thank you again for the edited answer. that's what I wanted and I think it's simpler than the version with tikz.
    – fad99daf
    Commented Oct 14, 2023 at 15:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .