像下面的例子一样,获取每个答案选项的图表的最简单方法是什么

像下面的例子一样,获取每个答案选项的图表的最简单方法是什么

例子

我正在尝试制作一个包含多个问题的考试,这些问题的答案选项为图表。我希望它们按如下所示对齐。

先感谢您!

答案1

这是一个使用exam类和groupplots来自的解决方案pgfplots。应用了两种不同的标签技能。一个在底部,是(需要 AlphaAlpha 包)

\makeatletter
\pgfplotsset{
auto title/.style={title=(\AlphAlph{\pgfplots@group@current@plot})
    }
}
\makeatother

其他用途,在顶部

\node (A) at (group c1r1.north west) {A};

在此处输入图片描述

代码

\documentclass[12pt,a4paper]{exam}%,answers
\usepackage{tikz}
\usepackage{alphalph}
\usepackage{pgfplots,geometry}     % for plots
\usepgfplotslibrary{groupplots}
\usetikzlibrary{arrows}

\makeatletter
\pgfplotsset{
auto title/.style={     title=(\AlphAlph{\pgfplots@group@current@plot})
    }
}
\makeatother
\begin{document}
\begin{questions}
\question[10]
Sketch the parent graph and translate it to obtain a graph of $y+1=|x-5|$.

\begin{tikzpicture}[font=\footnotesize\sffamily]
  \begin{groupplot}[group style={rows=2,columns=2, vertical sep=15mm},
    width=3cm,height=2cm, axis x line=center,
axis y line=center, scale only axis,
xmin=-1,xmax=1,ymin=-2,ymax=2,]
    \nextgroupplot[] \addplot [domain=-1:1, thick, cyan] {x};
    \nextgroupplot[] \addplot [domain=-1:1, thick, cyan] {x^2};    
    \nextgroupplot[] \addplot [domain=-1:1, thick, cyan] {x};
    \nextgroupplot[] \addplot [domain=-1:1, thick, cyan] {x^2};
    \end{groupplot}
    \node (A) at (group c1r1.north west) {A};
    \node (B) at (group c2r1.north west) {B};
    \node (C) at (group c1r2.north west) {C};
    \node (D) at (group c2r2.north west) {D};
\end{tikzpicture}


\question[10] $3x+7y=21$

\begin{tikzpicture}[font=\footnotesize\sffamily]
  \begin{groupplot}[group style={rows=2,columns=2,
  vertical sep=15mm},
  width=3cm,height=2cm,  scale only axis, xmin=-1,xmax=1,ymin=-2,ymax=2]
    \nextgroupplot[auto title] \addplot [domain=-1:1, thick, cyan] {x};
    \nextgroupplot[auto title] \addplot [domain=-1:1, thick, cyan] {x^2};
    \nextgroupplot[auto title] \addplot [domain=-1:1, thick, cyan] {x};
    \nextgroupplot[auto title] \addplot [domain=-1:1, thick, cyan] {x^2};
  \end{groupplot}
\end{tikzpicture}
\end{questions}
\end{document}

相关内容