无法在另一片森林下方绘制一片森林

无法在另一片森林下方绘制一片森林
  \resizebox{\columnwidth}{!}{%
                    \begin{forest}
                        for tree={draw, minimum width=2cm, minimum height=1cm, rounded corners},
                        forked edges,
                        [\textbf{TextBlob(``who hath relieved you?")}
                        [sentiment("who") [ p~:~0 ]]
                        [sentiment("hath") [p~:~0 ]]
                        [sentiment("relieved") [p~:~0 ]]
                        [sentiment("you") [p~:~0 ]]]
                    \end{forest}
                        \begin{forest}
                        for tree={draw, minimum width=2cm, minimum height=1cm, rounded corners},
                        forked edges,
                        [\textbf{TextBlob(``who hath relieved you?")}
                        [sentiment("who") [ p~:~0 ]]
                        [sentiment("hath") [p~:~0 ]]
                        [sentiment("relieved") [p~:~0 ]]
                        [sentiment("you") [p~:~0 ]]]
                    \end{forest}
                    
                        
            }

当我尝试执行它时,它会并排打印,而不是在 beamer 类中一个接一个地打印在此处输入图片描述

答案1

您没有提供一些重要信息:

  • 您使用哪种文档类别?
  • 这是两列文件吗?
  • 为什么需要缩放树?不要这样做,而是重新设计树(使用较小的字体大小,节点之间的距离较小)。如果您坚持使用\resizebox,则应该对每棵树分别使用它(并在它们之间插入空文本行)。

因此,请始终提供 MWE(最小工作示例),即一个完整的小文档,以 开头\documentclass,以 结尾,以\end{document}重现您的问题。假设您使用标准article文档类,MWE 可以解决您的问题,如下所示:

\documentclass{article}
\usepackage[edges]{forest}
%---------------- Show page layout. Don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
\begin{figure}[ht]
\centering
    \begin{forest}
for tree={draw, 
    minimum width=2cm, minimum height=1cm,
    rounded corners,
    font=\small,
forked edge,        % for forked edge
    s sep = 1mm,    % sibling distance
    l sep = 8mm,    % level distance
 fork sep = 4mm,    % distance from parent to branching point
        }
 [\textbf{TextBlob(``who hath relieved you?")}
    [sentiment("who") [ p~:~0 ]]
    [sentiment("hath") [p~:~0 ]]
    [sentiment("relieved") [p~:~0 ]]
    [sentiment("you") [p~:~0 ]]
]
    \end{forest}

\vspace{\baselineskip}
    \begin{forest}
for tree={draw,
    minimum width=2cm, minimum height=1cm,
    rounded corners,
    font=\small,
forked edge,        % for forked edge
    s sep = 1mm,    % sibling distance
    l sep = 8mm,    % level distance
 fork sep = 4mm,    % distance from parent to branching point
        }
 [\textbf{TextBlob(``who hath relieved you?")}
    [sentiment("who") [ p~:~0 ]]
    [sentiment("hath") [p~:~0 ]]
    [sentiment("relieved") [p~:~0 ]]
    [sentiment("you") [p~:~0 ]]
]
    \end{forest}
\end{figure}
\end{document}

在此处输入图片描述

(红线表示文本区域边框)

相关内容