将函数精确地置于图表下方

将函数精确地置于图表下方

我的演示文稿(仅其中一部分)如下所示: 在此处输入图片描述

正如你所见,该函数位于右下角,而不是确切地图表下方。你知道我该怎么做吗?

这是一个最简单的例子:

\documentclass[utf8]{beamer}

% =============
% Packages 
% =============
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}                % west european chars
\usepackage{amsmath, amsthm, amssymb}   % math symbols
\usepackage{pgfplots} % For function graphs
\pgfplotsset{compat=1.5}

% ------------
% Content 
% ------------
\begin{document}
\begin{frame}
    \frametitle{Asymptote of f(x)}
    \begin{columns}[t]
        %-- first graph --
        \column{0.4\textwidth}
           \begin{overlayarea}{\textwidth}{0.5\textheight}
               \only<1>{
                   \begin{tikzpicture}
                   \begin{axis} [
                       width = \textwidth,
                       height = 0.75\textheight,
                       axis lines = center,
                       xlabel = x,
                       ylabel = y,
                       scaled ticks = false,
                       samples = 100,
                       restrict y to domain = -10:10
                   ]
                       % Adding a graph
                       \addplot[
                           domain = -3:3,
                           color = black
                           ]
                           {
                               (1 / x)
                           };
                   \end{axis}
                   \end{tikzpicture}
            } % only <1>
        \end{overlayarea}
    \end{columns}
    % --------------
    % Functions 
    % --------------
    \begin{columns}[t]
        \column{0.4\textwidth}
            \begin{overlayarea}{\textwidth}{0.25\textheight}
                \begin{align*}
                    \only<1-3>{f(x) = \frac{1}{x}}
                \end{align*}
            \end{overlayarea}
    \end{columns}
\end{frame}
\end{document}

答案1

不需要columns、 和overlayarea,只需通过 来将内容置于框架的中心\centering,使用gather*或 简单地根据需要\[ ...\]编写函数和它们:uncover<...>

\documentclass[utf8]{beamer}
% Packages
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}                % west european chars
\usepackage{amsmath, amssymb, amsthm}   % math symbols
\usepackage{pgfplots} % For function graphs
\pgfplotsset{compat=1.17} % 1.5 is very ancient version ...

% Content
\begin{document}
\begin{frame}
\frametitle{Asymptote of $f(x)$}
\centering
\uncover<1>{
    \begin{tikzpicture}
\begin{axis}[width = 0.6\textwidth, height = 0.75\textheight,
   axis lines = center,
   xlabel = $x$,
   ylabel = $y$,
   xtick={-3,-2,...,3},
   ticklabel style={font=\scriptsize},
   scaled ticks = false,
   restrict y to domain = -8:8,
   domain = -3.5:3.5,
   samples = 100, no marks
            ]
\addplot [thick] {1/x};
\end{axis}
    \end{tikzpicture}
        }% end of <1>

\uncover<1-3>{
    \[% or \begin{gather*}
f(x) = \frac{1}{x}
    \] % or \end{gather*}
            }% end of <1-3>
\end{frame}
\end{document}

在此处输入图片描述

答案2

我稍微玩了一下,发现了这一点:

我不需要,overlayarea所以我只是删除了它并将所有内容包装到环境中center。现在它看起来像这样: 在此处输入图片描述

代码如下:

\documentclass[utf8]{beamer}

% =============
% Packages 
% =============
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}                % west european chars
\usepackage{amsmath, amsthm, amssymb}   % math symbols
\usepackage{pgfplots} % For function graphs
\pgfplotsset{compat=1.5}

% ------------
% Content 
% ------------
\begin{document}
\begin{frame}
    \frametitle{Asymptote of f(x)}
    \begin{columns}[t]
        %-- first graph --
        \column{0.4\textwidth}
            \begin{center} % ADD THIS
            \only<1>{
                \begin{tikzpicture}
                \begin{axis} [
                    width = \textwidth,
                    height = 0.75\textheight,
                    axis lines = center,
                    xlabel = x,
                    ylabel = y,
                    scaled ticks = false,
                    samples = 100,
                    restrict y to domain = -10:10
                ]
                    % Adding a graph
                    \addplot[
                        domain = -3:3,
                        color = black
                        ]
                        {
                            (1 / x)
                        };
                \end{axis}
                \end{tikzpicture}
            } % only <1>
            \end{center} % ADD THIS
    \end{columns}
    % --------------
    % Functions 
    % --------------
    \begin{columns}[t]
        \column{0.4\textwidth}
            \begin{align*}
                \only<1-3>{f(x) = \frac{1}{x}}
            \end{align*}
    \end{columns}
\end{frame}
\end{document}

相关内容