
Ich wäre dankbar für Ihre Hilfe beim Platzieren dieses Diagramms neben den Multiple-Choice-Fragen.
Ich verwende den \tasks
Befehl, damit die Frage und das Diagramm nebeneinander angezeigt werden. Allerdings ist es jetzt nicht mehr mit dem Rest des obigen Materials konform.
Folgendes habe ich getan:
\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}
Antwort1
Ich denke (bin mir aber nicht sicher, da der von Ihnen bereitgestellte Code recht fragmentarisch ist), dass Ihr Ziel etwa das Folgende sein könnte:
\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}