PSTricks 中绘制轴标签的条件

PSTricks 中绘制轴标签的条件

考虑同样的例子这里(但现在我确实遇到了一个问题):

% latex filename.tex
% dvips filename.dvi
% ps2pdf filename.ps

\documentclass[
  a4paper,
  dvipsnames
]{article}

\usepackage{lmodern}
\usepackage{amsmath}
\usepackage{pst-grad,pst-plot}
\usepackage{xfrac}
\usepackage[
  locale=DE
]{siunitx}

%%% Flydning af figurer %%%

\makeatletter
  \providecommand*{\setfloatlocations}[2]{\@namedef{fps@#1}{#2}}
\makeatother
\setfloatlocations{figure}{htbp}

%%% LaTeX 3-syntaks %%%

\ExplSyntaxOn
  \cs_new_eq:NN \calc \fp_eval:n
\ExplSyntaxOff

%%% Definitioner %%%

\def\radioaktivt{%
  \psscalebox{0.0125}{%
    \pscircle[
      fillstyle=solid,
      fillcolor=yellow,
      linestyle=none
    ](0,0){5}
    \pswedge*(0,0){5}{0}{60}
    \pswedge*(0,0){5}{120}{180}
    \pswedge*(0,0){5}{240}{300}
    \pscircle*[
      linecolor=yellow
    ](0,0){1.5}
    \pscircle*(0,0){1}
  }
}

\def\ikkeradioaktivt{%
  \pscircle*[
    linecolor=SeaGreen
  ](0,0){0.0625}
}

\def\henfald{rand 301 mod 50 div round 50 div }

\def\simpel#1{!#1 \henfald add \henfald \i\space 5 mul 16 div add 0.121 add }

\def\maerkerX{\calc{1.5*\i+0.75}}
\def\maerkerYa{\calc{10*2^(-\i)}}
\def\maerkerYb{\num{\calc{100*2^(-\i)}}}

\def\halveringerB{\calc{\Halveringer-1}}
\def\halveringerC{\calc{\Halveringer+1}}
\def\konstA{\calc{1.5*\i+0.25}\space}
\def\konstB{\calc{32*2^(-\i)}}
\def\konstC{\calc{32-\konstB}}
\def\konstD{\calc{1.5*\halveringerC+0.75}}
\def\konstE{\calc{\konstD-0.75}}
\def\konstF{\calc{\konstD+0.15}}

\newcommand*{\halveringer}[1]{%
 \def\Halveringer{#1}
 \centering
  \begin{pspicture}(-1.7,-0.6)(\konstF,11.2)
    \psframe[
      linestyle=none,
      fillstyle=gradient,
      gradangle=45,
      gradmidpoint=1,
      gradbegin=gray!80,
      gradend=gray!30
    ](0,0)(\konstE,10.25)
    \multido{\i=0+1}{\halveringerC}{%
      \psframe[
        dimen=middel,
        linecolor=NavyBlue,
        linewidth=1pt,
        fillstyle=gradient,
        gradangle=90,
        gradmidpoint=1,
        gradbegin=NavyBlue!50,
        gradend=white
      ](\konstA,0)(!\konstA 1 add \maerkerYa)
    }
    \multido{\i=0+1}{\halveringerC}{%
      \psframe[
        dimen=middel,
        linecolor=NavyBlue,
        linewidth=1pt,
        fillstyle=gradient,
        gradangle=90,
        gradmidpoint=0,
        gradbegin=SeaGreen!30,
        gradend=white
      ](\konstA,10)(!\konstA 1 add \maerkerYa)
    }
    \multido{\i=0+1}{\halveringerC}{%
      \rput(\konstA,0){%
        \multido{\i=0+1}{\konstB}{%
          \rput{!\henfald 777 mul}(\simpel{0.125}){\radioaktivt}
          \rput{!\henfald 777 mul}(\simpel{0.375}){\radioaktivt}
          \rput{!\henfald 777 mul}(\simpel{0.625}){\radioaktivt}
          \rput{!\henfald 777 mul}(\simpel{0.875}){\radioaktivt}
        }
      }
      \rput(\konstA,\maerkerYa){%
        \multido{\i=0+1}{\konstC}{%
          \rput(\simpel{0.125}){\ikkeradioaktivt}
          \rput(\simpel{0.375}){\ikkeradioaktivt}
          \rput(\simpel{0.625}){\ikkeradioaktivt}
          \rput(\simpel{0.875}){\ikkeradioaktivt}
        }
      }
    }
    \psaxes[
      ticks=none,
      labels=none,
      arrowinset=0.05,
      arrowscale=1.6,
      arrowlength=1.8
    ]{->}(0,0)(-0.3,-0.3)(\konstD,10.75)[$t$,0][Radioaktive kerner~(\si{\percent}),90]
    \psplot[
      algebraic,
      linecolor=red,
      linewidth=1.5pt
    ]{0.75}{\konstE}{10*0.5^(2*(x-0.75)/3)}
    \psxTick(0.75){\text{start}}
    \psxTick(2.25){T_{\sfrac{1}{2}}}
    \multido{\i=2+1}{\halveringerB}{%
      \psxTick(\maerkerX){\i \cdot T_{\sfrac{1}{2}}}
    }
    \multido{\i=0+1}{\halveringerC}{%
      \psyTick(\maerkerYa){\maerkerYb}
    }
  \end{pspicture}
}

\pagestyle{empty}

\begin{document}

\multido{\iK=0+1}{3}{%
  \begin{figure}
    \halveringer{\iK}
  \end{figure}
}

\end{document}

问题/问题

问题在于第一页上的绘图:在达到第一个半场之前,即 时\iK,时间轴上0只应绘制标签。我该如何解决这个问题?start

更新

几个小时之内我将不会在接下来的九天里待在电脑旁,也就是说,我不会在 9 号星期一之前查看这篇文章。

答案1

[...]
\psaxes[ticks=none,labels=none,arrowinset=0.05,
        arrowscale=1.6,arrowlength=1.8
      ]{->}(0,0)(-0.3,-0.3)(\konstD,10.75)[$t$,0][Radioaktive kerner~(\si{\percent}),90]
    \psplot[algebraic,linecolor=red,linewidth=1.5pt]{0.75}{\konstE}{10*0.5^(2*(x-0.75)/3)}
    \psxTick(0.75){\text{start}}
    \ifnum\Halveringer>0\relax  %%%%%%%%%
      \psxTick(2.25){T_{\sfrac{1}{2}}}
      \multido{\i=2+1}{\halveringerB}{\psxTick(\maerkerX){\i \cdot T_{\sfrac{1}{2}}}}
      \multido{\i=0+1}{\halveringerC}{\psyTick(\maerkerYa){\maerkerYb}}
    \fi%
  \end{pspicture}
}

\pagestyle{empty}    
\begin{document}    
\multido{\iK=0+1}{3}{\begin{center}\halveringer{\iK}\end{center}}    
\end{document}

不需要图形环境

相关内容