# Margins, forest package, text on page and node centering

I'm trying to draw a figure describing a timeline and would like help with 2 aspects of it

1) I'm trying to add some notes to a forest made in LaTeX. I have modified margins and resize boxes in order to make it fit the page exactly. However, now that I have added text to the page, it doesn't go all the way to the right margin. I tried using adjustbox but didn't worked

2) As you can see from the example, the nodes leaving the boxes to the right aren't centralized on the box. This is clear on the first three nodes (middle one is slightly tilted upwards) and on the last 2 lines of the second column (they are directed upwards). I would like to have all children coming out centralized from their fathers.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{pdflscape}
\usepackage[edges]{forest}
\usepackage{geometry}

%Gray scales
\definecolor{color1}{gray}{0.94}

\definecolor{color2}{gray}{0.8}
\begin{document}

\begin{landscape}
\pagestyle{empty}
\newgeometry{left = 1cm, right = 1cm, bottom = 0cm, top = 6cm}

\forestset{
L1/.style={fill=color2,minimum height=60mm,minimum width=120mm, font = \Huge},
L2/.style={fill=color2, font = \Large, edge={gray,line width=1pt},minimum width=95mm,minimum height=49mm},
L3/.style={fill=color2, font = \Large, edge={gray,line width=1pt},minimum width=95mm,minimum height=49mm},
L4/.style={fill=color2, font = \Large, edge={gray,line width=1pt},minimum width=95mm,minimum height=49mm},
L5/.style={fill=color2,edge={gray,line width=1pt},minimum width=60mm,minimum height=28mm},
L6/.style={fill=color2,edge={gray,line width=1pt},minimum width=52mm,minimum height=27mm},
}

%\resizebox{0.6\textidth}{!}{
\begin{forest}
for tree={
scale=.45,sibling distance=0pt,
grow=0,reversed, % tree direction
parent anchor=east,child anchor=west, % edge anchors
edge={line cap=round},
outer sep=+2pt, % edge/node connection
rounded corners,
minimum height=17mm, % node shape
l sep=25mm % level distance
}
[\textbf{\Huge{ }} \\
\huge{ },L1, align=center
[\textbf{\Huge{}},L2, for tree = {fill=color2}
[\textbf{\huge{ }},L5,for tree = {fill=color2}
[\textbf{\huge{}},L6, for tree = {fill=color2}][\textbf{\huge{}},L6,for tree={fill=color2}]
]
[\textbf{\huge{}},L5,for tree = {fill=color2}]
]
[
,L3, for tree = {fill=color2}, align=center
[\textbf{\huge{ }},L5,for tree = {fill=color2}
[\textbf{\huge{}},L6, for tree = {fill = color2}][\textbf{\huge{}},L6,for tree={fill=color2}]
]
[\textbf{\huge{}},L5,for tree = {fill=color2}]
]
[\textbf{\Huge{}} \\ \textbf{\Huge} \\ \\
\textit{\huge{ }} \huge{+} \\
\textit{\huge{ }} ,L4, for tree = {fill=color2}, align=center
[\textbf{\huge{ }},L5,for tree = {fill=color2}
[\textbf{\huge{}},L6, for tree = {fill=color2}][\textbf{\huge{}},L6,for tree={fill=color2}]
]
[\textbf{\huge{}},L5,for tree = {fill=color2}]
]
]
\end{forest}

\vspace{3cm}

\begin{picture}(000,-100)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%EARLY PAY GROUP
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%Draw line
\put(-30,0){\vector(1,0){705}} %700 for 28 ticks (days) implies 25 distance for each

%Day 1
\put(-30,0){\line(0,1){8}}
\put(-5,0){\line(0,1){4}}
\put(30,0){\line(0,1){4}}
\put(65,0){\line(0,1){4}}
\put(90,0){\line(0,1){4}}
\put(115,0){\line(0,1){4}}
\put(140,0){\line(0,1){4}}

%Day 8
\put(165,0){\line(0,1){8}}
\put(190,0){\line(0,1){4}}
\put(215,0){\line(0,1){4}}
\put(240,0){\line(0,1){4}}
\put(265,0){\line(0,1){4}}
\put(290,0){\line(0,1){4}}
\put(315,0){\line(0,1){4}}

%Day 15
\put(340,0){\line(0,1){8}}
\put(365,0){\line(0,1){4}}
\put(390,0){\line(0,1){4}}
\put(415,0){\line(0,1){4}}
\put(440,0){\line(0,1){4}}
\put(465,0){\line(0,1){4}}
\put(490,0){\line(0,1){4}}

%Day 22
\put(515,0){\line(0,1){8}}
\put(540,0){\line(0,1){4}}
\put(565,0){\line(0,1){4}}
\put(590,0){\line(0,1){4}}
\put(615,0){\line(0,1){4}}
\put(640,0){\line(0,1){4}}

%Day 28
\put(665,0){\line(0,1){8}}

\end{picture}

\vspace{2cm}

\textit{Notes:} Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes
\end{landscape}
\end{document}


Thank you!

Edit: Adding an image of problem 1

The second problem can be solved by adding anchor=center. Let's work on the first one. Here is some intermediate proposal. To first approximation I let the geometry package take care of the landscape and got (after reducing the top margin)

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[edges]{forest}
\usepackage[showframe,landscape]{geometry} % showframe just to guide the eye
%Gray scales
\definecolor{color1}{gray}{0.94}
\definecolor{color2}{gray}{0.8}
\begin{document}
\newgeometry{left = 1cm, right = 1cm, bottom = 0cm, top = 1cm}
\pagestyle{empty}

\forestset{
L1/.style={fill=color2,minimum height=60mm,minimum width=120mm, font = \Huge},
L2/.style={fill=color2, font = \Large, edge={gray,line width=1pt},minimum width=95mm,minimum height=49mm},
L3/.style={fill=color2, font = \Large, edge={gray,line width=1pt},minimum width=95mm,minimum height=49mm},
L4/.style={fill=color2, font = \Large, edge={gray,line width=1pt},minimum width=95mm,minimum height=49mm},
L5/.style={fill=color2,edge={gray,line width=1pt},minimum width=60mm,minimum height=28mm},
L6/.style={fill=color2,edge={gray,line width=1pt},minimum width=52mm,minimum height=27mm},
}

%\resizebox{0.6\textwidth}{!}{
\begin{forest}
for tree={anchor=center,
scale=.45,sibling distance=0pt,
grow=0,reversed, % tree direction
parent anchor=east,child anchor=west, % edge anchors
edge={line cap=round},
outer sep=+2pt, % edge/node connection
rounded corners,
minimum height=17mm, % node shape
l sep=25mm % level distance
}
[\textbf{\Huge{ }} \\
\huge{ },L1, align=center,
[\textbf{\Huge{}},L2, for tree = {fill=color2}
[\textbf{\huge{ }},L5,for tree = {fill=color2}
[\textbf{\huge{}},L6, for tree = {fill=color2}][\textbf{\huge{}},L6,for tree={fill=color2}]
]
[\textbf{\huge{}},L5,for tree = {fill=color2}]
]
[
,L3, for tree = {fill=color2}, align=center
[\textbf{\huge{ }},L5,for tree = {fill=color2}
[\textbf{\huge{}},L6, for tree = {fill = color2}][\textbf{\huge{}},L6,for tree={fill=color2}]
]
[\textbf{\huge{}},L5,for tree = {fill=color2}]
]
[\textbf{\Huge{}} \\ \textbf{\Huge} \\ \\
\textit{\huge{ }} \huge{+} \\
\textit{\huge{ }} ,L4, for tree = {fill=color2}, align=center
[\textbf{\huge{ }},L5,for tree = {fill=color2}
[\textbf{\huge{}},L6, for tree = {fill=color2}][\textbf{\huge{}},L6,for tree={fill=color2}]
]
[\textbf{\huge{}},L5,for tree = {fill=color2}]
]
]
\end{forest}

\vspace{3cm}
% this picture should get replaced by something more appropriate IMHO
\begin{picture}(000,-100)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%EARLY PAY GROUP
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%Draw line
\put(-30,0){\vector(1,0){705}} %700 for 28 ticks (days) implies 25 distance for each

%Day 1
\put(-30,0){\line(0,1){8}}
\put(-5,0){\line(0,1){4}}
\put(30,0){\line(0,1){4}}
\put(65,0){\line(0,1){4}}
\put(90,0){\line(0,1){4}}
\put(115,0){\line(0,1){4}}
\put(140,0){\line(0,1){4}}

%Day 8
\put(165,0){\line(0,1){8}}
\put(190,0){\line(0,1){4}}
\put(215,0){\line(0,1){4}}
\put(240,0){\line(0,1){4}}
\put(265,0){\line(0,1){4}}
\put(290,0){\line(0,1){4}}
\put(315,0){\line(0,1){4}}

%Day 15
\put(340,0){\line(0,1){8}}
\put(365,0){\line(0,1){4}}
\put(390,0){\line(0,1){4}}
\put(415,0){\line(0,1){4}}
\put(440,0){\line(0,1){4}}
\put(465,0){\line(0,1){4}}
\put(490,0){\line(0,1){4}}

%Day 22
\put(515,0){\line(0,1){8}}
\put(540,0){\line(0,1){4}}
\put(565,0){\line(0,1){4}}
\put(590,0){\line(0,1){4}}
\put(615,0){\line(0,1){4}}
\put(640,0){\line(0,1){4}}

%Day 28
\put(665,0){\line(0,1){8}}

\end{picture}

\vspace{2cm}

\textit{Notes:} Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes Some notes
\end{document}


As you can see, apart from the picture mode picture everything looks sort of reasonable. What is the purpose of the picture mode picture? (You are loading forest which loads TikZ....)

• Hi Schrodinger's, I posted an image of problem 1 (I thought you were referring to that because anchor=center solved problem 2) – jpugliese Sep 19 at 3:14
• @jpugliese I see. The problem is that the tree overshoots. To see this, replace \usepackage{geometry} by \usepackage[showframe]{geometry} in your document. What would you ultimately like to achieve? A landscape document with a very small margin on the left and the right? – Schrödinger's cat Sep 19 at 3:18
• @jpugliese I added a proposal. Does that go in the right direction? – Schrödinger's cat Sep 19 at 3:26