2

I am trying to draw a nuclides chart in tikz. But when I look at the different elements names (C, Be, etc.) I notice that my text does not seem to be vectorial... What is very strange is that some of them are (look at the n for example, look at the exponents) and I can zoom all the way but others aren't (the C of Carbon, the Ca of calcium etc.). Why is that?

Here is a MWE

\documentclass{standalone}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\usepackage{mathtools}
\usepackage{amssymb}
\usepackage{amsthm}

\usepackage{color}

\usepackage{tikz}   % drawing
\usetikzlibrary
{
    arrows,
    shadings,
    shapes,
}
\tikzset{>=stealth'}

\begin{document}

    \pgfdeclareradialshading{sphereK}{\pgfpoint{-0.4cm}{0.4cm}}% 
    {rgb(0cm)=(0.3,0.3,0.3); rgb(1cm)=(0.05,0.05,0.05); rgb(2cm)=(0,0,0)}
    \pgfdeclareradialshading{sphereR}{\pgfpoint{-0.4cm}{0.4cm}}% 
    {rgb(0cm)=(1,0,0); rgb(1cm)=(0.5,0,0); rgb(2cm)=(0.2,0,0)}
    \pgfdeclareradialshading{sphereB}{\pgfpoint{-0.4cm}{0.4cm}}% 
    {rgb(0cm)=(0,0,1); rgb(1cm)=(0,0,0.5); rgb(2cm)=(0,0,0.2)}
    \pgfdeclareradialshading{sphereG}{\pgfpoint{-0.4cm}{0.4cm}}% 
    {rgb(0cm)=(0,0.7,0); rgb(1cm)=(0,0.4,0); rgb(2cm)=(0,0.3,0)}
    \pgfdeclareradialshading{sphereP}{\pgfpoint{-0.4cm}{0.4cm}}% 
    {rgb(0cm)=(1,0.4,0.4); rgb(1cm)=(0.75,0.35,0.35); rgb(2cm)=(0.5,0.3,0.3)}
    \pgfdeclareradialshading{sphereN}{\pgfpoint{-0.4cm}{0.4cm}}% 
    {rgb(0cm)=(0.4,0.6,1); rgb(1cm)=(0.3,0.45,0.75); rgb(2cm)=(0.2,0.3,0.5)}

    \begin{tikzpicture}
        \tikzstyle{stable}=[draw=black, shape = rectangle,inner sep=0pt, shading = sphereK, minimum size=1cm];
        \tikzstyle{oneP}=[draw=black, shape = rectangle, inner sep=0pt, shading = sphereR, minimum size=1cm];
        \tikzstyle{oneN}=[draw=black,shape = rectangle, inner sep=0pt, shading = sphereB, minimum size=1cm];
        \tikzstyle{twoN}=[draw=black,shape = rectangle, inner sep=0pt, shading = sphereG, minimum size=1cm];
        \tikzstyle{nucP}=[draw=black,shape = rectangle, inner sep=0pt, shading = sphereP, minimum size=1cm];
        \tikzstyle{nucN}=[draw=black,shape = rectangle, inner sep=0pt, shading = sphereN, minimum size=1cm];    %

        \node[nucN, text=white] at (1cm,0cm) {$n$};
        \node[stable, text = white] (H1) at (0cm,1cm) {$^1$H};
        \node[oneN, text = white] (H2) at (1cm,1cm) {$^2$C};
        \node[nucP, text = white] (H3) at (2cm,1cm) {$^3$B};
        \node[twoN, text = white] at (1cm,2cm) {$^3$Ne};
        \node[oneP, text = white] at (2cm,2cm) {$^4$Ca};
        \end{tikzpicture}

\end{document}

And here is a screen capture of what is rendered when I zoom in the pdf:

enter image description here

  • 1
    This must be a viewer issue, i.e. I cannot reproduce the issue when compiling your code on my updated TeXLive 2019 installation and view the result with standard viewers. So you may want to add how you compile and which viewer you use. Ceterum censeo \tikzstyle deprecated esse. – Schrödinger's cat Oct 14 '19 at 8:58
  • What would you advice to use instead of \tikzstyle ? – mwoua Oct 14 '19 at 9:08
  • E.g. \tikzstyle{stable}=[draw=black, shape = rectangle,inner sep=0pt, shading = sphereK, minimum size=1cm]; goes to \tikzset{stable/.style={draw=black, shape = rectangle,inner sep=0pt,shading = sphereK, minimum size=1cm}}. Note that the ; at the end of \tikzstyle is unnecessary but you should get rid of the \tikzstyles anyway. – Schrödinger's cat Oct 14 '19 at 9:18
  • 2
    You need to test which kind of fonts are you using. If you have some Type 3 fonts, this behaviour is normal. Open your pdf file with AdobeReader or any other viewer which shows used fonts and test it. In my MikTeX system I see a Type 3 font with your code and everything is correct when I add lmodern package. – Ignasi Oct 14 '19 at 9:25
  • 1
    @Schrödinger'scat I changed everything to \tikzset, even though it didn't solve the issue. I'll try to keep that in mind, thanks for the tip. @Ignasi It is indeed a Type 3. The lmodern package solved it. Do you want to write an answer so that I accept it? Or do I do it? Anyway, thank you! However, I still don't understand one thing... why the n of neutron is vectorial but the rest is not? – mwoua Oct 14 '19 at 9:51
2

The problem could be a viewer issue or that a Type 3 font is used. To be sure about the second option you can use pdffonts command which lists all fonts included into a pdf file:

enter image description here

or open the pdf result into a viewer (Adobe Reader, PDF-X Change Viewer, ...) which can list fonts:

enter image description here

If Type 3 fonts are used, like is shown in this case, the problem can be solved with cm-super font (which MikTeX doesn't install by default) or load any other Type 1 font like lmodern

\documentclass{standalone}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{lmodern}

\usepackage{mathtools}
\usepackage{amssymb}
\usepackage{amsthm}

\usepackage{color}

\usepackage{tikz}   % drawing
\usetikzlibrary
{
    arrows,
    shadings,
    shapes,
}
\tikzset{>=stealth'}

\begin{document}

    \pgfdeclareradialshading{sphereK}{\pgfpoint{-0.4cm}{0.4cm}}% 
    {rgb(0cm)=(0.3,0.3,0.3); rgb(1cm)=(0.05,0.05,0.05); rgb(2cm)=(0,0,0)}
    \pgfdeclareradialshading{sphereR}{\pgfpoint{-0.4cm}{0.4cm}}% 
    {rgb(0cm)=(1,0,0); rgb(1cm)=(0.5,0,0); rgb(2cm)=(0.2,0,0)}
    \pgfdeclareradialshading{sphereB}{\pgfpoint{-0.4cm}{0.4cm}}% 
    {rgb(0cm)=(0,0,1); rgb(1cm)=(0,0,0.5); rgb(2cm)=(0,0,0.2)}
    \pgfdeclareradialshading{sphereG}{\pgfpoint{-0.4cm}{0.4cm}}% 
    {rgb(0cm)=(0,0.7,0); rgb(1cm)=(0,0.4,0); rgb(2cm)=(0,0.3,0)}
    \pgfdeclareradialshading{sphereP}{\pgfpoint{-0.4cm}{0.4cm}}% 
    {rgb(0cm)=(1,0.4,0.4); rgb(1cm)=(0.75,0.35,0.35); rgb(2cm)=(0.5,0.3,0.3)}
    \pgfdeclareradialshading{sphereN}{\pgfpoint{-0.4cm}{0.4cm}}% 
    {rgb(0cm)=(0.4,0.6,1); rgb(1cm)=(0.3,0.45,0.75); rgb(2cm)=(0.2,0.3,0.5)}

    \begin{tikzpicture}
        \tikzstyle{stable}=[draw=black, shape = rectangle,inner sep=0pt, shading = sphereK, minimum size=1cm];
        \tikzstyle{oneP}=[draw=black, shape = rectangle, inner sep=0pt, shading = sphereR, minimum size=1cm];
        \tikzstyle{oneN}=[draw=black,shape = rectangle, inner sep=0pt, shading = sphereB, minimum size=1cm];
        \tikzstyle{twoN}=[draw=black,shape = rectangle, inner sep=0pt, shading = sphereG, minimum size=1cm];
        \tikzstyle{nucP}=[draw=black,shape = rectangle, inner sep=0pt, shading = sphereP, minimum size=1cm];
        \tikzstyle{nucN}=[draw=black,shape = rectangle, inner sep=0pt, shading = sphereN, minimum size=1cm];    %

        \node[nucN, text=white] at (1cm,0cm) {$n$};
        \node[stable, text = white] (H1) at (0cm,1cm) {$^1$H};
        \node[oneN, text = white] (H2) at (1cm,1cm) {$^2$C};
        \node[nucP, text = white] (H3) at (2cm,1cm) {$^3$B};
        \node[twoN, text = white] at (1cm,2cm) {$^3$Ne};
        \node[oneP, text = white] at (2cm,2cm) {$^4$Ca};
        \end{tikzpicture}

\end{document}

enter image description here

  • 2
    You should probably mention that the missing cm-super issue is well known to miktex. – daleif Oct 15 '19 at 8:16
  • @daleif Thank you for the comment. I've added it. In any case, feel free to edit my answer as you like. – Ignasi Oct 15 '19 at 8:32

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.