6

Consider the same example as here (but now I actually have a problem):

% 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}

Problem / Question

The problem is the drawing on the first page: Before the first halftime is reached, i.e., when \iK is 0, only the label start should be drawn on the time axis. How do I fix this?

Update

Within a few hours I won't be near a computer for the next nine days, i.e., I won't check this post before Monday the 9th.

2
[...]
\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}

there is no need for the figure environment

  • This is really great, Herbert! Any chance I can make you show me how you would create the entire drawing? (What I have works but I feel that it can be made simpler.) – Svend Tveskæg Jul 8 '13 at 18:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.