4

I'm not sure where to put this question, but is it possible to create a graphical element with six dots in pyramid shape with Latex?

I cannot find this symbol from Unicode character blocks, so I guess next try is to make it with Latex or similar method. And if this is not working then just accepting png image...

Below symbol T3=6 is the one I'm trying to make.

Pyramidical shape of dots

6

You can do it with tikz. See the comments in the \pyrdot command definition.

enter image description here

\documentclass[11pt]{article}
\usepackage{tikz}
\usetikzlibrary{calc}

\newcommand{\pyrdot}[1]{
    % you can tune the size of the pyramid using the scale option
    \begin{tikzpicture}[scale=.4] 
        \pgfmathsetmacro{\n}{#1}                            % define \n, the number of rows 
        \edef\m{0}                                          % define \m, the total number of circles
        \foreach \i in {1, ..., \n} {                       % vertical loop
            \foreach \k in {1, ..., \i} {                   % horizontal loop
                \fill ($(\k,-\i)+(-.5*\i,0)$) circle (4mm); % draw the circle (size = 4mm, shifted to the left)
                \pgfmathparse{int(\m+1)}                    % increment \m
                \xdef\m{\pgfmathresult}
            }
        }
        % put the text below the pyramid
        \node[anchor=north] at (current bounding box.south) {$T_{\n}=\m$};
    \end{tikzpicture}
}

\begin{document}

\section{pyramidical dots}
\pyrdot{1}
\pyrdot{2}
\pyrdot{3}
\pyrdot{4}
\pyrdot{5}
\pyrdot{6}

\end{document}

References

2
  • It would be helpful to explain and give a reference to tikz, plus give a small explanation of the pgfmathsetmacro, what it is doing. I tried this at overleaf.com and it was working perfectly.
    – MarkokraM
    Feb 17 '16 at 16:31
  • @MarkokraM Please see the edits.
    – sergej
    Feb 18 '16 at 10:06

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.