2

I want smaller font size for all levels except the far out children (in the example below, everything except I saw Jane.) How do I do that with the forestset?

\documentclass{article}
\usepackage[linguistics, edges]{forest}
\begin{document}
\begin{center}
    \begin{forest}
    forked edges,
    [S
        [subject
            [pronoun [I]]
        ]
        [predicate,before computing xy={s/.average={s}{siblings}}
            [verb [saw]]
        ] [object
            [noun
                [Jane.]
            ]
        ]
    ]
    \end{forest}  
\end{center}
\end{document}

enter image description here

2
  • the code for tree={font=\tiny} effects the entire tree font whereas the code where n children=0{font=\normalsize}{} effects only the last level since the children are =0, from page 7 of the documentation -- ctan.imsc.res.in/graphics/pgf/contrib/forest/forest-doc.pdf
    – js bibra
    Jan 28, 2021 at 0:38
  • is there something else i can help you with
    – js bibra
    Jan 28, 2021 at 5:08

2 Answers 2

1

With use of the forestset:

\documentclass{article}
\usepackage[linguistics, edges]{forest}
\forestset{  % <---
  my tree/.style={for tree={forked edge,
                  where n children=0{font=\large} % <---
                                    {font=\small} % <---
                           }
                 }
          }% end of forestset

\begin{document}
\begin{center}
    \begin{forest} my tree % <---
[S
    [subject
        [pronoun 
            [I]
        ]
    ]
    [predicate,before computing xy={s/.average={s}{siblings}}
        [verb 
            [saw]
        ]
    ] 
    [object
        [noun
            [Jane.]
        ]
    ]
]
    \end{forest}
\end{center}
\end{document}

enter image description here

2

enter image description here

\documentclass{article}
\usepackage[linguistics, edges]{forest}
\begin{document}
\begin{center}
    \begin{forest}for tree={font=\tiny},where n children=0{font=\normalsize}{},
    forked edges,
    [S
        [subject
            [pronoun [I]]
        ]
        [predicate,before computing xy={s/.average={s}{siblings}}
            [verb [saw]]
        ] [object
            [noun
                [Jane.]
            ]
        ]
    ]
    \end{forest}  
\end{center}
\end{document}

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.