forest - 将父节点置于顶层

forest - 将父节点置于顶层

使用下面的代码,我想将父节点放在顶部。这可行吗?

在此处输入图片描述

% Source: https://tex.stackexchange.com/a/593383/6880

\documentclass[border=3.141592]{standalone}%{article}
\usepackage[edges]{forest}

\begin{document}
    \begin{forest}
for tree = {
% nodes
    circle, minimum size=0.5ex, fill, outer sep=0pt,
% tree style
    grow = east,
    forked edge,
    s sep = 4mm,
    l sep = 8mm,
 fork sep = 4mm,
lr/.style = {label={[align=left,    % <--- added
                     font=\linespread{0.84}\selectfont]right:{#1}}}
            }
[, label=left:\textbf{ISO\slash IEC 29100:2011}
    [, lr=Consent and Choice]
    [, lr=Purpose Legitimacy and Specification]
    [, lr=Collection Limitation]
    [, lr=Data Minimization]
    [, lr={Use, Retention and Disclosure\\ Limitationg}]
    [, lr=Accuracy and Quality]
    [, lr={Openness, Transparency and Notice}]
    [, lr=Individual Participation and Access]
    [, lr=Accountability]
    [, lr=Information Security Controls]
    [, lr=Compliance]
 ]
    \end{forest}
\end{document}

答案1

添加该calign=last选项将产生以下输出:

在此处输入图片描述

或者calign=first, reversed=true也可以。


% Source: https://tex.stackexchange.com/a/593383/6880

\documentclass[border=3.141592]{standalone}%{article}
\usepackage[edges]{forest}

\begin{document}
    \begin{forest}
for tree = {
% nodes
    circle, minimum size=0.5ex, fill, outer sep=0pt,
% tree style
    grow = east,
    calign=last, %<------------------------- added
    forked edge,
    s sep = 4mm,
    l sep = 8mm,
 fork sep = 4mm,
lr/.style = {label={[align=left,    % <--- added
                     font=\linespread{0.84}\selectfont]right:{#1}}}
            }
[, label=left:\textbf{ISO\slash IEC 29100:2011}
    [, lr=Consent and Choice]
    [, lr=Purpose Legitimacy and Specification]
    [, lr=Collection Limitation]
    [, lr=Data Minimization]
    [, lr={Use, Retention and Disclosure\\ Limitationg}]
    [, lr=Accuracy and Quality]
    [, lr={Openness, Transparency and Notice}]
    [, lr=Individual Participation and Access]
    [, lr=Accountability]
    [, lr=Information Security Controls]
    [, lr=Compliance]
 ]
    \end{forest}
\end{document}

相关内容