! 额外 },或者忘记了 \endgroup. latex

! 额外 },或者忘记了 \endgroup. latex

我一直收到这个错误,我不知道我做错了什么。

\documentclass{report}
\usepackage{forest} %Required for trees
\usepackage{tikz}


\begin{document}

\begin{figure}

    \forestset{
  L2/.style={draw=blue,},
  L1/.style={,edge={,line width=0.9pt}},
}

\tikzset{%
  L1/.style={draw=blue},
  L2/.style={line width=0.9pt},
}%

\begin{center}

\begin{forest}
  for tree={
    grow'=0,
    parent anchor=children,
    child anchor=parent,
    edge+=L2,
    outer sep=+1pt,
    rounded corners,
    minimum width=19mm,
    minimum height=7mm,
    l sep' =31mm,
    s sep' =21mm
  }
  [S1, L1
    [aS1, L2, edge label={node[midway,fill=white,font=\scriptsize]{p1}}]

    [aS1, L2, edge label={node[midway,fill=white,font=\scriptsize]{p2}}]
  ]
\end{forest}


\bigskip


t=0~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~t=1
\end{center}

\caption{googly}

\end{figure}


\end{document}

上次遇到这个问题时,我调整了标签以不包含下标。不太确定这里出了什么问题。

答案1

删除 l.37 中的空行:

\documentclass{report}
\usepackage{forest} %Required for trees
\usepackage{tikz}


\begin{document}

\begin{figure}

    \forestset{
  L2/.style={draw=blue,},
  L1/.style={,edge={,line width=0.9pt}},
}

\tikzset{%
  L1/.style={draw=blue},
  L2/.style={line width=0.9pt},
}%

\begin{center}

\begin{forest}
  for tree={
    grow'=0,
    parent anchor=children,
    child anchor=parent,
    edge+=L2,
    outer sep=+1pt,
    rounded corners,
    minimum width=19mm,
    minimum height=7mm,
    l sep' =31mm,
    s sep' =21mm
  }
  [S1, L1
    [aS1, L2, edge label={node[midway,fill=white,font=\scriptsize]{p1}}]
    [aS1, L2, edge label={node[midway,fill=white,font=\scriptsize]{p2}}]
  ]
\end{forest}


\bigskip


t=0~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~t=1
\end{center}

\caption{googly}

\end{figure}


\end{document}

在此处输入图片描述

相关内容