在投影機中建立兩列

在投影機中建立兩列

我已經在 stackexchange 中搜尋了此問題的解決方案,但是當我輸入以下內容時仍然收到錯誤訊息(目前忽略文件中的其他內容,例如 documentclass、begin{document} 等):

\begin{frame}
\frametitle{explanation}
\begin{columns}
\begin{column}{width=0.5\textwidth}
   some text here
\end{column}
\begin{column}
    \begin{center}
     \includegraphics[width=0.5\textwidth]{image1.jpg}      
     \end{center}
\end{column}
\end{columns}
\end{frame}

編譯時,出現錯誤:Missing number, treated as zero。我應該感謝任何幫助。

答案1

您忘記為第二列提供強制寬度,並且width=在第一列的寬度中包含了不必要的寬度。

\documentclass[demo]{beamer}
\begin{document}
  \begin{frame}
\frametitle{explanation}
\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}  %%<--- here
    \begin{center}
     \includegraphics[width=0.5\textwidth]{image1.jpg}
     \end{center}
\end{column}
\end{columns}
\end{frame}
\end{document}

在此輸入影像描述

答案2

另請注意,第二列中的圖形無需按比例縮小。該列變為minipage,因此\textwidth已調整為其寬度。

\documentclass[demo]{beamer}
\begin{document}
  \begin{frame}
\frametitle{explanation}
\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}
     %%%%% this is a minipage, so \textwidth is already adjusted to the size of the column
     \includegraphics[width=\textwidth]{image1.jpg}
     \end{center}
\end{column}
\end{columns}
\end{frame}
\end{document}

答案3

Beamer 的「列」功能(上面的其他答案)可讓您自訂佈局和斷點。

但是,如果您想讓文字流暢,或者您不關心確切的佈局,很多時候,好的舊multicol包可以很好地完成工作,並且噪音更少。段落劃分\columnbreak可以幫助確定兩列情況下左側和右側或右側的內容。

\usepackage{multicol}
...
\begin{frame}{Frame Title}
    \begin{multicols}{2} % two columns
        Left Hand side text

        \includegraphics[width=4cm]{RHS_image}
    \end{multicols}
\end{frame}

相關內容