
Мне бы очень хотелось получить помощь в размещении этого графика рядом с вопросами с несколькими вариантами ответов.
Я использую \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}