# Fun with LaTeX

Here’s a quick diagram of the interior of a Sun-like star I used in a presentation not so long ago. The picture was generated with a bit of LaTeX code.  Here it is:

\documentclass{article}
\usepackage{pstricks}
\usepackage{pst-plot}
\usepackage{pst-coil}
\usepackage{pst-node}
\usepackage{pst-slpe}
\usepackage{multido}
\begin{document}

\psset{unit=1.2,yunit=1.2cm,xunit=1.2cm,algebraic}
\begin{pspicture*}(-1,-1)(5,4.7)

% Star

\pscustom[fillstyle=ccslope,slopecenter=0 0,slopebegin=yellow!30,slopeend=red!10!orange!60,linestyle=none]{\pswedge(0,0){4.5}{0}{90}}

% Core
\pscustom[fillstyle=ccslope,slopecenter=0 0,slopebegin=yellow!2,slopeend=orange!10,linestyle=none]{%
\pswedge(0,0){1.35}{0}{90}}

\SpecialCoor

% Radiative zone lines

\multido{\iA=5+15}{6}{\pnode(1.4;\iA){A}\pnode(3.15;\iA){B}\ncsin[linewidth=0.1pt,amplitude=0.05,periods=4,coilarm=0pt,function=dup 0.1 mul sin exch sin add]{A}{B}}

% Convective zone lines

\multido{\iB=7+15}{6}{\rput{\iB}(3.25;\iB){\pccurve[angleA=-70, angleB=250,linewidth=0.25pt,ArrowInside=->,ArrowInsideNo=3]{->}(0,0)(1.2,0)}
\rput{\iB}(3.25;\iB){\pccurve[angleA=110, angleB=70,linewidth=0.25pt,ArrowInside=->,ArrowInsideNo=3]{->}(1.2,0)(0,0)}}

% Axes and labels

\psaxes[labelFontSize=\scriptscriptstyle,labels=y,ticks=y,Dy=0.2,dy=0.9,linewidth=0.25pt,ticksize=-3pt 0]{-}(0,0)(4.5,4.5)
\tiny \rput[l](0.15,-0.3){Core}
\rput[l](1.5,-0.4){\parbox{1cm}{\centering Radiative \\ Zone}}
\rput[l](3.2,-0.4){\parbox{1cm}{\centering Convective \\ Zone}}
\end{pspicture*}

\end{document}

## 6 Comments

1. Bruno Lustosa says:

Thank you so much Dr A. Jannetta. I will be indicate you on my thesis. I will include this modify picture as it on the text. Cheers!

1. Dr Adrian Jannetta says:

You’re very welcome Bruno. Good luck with your thesis!

2. Bruno Lustosa says:

Sorry Adrian It did not work…

1. Dr Adrian Jannetta says:

I’ll try to help. Some of the packages may not be installed in LaTeX distribution by default (e.g. pst-slpe). You should check. Take a look at the .log file generated when you compile and look for errors in there. If you’d prefer to correspond by email – you can reach me on adrian@themoon.co.uk.

2. Dr Adrian Jannetta says:

Also, make sure your compiling like this.

>> latex sun.tex
>> dvips sun.dvi
>> ps2pdf sun.ps

So LaTeX > DVI > Postscript > PDF.

It also compiles to PDF with XeLaTeX:

>> xelatex sun.tex

Hope that helps!

1. Bruno Lustosa says:

Hi Adrian
I sent to you a email include all files that I tried
Compile. In my pc it did not work. Let me know if the code are correct.