How to determine nodes to reduce their length using `tikzpicture` environmentChecking whether or not a node has been previously definedHow to draw a diagram of custom subject correlativitiesHow to insert elective subjects section within a diagramHow to modify nodes in TikZ to automatically add a line on their top?How to reduce the space between nodes?How to reduce the render of tikzpictureTikZ/ERD: node (=Entity) label on the insideHow to reduce length of and edge between two nodes without affecting a custom line marker?How to reduce the fill in many nodes for tikzTikZ: Using current length inside scope environmentHow to move tikzpicture with named nodes?How to create an ER diagram using tikzpicture environmentHow to draw this rectangle using tikzpicture environment

Have any astronauts/cosmonauts died in space?

What (if any) is the reason to buy in small local stores?

What is it called when someone votes for an option that's not their first choice?

10 year ban after applying for a UK student visa

Print last inputted byte

How can a new country break out from a developed country without war?

How to balance a monster modification (zombie)?

Why didn't Héctor fade away after this character died in the movie Coco?

Exposing a company lying about themselves in a tightly knit industry: Is my career at risk on the long run?

Writing in a Christian voice

Is "inadequate referencing" a euphemism for plagiarism?

Turning a hard to access nut?

Animating wave motion in water

Should a narrator ever describe things based on a characters view instead of fact?

The English Debate

Should I be concerned about student access to a test bank?

CLI: Get information Ubuntu releases

Determine voltage drop over 10G resistors with cheap multimeter

"Marked down as someone wanting to sell shares." What does that mean?

How do researchers send unsolicited emails asking for feedback on their works?

How to test the sharpness of a knife?

Unfrosted light bulb

Why is participating in the European Parliamentary elections used as a threat?

TDE Master Key Rotation



How to determine nodes to reduce their length using `tikzpicture` environment


Checking whether or not a node has been previously definedHow to draw a diagram of custom subject correlativitiesHow to insert elective subjects section within a diagramHow to modify nodes in TikZ to automatically add a line on their top?How to reduce the space between nodes?How to reduce the render of tikzpictureTikZ/ERD: node (=Entity) label on the insideHow to reduce length of and edge between two nodes without affecting a custom line marker?How to reduce the fill in many nodes for tikzTikZ: Using current length inside scope environmentHow to move tikzpicture with named nodes?How to create an ER diagram using tikzpicture environmentHow to draw this rectangle using tikzpicture environment













0















This is and addendum of a previous question: How to insert elective subjects section within a diagram.



What I want



I would like to reduce the length of those nodes that only have a single column of a matrix environment of the Tikz package but keeping the same space between nodes. If possible, also do it automatically (it is not necessary at all, just know what the necessary commands are):



What I want



What I have done



MWE:



All the following source code belongs to marmot in the incredible accepted answer of the attached question. I only modified the nodes and things like that.



documentclassarticle
usepackage[margin=0in,footskip=0in,paperwidth=95cm,paperheight=29cm]geometry
usepackage[english]babel
usepackage[utf8]inputenc
usepackage[T1]fontenc
usepackagehyperref

usepackagetikz
usetikzlibrarypositioning,backgrounds,fit,calc
tikzset
text field/.style=text height=1.5ex,align=center,rounded corners,
nonfillable title field/.style=text height=2ex,text depth=0.3em,anchor=south,text
width=5cm,align=center,font=footnotesizesffamily,
fillable title field/.style=text height=3.14ex,text depth=0em,anchor=south,text
width=5cm,align=center,font=footnotesizesffamily,
pics/fillable subject/.style=code=- (-Title.south west)
,
pics/nonfillable subject/.style=code=- (-Title.south west)
,
pics/fillable elective subject/.style=code= (-TF.south east)
-- cycle;
draw ([xshift=4pt]-Title.south west) -- ([xshift=-4pt]-Title.south east);
,
pics/nonfillable elective subject/.style=code=- (-Title.north east) -- (-Title.south east) -,
manoooh/.style=column sep=-1.75cm,row sep=5mm,
manooohE/.style=column sep=-2.25cm,row sep=5mm,anchor=south,
electives/.style=column sep=-7.25cm,row sep=5mm,
fit sep/.initial=4pt, % change width of node (big rectangle shape)
fit dist/.initial=3cm, % change node distance (big rectangle shape)
inlay top sep/.initial=24pt,
matrix top sep/.initial=24pt,
% From https://tex.stackexchange.com/a/478723/152550

makeatletter% from https://tex.stackexchange.com/a/85531/121799
longdefifnodedefined#1#2#3%
@ifundefinedpgf@sh@ns@#1#3#2%

makeatother

begindocument
thispagestyleempty % To suppress page number
noindent
begintikzpicture
fill[white,fill=orange] (0,0) rectangle (paperwidth,-2cm) node[midway,align=center,font=Huge] bfseries Some text here\LARGE More text here;
endtikzpicture

ifdefinedmymatdist
%typeoutgotspacemymatdist
else
typeoutPleasespace recompilespace yourspace file!
defmymatdist150pt
fi
ifdefinedmymatbottom
%typeoutgotspacemymatbottom
else
typeoutPleasespace recompilespace yourspace file!
defmymatbottom-150pt
fi
ifdefinedmyheight
else
defmyheight0
typeoutPleasespace recompilespace yourspace file!
fi
ifdefinedLstMatShifts
else
defLstMatShifts0pt,0pt,0pt,0pt,0pt
fi
%typeoutheight:myheight
%typeoutshifts(in):LstMatShifts

vfill
centering
beginForm
begintikzpicture
% step 1: add the matrices, name them mat0, mat1 etc.
beginscope[local bounding box=matrices]
matrix[manoooh] (mat0) at (0*mymatdist,LstMatShifts[0])
& pic[local bounding box=A] (A) nonfillable subject=Subject A; & \
& pic (B) nonfillable subject=Subject B; & \
;
matrix[manoooh] (mat1) at (1*mymatdist,LstMatShifts[1])
& pic (C) nonfillable subject=Subject C; & \
& pic (D) nonfillable subject=Subject D; & \
& pic (E) nonfillable subject=Subject E; & \
& pic (F) nonfillable subject=Subject F; & \
& pic (G) nonfillable subject=Subject G; & \
& pic (H) nonfillable subject=Subject H; & \
& pic (I) nonfillable subject=Subject I; & \
& pic[draw=red] (J) nonfillable subject=Subject J; & \
;
matrix[manoooh] (mat2) at (2*mymatdist,LstMatShifts[2])
& pic[draw=red] (K) nonfillable subject=Subject K; & \
& pic (L) nonfillable subject=Subject L; & \
& pic (M) nonfillable subject=Subject A; & \
& pic (N) nonfillable subject=Subject N; & \
& pic (O) nonfillable subject=Subject O; & \
& pic (P) nonfillable subject=Subject P; & \
& pic (Q) nonfillable subject=Subject Q; & \
& pic (R) nonfillable subject=Subject R; & \
;
matrix[manoooh] (mat3) at (3*mymatdist,LstMatShifts[3])
& pic[draw=red] (S) nonfillable subject=Subject S; & \
& pic (T) nonfillable subject=Subject T; & \
& pic (U) nonfillable subject=Subject U; & \
& pic (V) nonfillable subject=Subject V; & \
& pic (W) nonfillable subject=Subject W; & \
& pic (X) nonfillable subject=Subject X; & \
& pic (Y) nonfillable subject=Subject Y; & \
& pic (Z) nonfillable subject=Subject Z; & \
;
matrix[manooohE,column sep=8pt] (matE3) at (3*mymatdist,mymatbottom)
pic (L3E1) nonfillable elective subject=Subject; &
pic (L3E2) nonfillable elective subject=Subject; \
;
matrix[manoooh] (mat4) at (4*mymatdist,LstMatShifts[4])
& pic[draw=red] (AA) nonfillable subject=Subject AA; & \
pic (AB) nonfillable subject=Subject AB; & & pic (AC) nonfillable subject=Subject AC; \
& pic (AD) nonfillable subject=Subject AD; & \
& pic (AE) nonfillable subject=Subject AE; & \
& pic (AF) nonfillable subject=Subject AF; & \
& pic (AG) nonfillable subject=Subject AG; & \
;
matrix[manooohE] (matE4) at (4*mymatdist,mymatbottom)
pic (L4E1) nonfillable elective subject=Subject; \
;
matrix[manoooh] (mat5) at (5*mymatdist,LstMatShifts[5])
& pic (AH) nonfillable subject=Subject AH; & \
& pic (AI) nonfillable subject=Subject AI; & \
& pic[draw=red] (AJ) nonfillable subject=Subject AJ; & \
& pic (AK) nonfillable subject=Subject AK; & \
;
matrix[manooohE] (matE5) at (5*mymatdist,mymatbottom)
& pic (L5E1) nonfillable elective subject=Subject; & \
& pic (L5E2) nonfillable elective subject=Subject; & \
& pic (L5E3) nonfillable elective subject=Subject; & \
& pic (L5E4) nonfillable elective subject=Subject; & \
& pic (L5E5) nonfillable elective subject=Subject; & \
;
endscope
pgfmathsetmacromywidth0
foreach X in 0,...,5 %<- if you have more or less matrices, adjust 3

ifnodedefinedmatEX% has inlay
path let p1=($(matX.north east)-(matX.south west)$),
p2=($(matEX.north east)-(matEX.south west)$)
in
pgfextrapgfmathsetmacromywidthmax(x1,mywidth)
pgfmathsetmacromyheightmax(y1+y2+%
pgfkeysvalueof/tikz/inlay top sep+pgfkeysvalueof/tikz/matrix top sep,%
myheight)
xdefmywidthmywidthxdefmyheightmyheight
pgfmathsetmacromyshift(pgfkeysvalueof/tikz/inlay top sep+y2)/2
ifnumX=0
xdefLstMatShiftsmyshift pt
else
xdefLstMatShiftsLstMatShifts,myshift pt
fi;% no inlay
path
let p1=($(matX.north east)-(matX.south west)$) in
pgfextrapgfmathsetmacromywidthmax(x1,mywidth)
pgfmathsetmacromyheightmax(y1+pgfkeysvalueof/tikz/matrix top sep,myheight)
xdefmywidthmywidthxdefmyheightmyheight;
ifnumX=0
xdefLstMatShifts0pt
else
xdefLstMatShiftsLstMatShifts,0pt
fi

node[anchor=south,yshift=1cm,align=center,font=LARGEbfseriesboldmath]
at (matX
%typeoutheight1:myheight %
%
pgfmathsetmacromydistmywidth+2*pgfkeysvalueof/tikz/fit
sep+pgfkeysvalueof/tikz/fit dist
xdefmydistmydist
defmymatbottom0pt
foreach X in 0,...,5 %
ifnodedefinedmatEXpath let p1=($(matX.north)-(matX.south)$),
p2=($(matEX.north)-(matEX.south)$),
n1=max(abs(y1)/2+abs(y2)+2*pgfkeysvalueof/tikz/inlay top sep,mymatbottom)
in pgfextraxdefmymatbottomn1
node[anchor=south east,xshift=-3cm,font=LARGEbfseries] (ElX)
at (matEX.north)Electives;
beginscope[on background layer]
node[fit=(matEX) (ElX)] (FEX);
fill[blue!30,rounded corners=30pt] (X*mymatdist-
mymatdist/2+pgfkeysvalueof/tikz/fit dist/4+10pt,0
%typeoutshifts(end):LstMatShifts
makeatletter
immediatewrite@mainauxxdefstringmymatdistmydist ptrelax
immediatewrite@mainauxxdefstringmymatbottom-mymatbottomrelax
immediatewrite@mainauxxdefstringmyheightmyheightrelax
immediatewrite@mainauxxdefstringLstMatShiftsLstMatShiftsrelax
makeatother

% now add the arrows
foreach X in C,D,E,F,G,H,I,J
draw[very thick,blue,-latex] (A-Title) to[out=0,in=180] (X-Title);
draw[very thick,red,-latex] (B-Title) to[out=0,in=180] (X-Title);

foreach X in L,O
draw[very thick,orange,-latex] (C-Title) to[out=0,in=180] (X-Title);

foreach X in K,N,O,Z
draw[very thick,green,-latex] (D-Title) to[out=0,in=180] (X-Title);

endtikzpicture
endForm

vfill

enddocument


What I have done



Thanks!!










share|improve this question


























    0















    This is and addendum of a previous question: How to insert elective subjects section within a diagram.



    What I want



    I would like to reduce the length of those nodes that only have a single column of a matrix environment of the Tikz package but keeping the same space between nodes. If possible, also do it automatically (it is not necessary at all, just know what the necessary commands are):



    What I want



    What I have done



    MWE:



    All the following source code belongs to marmot in the incredible accepted answer of the attached question. I only modified the nodes and things like that.



    documentclassarticle
    usepackage[margin=0in,footskip=0in,paperwidth=95cm,paperheight=29cm]geometry
    usepackage[english]babel
    usepackage[utf8]inputenc
    usepackage[T1]fontenc
    usepackagehyperref

    usepackagetikz
    usetikzlibrarypositioning,backgrounds,fit,calc
    tikzset
    text field/.style=text height=1.5ex,align=center,rounded corners,
    nonfillable title field/.style=text height=2ex,text depth=0.3em,anchor=south,text
    width=5cm,align=center,font=footnotesizesffamily,
    fillable title field/.style=text height=3.14ex,text depth=0em,anchor=south,text
    width=5cm,align=center,font=footnotesizesffamily,
    pics/fillable subject/.style=code=- (-Title.south west)
    ,
    pics/nonfillable subject/.style=code=- (-Title.south west)
    ,
    pics/fillable elective subject/.style=code= (-TF.south east)
    -- cycle;
    draw ([xshift=4pt]-Title.south west) -- ([xshift=-4pt]-Title.south east);
    ,
    pics/nonfillable elective subject/.style=code=- (-Title.north east) -- (-Title.south east) -,
    manoooh/.style=column sep=-1.75cm,row sep=5mm,
    manooohE/.style=column sep=-2.25cm,row sep=5mm,anchor=south,
    electives/.style=column sep=-7.25cm,row sep=5mm,
    fit sep/.initial=4pt, % change width of node (big rectangle shape)
    fit dist/.initial=3cm, % change node distance (big rectangle shape)
    inlay top sep/.initial=24pt,
    matrix top sep/.initial=24pt,
    % From https://tex.stackexchange.com/a/478723/152550

    makeatletter% from https://tex.stackexchange.com/a/85531/121799
    longdefifnodedefined#1#2#3%
    @ifundefinedpgf@sh@ns@#1#3#2%

    makeatother

    begindocument
    thispagestyleempty % To suppress page number
    noindent
    begintikzpicture
    fill[white,fill=orange] (0,0) rectangle (paperwidth,-2cm) node[midway,align=center,font=Huge] bfseries Some text here\LARGE More text here;
    endtikzpicture

    ifdefinedmymatdist
    %typeoutgotspacemymatdist
    else
    typeoutPleasespace recompilespace yourspace file!
    defmymatdist150pt
    fi
    ifdefinedmymatbottom
    %typeoutgotspacemymatbottom
    else
    typeoutPleasespace recompilespace yourspace file!
    defmymatbottom-150pt
    fi
    ifdefinedmyheight
    else
    defmyheight0
    typeoutPleasespace recompilespace yourspace file!
    fi
    ifdefinedLstMatShifts
    else
    defLstMatShifts0pt,0pt,0pt,0pt,0pt
    fi
    %typeoutheight:myheight
    %typeoutshifts(in):LstMatShifts

    vfill
    centering
    beginForm
    begintikzpicture
    % step 1: add the matrices, name them mat0, mat1 etc.
    beginscope[local bounding box=matrices]
    matrix[manoooh] (mat0) at (0*mymatdist,LstMatShifts[0])
    & pic[local bounding box=A] (A) nonfillable subject=Subject A; & \
    & pic (B) nonfillable subject=Subject B; & \
    ;
    matrix[manoooh] (mat1) at (1*mymatdist,LstMatShifts[1])
    & pic (C) nonfillable subject=Subject C; & \
    & pic (D) nonfillable subject=Subject D; & \
    & pic (E) nonfillable subject=Subject E; & \
    & pic (F) nonfillable subject=Subject F; & \
    & pic (G) nonfillable subject=Subject G; & \
    & pic (H) nonfillable subject=Subject H; & \
    & pic (I) nonfillable subject=Subject I; & \
    & pic[draw=red] (J) nonfillable subject=Subject J; & \
    ;
    matrix[manoooh] (mat2) at (2*mymatdist,LstMatShifts[2])
    & pic[draw=red] (K) nonfillable subject=Subject K; & \
    & pic (L) nonfillable subject=Subject L; & \
    & pic (M) nonfillable subject=Subject A; & \
    & pic (N) nonfillable subject=Subject N; & \
    & pic (O) nonfillable subject=Subject O; & \
    & pic (P) nonfillable subject=Subject P; & \
    & pic (Q) nonfillable subject=Subject Q; & \
    & pic (R) nonfillable subject=Subject R; & \
    ;
    matrix[manoooh] (mat3) at (3*mymatdist,LstMatShifts[3])
    & pic[draw=red] (S) nonfillable subject=Subject S; & \
    & pic (T) nonfillable subject=Subject T; & \
    & pic (U) nonfillable subject=Subject U; & \
    & pic (V) nonfillable subject=Subject V; & \
    & pic (W) nonfillable subject=Subject W; & \
    & pic (X) nonfillable subject=Subject X; & \
    & pic (Y) nonfillable subject=Subject Y; & \
    & pic (Z) nonfillable subject=Subject Z; & \
    ;
    matrix[manooohE,column sep=8pt] (matE3) at (3*mymatdist,mymatbottom)
    pic (L3E1) nonfillable elective subject=Subject; &
    pic (L3E2) nonfillable elective subject=Subject; \
    ;
    matrix[manoooh] (mat4) at (4*mymatdist,LstMatShifts[4])
    & pic[draw=red] (AA) nonfillable subject=Subject AA; & \
    pic (AB) nonfillable subject=Subject AB; & & pic (AC) nonfillable subject=Subject AC; \
    & pic (AD) nonfillable subject=Subject AD; & \
    & pic (AE) nonfillable subject=Subject AE; & \
    & pic (AF) nonfillable subject=Subject AF; & \
    & pic (AG) nonfillable subject=Subject AG; & \
    ;
    matrix[manooohE] (matE4) at (4*mymatdist,mymatbottom)
    pic (L4E1) nonfillable elective subject=Subject; \
    ;
    matrix[manoooh] (mat5) at (5*mymatdist,LstMatShifts[5])
    & pic (AH) nonfillable subject=Subject AH; & \
    & pic (AI) nonfillable subject=Subject AI; & \
    & pic[draw=red] (AJ) nonfillable subject=Subject AJ; & \
    & pic (AK) nonfillable subject=Subject AK; & \
    ;
    matrix[manooohE] (matE5) at (5*mymatdist,mymatbottom)
    & pic (L5E1) nonfillable elective subject=Subject; & \
    & pic (L5E2) nonfillable elective subject=Subject; & \
    & pic (L5E3) nonfillable elective subject=Subject; & \
    & pic (L5E4) nonfillable elective subject=Subject; & \
    & pic (L5E5) nonfillable elective subject=Subject; & \
    ;
    endscope
    pgfmathsetmacromywidth0
    foreach X in 0,...,5 %<- if you have more or less matrices, adjust 3

    ifnodedefinedmatEX% has inlay
    path let p1=($(matX.north east)-(matX.south west)$),
    p2=($(matEX.north east)-(matEX.south west)$)
    in
    pgfextrapgfmathsetmacromywidthmax(x1,mywidth)
    pgfmathsetmacromyheightmax(y1+y2+%
    pgfkeysvalueof/tikz/inlay top sep+pgfkeysvalueof/tikz/matrix top sep,%
    myheight)
    xdefmywidthmywidthxdefmyheightmyheight
    pgfmathsetmacromyshift(pgfkeysvalueof/tikz/inlay top sep+y2)/2
    ifnumX=0
    xdefLstMatShiftsmyshift pt
    else
    xdefLstMatShiftsLstMatShifts,myshift pt
    fi;% no inlay
    path
    let p1=($(matX.north east)-(matX.south west)$) in
    pgfextrapgfmathsetmacromywidthmax(x1,mywidth)
    pgfmathsetmacromyheightmax(y1+pgfkeysvalueof/tikz/matrix top sep,myheight)
    xdefmywidthmywidthxdefmyheightmyheight;
    ifnumX=0
    xdefLstMatShifts0pt
    else
    xdefLstMatShiftsLstMatShifts,0pt
    fi

    node[anchor=south,yshift=1cm,align=center,font=LARGEbfseriesboldmath]
    at (matX
    %typeoutheight1:myheight %
    %
    pgfmathsetmacromydistmywidth+2*pgfkeysvalueof/tikz/fit
    sep+pgfkeysvalueof/tikz/fit dist
    xdefmydistmydist
    defmymatbottom0pt
    foreach X in 0,...,5 %
    ifnodedefinedmatEXpath let p1=($(matX.north)-(matX.south)$),
    p2=($(matEX.north)-(matEX.south)$),
    n1=max(abs(y1)/2+abs(y2)+2*pgfkeysvalueof/tikz/inlay top sep,mymatbottom)
    in pgfextraxdefmymatbottomn1
    node[anchor=south east,xshift=-3cm,font=LARGEbfseries] (ElX)
    at (matEX.north)Electives;
    beginscope[on background layer]
    node[fit=(matEX) (ElX)] (FEX);
    fill[blue!30,rounded corners=30pt] (X*mymatdist-
    mymatdist/2+pgfkeysvalueof/tikz/fit dist/4+10pt,0
    %typeoutshifts(end):LstMatShifts
    makeatletter
    immediatewrite@mainauxxdefstringmymatdistmydist ptrelax
    immediatewrite@mainauxxdefstringmymatbottom-mymatbottomrelax
    immediatewrite@mainauxxdefstringmyheightmyheightrelax
    immediatewrite@mainauxxdefstringLstMatShiftsLstMatShiftsrelax
    makeatother

    % now add the arrows
    foreach X in C,D,E,F,G,H,I,J
    draw[very thick,blue,-latex] (A-Title) to[out=0,in=180] (X-Title);
    draw[very thick,red,-latex] (B-Title) to[out=0,in=180] (X-Title);

    foreach X in L,O
    draw[very thick,orange,-latex] (C-Title) to[out=0,in=180] (X-Title);

    foreach X in K,N,O,Z
    draw[very thick,green,-latex] (D-Title) to[out=0,in=180] (X-Title);

    endtikzpicture
    endForm

    vfill

    enddocument


    What I have done



    Thanks!!










    share|improve this question
























      0












      0








      0








      This is and addendum of a previous question: How to insert elective subjects section within a diagram.



      What I want



      I would like to reduce the length of those nodes that only have a single column of a matrix environment of the Tikz package but keeping the same space between nodes. If possible, also do it automatically (it is not necessary at all, just know what the necessary commands are):



      What I want



      What I have done



      MWE:



      All the following source code belongs to marmot in the incredible accepted answer of the attached question. I only modified the nodes and things like that.



      documentclassarticle
      usepackage[margin=0in,footskip=0in,paperwidth=95cm,paperheight=29cm]geometry
      usepackage[english]babel
      usepackage[utf8]inputenc
      usepackage[T1]fontenc
      usepackagehyperref

      usepackagetikz
      usetikzlibrarypositioning,backgrounds,fit,calc
      tikzset
      text field/.style=text height=1.5ex,align=center,rounded corners,
      nonfillable title field/.style=text height=2ex,text depth=0.3em,anchor=south,text
      width=5cm,align=center,font=footnotesizesffamily,
      fillable title field/.style=text height=3.14ex,text depth=0em,anchor=south,text
      width=5cm,align=center,font=footnotesizesffamily,
      pics/fillable subject/.style=code=- (-Title.south west)
      ,
      pics/nonfillable subject/.style=code=- (-Title.south west)
      ,
      pics/fillable elective subject/.style=code= (-TF.south east)
      -- cycle;
      draw ([xshift=4pt]-Title.south west) -- ([xshift=-4pt]-Title.south east);
      ,
      pics/nonfillable elective subject/.style=code=- (-Title.north east) -- (-Title.south east) -,
      manoooh/.style=column sep=-1.75cm,row sep=5mm,
      manooohE/.style=column sep=-2.25cm,row sep=5mm,anchor=south,
      electives/.style=column sep=-7.25cm,row sep=5mm,
      fit sep/.initial=4pt, % change width of node (big rectangle shape)
      fit dist/.initial=3cm, % change node distance (big rectangle shape)
      inlay top sep/.initial=24pt,
      matrix top sep/.initial=24pt,
      % From https://tex.stackexchange.com/a/478723/152550

      makeatletter% from https://tex.stackexchange.com/a/85531/121799
      longdefifnodedefined#1#2#3%
      @ifundefinedpgf@sh@ns@#1#3#2%

      makeatother

      begindocument
      thispagestyleempty % To suppress page number
      noindent
      begintikzpicture
      fill[white,fill=orange] (0,0) rectangle (paperwidth,-2cm) node[midway,align=center,font=Huge] bfseries Some text here\LARGE More text here;
      endtikzpicture

      ifdefinedmymatdist
      %typeoutgotspacemymatdist
      else
      typeoutPleasespace recompilespace yourspace file!
      defmymatdist150pt
      fi
      ifdefinedmymatbottom
      %typeoutgotspacemymatbottom
      else
      typeoutPleasespace recompilespace yourspace file!
      defmymatbottom-150pt
      fi
      ifdefinedmyheight
      else
      defmyheight0
      typeoutPleasespace recompilespace yourspace file!
      fi
      ifdefinedLstMatShifts
      else
      defLstMatShifts0pt,0pt,0pt,0pt,0pt
      fi
      %typeoutheight:myheight
      %typeoutshifts(in):LstMatShifts

      vfill
      centering
      beginForm
      begintikzpicture
      % step 1: add the matrices, name them mat0, mat1 etc.
      beginscope[local bounding box=matrices]
      matrix[manoooh] (mat0) at (0*mymatdist,LstMatShifts[0])
      & pic[local bounding box=A] (A) nonfillable subject=Subject A; & \
      & pic (B) nonfillable subject=Subject B; & \
      ;
      matrix[manoooh] (mat1) at (1*mymatdist,LstMatShifts[1])
      & pic (C) nonfillable subject=Subject C; & \
      & pic (D) nonfillable subject=Subject D; & \
      & pic (E) nonfillable subject=Subject E; & \
      & pic (F) nonfillable subject=Subject F; & \
      & pic (G) nonfillable subject=Subject G; & \
      & pic (H) nonfillable subject=Subject H; & \
      & pic (I) nonfillable subject=Subject I; & \
      & pic[draw=red] (J) nonfillable subject=Subject J; & \
      ;
      matrix[manoooh] (mat2) at (2*mymatdist,LstMatShifts[2])
      & pic[draw=red] (K) nonfillable subject=Subject K; & \
      & pic (L) nonfillable subject=Subject L; & \
      & pic (M) nonfillable subject=Subject A; & \
      & pic (N) nonfillable subject=Subject N; & \
      & pic (O) nonfillable subject=Subject O; & \
      & pic (P) nonfillable subject=Subject P; & \
      & pic (Q) nonfillable subject=Subject Q; & \
      & pic (R) nonfillable subject=Subject R; & \
      ;
      matrix[manoooh] (mat3) at (3*mymatdist,LstMatShifts[3])
      & pic[draw=red] (S) nonfillable subject=Subject S; & \
      & pic (T) nonfillable subject=Subject T; & \
      & pic (U) nonfillable subject=Subject U; & \
      & pic (V) nonfillable subject=Subject V; & \
      & pic (W) nonfillable subject=Subject W; & \
      & pic (X) nonfillable subject=Subject X; & \
      & pic (Y) nonfillable subject=Subject Y; & \
      & pic (Z) nonfillable subject=Subject Z; & \
      ;
      matrix[manooohE,column sep=8pt] (matE3) at (3*mymatdist,mymatbottom)
      pic (L3E1) nonfillable elective subject=Subject; &
      pic (L3E2) nonfillable elective subject=Subject; \
      ;
      matrix[manoooh] (mat4) at (4*mymatdist,LstMatShifts[4])
      & pic[draw=red] (AA) nonfillable subject=Subject AA; & \
      pic (AB) nonfillable subject=Subject AB; & & pic (AC) nonfillable subject=Subject AC; \
      & pic (AD) nonfillable subject=Subject AD; & \
      & pic (AE) nonfillable subject=Subject AE; & \
      & pic (AF) nonfillable subject=Subject AF; & \
      & pic (AG) nonfillable subject=Subject AG; & \
      ;
      matrix[manooohE] (matE4) at (4*mymatdist,mymatbottom)
      pic (L4E1) nonfillable elective subject=Subject; \
      ;
      matrix[manoooh] (mat5) at (5*mymatdist,LstMatShifts[5])
      & pic (AH) nonfillable subject=Subject AH; & \
      & pic (AI) nonfillable subject=Subject AI; & \
      & pic[draw=red] (AJ) nonfillable subject=Subject AJ; & \
      & pic (AK) nonfillable subject=Subject AK; & \
      ;
      matrix[manooohE] (matE5) at (5*mymatdist,mymatbottom)
      & pic (L5E1) nonfillable elective subject=Subject; & \
      & pic (L5E2) nonfillable elective subject=Subject; & \
      & pic (L5E3) nonfillable elective subject=Subject; & \
      & pic (L5E4) nonfillable elective subject=Subject; & \
      & pic (L5E5) nonfillable elective subject=Subject; & \
      ;
      endscope
      pgfmathsetmacromywidth0
      foreach X in 0,...,5 %<- if you have more or less matrices, adjust 3

      ifnodedefinedmatEX% has inlay
      path let p1=($(matX.north east)-(matX.south west)$),
      p2=($(matEX.north east)-(matEX.south west)$)
      in
      pgfextrapgfmathsetmacromywidthmax(x1,mywidth)
      pgfmathsetmacromyheightmax(y1+y2+%
      pgfkeysvalueof/tikz/inlay top sep+pgfkeysvalueof/tikz/matrix top sep,%
      myheight)
      xdefmywidthmywidthxdefmyheightmyheight
      pgfmathsetmacromyshift(pgfkeysvalueof/tikz/inlay top sep+y2)/2
      ifnumX=0
      xdefLstMatShiftsmyshift pt
      else
      xdefLstMatShiftsLstMatShifts,myshift pt
      fi;% no inlay
      path
      let p1=($(matX.north east)-(matX.south west)$) in
      pgfextrapgfmathsetmacromywidthmax(x1,mywidth)
      pgfmathsetmacromyheightmax(y1+pgfkeysvalueof/tikz/matrix top sep,myheight)
      xdefmywidthmywidthxdefmyheightmyheight;
      ifnumX=0
      xdefLstMatShifts0pt
      else
      xdefLstMatShiftsLstMatShifts,0pt
      fi

      node[anchor=south,yshift=1cm,align=center,font=LARGEbfseriesboldmath]
      at (matX
      %typeoutheight1:myheight %
      %
      pgfmathsetmacromydistmywidth+2*pgfkeysvalueof/tikz/fit
      sep+pgfkeysvalueof/tikz/fit dist
      xdefmydistmydist
      defmymatbottom0pt
      foreach X in 0,...,5 %
      ifnodedefinedmatEXpath let p1=($(matX.north)-(matX.south)$),
      p2=($(matEX.north)-(matEX.south)$),
      n1=max(abs(y1)/2+abs(y2)+2*pgfkeysvalueof/tikz/inlay top sep,mymatbottom)
      in pgfextraxdefmymatbottomn1
      node[anchor=south east,xshift=-3cm,font=LARGEbfseries] (ElX)
      at (matEX.north)Electives;
      beginscope[on background layer]
      node[fit=(matEX) (ElX)] (FEX);
      fill[blue!30,rounded corners=30pt] (X*mymatdist-
      mymatdist/2+pgfkeysvalueof/tikz/fit dist/4+10pt,0
      %typeoutshifts(end):LstMatShifts
      makeatletter
      immediatewrite@mainauxxdefstringmymatdistmydist ptrelax
      immediatewrite@mainauxxdefstringmymatbottom-mymatbottomrelax
      immediatewrite@mainauxxdefstringmyheightmyheightrelax
      immediatewrite@mainauxxdefstringLstMatShiftsLstMatShiftsrelax
      makeatother

      % now add the arrows
      foreach X in C,D,E,F,G,H,I,J
      draw[very thick,blue,-latex] (A-Title) to[out=0,in=180] (X-Title);
      draw[very thick,red,-latex] (B-Title) to[out=0,in=180] (X-Title);

      foreach X in L,O
      draw[very thick,orange,-latex] (C-Title) to[out=0,in=180] (X-Title);

      foreach X in K,N,O,Z
      draw[very thick,green,-latex] (D-Title) to[out=0,in=180] (X-Title);

      endtikzpicture
      endForm

      vfill

      enddocument


      What I have done



      Thanks!!










      share|improve this question














      This is and addendum of a previous question: How to insert elective subjects section within a diagram.



      What I want



      I would like to reduce the length of those nodes that only have a single column of a matrix environment of the Tikz package but keeping the same space between nodes. If possible, also do it automatically (it is not necessary at all, just know what the necessary commands are):



      What I want



      What I have done



      MWE:



      All the following source code belongs to marmot in the incredible accepted answer of the attached question. I only modified the nodes and things like that.



      documentclassarticle
      usepackage[margin=0in,footskip=0in,paperwidth=95cm,paperheight=29cm]geometry
      usepackage[english]babel
      usepackage[utf8]inputenc
      usepackage[T1]fontenc
      usepackagehyperref

      usepackagetikz
      usetikzlibrarypositioning,backgrounds,fit,calc
      tikzset
      text field/.style=text height=1.5ex,align=center,rounded corners,
      nonfillable title field/.style=text height=2ex,text depth=0.3em,anchor=south,text
      width=5cm,align=center,font=footnotesizesffamily,
      fillable title field/.style=text height=3.14ex,text depth=0em,anchor=south,text
      width=5cm,align=center,font=footnotesizesffamily,
      pics/fillable subject/.style=code=- (-Title.south west)
      ,
      pics/nonfillable subject/.style=code=- (-Title.south west)
      ,
      pics/fillable elective subject/.style=code= (-TF.south east)
      -- cycle;
      draw ([xshift=4pt]-Title.south west) -- ([xshift=-4pt]-Title.south east);
      ,
      pics/nonfillable elective subject/.style=code=- (-Title.north east) -- (-Title.south east) -,
      manoooh/.style=column sep=-1.75cm,row sep=5mm,
      manooohE/.style=column sep=-2.25cm,row sep=5mm,anchor=south,
      electives/.style=column sep=-7.25cm,row sep=5mm,
      fit sep/.initial=4pt, % change width of node (big rectangle shape)
      fit dist/.initial=3cm, % change node distance (big rectangle shape)
      inlay top sep/.initial=24pt,
      matrix top sep/.initial=24pt,
      % From https://tex.stackexchange.com/a/478723/152550

      makeatletter% from https://tex.stackexchange.com/a/85531/121799
      longdefifnodedefined#1#2#3%
      @ifundefinedpgf@sh@ns@#1#3#2%

      makeatother

      begindocument
      thispagestyleempty % To suppress page number
      noindent
      begintikzpicture
      fill[white,fill=orange] (0,0) rectangle (paperwidth,-2cm) node[midway,align=center,font=Huge] bfseries Some text here\LARGE More text here;
      endtikzpicture

      ifdefinedmymatdist
      %typeoutgotspacemymatdist
      else
      typeoutPleasespace recompilespace yourspace file!
      defmymatdist150pt
      fi
      ifdefinedmymatbottom
      %typeoutgotspacemymatbottom
      else
      typeoutPleasespace recompilespace yourspace file!
      defmymatbottom-150pt
      fi
      ifdefinedmyheight
      else
      defmyheight0
      typeoutPleasespace recompilespace yourspace file!
      fi
      ifdefinedLstMatShifts
      else
      defLstMatShifts0pt,0pt,0pt,0pt,0pt
      fi
      %typeoutheight:myheight
      %typeoutshifts(in):LstMatShifts

      vfill
      centering
      beginForm
      begintikzpicture
      % step 1: add the matrices, name them mat0, mat1 etc.
      beginscope[local bounding box=matrices]
      matrix[manoooh] (mat0) at (0*mymatdist,LstMatShifts[0])
      & pic[local bounding box=A] (A) nonfillable subject=Subject A; & \
      & pic (B) nonfillable subject=Subject B; & \
      ;
      matrix[manoooh] (mat1) at (1*mymatdist,LstMatShifts[1])
      & pic (C) nonfillable subject=Subject C; & \
      & pic (D) nonfillable subject=Subject D; & \
      & pic (E) nonfillable subject=Subject E; & \
      & pic (F) nonfillable subject=Subject F; & \
      & pic (G) nonfillable subject=Subject G; & \
      & pic (H) nonfillable subject=Subject H; & \
      & pic (I) nonfillable subject=Subject I; & \
      & pic[draw=red] (J) nonfillable subject=Subject J; & \
      ;
      matrix[manoooh] (mat2) at (2*mymatdist,LstMatShifts[2])
      & pic[draw=red] (K) nonfillable subject=Subject K; & \
      & pic (L) nonfillable subject=Subject L; & \
      & pic (M) nonfillable subject=Subject A; & \
      & pic (N) nonfillable subject=Subject N; & \
      & pic (O) nonfillable subject=Subject O; & \
      & pic (P) nonfillable subject=Subject P; & \
      & pic (Q) nonfillable subject=Subject Q; & \
      & pic (R) nonfillable subject=Subject R; & \
      ;
      matrix[manoooh] (mat3) at (3*mymatdist,LstMatShifts[3])
      & pic[draw=red] (S) nonfillable subject=Subject S; & \
      & pic (T) nonfillable subject=Subject T; & \
      & pic (U) nonfillable subject=Subject U; & \
      & pic (V) nonfillable subject=Subject V; & \
      & pic (W) nonfillable subject=Subject W; & \
      & pic (X) nonfillable subject=Subject X; & \
      & pic (Y) nonfillable subject=Subject Y; & \
      & pic (Z) nonfillable subject=Subject Z; & \
      ;
      matrix[manooohE,column sep=8pt] (matE3) at (3*mymatdist,mymatbottom)
      pic (L3E1) nonfillable elective subject=Subject; &
      pic (L3E2) nonfillable elective subject=Subject; \
      ;
      matrix[manoooh] (mat4) at (4*mymatdist,LstMatShifts[4])
      & pic[draw=red] (AA) nonfillable subject=Subject AA; & \
      pic (AB) nonfillable subject=Subject AB; & & pic (AC) nonfillable subject=Subject AC; \
      & pic (AD) nonfillable subject=Subject AD; & \
      & pic (AE) nonfillable subject=Subject AE; & \
      & pic (AF) nonfillable subject=Subject AF; & \
      & pic (AG) nonfillable subject=Subject AG; & \
      ;
      matrix[manooohE] (matE4) at (4*mymatdist,mymatbottom)
      pic (L4E1) nonfillable elective subject=Subject; \
      ;
      matrix[manoooh] (mat5) at (5*mymatdist,LstMatShifts[5])
      & pic (AH) nonfillable subject=Subject AH; & \
      & pic (AI) nonfillable subject=Subject AI; & \
      & pic[draw=red] (AJ) nonfillable subject=Subject AJ; & \
      & pic (AK) nonfillable subject=Subject AK; & \
      ;
      matrix[manooohE] (matE5) at (5*mymatdist,mymatbottom)
      & pic (L5E1) nonfillable elective subject=Subject; & \
      & pic (L5E2) nonfillable elective subject=Subject; & \
      & pic (L5E3) nonfillable elective subject=Subject; & \
      & pic (L5E4) nonfillable elective subject=Subject; & \
      & pic (L5E5) nonfillable elective subject=Subject; & \
      ;
      endscope
      pgfmathsetmacromywidth0
      foreach X in 0,...,5 %<- if you have more or less matrices, adjust 3

      ifnodedefinedmatEX% has inlay
      path let p1=($(matX.north east)-(matX.south west)$),
      p2=($(matEX.north east)-(matEX.south west)$)
      in
      pgfextrapgfmathsetmacromywidthmax(x1,mywidth)
      pgfmathsetmacromyheightmax(y1+y2+%
      pgfkeysvalueof/tikz/inlay top sep+pgfkeysvalueof/tikz/matrix top sep,%
      myheight)
      xdefmywidthmywidthxdefmyheightmyheight
      pgfmathsetmacromyshift(pgfkeysvalueof/tikz/inlay top sep+y2)/2
      ifnumX=0
      xdefLstMatShiftsmyshift pt
      else
      xdefLstMatShiftsLstMatShifts,myshift pt
      fi;% no inlay
      path
      let p1=($(matX.north east)-(matX.south west)$) in
      pgfextrapgfmathsetmacromywidthmax(x1,mywidth)
      pgfmathsetmacromyheightmax(y1+pgfkeysvalueof/tikz/matrix top sep,myheight)
      xdefmywidthmywidthxdefmyheightmyheight;
      ifnumX=0
      xdefLstMatShifts0pt
      else
      xdefLstMatShiftsLstMatShifts,0pt
      fi

      node[anchor=south,yshift=1cm,align=center,font=LARGEbfseriesboldmath]
      at (matX
      %typeoutheight1:myheight %
      %
      pgfmathsetmacromydistmywidth+2*pgfkeysvalueof/tikz/fit
      sep+pgfkeysvalueof/tikz/fit dist
      xdefmydistmydist
      defmymatbottom0pt
      foreach X in 0,...,5 %
      ifnodedefinedmatEXpath let p1=($(matX.north)-(matX.south)$),
      p2=($(matEX.north)-(matEX.south)$),
      n1=max(abs(y1)/2+abs(y2)+2*pgfkeysvalueof/tikz/inlay top sep,mymatbottom)
      in pgfextraxdefmymatbottomn1
      node[anchor=south east,xshift=-3cm,font=LARGEbfseries] (ElX)
      at (matEX.north)Electives;
      beginscope[on background layer]
      node[fit=(matEX) (ElX)] (FEX);
      fill[blue!30,rounded corners=30pt] (X*mymatdist-
      mymatdist/2+pgfkeysvalueof/tikz/fit dist/4+10pt,0
      %typeoutshifts(end):LstMatShifts
      makeatletter
      immediatewrite@mainauxxdefstringmymatdistmydist ptrelax
      immediatewrite@mainauxxdefstringmymatbottom-mymatbottomrelax
      immediatewrite@mainauxxdefstringmyheightmyheightrelax
      immediatewrite@mainauxxdefstringLstMatShiftsLstMatShiftsrelax
      makeatother

      % now add the arrows
      foreach X in C,D,E,F,G,H,I,J
      draw[very thick,blue,-latex] (A-Title) to[out=0,in=180] (X-Title);
      draw[very thick,red,-latex] (B-Title) to[out=0,in=180] (X-Title);

      foreach X in L,O
      draw[very thick,orange,-latex] (C-Title) to[out=0,in=180] (X-Title);

      foreach X in K,N,O,Z
      draw[very thick,green,-latex] (D-Title) to[out=0,in=180] (X-Title);

      endtikzpicture
      endForm

      vfill

      enddocument


      What I have done



      Thanks!!







      tikz-pgf horizontal-alignment






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 19 mins ago









      manoooohmanooooh

      1,0171516




      1,0171516




















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "85"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f480186%2fhow-to-determine-nodes-to-reduce-their-length-using-tikzpicture-environment%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f480186%2fhow-to-determine-nodes-to-reduce-their-length-using-tikzpicture-environment%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How should I use the fbox command correctly to avoid producing a Bad Box message?How to put a long piece of text in a box?How to specify height and width of fboxIs there an arrayrulecolor-like command to change the rule color of fbox?What is the command to highlight bad boxes in pdf?Why does fbox sometimes place the box *over* the graphic image?how to put the text in the boxHow to create command for a box where text inside the box can automatically adjust?how can I make an fbox like command with certain color, shape and width of border?how to use fbox in align modeFbox increase the spacing between the box and it content (inner margin)how to change the box height of an equationWhat is the use of the hbox in a newcommand command?

          152 Atala Notae | Nexus externi | Tabula navigationis"Discovery Circumstances: Numbered Minor Planets"2000152Small-Body Database

          Doxepinum Nexus interni Notae | Tabula navigationis3158DB01142WHOa682390"Structural Analysis of the Histamine H1 Receptor""Transdermal and Topical Drug Administration in the Treatment of Pain""Antidepressants as antipruritic agents: A review"