圖片標題出現在側面而不是下面

圖片標題出現在側面而不是下面

我正在使用 Beamer 類別進行演示。我正在使用 minipage 來獲取 2 x 2 排列的 4 個數字。

當我為圖表添加標題時,出現了兩個問題:

  • 標題從圖中開始,而不是從下面開始
  • 標題將被圖形剪切,而不是減小圖形的大小。
  • 我還收到錯誤:“\標題位於圖形或表格之外。\end{frame}”
\documentclass{beamer}
\usetheme{default}
\setbeamerfont{caption}{size=\footnotesize}
\begin{document}
  \begin{frame}
      \begin{columns}
          \column{0.5\textwidth}
          \begin{minipage}[c][0.4\textheight][c]{\linewidth}
              \centering
              \includegraphics[width=1\linewidth]{ETRM1042-epspdf-to}
              \caption{WT terminal voltage}
          \end{minipage}
          \begin{minipage}[c][0.4\textheight][c]{\linewidth}
              \centering
              \includegraphics[width=1\linewidth]{ITRM1042-epspdf-to}
              \caption{WT terminal current}
          \end{minipage}
          \column{0.5\textwidth}
          \begin{minipage}[c][0.4\textheight][c]{\linewidth}
                      \centering
                      \includegraphics[width=1\linewidth]{ETRM1042-epspdf-to}
                  \caption{Caption 3}
                  \end{minipage}
          \begin{minipage}[c][0.4\textheight][c]{\linewidth}
              \centering
              \includegraphics[width=1\linewidth]{VAACC-epspdf-to}
              \caption{previous Vterm angle}
          \end{minipage}
      \end{columns}
    \end{frame}
   \end{document}

在此輸入影像描述

答案1

使用以下方法可以減少複雜性:

\documentclass{beamer}
    \usepackage{graphicx}
    \usepackage{tabularx}

\begin{document}
\begin{figure}
\begin{frame}
    \begin{tabularx}{\textwidth}{*{2}{>{\centering\arraybackslash}X}}
\includegraphics[width=0.9\linewidth,height=24mm]{example-image-a}
\caption{WT terminal voltage}
    &   \includegraphics[width=\linewidth,height=24mm]{example-image-a}
        \caption{???}
        \\  % new row
\includegraphics[width=0.9\linewidth,height=24mm]{example-image-b}
\caption{WT terminal current}
    &   \includegraphics[width=\linewidth,height=24mm]{example-image-b}
        \caption{previous Vterm angle}
    \end{tabularx}
\end{figure}
\end{frame}
\end{document}

在此輸入影像描述

當然,要查看標題,您的圖像會適當限制其高度。

編輯: 要新增編號標題,您需要新增序言\setbeamertemplate{caption}[numbered]

附錄: 正如評論中所要求的,沒有“圖”一詞的“標題”很容易獲得——只是不使用\caption{...}:-)。下面的 MWE 演示了可能的解決方案。

\documentclass{beamer}
    \usetheme{default}
%----
    \usepackage{graphicx}
    \usepackage{tabularx}

\begin{document}
\begin{frame}
    \begin{tabularx}{\textwidth}{*{2}{>{\centering\arraybackslash}X}}
\includegraphics[width=0.9\linewidth,height=24mm]{example-image-a}\newline\footnotesize
WT terminal voltage
    &   \includegraphics[width=\linewidth,height=24mm]{example-image-a}\newline\footnotesize
        ???
        \\[1em]  % new row
\includegraphics[width=0.9\linewidth,height=24mm]{example-image-b}\newline\footnotesize
WT terminal current
    &   \includegraphics[width=\linewidth,height=24mm]{example-image-b}\newline\footnotesize
        previous Vterm angle
    \end{tabularx}
\end{frame}
\end{document}

這使:

在此輸入影像描述

答案2

如果我運行你的例子我得到

! LaTeX Error: \caption outside figure or table.

如果發生錯誤,根本不值得查看 pdf 輸出,teX 會嘗試恢復以錯誤檢查更多文件,但不會產生合理的輸出。

如果我添加表,因為錯誤表明輸出對我來說看起來不錯:

在此輸入影像描述

\documentclass{beamer}
\usetheme{default}
\setbeamerfont{caption}{size=\footnotesize}
\begin{document}
  \begin{frame}
      \begin{columns}
          \column{0.5\textwidth}
          \begin{table}
              \centering
              \includegraphics[height=.3\textheight]{example-image}
              \caption{WT terminal voltage}
          \end{table}
          \begin{table}
              \centering
              \includegraphics[height=.3\textheight]{example-image-a}
              \caption{WT terminal current}
          \end{table}
          \column{0.5\textwidth}
          \begin{table}
                      \centering
                      \includegraphics[height=.3\textheight]{example-image-b}
                  \caption{Caption 3}
                  \end{table}
          \begin{table}
              \centering
              \includegraphics[height=.3\textheight]{example-image}
              \caption{previous Vterm angle}
          \end{table}
      \end{columns}
    \end{frame}
   \end{document}

相關內容