我不确定是否有人能看出我在这里做错了什么,因为这两个图表是分开工作的,第一个图表产生了一条数字线,第二个图表使用蛋白石产生了一个加法问题。
\documentclass{standalone}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{enumitem}
\usepackage{tikz}
\pgfmathsetseed{\number\pdfrandomseed}
\usepackage{xlop}
\usepackage{pstricks}
%--------NumberlineCode---------
\usepackage[dvipsnames]{xcolor}
\newcommand{\addsubnumline}[3]{%
\begin{tikzpicture}[out=45,in=135,relative,>=stealth]
\draw[<->] (-5,0)--(5,0);
\foreach \x in {-4,...,4}
\draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) node[below] {\footnotesize $\x$};
\fill (#1,0) circle (2pt);
\fill (#2,0) circle (2pt);
\draw[#3,shorten >=2pt]
\foreach \i in {#1,...,\number\numexpr#2 - 1\relax}{%
(\i,0) to (\i+1,0)
} ;
\node[color=OrangeRed] at (#2,-0.75) {\small End};
\node[color=Cerulean] at (#1,-0.75) {\small Start};
\node at (\number\numexpr #2/2+#1/2\relax,0.5) {\small Move \number\numexpr#2- #1\relax\ units to the \emph{right}};
\end{tikzpicture}}
%--------NumberlineCode----------
\begin{document}
%-----NumberLine
\addsubnumline{-4}{2}{->,color=MidnightBlue}
%--------Addition
\subsection{Addition}
\opadd[carryadd=false, resultstyle=\white]{356}{278}
\opadd[carryadd=false, resultstyle=\blue]{356}{278}
\opadd[carryadd=true, resultstyle=\blue, carrystyle=\scriptsize\red]{356}{278}
\end{Document}
抱歉,我无法制作屏幕截图,但正如我所说,当我将两个代码放在一起时,它将无法呈现。
答案1
注释掉不必要的内容、调整一些颜色名称后,主要问题似乎是您的代码应该以 结尾 \end{document}% <<< typo
。
除此之外,这些语句还有些奇怪\opadd
,也许是我注释掉所有这些包的结果。addsubnumline
当然还有宏的定义。\subsection
原因是:未定义class standalone
。
\documentclass{standalone}
% \usepackage{amsmath}
% \usepackage{mathtools}
% \usepackage{enumitem}
\usepackage{tikz}
% \pgfmathsetseed{\number\pdfrandomseed}
\usepackage{xlop}
% \usepackage{pstricks}
%--------NumberlineCode---------
% \usepackage[dvipsnames]{xcolor}
\usepackage{xcolor}
\newcommand\addsubnumline[3]{% <<<
\begin{tikzpicture}[out=45,in=135,relative,>=stealth]
\draw[<->] (-5,0)--(5,0);
\foreach \x in {-4,...,4}
\draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) node[below] {\footnotesize $\x$};
\fill (#1,0) circle (2pt);
\fill (#2,0) circle (2pt);
\draw[#3,shorten >=2pt]
\foreach \i in {#1,...,\number\numexpr#2 - 1\relax}{%
(\i,0) to (\i+1,0)
} ;
% \node[color=OrangeRed] at (#2,-0.75) {\small End};
\node[color=red] at (#2,-0.75) {\small End};
% \node[color=Cerulean] at (#1,-0.75) {\small Start};
\node[color=green] at (#1,-0.75) {\small Start};
\node at (\number\numexpr #2/2+#1/2\relax,0.5) {\small Move \number\numexpr#2- #1\relax\ units to the \emph{right}};
\end{tikzpicture}}
%--------NumberlineCode----------
\begin{document}
%-----NumberLine
\addsubnumline{-4}{2}{->,color=blue}%color=MidnightBlue}
%--------Addition
% \subsection{Addition}
% \opadd[carryadd=false, resultstyle=\white]{356}{278}
% \opadd[carryadd=false, resultstyle=\blue]{356}{278}
% \opadd[carryadd=true, resultstyle=\blue, carrystyle=\scriptsize\red]{356}{278}
\end{document}% <<< typo