请教一个关于forest的问题

发布于 2021-05-03 20:00:10

请教各位大佬,图中第三级21的下一级“文字文字。。。”那块地方的大括号没有与“第三级21”这几个居中对齐,还有“文字文字。。。”那一级侵占了其他级的空间,这两个问题如何调整呢?
WechatIMG122.jpeg

\documentclass{ctexart}
\usepackage{tikz}
\usepackage{amsmath,forest}
\usetikzlibrary{decorations.pathreplacing}
\forestset{
  forest scheme/.style={
    for tree={
      child anchor=west,
      parent anchor=east,
      grow'=0,
      anchor=west,
      align=left,
      if n=1{%
        edge path={
          \noexpand\path [\forestoption{edge}] ([yshift=0.7em]!ul.south west) -- ([yshift=-0.7em]!u1.north west)\forestoption{edge label};
        }
      }{no edge},
      edge={decorate, decoration={brace,amplitude=2mm,raise=3pt}},
    },
  }
}
\begin{document}
\begin{forest}
forest scheme
  [Main
    [第二级1
      [第三级11]
      [第三级12]
    ]
    [第二级2
      [第三级21
      [\parbox{6em}{文字文字文字文字文字文字文字文文字}]
      [结构]
      ]
      [第三级22]
    ]
  ]
\end{forest}
\end{document}

查看更多

关注者
0
被浏览
1.1k
2 个回答
Y@@Y
Y@@Y 2021-05-03
这家伙很懒,什么也没写!
\documentclass[UFT8]{ctexart}
\usepackage{tikz}
\usepackage{amsmath,forest}
\usetikzlibrary{decorations.pathreplacing}
\forestset{
  forest scheme/.style={
    for tree={
      child anchor=west,
      parent anchor=east,
      grow'=0,
      anchor=west,
      align=left,
      if n=1{%
        edge path={
          \noexpand\path [\forestoption{edge}] ([yshift=0.7em]!ul.south west) -- ([yshift=-0.7em]!u1.north west)\forestoption{edge label};
        }
      }{no edge},
      edge={decorate, decoration={brace,amplitude=2mm,raise=3pt}},
    },
  }
}
\begin{document}
\begin{forest}
forest scheme
  [Main
    [第二级1
      [第三级11]
      [第三级12]
    ]
    [第二级2
      [第三级21
      \vspace*{15pt} [\parbox{6em}{文字文字文字文字文字文字文字文文字}]
      [结构]
      ]
      [第三级22]
    ]
  ]
\end{forest}
\end{document}
行者
行者 2021-08-29
这家伙很懒,什么也没写!

暂时仅解决了第2个问,详见【用 forest 宏包画“大括号”图】,https://latexstudio.net/index/details/index/ids/1894
image.png

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览