I am working on a paper on integer partitions and I want to add something like this. This is not my picture, it is from another paper, but is it possible to do this on LaTex? I want to be able to customize the amount of points and the labels on the points. Any help would be appreciatedenter image description here

  • 1
    Hi, welcome to TeX.SE! If you've not done so yet, have a look at pgf and TikZ.
    – chsk
    May 3 at 7:41
  • Anything you can imagine is possible to draw in latex.
    – hola
    May 10 at 0:38

I don't know exactly what kind of changes you will need, but perhaps this could be a starting point. My approach is basically to use calc library to compute the coordinates of the dots.

\usepackage    {amsmath} % for pmatrix
\usepackage    {tikz}
\usetikzlibrary{calc}    % for coordinates

                    line cap=round,line join=round]
  % coordinates
  \coordinate (A) at (\a,0,0);
  \coordinate (B) at (0,\b,0);
  \coordinate (C) at (0,0,\c);
  \coordinate (M) at ($(A)!0.5!(B)$);
  \coordinate (G) at ($(C)!{2/3}!(M)$);
  \foreach\i in {1,...,6}
  {% dots in olive and red lines
    \coordinate (A\i) at ($(A)!{\i/6}!(G)$);
    \coordinate (C\i) at ($(M)!{\i/6}!(G)$);
  % axes
  \draw (0,0,0) -- (\a+1,0,0);
  \draw (0,0,0) -- (0,\b+1,0);
  \draw (0,0,0) -- (0,0,\c+1);
  % other lines
  \draw[thick,olive] (A) -- ($(B)!0.5!(C)$);
  \draw[thick,gray]  (B) -- ($(A)!0.5!(C)$);
  \draw[thick,red]   (C) -- ($(A)!0.5!(B)$);
  \draw[thick,dashed,cyan]  (A) -- (B);
  \draw[thick]       (A) -- (C) -- (B);
  % dots
  \fill (G) circle (2pt);
  \foreach\i in {1,...,5}
    \foreach\j in {0,2,...,\np}
      \fill ($(A\i)!{\j/\np}!(C\i)$) circle (2pt);
  % labels
  \draw (G)  circle (3pt) --++ (2cm,3cm)
        node[right] {\small$\begin{pmatrix}6\\6\\6\end{pmatrix}$};
  \draw (A1) circle (3pt) --++ (-1cm,1cm)
        node[left]  {\small$\begin{pmatrix}16\\1\\1\end{pmatrix}$};
  \draw ($(A3)!{8/9}!(C3)$) circle (3pt) --++ (2cm,1cm)
        node[right] {\small$\begin{pmatrix}8\\7\\3\end{pmatrix}$};

enter image description here

  • Wow, thanks! That's just what I wanted!
    – Lewis
    May 3 at 15:15
  • Hello again, how would I add an extra line of dots under the very last row?
    – Lewis
    May 3 at 21:47
  • 2
    @Lewis, you only have to change the lines \foreach\i in {1,...,6} to \foreach\i in {0,...,6} and \foreach\i in {1,...,5} to \foreach\i in {0,...,5}. This sets how many lines of dots there are, and their heights. May 4 at 5:58

A reasonable choice for 3D graphics would be Asymptote:

// file  diag.asy
// run 
//     asy diag.asy
// to get a standalone image  diag.pdf
import graph3; size(200,0);
import fontsize; defaultpen(fontsize(7pt));
triple A,B,C,D,E,F,G,H,K,L; real r=0.3;
A=( 6,6,6); B=(18,0, 0); C=(9, 9,0);
D=( 8,0,3); E=( 0,0,18); F=(0,18,0);
G=( 0,9,9); H=( 9,0, 9); K=(16,1,1); L=( 8,7, 3);
void drop(guide3[] g, pen[] p){
  for(int i=0;i<g.length;++i) draw(project(g[i]),p[i]);
guide3[] line={B--E--F--cycle, B--G, E--C, F--H, 
A--E--B, O--20*Y, O--22*X, O--20*Z,};
pen[] p={darkblue,deepgreen,red,blue,}; p.cyclic=true;
for(int i=0;i<7;++i){
  for(int j=0;j<=9-i-ceil(i/2);++j){
void labLoc(triple V, triple P){
  pair v=project(V), p=project(P);
  draw(circle(v,r)); draw((v+r*dir(p-v))--p);

enter image description here

  • +1 surely. Please, have you seen this question? tex.stackexchange.com/questions/596306/…
    – Sebastiano
    May 9 at 21:19
  • 1
    @Sebastiano: I have, but it looks like pdfcrop solves it nicely, and it becomes more like a simple automation question, which can be solved by many means like e.g. catch files or just running asy twice. Of course, if the developers of the Asymptote can solve it that would be nice, but I don't think that efforts of reimplementing already existent functionality worth it, unless perhaps, if they know that if can be done easily by just a couples of code lines.
    – g.kov
    May 10 at 3:33
  • I thank you infinitely for your comprehensive explanation that I understood without using the translator. I thought it was a specific question for you and I know you are very good with Asymptote. I always wish you the best.
    – Sebastiano
    May 10 at 14:41

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.