
객관식 문제를 내고 있어요. (여기서는 두 가지 선택 항목을 표시합니다.) 를 사용하여 포물선을 그리려고 합니다 pgfplots
. TikZ
내 코드가 컴파일되지 않는 이유는 무엇입니까 ? 코드를 컴파일할 수 %
있도록 플롯하려는 포물선 앞에 를 넣었습니다 .TikZ
또한 그림이 왼쪽 여백과 같은 높이가 되도록 하고 싶습니다. 환경 \hspace{\fill}
종료 후 입력했습니다 tikzpicture
.
\documentclass{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\begin{document}
\begin{tikzpicture}
%These four commands give commands to draw a rectangle in which the graphs are to be drawn.
\draw[gray,dashed,line width=0.1pt,name path=top] (-6,4.25) -- (6,4.25);
\draw[gray,dashed,line width=0.1pt,name path=right] (6,0) -- (6,4.25);
\draw[gray,dashed,line width=0.1pt,name path=bottom] (-6,0) -- (6,0);
\draw[gray,dashed,line width=0.1pt,name path=left] (-6,0) -- (-6,4.25);
%These commands place the letters indicating the choices.
\node[left] (a) at (-6,4) {$\mathrm{a.)}$};
\node[left] (b) at (1,4) {$\mathrm{b.)}$};
%These commands place the axes for the graphs.
\draw[draw=gray!30,latex-latex] (-3.5,4) +(0,0.5cm) node[above right] {$y$} -- (-3.5,1) -- +(0,-0.5cm);
\draw[draw=gray!30,latex-latex] (-5.5,2) +(-0.5cm,0) -- (-1.5,2) -- +(0.5cm,0) node[below right] {$x$};
%\addplot[samples=201,domain=-3.75:-3.25,blue] {-4*(x + 3.5)^(2) + 1.5};
%These commands plot the second parabola on the Cartesian plane.
\draw[draw=gray!30,latex-latex] (3.5,4) +(0,0.5cm) node[above right] {$y$} -- (3.5,1) -- +(0,-0.5cm);
\draw[draw=gray!30,latex-latex] (1.5,2) +(-0.5cm,0) -- (5.5,2) -- +(0.5cm,0) node[below right] {$x$};
%\addplot[samples=201,domain=-2.75:-2.25,blue] {(x - 3.5)^(2) + 2.5};
\end{tikzpicture}
\hspace{\fill}
\end{document}
답변1
다음은 부분적인 답변입니다. 그런 다음 이를 상황에 맞게 입력해야 합니다. 개인적으로 저는 재사용 가능한 다이어그램의 '라이브러리'를 구축하는 독립 실행형 클래스를 사용하여 각 그래픽 그림을 구축하겠습니다. 그런 다음 \inputgraphics를 사용하여 필요한 곳에 그래픽을 배치합니다. 하지만 이 코드는 귀하의 질문에 대한 답변입니다. 그러나 포물선을 얻으려면 도메인과 그래픽 창을 올바르게 명시해야 합니다. (수학은 당신에게 맡깁니다.)
\documentclass{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections}
\usepackage{adjustbox}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\begin{document}
a.) \adjustbox{valign=t}{\begin{tikzpicture}[scale=.5]
%These commands plot the second parabola on the Cartesian plane.
\draw[draw=gray!30,latex-latex] (3.5,4) +(0,0.5cm) node[above right] {$y$} -- (3.5,1) -- +(0,-0.5cm);
\draw[draw=gray!30,latex-latex] (1.5,2) +(-0.5cm,0) -- (5.5,2) -- +(0.5cm,0) node[below right] {$x$};
\begin{axis}[axis lines=none]\addplot[samples=201,domain=-2.75:-2.25,blue] {(x - 3.5)^(2) + 2.5};\end{axis}
% axis lines=none comes from pg 219 of the pgfplots documentation
\end{tikzpicture}}%
%
b.) \adjustbox{valign=t}{\begin{tikzpicture}[scale=.5]
%These commands plot the second parabola on the Cartesian plane.
\draw[draw=gray!30,latex-latex] (3.5,4) +(0,0.5cm) node[above right] {$y$} -- (3.5,1) -- +(0,-0.5cm);
\draw[draw=gray!30,latex-latex] (1.5,2) +(-0.5cm,0) -- (5.5,2) -- +(0.5cm,0) node[below right] {$x$};
\begin{axis}[axis lines=none]\addplot[samples=201,domain=-2.75:-2.25,blue] {(x - 3.5)^(2) + 2.5};\end{axis}
\end{tikzpicture}}%
%
c.) \adjustbox{valign=t}{\begin{tikzpicture}[scale=.5]
%These commands plot the second parabola on the Cartesian plane.
\draw[draw=gray!30,latex-latex] (3.5,4) +(0,0.5cm) node[above right] {$y$} -- (3.5,1) -- +(0,-0.5cm);
\draw[draw=gray!30,latex-latex] (1.5,2) +(-0.5cm,0) -- (5.5,2) -- +(0.5cm,0) node[below right] {$x$};
\begin{axis}[axis lines=none]\addplot[samples=201,domain=-2.75:-2.25,blue] {(x - 3.5)^(2) + 2.5};\end{axis}
\end{tikzpicture}}%
%
d.) \adjustbox{valign=t}{\begin{tikzpicture}[scale=.5]
%These commands plot the second parabola on the Cartesian plane.
\draw[draw=gray!30,latex-latex] (3.5,4) +(0,0.5cm) node[above right] {$y$} -- (3.5,1) -- +(0,-0.5cm);
\draw[draw=gray!30,latex-latex] (1.5,2) +(-0.5cm,0) -- (5.5,2) -- +(0.5cm,0) node[below right] {$x$};
\begin{axis}[axis lines=none]\addplot[samples=201,domain=-2.75:-2.25,blue] {(x - 3.5)^(2) + 2.5};\end{axis}
\end{tikzpicture}}%
%
e.) \adjustbox{valign=t}{\begin{tikzpicture}[scale=.5]
%These commands plot the second parabola on the Cartesian plane.
\draw[draw=gray!30,latex-latex] (3.5,4) +(0,0.5cm) node[above right] {$y$} -- (3.5,1) -- +(0,-0.5cm);
\draw[draw=gray!30,latex-latex] (1.5,2) +(-0.5cm,0) -- (5.5,2) -- +(0.5cm,0) node[below right] {$x$};
\begin{axis}[axis lines=none]\addplot[samples=201,domain=-2.75:-2.25,blue] {(x - 3.5)^(2) + 2.5};\end{axis}
\end{tikzpicture}}
\hspace{\fill}
\end{document}
답변2
다음은 패키지를 사용하는 환경과 같은 두 개의 열 열거입니다 tasks
.
\documentclass{amsart}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\usepackage[more]{tasks}
\NewTasks[style=enumerate,counter-format=tsk[a]),label-width=1em,item-indent = 1em,column-sep =2em,after-item-skip =3ex]{choices}[\choice](2)
\begin{document}
\begin{choices}
\choice
\begin{tikzpicture}[baseline=(current bounding box.north)]
\begin{axis}[hide axis,width=0.4\textwidth,clip=false]
\addplot[samples=201,domain=-3.75:-3.25,blue] {-4*(x + 3.5)^(2) + 1.5};
\draw[draw=gray!30,latex-latex] (axis cs: -3.5, 1.55) node[below right] {$y$} -- (axis cs: -3.5, 1.25);
\draw[draw=gray!30,latex-latex] (axis cs: -3.85, 1.35) -- (axis cs: -3.15, 1.35) node[below right] {$x$};
\end{axis}
\end{tikzpicture}
\choice
\begin{tikzpicture}[baseline=(current bounding box.north)]
\begin{axis}[hide axis,width=0.4\textwidth,clip=false]
\addplot[samples=201,domain=-2.75:-2.25,blue] {(x - 3.5)^(2) + 2.5};
\draw[draw=gray!30,latex-latex] (axis cs: -2.5, 42.75) node[below right] {$y$} -- (axis cs: -2.5, 35.55);
\draw[draw=gray!30,latex-latex] (axis cs: -2.85, 38) -- (axis cs: -2.15, 38) node[below right] {$x$};
\end{axis}
\end{tikzpicture}
\choice
\begin{tikzpicture}[baseline=(current bounding box.north)]
\begin{axis}[hide axis,width=0.4\textwidth,clip=false]
\addplot[samples=201,domain=-3.75:-3.25,blue] {-4*(x + 3.5)^(2) + 1.5};
\draw[draw=gray!30,latex-latex] (axis cs: -3.5, 1.55) node[below right] {$y$} -- (axis cs: -3.5, 1.25);
\draw[draw=gray!30,latex-latex] (axis cs: -3.85, 1.35) -- (axis cs: -3.15, 1.35) node[below right] {$x$};
\end{axis}
\end{tikzpicture}
\choice
\begin{tikzpicture}[baseline=(current bounding box.north)]
\begin{axis}[hide axis,width=0.4\textwidth,clip=false]
\addplot[samples=201,domain=-2.75:-2.25,blue] {(x - 3.5)^(2) + 2.5};
\draw[draw=gray!30,latex-latex] (axis cs: -2.5, 42.75) node[below right] {$y$} -- (axis cs: -2.5, 35.55);
\draw[draw=gray!30,latex-latex] (axis cs: -2.85, 38) -- (axis cs: -2.15, 38) node[below right] {$x$};
\end{axis}
\end{tikzpicture}
\choice
\begin{tikzpicture}[baseline=(current bounding box.north)]
\begin{axis}[hide axis,width=0.4\textwidth,clip=false]
\addplot[samples=201,domain=-3.75:-3.25,blue] {-4*(x + 3.5)^(2) + 1.5};
\draw[draw=gray!30,latex-latex] (axis cs: -3.5, 1.55) node[below right] {$y$} -- (axis cs: -3.5, 1.25);
\draw[draw=gray!30,latex-latex] (axis cs: -3.85, 1.35) -- (axis cs: -3.15, 1.35) node[below right] {$x$};
\end{axis}
\end{tikzpicture}
\end{choices}
\end{document}