1

I am trying to create a figure in latex using Tikz. But its not fitting in a page. I do not need the levels to match for different groups.

\documentclass[10pt,twoside,a4paper]{memoir}
\usepackage{graphicx}
\usepackage{forest}
\usepackage{tikz-qtree}
\begin{document}

\begin{tikzpicture}
\tikzset{edge from parent/.style={draw,edge from parent path={(\tikzparentnode.south)--     +(0,-8pt)-| (\tikzchildnode)}}}
\Tree [.CD45$^+$
[.CD3
[.CD56 [CD319 PD1 ICOS ] ]
[.CD4 [Tbet ROR$\gamma$T PD1 CD27 ICOS CD43 CD103 INF$\gamma$ FOXP3 IL10 ]  
]
[.CD8 ]
[TCR$\delta$ ]
]
[.CD20
[[[.CD11c [.Tbet ] ]  CD27 FoxP3 CD21 PD1 ] ] ] 
[.CD138 [.CD319 ] ] 
[.CD14 ] 
[.CD56   [ICOS GZMs CD16 CD319 PD1 ] ] ]
\end{tikzpicture}
\end{document}
2
  • Welcome to TeX.SE! Your tree is far to wide that can be placed on page, even if it is in landscape orientation. You need to reorganize it, for example that will grow to east.
    – Zarko
    Commented Jan 24, 2023 at 23:11
  • @Zarko yes I have tried those and their combinations.
    – Deep
    Commented Jan 24, 2023 at 23:15

1 Answer 1

0

Possible solution with forest package:

  • tree grow to east
  • defined are distance between nodes

Edit:
ups, i didn't load last version of my experiments with your tree, so it have some typing error. Now errors are corrected.

\documentclass[10pt,twoside,a4paper]{memoir}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage[edges]{forest}

\begin{document}
\begin{center}
    \begin{forest}
for tree={
     child anchor=west,
%
     grow = east,
forked edge,        % for forked edge
    s sep =  2mm,   % sibling distance
    l sep = 12mm,   % level distance
 fork sep =  6mm,   % distance from parent to branching point
tier/.option=level, % for aligning nodes to levels
           }
[CD45$^+$
    [CD3
        [CD56 
            [CD319] 
            [PD1] 
            [ICOS] 
        ]
        [CD4
            [Tbet]
            [ROR$\gamma$T]
            [PD1]
            [CD27]
            [ICOS]
            [CD43]
            [CD103]
            [INF$\gamma$]
            [FOXP3]
            [IL10]
        ]
        [CD8]
        [TCR$\delta$ ]
    ]
    [CD20
        [CD11c 
            [Tbet] 
        ]  
        [CD27]
        [FoxP3]
        [CD21]
        [PD1] 
    ]
    [CD138 
        [CD319] 
    ]
    [CD14]
    [CD56   
        [ICOS]
        [GZMs]
        [CD16]
        [CD319]
        [PD1] 
    ] 
]
\end{forest}
    \end{center}
\end{document}

enter image description here

(red lines indicate page layout)

3
  • Thanks a lot. This surely will work. There will be comma after \small I guess. Also can I remove the red outlines.
    – Deep
    Commented Jan 24, 2023 at 23:45
  • Okay I just change from red to white.
    – Deep
    Commented Jan 24, 2023 at 23:49
  • @Deep, after observing, that I didn't upload last version of MWE (Minimal Working Example), I edit answer and correct all typing errors in upload correct image. Red lines are only for helčp to see, if tree fit on page. In real document this part code should be removed, as I marked in code (please, read MWE code carefully)
    – Zarko
    Commented Jan 24, 2023 at 23:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .