# Improved PSTricks figure for everyone interested [closed]

First: This post might not be appropirate for this site, so feel free to close it if necessary.

I have improved on the drawing by Thomas Söll from here and I thought someone might find it useful.

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

\documentclass[
a4paper,
dvipsnames
]{article}

\usepackage{lmodern}
\usepackage{amsmath}
\usepackage{
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 %%%

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

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

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

\def\halveringerB{\calc{\Halveringer-1}}
\def\halveringerC{\calc{\Halveringer+1}}

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

\def\konstA{\calc{1.5*\i+0.25}}
\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,
](0,0)(\konstE,10.25)
\multido{\i=0+1}{\halveringerC}{%
\psframe[
dimen=middel,
linecolor=NavyBlue,
linewidth=1pt,
}
\multido{\i=0+1}{\halveringerC}{%
\psframe[
dimen=middel,
linecolor=NavyBlue,
linewidth=1pt,
}
\multido{\i=0+1}{\halveringerC}{%
\rput(\konstA,0){%
\multido{\i=0+1}{\konstB}{%
}
}
\rput(\konstA,\maerkerYa){%
\multido{\i=0+1}{\konstC}{%
}
}
}
\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 atomer~(\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\space \cdot T_{\sfrac{1}{2}}}
}
\multido{\i=2+1}{\halveringerB}{%
\psxTick(\maerkerX){\i\space \cdot T_{\sfrac{1}{2}}}
}
\multido{\i=0+1}{\halveringerC}{%
\psyTick(\maerkerYa){\maerkerYb}
}
\end{pspicture}
}

\pagestyle{empty}

\begin{document}

\begin{figure}
\halveringer{5}
\end{figure}

\end{document}


The comments, labels, and macro names are Danish but changing them should be doable.

If you can improve further on the code, feel free to post your suggestion(s).

Usage

All you have to do is type \halveringer and give the number of halftimes as argument.

-

## closed as off-topic by David Carlisle, Svend Tveskæg, egreg, Werner, Scott H.Jun 28 '13 at 0:15

• This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

Why not become contributor at tex.blogoverflow:Topics-->PSTricks –  texenthusiast Jun 27 '13 at 22:58
Maybe a short mention of the changes you made could be useful. –  Laurent Jun 27 '13 at 22:59
This appears to be off-topic because it is not a question –  David Carlisle Jun 27 '13 at 23:04
@texenthusiast Unfortunately, I'm nowhere near good enough at using PSTricks for that. –  Svend Tveskæg Jun 27 '13 at 23:05
what kind of automation with more verbose description might help ? Nobody is good enough for anything until somebody pulls/streches to something :). –  texenthusiast Jun 27 '13 at 23:11