I'm working on a program to draw crystal unit cells with pgf/tikz. In the course of this project the question arose whether I should draw the constituent bonds and atoms using pgf Basic Layer commands or tikz commands. It's clear to me that some things like declaring shadings and such need to be done in pgf but I'm asking for situations where the exact same result can be achieved with Basic Layer or tikz commands. Can there be an advantage in using the more low level Basic Layer over the tikz commands in such situations or is it equivalent? Are there situations where I can/should use a pgfpicture but not a tikzpicture environment?
Edit: Since @percusse mentioned, that the answer might depend on the particular use case I will provide a small example: I plan to draw the atoms in the crystal unit cells I want to depict as circles with a spherelike shading. The following MWE contains two versions of such an "atom" which look exactly the same, one drawn solely with Basic Layer commands the other with tikz commands. For the sake of brevity I enclosed them in the same tikzpicture environment. The question would then be, if the Basic Layer version might be more easily tweakable or more compatible with PDF viewers or has any advantage at all over the tikz version? In terms of amount of code and readability the tikz version would clearly be preferable.
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\pgfdeclareradialshading{new}{\pgfqpoint{0bp}{0bp}}{%
color(0bp)=(blue);
color(6bp)=(blue!90!black);
color(20bp)=(black!75!blue);
color(30bp)=(black!85!blue)}
\begin{tikzpicture}
% tikz version
\begin{scope}
\clip (-1,0) circle (1cm);
\draw [fill=black!70] (0, 0) circle (1cm);
\begin{scope}[transform canvas={xshift=-1cm, rotate=45}]
\shade [shading=new] (0.00,0.50) ellipse (1.75 and 1.55);
\end{scope}
\node (nodename) at (-1, 0) [circle, minimum size = 2cm] {tikz};
\end{scope}
% Basic Layer version
\begin{pgfscope}
\pgfpathcircle{\pgfpoint{3cm}{0cm}}{1cm}
\pgfusepath{clip}
\begin{pgflowlevelscope}{\pgftransformshift{\pgfpoint{3cm}{0cm}}, \pgftransformrotate{45}}
\pgfpathellipse{\pgfpoint{0cm}{0.5cm}}
{\pgfpoint{1.75cm}{0cm}}
{\pgfpoint{0cm}{1.55cm}}
\pgfshadepath{new}{0}
\pgfusepath{}
\end{pgflowlevelscope}
\end{pgfscope}
{
\pgftransformshift{\pgfpoint{3cm}{0cm}}
\pgfset{minimum size=2cm}
\pgfnode{circle}{center}{pgf}{nodename}{
\pgfusepath{}}
}
\end{tikzpicture}
\end{document}


pgfpicturecompatible way. But I would prefer using sometikzcode for such things like the creation of nodes and maybe canvas transformations but only if nothing speaks against it. – Philipp Jul 22 '13 at 13:19tikzpictureenvironment. The second is the differences betweenpgfpictureandtikzpictureenvironments. You can use the packagepgfas a standalone package so I guess we have to narrow down the focus of the question or branch into two distinct ones to avoid the digressions. – percusse Jul 22 '13 at 13:21pgfpictureandtikzpicture. The mixing would only come into play if there is no advantage in using only the Basic Layer. Should I make another question concerning the mixing of Basic Layer and Front Layer commands and change the question title of this question? – Philipp Jul 22 '13 at 13:25tikzcommands where they can achieve what I want instead of Basic Layer commands. – Philipp Jul 22 '13 at 14:21tikzwas invented / published, I made a very extend collection ofpgfpictures for my lecture notes and other papers. Over the years, I am rewritting them step by step intotikzcode. The main reason is thattikzcode is much more compact, easier to understand when you look at it some years later, and, therefore, easier to maintain. So, from my experience, I would also recommend to use the front layer. – Thomas F. Sturm Jul 22 '13 at 15:19filloption for the sake of example), this would mean you would have to translate that part of your picture to pgf to fill it. However I am NOT aware of such cases. – ted Jul 22 '13 at 16:05