-1

I want to change the size of the tree in my document.... But I'm totally new with trees and I don't know how to scale it. This is my code (with the tree from this answer:

\documentclass[a4paper, 12pt,fleqn]{article} 
 \usepackage[ngerman]{babel}
  \usepackage[utf8]{inputenc}
 \usepackage{graphicx}
%\documentclass[border=10pt,tikz]{standalone} %für den Baum
  \usepackage[edges]{forest}
  \usetikzlibrary{fit}
  \usepackage{natbib}
   \usepackage[fleqn]{amsmath}
\allowdisplaybreaks
\usepackage{mathptmx}
 \usepackage[scaled=.92]{helvet}
 \usepackage{courier}
\usepackage[left=30mm,right=40mm,top=25mm,bottom=20mm, includeheadfoot,    
 centering]   
  {geometry}
\usepackage{parskip}
\usepackage[onehalfspacing]{setspace}
\usepackage[center]{caption2}
\usepackage[flushmargin,bottom,hang]{footmisc}
\usepackage{acronym}
\usepackage[noxspace,final]{listofsymbols}
\usepackage{longtable}
\usepackage{array}
\usepackage{lmodern} %Schriftart ändern
\renewcommand*\familydefault{\sfdefault} %Schriftart geändert
\usepackage{pgfplots} %von philipp
\usepackage[figuresright]{rotating}
\usepackage{verbatim}
\usepackage{float}
\usepackage{parskip}



 \usepackage[edges]{forest}
 \usetikzlibrary{fit}




 \pagestyle{myheadings}
\renewcommand{\baselinestretch}{1.3}
\renewcommand{\arraystretch}{1.0}
 \setlength{\parindent}{0pt}
\setlength{\parskip}{0cm}
 \setlength{\footnotemargin}{1em}

 \renewcommand{\labelenumi}{(\alph{enumi})}
 \renewcommand{\labelenumii}{(\alph{enumi}\arabic{enumii})}

 \opensymdef



 \setlength{\mathindent}{0pt}
  %\setlength\jot{1cm} %abstand zwischen Formeln
 \begin{document}

 The Tree ist just too big!

 \begin{forest}
   for tree={
    draw,
    align=center
   },
   forked edges,
   [Maschinenbelegungs-\\planung
     [deterministische\\Prozesse
      [ein- Maschinen\\Probleme
      ]
       [mehrstufige\\Probleme
        [identische Maschinenfolge f\"ur\\alle Auftr\"age \\\textbf{Flow Shop}
         ]
        [unterschiedliche\\Maschinenfolge der Auftr\"age \\\textbf{Job Shop}
        ]
        [ungeordnete Maschinenfolge\\ der Auftr\"age \\\textbf{Open Shop}
        ]
      ]
    ]
    [stochastische\\Prozesse
    ]
  ]
   \node [draw, fit=(current bounding box.south east) (current bounding 
  box.north    
  west)] {};
\end{forest}
\end{document}

How can I put all the lines in the code that you can see my code? Normally I just have to tap every line 4 times via space. Is there a better solution?

Milo Li
  • 347

1 Answers1

2

As I say in my answer to your earlier question, there are different ways to make things fit. Which works best for you is something only you can judge.

I would try making the terminal nodes 4, rather than 3, lines. For example:

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[left=30mm,right=40mm,top=25mm,bottom=20mm, includeheadfoot, centering]{geometry}
\usepackage[edges]{forest}
\usetikzlibrary{fit}

\begin{document}
\begin{figure}
  \centering
  \begin{forest}
    for tree={
      draw,
      align=center
    },
    forked edges,
    [Maschinenbelegungs-\\planung
      [deterministische\\Prozesse
        [ein- Maschinen\\Probleme
        ]
        [mehrstufige\\Probleme
          [identische\\Maschinenfolge\\für alle Auftr\"age\\\textbf{Flow Shop}
          ]
          [unterschiedliche\\Maschinenfolge\\der Auftr\"age\\\textbf{Job Shop}, calign with current
          ]
          [ungeordnete\\Maschinenfolge\\der Auftr\"age\\\textbf{Open Shop}
          ]
        ]
      ]
      [stochastische\\Prozesse
      ]
    ]
    \node [draw, fit=(current bounding box.south east) (current bounding box.north west)] {};
  \end{forest}
  \caption{Organisation}\label{fig:org}
\end{figure}
\end{document}

fit tree to page

EDIT

If you do not want to alter the line breaks, then either you rotate the figure or you make it smaller. The obvious way to do this is to use a smaller font. I found that I needed to make it much smaller to get it to fit. (\scriptsize) Since you are using Latin Modern Sans as your default text font, one possibility to do this without losing legibility would be to utilise the Quotation Sans font from Latin Modern. lmodern doesn't support this, but cfr-lm does. Here, I load cfr-lm with options equivalent to those used when lmodern is used. Personally, I wouldn't use these options: I would at least use proportional figures for serif and sans, even if you want lining. But maybe that's just me.

The result:

tree in Latin Modern Quotation Sans

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[rm={tabular, lining},sf={tabular, lining},tt={monowidth, tabular, lining}]{cfr-lm}
\renewcommand*\familydefault{\sfdefault}
\usepackage[left=30mm,right=40mm,top=25mm,bottom=20mm, includeheadfoot, centering]{geometry}
\usepackage[edges]{forest}
\usetikzlibrary{fit}

\begin{document}
\begin{figure}
  \centering
  \qtstyle\scriptsize
  \begin{forest}
    for tree={
      draw,
      align=center
    },
    forked edges,
    [Maschinenbelegungs-\\planung
      [deterministische\\Prozesse
        [ein- Maschinen\\Probleme
        ]
        [mehrstufige\\Probleme
          [identische Maschinenfolge für\\alle Auftr\"age\\\textbf{Flow Shop}
          ]
          [unterschiedliche\\Maschinenfolge der Auftr\"age\\\textbf{Job Shop}, calign with current
          ]
          [ungeordnete Maschinenfolge\\der Auftr\"age\\\textbf{Open Shop}
          ]
        ]
      ]
      [stochastische\\Prozesse
      ]
    ]
    \node [draw, fit=(current bounding box.south east) (current bounding box.north west)] {};
  \end{forest}
  \caption{Organisation}\label{fig:org}
\end{figure}
\end{document}

EDIT EDIT

Here's a rather prettier version:

prettier version

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[rm={lining},sf={lining},tt={monowidth, tabular, lining}]{cfr-lm}
\renewcommand*\familydefault{\sfdefault}
\usepackage[left=30mm,right=40mm,top=25mm,bottom=20mm, includeheadfoot, centering]{geometry}
\usepackage[edges]{forest}
\usetikzlibrary{fit,backgrounds,shadows.blur}
\forestset{
  terminus label/.style={
    l sep'=5pt,
    before typesetting nodes={
      append={[#1, font=\bfseries, no edge, name=#1]}
    }
  }
}
\begin{document}
\begin{figure}
  \centering
  \sffamily
  \begin{forest}
    for tree={
      draw=darkgray,
      thick,
      align=center,
      rounded corners,
      top color=gray!5,
      bottom color=gray!10,
      edge={thick, draw=darkgray},
      blur shadow,
    },
    forked edges,
    [Maschinenbelegungs-\\planung
      [deterministische\\Prozesse
        [ein- Maschinen\\Probleme
        ]
        [mehrstufige\\Probleme
          [identische\\Maschinenfolge\\für alle Aufträge, terminus label=Flow Shop
          ]
          [unterschiedliche\\Maschinenfolge\\der Aufträge, terminus label=Job Shop, calign with current
          ]
          [ungeordnete\\Maschinenfolge\\der Aufträge, terminus label=Open Shop
          ]
        ]
      ]
      [stochastische\\Prozesse
      ]
    ]
    \scoped[on background layer]{\node [draw, blur shadow, inner sep=5pt, fill=gray!2.5, thick, rounded corners, fit=(current bounding box.south east) (current bounding box.north west)] {};}
  \end{forest}
  \caption{Organisation}\label{fig:org}
\end{figure}
\end{document}
cfr
  • 198,882
  • thank you for that, normally i just want to have it like the picture i posted in the last post.... but i think they changed the size of the font.... – Milo Li Dec 07 '16 at 00:04
  • @MiloLi See edit. I wouldn't do it this way, but there you go. – cfr Dec 07 '16 at 00:17
  • thanks for your edit and help. You did a lot of helping! I mean the first solution just looked ugly with 3 nodes it was too big and 4 nodes it was too small, so i thaught it would be better if it looks like the picture i posted... Thanks alot cfr! – Milo Li Dec 07 '16 at 00:33
  • @MiloLi ^^ Prettier version. – cfr Dec 07 '16 at 02:26
  • one last question under the first version i want to put under Figure1 a Text. when i write the text like Source: Eigene Darstellung. He writes the text smaller.... cuz of the scriptstyle! how can i change that ? – Milo Li Dec 10 '16 at 19:43
  • @MiloLi Sorry. Where do I use \scriptstyle? – cfr Dec 11 '16 at 00:38
  • @MiloLi Oh, you mean \scriptsize. Leave a blank line, probably, and then just say \normalfont\normalsize. Or group the tree with the font change at the beginning and the blank line using { } or something. – cfr Dec 11 '16 at 00:39
  • hey@cfr that was just what i was looking for, thank you so much! – Milo Li Dec 11 '16 at 20:50