使森林适合双栏期刊

使森林适合双栏期刊

所以我有一个类似的垂直森林。我想将其放入带有以下类别的两列日记文档中。但第二列的森林溢出了页面。有什么方法可以让它适合其中一列吗?另外,我想删除方框,改用纯文本。

该文件的乳胶模板可以在这里找到这里

\documentclass[a4paper,twoside, multi, tikz]{article}

\usepackage{apalike}

\usepackage{forest,array}

\usepackage{SCITEPRESS}

\usetikzlibrary{shadows}

\begin{document}

\newcolumntype{C}[1]{>{\centering}p{#1}}

\begin{forest}
for tree={
  if level=0{align=center}{% allow multi-line text and set alignment
    align={@{}C{45mm}@{}},
  },
  grow=east,
  draw,
  font=\sffamily\bfseries,
  edge path={
    \noexpand\path [draw, \forestoption{edge}] (!u.parent anchor) -- +(5mm,0) |- (.child anchor)\forestoption{edge label};
  },
  parent anchor=east,
  child anchor=west,
  l sep=10mm,
  tier/.wrap pgfmath arg={tier #1}{level()},
  edge={ultra thick, rounded corners=2pt},
  fill=white,
  rounded corners=2pt,
  drop shadow,
}
[UML Diagram
  [Structure Diagram
    [Class Diagram]
    [Object Diagram]
    [Package Diagram]
    [Component Diagram]
    [Composite Structure Diagram]
    [Deployment Diagram]
    [Profile Diagram]
  ]
  [Behaviour Diagram
    [Use Case Diagram]
    [Activity Diagram]
    [State Machine Diagram]
    [Interaction Diagram
        [Sequence Diagram]
        [Communication Diagram]
        [Interaction Overview Diagram]
        [Timing Diagram]
    ]
  ]
]
\end{forest}

\end{document}

答案1

我可以通过减小字体大小和级别之间的间隔将其压缩到一列中。请参阅下面的代码。

另一个选择可能是将树放在 figure*横跨两列的环境中,并添加标题和标签,您可以\ref在其他地方这样做。然后您需要做的就是修改上述列的宽度C

您会得到方框,因为您已将draw选项添加到树中,以及drop shadow。删除这些,您也可以删除填充和圆角。

\documentclass[a4paper,twoside, multi, tikz]{article}

\usepackage{apalike}

\usepackage{forest,array}
\newcolumntype{C}[1]{>{\centering}p{#1}}

\usepackage{SCITEPRESS}

\usetikzlibrary{shadows}


\usepackage{lipsum}

\begin{document}
\lipsum[1-4]

\begin{center}
\begin{forest}
for tree={
  align=center,
  minimum width=13.5mm,
  grow=east,
%  draw, % <-- removed
  font=\sffamily\bfseries\scriptsize, % <-- smaller font
  edge path={
    \noexpand\path [draw, \forestoption{edge}] (!u.parent anchor) -- +(2mm,0) |- (.child anchor)\forestoption{edge label};  % <-- shorter edge
  },
  parent anchor=east,
  child anchor=west,
  l sep=4mm, % <-- less space
  tier/.wrap pgfmath arg={tier #1}{level()},
  edge={ultra thick, rounded corners=2pt},
%  fill=white, % <-- removed
%  rounded corners=2pt, % <-- removed
% drop shadow, % <-- removed
}
[UML\\Diagram
  [Structure\\Diagram
    [Class\\Diagram]
    [Object\\Diagram]
    [Package\\Diagram]
    [Component\\Diagram]
    [Composite\\Structure\\Diagram]
    [Deployment\\Diagram]
    [Profile\\Diagram]
  ]
  [Behaviour\\Diagram
    [Use Case\\Diagram]
    [Activity\\Diagram]
    [State\\Machine\\Diagram]
    [Interaction\\Diagram
        [Sequence\\Diagram]
        [Communication\\Diagram]
        [Interaction\\Overview\\Diagram]
        [Timing\\Diagram]
    ]
  ]
]
\end{forest}
\end{center}
\lipsum

\begin{figure*}
\centering
\begin{forest}
for tree={
  if level=0{align=center}{% allow multi-line text and set alignment
    align={@{}C{30mm}@{}}, % <---only changed this
  },
  grow=east,
  font=\sffamily\bfseries,
  edge path={
    \noexpand\path [draw, \forestoption{edge}] (!u.parent anchor) -- +(5mm,0) |- (.child anchor)\forestoption{edge label};
  },
  parent anchor=east,
  child anchor=west,
  l sep=10mm,
  tier/.wrap pgfmath arg={tier #1}{level()},
  edge={ultra thick, rounded corners=2pt},
}
[UML Diagram
  [Structure Diagram
    [Class Diagram]
    [Object Diagram]
    [Package Diagram]
    [Component Diagram]
    [Composite Structure Diagram]
    [Deployment Diagram]
    [Profile Diagram]
  ]
  [Behaviour Diagram
    [Use Case Diagram]
    [Activity Diagram]
    [State Machine Diagram]
    [Interaction Diagram
        [Sequence Diagram]
        [Communication Diagram]
        [Interaction Overview Diagram]
        [Timing Diagram]
    ]
  ]
]
\end{forest}
\caption{...}
\label{foo}
\end{figure*}
\end{document}

单列树型结构

图中树*

相关内容