将情节放在问题旁边

将情节放在问题旁边

我希望得到一些帮助,尝试将这张图表放在多项选择题旁边。

我正在使用\tasks命令让问题和图表彼此相邻,但现在它与上面的其他内容不一致

在此处输入图片描述

以下是我所做的事情:

\question Find the equation of the following graph 

\begin{tasks}(2)


\task[]

\begin{oneparchoices}
    \choice $y = (x-1)(x-5)$ \\
    \choice $y = \frac{4(x-1)(x-5)}{5}$ \\
    \choice $y = x^2 -6x -5$\\
    \choice $\frac{4(x-6)}{5}$
\end{oneparchoices}

\task[] 

\pgfplotsset{
    standard/.style={
    axis line style = thick,
    trig format=rad,
    enlargelimits,
    axis x line=middle,
    axis y line=middle,
    enlarge x limits=0.15,
    enlarge y limits=0.15,
    every axis x label/.style={at={(current axis.right of origin)},anchor=north west},
    every axis y label/.style={at={(current axis.above origin)},anchor=south east}
    }
}

\begin{tikzpicture}
\begin{axis}[standard,
            xtick={1, 5},
            ytick={4},
            samples=1000,
            xlabel={$x$},
            ylabel={$y$},
            xmin=-1,xmax=7,
            ymin=-3,ymax=6]

\node[anchor=center,label=south west:$O$] at (axis cs:0,0){};

\addplot[name path=F,domain={-1:7}]{((4/5)*(x-1)*(x-5)};

\end{axis}
\end{tikzpicture}
\end{tasks}

答案1

我认为(但我不确定,因为你提供的代码很零散)你的目标可能是如下内容:

\documentclass{exam}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18} 

\pgfplotsset{
    standard/.style={
        axis line style=thick,
        trig format=rad,
        enlargelimits,
        axis x line=middle,
        axis y line=middle,
        enlarge x limits=0.15,
        enlarge y limits=0.15,
        every axis x label/.style={
            at={(current axis.right of origin)},
            anchor=north west
        },
        every axis y label/.style={
            at={(current axis.above origin)},
            anchor=south east
        }
    }
}
 
\begin{document}
\begin{questions}

\question Find the equation of the following graph 

\begin{oneparchoices}
    \choice $y = (x-1)(x-5)$ \\
    \choice $y = \frac{4(x-1)(x-5)}{5}$ \\
    \choice $y = x^2 -6x -5$ \\
    \choice $\frac{4(x-6)}{5}$
\end{oneparchoices}

\question Find the equation of the following graph 
\hfill\makebox(0.5\linewidth,0pt)[rt]{%
    \begin{tikzpicture}
    \begin{axis}[
        standard,
        xtick={1, 5},
        ytick={4},
        samples=1000,
        xlabel={$x$},
        ylabel={$y$},
        xmin=-1, xmax=7,
        ymin=-3, ymax=6
    ]
    
    \node[anchor=center, label=south west:$O$] at (axis cs:0,0) {};
    
    \addplot[domain={-1:7}]{((4/5)*(x-1)*(x-5)};
    \end{axis}
    \end{tikzpicture}%
}

\begin{oneparchoices}
    \choice $y = (x-1)(x-5)$ \\
    \choice $y = \frac{4(x-1)(x-5)}{5}$ \\
    \choice $y = x^2 -6x -5$ \\
    \choice $\frac{4(x-6)}{5}$
\end{oneparchoices}

\end{questions}
\end{document}

在此处输入图片描述

相关内容