图像的位置

图像的位置

有人能帮我解决以下代码吗?我想要的图像定位在练习之前,但事实并非如此,它位于练习之后。所以我知道代码很多,但我只想知道位置问题,因为代码的运行顺序不对。

\documentclass{book}

\usepackage{newfile}
\usepackage{amsmath}
\usepackage{xifthen}
\usepackage{enumitem}
\usepackage{multicol}
\usepackage{lipsum}

\usepackage{blindtext}

\usepackage{tikz}% added <<<<<<<<<<<<<<<<<

\usepackage[left=1.00cm, right=1.00cm, top=3.00cm, bottom=3.00cm]{geometry}


%start of book and exercise code
\setlength{\parindent}{0pt}

\newoutputstream{solutions}
\openoutputfile{\jobname.solutions}{solutions}
\newcounter{exblock}
\newcounter{exquestion}
\newcounter{exsubquestion}
\newlist{questionlist}{enumerate}{1}
\newlist{solutionlist}{enumerate}{1}
\newlist{subquestionlist}{enumerate*}{1}
\newlist{subsolutionlist}{enumerate*}{1}
\setlist[questionlist,solutionlist]{label=\arabic*.}
\setlist[subquestionlist,subsolutionlist]{label=(\alph*),itemjoin={},before=~}
\newcommand{\exheader}{%
\ifthenelse{\value{exblock}>0}{\addtostream{solutions} {\noexpand\end{solutionlist}}}{}%
    \refstepcounter{exblock}%
    \setcounter{exquestion}{0}%
    \section{Exercises}%
    \label{ex.\arabic{exblock}}%
    \addtostream{solutions}{\noexpand\paragraph{Exercises          \noexpand\ref{ex.\arabic{exblock}}, page \noexpand\pageref{ex.\arabic{exblock}}}}%
    \addtostream{solutions}{\noexpand\begin{solutionlist}}%
}
\newcommand{\printsolutions}{%
    \ifthenelse{\value{exblock}>0}{\addtostream{solutions} {\noexpand\end{solutionlist}}}{}%
     \closeoutputstream{solutions}%
     \input{\jobname.solutions}%
}
 \newenvironment{exercises}[1][]{%
 \begin{questionlist}[start=\value{exquestion}+1, #1]%
 }{%
    \end{questionlist}%
}
 \newenvironment{exercisescol}[2][]{%
    \begin{multicols}{#2}%
    \begin{questionlist}[start=\value{exquestion}+1, #1]%
}{%
    \end{questionlist}%
    \end{multicols}%
}
\newcommand{\question}[2]{%
    \refstepcounter{exquestion}%
    \label{ex.\arabic{exblock}.\arabic{exquestion}}%
    \item #1%
    \addtostream{solutions} {\noexpand\item[\noexpand\ref{ex.\arabic{exblock}.\arabic{exquestion}}.] #2}%
 }
 \newenvironment{subquestions}[1][]{%
 \refstepcounter{exquestion}%
 \label{ex.\arabic{exblock}.\arabic{exquestion}}%
 \setcounter{exsubquestion}{0}%
 \addtostream{solutions} {\noexpand\item[\noexpand\ref{ex.\arabic{exblock}.\arabic{exquestion}}.]\noexpand\begin {subsolutionlist}}%
    \item #1%
    \begin{subquestionlist}%
 }{%
    \end{subquestionlist}%
    \addtostream{solutions}{\noexpand\end{subsolutionlist}}
}
\newcommand{\subquestion}[2]{%
    \refstepcounter{exsubquestion}%
    \item #1%
    \addtostream{solutions}{\noexpand\item #2}%
}


\setlist*[questionlist]{font=\bfseries}
\setlist*[solutionlist]{noitemsep,font=\bfseries}
\setlist*[subquestionlist]{font=\bfseries}
\setlist*[subsolutionlist]{noitemsep,font=\bfseries,itemjoin={\\},before={}}
%end of book and exercise code

%start place value code

%Place value code
\newcounter{x}
\newlength{\x}
\setlength{\x}{.8cm}
\newcounter{y}
\newcounter{z}
% The angles of x,y,z-axes
\def\xangle{30}
\def\yangle{10}
\newcommand\xaxis{180+\xangle}
\newcommand\yaxis{-\yangle}
\newcommand\zaxis{90}
% The top side of a cube
\newcommand\topside[3]{
    \fill[fill=yellow!60,fill opacity=1, draw=black,shift={(\xaxis:#1\x)},shift=    {(\yaxis:#2)},
     shift={(\zaxis:#3)}] (0,0) -- (\xangle:\x) --++ (180-\yangle:1) --++  (180+\xangle:\x)--cycle;
}
% The left side of a cube
\newcommand\leftside[3]{
\fill[fill=orange!60,fill opacity=1, draw=black,shift={(\xaxis:#1\x)},shift={(\yaxis:#2)},
     shift={(\zaxis:#3)}] (0,0) -- (0,-1) --++ (180-\yangle:1) --(180-\yangle:1)--(0,0);
}
% The right side of a cube
\newcommand\rightside[3]{
    \fill[fill=blue!60,fill opacity=1, draw=black,shift={(\xaxis:#1\x)},shift={(\yaxis:#2)},
     shift={(\zaxis:#3)}] (0,0) -- (\xangle:\x) --++ (0,-1)--(0,-1)--(0,0);
}
% The cube 
\newcommand\cube[3]{
     \topside{#1}{#2}{#3} \leftside{#1}{#2}{#3} \rightside{#1}{#2}{#3}
}
% Definition of \planepartition
% To draw the following plane partition, just write \planepartition{ {a, b, c},    {d,e}     }.
%  a b c
%  d e
\newcommand\planepartition[2][0]{
    \typeout{ONE== #1}
    \typeout{TWO== #2}
    \setcounter{x}{-1}
    \foreach \a in {#2} {
        \addtocounter{x}{1}
        \setcounter{y}{-1}
        \foreach \b in \a {
            \addtocounter{y}{1}
            \setcounter{z}{-1}
            \addtocounter{z}{#1} %partition of the desired floor (layer)
            \ifnum \b>0
            \foreach \c in {1,...,\b} {
                \addtocounter{z}{1}
                \cube{\value{x}}{\value{y}}{\value{z}}
            }\fi
        }
     }
}

\newcommand{\DrawCubes}[3][0]{% added <<<<<<<<<<<<<<<<<<<<
     \begin{tikzpicture}[scale=#3]
         \setcounter{x}{-1}
         \foreach \a in {#2} {
         \addtocounter{x}{1}
         \setcounter{y}{-1}
         \foreach \b in \a {
         \addtocounter{y}{1}
         \setcounter{z}{-1}
         \addtocounter{z}{#1} %partition of the desired floor (layer)
         \ifnum \b>0
         \foreach \c in {1,...,\b} {
        \addtocounter{z}{1}
        \cube{\value{x}}{\value{y}}{\value{z}}
         }\fi
        }
       }
    \end{tikzpicture}
}


%end place value code


\begin{document}

\chapter{Place value}

\section{Introduction}
We all started to think about maths as thinking about maths and counting numbers.              But in the past other civilisations thought of numbers in different ways, which will   look at briefly below. they would be astonished by the concept of the position of the   number $1$ in different places in the place value system could mean the difference between $1$, $10$....$1,000,000$.\\

 \begin{table}
    \begin{tabular}{|c|c|c|c|}  
            \hline
            Unit & Ten & Hundred & Thousand \\
            \hline
            1 & 10 & 100 & 1,000 \\ \hline
            \DrawCubes{1}{0.5}% units 1x1
            &   \DrawCubes{10}{0.5}% Tens 1x10
            &   \DrawCubes{{10,10,10,10,10,10,10,10,10,10}}{0.5}%% Hundreds 10x10
            &   \DrawCubes{{10,10,10,10,10,10,10,10,10,10}, 
                     {10,10,10,10,10,10,10,10,10,10},
                     {10,10,10,10,10,10,10,10,10,10},
                     {10,10,10,10,10,10,10,10,10,10},
                     {10,10,10,10,10,10,10,10,10,10},
                     {10,10,10,10,10,10,10,10,10,10},
                     {10,10,10,10,10,10,10,10,10,10},
                     {10,10,10,10,10,10,10,10,10,10},
                     {10,10,10,10,10,10,10,10,10,10},
                     {10,10,10,10,10,10,10,10,10,10}}{0.5}% Thousands 10x10x10       
             \\      
            \hline
         \end{tabular}
     \end{table} 




\exheader
Find the indicated integral.
 \begin{exercisescol}[noitemsep]{2}
    \question{$\int\sqrt{x}dx$}{$\tfrac{2}{3}x\sqrt{x}+C$}
    \question{$\int3e^xdx$}{$3e^x+C$}
    \question{$\int(3x^2-\sqrt{5x}+2)dx$}{$x^3-\tfrac{2}{3}x\sqrt{5x}+2x+C$}
    \question{$\int(\tfrac{1}{2x}-\tfrac{2}{x^2}+\tfrac{3}{\sqrt{x}})dx$} {$\tfrac{1}{2}\ln|x|+\tfrac{2}{x}+6\sqrt{x}+C$}
 \end{exercisescol}
 Now some more complicated questions:
 \begin{exercises}
     \question{Find the function $f$ whose tangent has slope $x^3-\tfrac{2}{x^2}+2$  for each value of $x$ and whose graph passes through the point $(1,3)$.}  {$f(x)=\tfrac{1}{4}x^4+\tfrac{2}{x}+2x-\tfrac{5}{4}$}
      \begin{subquestions}[Suppose a car supplies a constant deceleration of $A$  meters per second squared. If it is traveling at 90 kilometers per hour when the brakes  are applied, its stopping distance is 50 meters.]
        \subquestion{What is $A$?}{$A=6.25$}
        \subquestion{What would the stopping distance have been if the car had been traveling at only 54 kilometers per hour when the brakes were applied?}{42 meters}
    \end{subquestions}
\end{exercises}
\end{document}

提前致谢。

相关内容