3

I find no solution to

1) shift the circle to another origin as (0,0). As you can see in picture two th pic is "distorted"(same for circular sectors!)?. The placement should be arbitrarily on a chosen papersize.

2) implement a definite papersize (want to choose A4 or A5) without margins. Perhaps via standalone package? Current output in this respect ok, but paperdimensions are not. Nota: the mentioning of paperwidth and height for the black background changes to a letter format (where comes this from?)

\documentclass[tikz,border=0mm]{standalone}
\usepackage{color}
\usetikzlibrary{math,}


\definecolor{clr1}{RGB}{0.00,0.00,0.00}
\definecolor{clr2}{RGB}{40,0.00,40}%
\definecolor{clr3}{RGB}{60,0,60}%
\definecolor{clr4}{RGB}{80,0,80}% 
\definecolor{clr5}{RGB}{100,255,100}%
\definecolor{clr6}{RGB}{139,0,139}%
\tikzset{
%%
%%
shade radial/.code={%
\tikzset{%
        color four radial/.cd,% 
        #1,
        cfradial
       }%end second(!) tikzset
},%end code shade radial!
%
color four radial/.cd,%causes default path to be set to key(color four radial)  
                  shade radial color/.code n args={2} 
{\colorlet{cfradialcolor#1}{#2}},
                                           shade radial color={1}{black},
                                           shade radial color={2}{black},
                                           shade radial color={3}{white},
                                           shade radial color={4}{white},
                                           shade radial color={5}{purple},
                                           shade radial color={6}{purple},
%
cfradial/.style={/tikz/path picture={
                                 \xdef\radius{\radius}
                                 \pgfmathsetmacro{\rone}{0.65*\radius}
                                 \pgfmathsetmacro{\rtwo}{0.90*\radius}
                                 \pgfmathsetmacro{\rthree}{0.98*\radius}
                                 \pgfmathsetmacro{\rfour}{0.99*\radius}
                                 \pgfdeclareradialshading[cfradialcolor1,cfradialcolor2,cfradialcolor3,cfradialcolor4,cfradialcolor5,cfradialcolor6]
                                                         {cfradial}%shading name s. 3.01a, p. 1083
                                                         {\centerpoint}%center point 
                                                         {color(0pt)=(cfradialcolor1); %color specifications
                                                          color(\rone pt)=(cfradialcolor2);
                                                          color(\rtwo pt)=(cfradialcolor3);
                                                          color(\rthree pt)=(cfradialcolor4);
                                                          color(\rfour pt)=(cfradialcolor5);
                                                          color(\radius)=(cfradialcolor6) %
                                                         }
                                  \typeout{\radius,\rone,\rtwo}
                                  \pgfuseshading{cfradial}
                                 }%end path picture
             }%end style cfradial
%%
%%
}%%en
\begin{document}

\begin{tikzpicture}%

\newdimen\circleradius

\tikzmath{
   \circleradius=14.0 cm;
}%end tikzmath

\coordinate (circleorig) at (-1cm,0cm);%%wrong if differs from (0,0)


\tikzset{
  recstyle/.style={minimum height=\paperheight,minimum width=\paperwidth,rectangle,draw=blue!50,fill=black!100,thick}
}
\node at (circleorig)  [recstyle]{background black};

\node [shape=circle, opacity=.5,
      inner sep=0cm,
      shade radial={
                    shade radial color={1}{clr1},
                    shade radial color={2}{clr2},
                    shade radial color={3}{clr3},
                    shade radial color={4}{clr4},
                    shade radial color={5}{clr5},
                    shade radial color={6}{clr6}
                   },%the one parameter of shade radial
      minimum size = \circleradius,
      font=\sffamily
     ] 
  (thecircle) at (circleorig) {do};
\end{tikzpicture} 
\end{document}

no distortion on (0,0)

enter image description here

I have tried bounding boxes and many more but my faculties are too small to get wished output.

3

I have mixed up Latex and Tikz to solve the problem. The whole correct shaded picture is set into a minipage, which takes as much room as the picture, beside marginal borders, which can perhaps eliminated by Latex means if needed(new question).

The minipage will be moved left and right by values of hspace, up and down by vspace.

\documentclass[a4paper]{scrartcl}
\usepackage[margin=0cm,showframe]{geometry}

\usepackage{color}
\usepackage{tikz}
\usetikzlibrary{math,}


\definecolor{clr1}{RGB}{0.00,0.00,0.00}
\definecolor{clr2}{RGB}{40,0.00,40}%
\definecolor{clr3}{RGB}{60,0,60}%
\definecolor{clr4}{RGB}{80,0,80}%
\definecolor{clr5}{RGB}{100,255,100}%
\definecolor{clr6}{RGB}{139,0,139}%
\tikzset{
%%
%%
shade radial/.code={%
\tikzset{%
        color four radial/.cd,% 
        #1,
        cfradial
       }%end second(!) tikzset
},%end code shade radial!
%
color four radial/.cd,%causes default path to be set to key(color four radial)  
                  shade radial color/.code n args={2}{\colorlet{cfradialcolor#1}{#2}},
                                           shade radial color={1}{black},
                                           shade radial color={2}{black},
                                           shade radial color={3}{white},
                                           shade radial color={4}{white},
                                           shade radial color={5}{purple},
                                           shade radial color={6}{purple},
%
cfradial/.style={/tikz/path picture={
                                 \xdef\radius{\radius}
                                 \pgfmathsetmacro{\rone}{0.65*\radius}
                                 \pgfmathsetmacro{\rtwo}{0.90*\radius}
                                 \pgfmathsetmacro{\rthree}{0.98*\radius}
                                 \pgfmathsetmacro{\rfour}{0.99*\radius}
                                 \pgfdeclareradialshading[cfradialcolor1,cfradialcolor2,cfradialcolor3,cfradialcolor4,cfradialcolor5,cfradialcolor6]
                                                         {cfradial}%shading name s. 3.01a, p. 1083
                                                         {\centerpoint}%center point 
                                                         {color(0pt)=(cfradialcolor1); %color specifications
                                                          color(\rone pt)=(cfradialcolor2);
                                                          color(\rtwo pt)=(cfradialcolor3);
                                                          color(\rthree pt)=(cfradialcolor4);
                                                          color(\rfour pt)=(cfradialcolor5);
                                                          color(\radius)=(cfradialcolor6) %
                                                         }
                                  \typeout{\radius,\rone,\rtwo}
                                  \pgfuseshading{cfradial}
                                 }%end path picture
             }%end style cfradial
%%
%%
}%%end first tikzset

\begin{document}
%old code for black background replaced by this: 
%https://tex.stackexchange.com/questions/56716/shading-over-a-single-page?rq=1
%replace white and orange by black and the job is done
\begin{tikzpicture}[remember picture,overlay]
   \shade[left color=white,right color=orange!60]
      (current page.south west) rectangle (current page.north east);
\end{tikzpicture}

%height above the picture. adding to vspace sets the circle lower
\vspace*{40mm}
%if zero, circle on most left place. adding to hspace shifts the circle to right side
\hspace*{50mm}
%\fbox{%just to see the minipage
\begin{minipage}{145mm}
\begin{tikzpicture}%

\newdimen\circleradius

\tikzmath{\circleradius=14.0 cm;}%end tikzmath

\coordinate (circleorig) at (0cm,0cm);

 \node [shape=circle, 
      inner sep=0cm,
      shade radial={
                    shade radial color={1}{clr1},
                    shade radial color={2}{clr2},
                    shade radial color={3}{clr3},
                    shade radial color={4}{clr4},
                    shade radial color={5}{clr5},
                    shade radial color={6}{clr6}
                   },%the one parameter of shade radial
      minimum size = \circleradius,
      font=\sffamily
     ] 
  (thecircle) at (circleorig) {do};
\end{tikzpicture} 
\end{minipage}
%}%end fbox
\end{document}

enter image description here enter image description here

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.