并排投影仪幻灯片 (文本和 PGFPlot)

并排投影仪幻灯片 (文本和 PGFPlot)

我正在尝试将图片和文本并排显示。我尝试使用列和迷你页面环境,但没有成功。这是我的示例。

\documentclass[compress]{beamer}
\mode<presentation>
\usetheme{JuanLesPins}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{multicol}
\usepackage{amssymb}
\usepackage{color}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}



\begin{document}


\section{Example }
    \begin{frame}
        \frametitle{Side By Side }
        
        \begin{minipage}{.7\linewidth}
               Given the graph of \(f(x)\).
            \begin{enumerate}
                \item Evaluate \(f(2)\).
                \item Find when \(f(x)=4\).
            \end{enumerate}
      \end{minipage}
      \begin{minipage}{.3\linewidth}
        \begin{tikzpicture}[scale=.8]
       \begin{axis}[grid style={gray!50},
                    xlabel={\(x\)},
                    ylabel={\(y\)}, xmin=-5,xmax=5,ymin=-5,ymax=5,
                    xtick={-5,-4,...,5},
                    ytick={-5,-4,...,5},
            every axis plot/.append style={ultra thick},
            axis y line=center,
            axis x line=center,
            axis line style={Triangle-Triangle},
             grid = both,
            ]
            \addplot[Triangle-Triangle,red,domain=-2.1:2.1,samples=500]{x^2};
         \end{axis}  
        \end{tikzpicture}      
    \end{minipage}
        
    \end{frame}
    



    
    


    \end{document}


任何帮助都将不胜感激。非常感谢

答案1

这应该可以工作:

\documentclass[compress]{beamer}
\mode<presentation>
\usetheme{JuanLesPins}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{multicol}
\usepackage{amssymb}
\usepackage{color}
\usepackage{tikz}
\usetikzlibrary{arrows.meta} % add this to make Triangle arrow tip available 
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\section{Example }
\begin{frame}
\frametitle{Side By Side }
\begin{columns}
\begin{column}{0.5\linewidth}
Given the graph of \(f(x)\).
\begin{enumerate}
\item Evaluate \(f(2)\).
\item Find when \(f(x)=4\).
\end{enumerate}
\end{column}
\begin{column}{0.5\linewidth}
\begin{tikzpicture}[scale=.8]
\begin{axis}[
grid style={gray!50},
xlabel={\(x\)},
ylabel={\(y\)},
xmin=-5,xmax=5,ymin=-5,ymax=5,
xtick={-5,-4,...,5},
ytick={-5,-4,...,5},
 every axis plot/.append style={ultra thick},
axis y line=center,
axis x line=center,
axis line style={Triangle-Triangle},
grid = both,
]
\addplot[Triangle-Triangle,red,domain=-2.1:2.1,samples=500]{x^2};
\end{axis}  
\end{tikzpicture}      
\end{column}
\end{columns}
\end{frame}
\end{document}

在此处输入图片描述

相关内容