tikz-uml 和 pgf-umlcd new 崩溃

tikz-uml 和 pgf-umlcd new 崩溃

我收到以下错误信息:

! 软件包 pgf 错误:抱歉,请求的层“connectionlayers”不属于层列表。请验证您提供的 \pgfsetlayers 和“conn ectionlayers”是否属于此列表。

使用时:

\usepackage{tikz-uml}
\let\umlnoteold\umlnote
\let\umlnote\relax
\usepackage[simplified]{pgf-umlcd}

该问题的背景:tikz-uml 和 pgf-umlcd 崩溃

有人可以帮我吗?

可编译代码:

\documentclass[]{scrreprt} 
\usepackage[ngerman, english]{babel} 
\usepackage{tikz}
\usepackage{verbatim}
\usetikzlibrary{positioning,shapes,shadows,arrows}
\usepackage{tikz-uml}
\let\umlnoteold\umlnote
\let\umlnote\relax
\usepackage[simplified]{pgf-umlcd}


\begin{document}

%\begin{figure}[h]
%\centering
%\resizebox{1\textwidth}{!}{%
%\begin{tikzpicture}
%\tikzumlset{fill object = white, fill call = gray!20} 
%\begin{umlseqdiag}
%\umlactor{a}
%\umlobject[x=4]{b}
%\umlobject[x=13]{c}
%\begin{umlcall}[op=blah, type=synchron, return=halb]{a}{b}
%
%        \begin{umlcallself}[op=lögfkhjölgkjh]{b} 
%       \end{umlcallself}
%       
%       \begin{umlcallself}[op=sieorjögdfljglö]{b} 
%       \end{umlcallself}
%       
%       \begin{umlcallself}[op=pffffff]{b} 
%       \end{umlcallself}       
%        \begin{umlcall}[op=signalize witching]{b}{c} 
%            \end{umlcall}                  
%                \begin{umlcall}[op=send fartValue, type=synchron, return=backnforth]{b}{c}                 
%                   \begin{umlcallself}[padding=1.5, op=search th ligth]{c} 
%                   \end{umlcallself}                   
%           \end{umlcall}
%\end{umlcall}
%\umlsdnode[dt=5]{a}
%\umlsdnode[dt=5.5]{b}
%\umlsdnode[dt=7]{c}
%\end{umlseqdiag}
%\end{tikzpicture}}
%\caption{blaaaaah}
%\label{fig:SDG}
%\end{figure}
%
%



\begin{figure}[h]
\centering
\resizebox{1\textwidth}{!}{%
\begin{tikzpicture}

    \begin{class}[text width =14 cm]{Meeeh}{0,0}
\attribute{\# m\_actualinpuss:int}
\attribute{\# m\_bufferFlood:buul}
%%%%%
\operation{+ deleteSuffers():void}
\operation{+ Togglewitch(int, FatServer*, unint32\_t)}
\end{class}
    \begin{class}[text width =10 cm]{Slave}{-6,-14}
\inherit{Meeeh}
\attribute{- m\_...: ... int}
%%%%%
\operation{+ ....(int, ...)}
\end{class}
    \begin{class}[text width =10 cm]{Master}{6,-14}
\inherit{Slave}
\attribute{- m\_...: ... int}
%%%%%
\operation{+ ....(int, ...)}
\end{class}
    \begin{class}[text width =15 cm]{blabber}{-8,-18}
\inherit{Slave}
\attribute{- m\_bufferHamburger: unsigned int}
\attribute{- m\_emptySlotCount:int}
%%%%%
\operation{+ nghjkldrt*)}
\operation{+ \~{}ggllblabber()}
\
\end{class}
    \begin{class}[text width =15 cm]{blubber}{8,-18}
\inherit{Master}
\attribute{-  m\_blub:bool}
\attribute{-  m\_blahblah*}
%%%%%
\operation{+  getBlah():shared\_ptr$<$ShmSlotBlahBuffer$>$}
\operation{+  blah():void}
\end{class}

\end{tikzpicture}}
\caption{blah}
\label{fig:KDG}
\end{figure}
\end{document}

这工作正常(TeXworks、texlive)。但是当取消注释第一个图时,问题就出现了。

答案1

我可能没有使用相同版本的tikz-uml,但您所描述的错误可以通过在代码中添加此行来解决:

\pgfsetlayers{connections,activity,lifelines}`

这会将图层添加到您的图像中,请参见平均能量损失

\documentclass[]{scrreprt} 
\usepackage[ngerman, english]{babel} 
\usepackage{tikz}
\usepackage{verbatim}
\usetikzlibrary{positioning,shapes,shadows,arrows}
\usepackage{tikz-uml}
\let\umlnoteold\umlnote
\let\umlnote\relax
\usepackage[simplified]{pgf-umlcd}

\begin{document}

\begin{figure}[h]
\centering
\begin{tikzpicture}
\pgfsetlayers{connections,activity,lifelines}
\tikzumlset{fill object = white, fill call = gray!20} 
\begin{umlseqdiag}
\umlactor{a}
\umlobject[x=4]{b}
\umlobject[x=13]{c}
\begin{umlcall}[op=blah, type=synchron, return=halb]{a}{b}

        \begin{umlcallself}[op=bb]{b} 
       \end{umlcallself}

       \begin{umlcallself}[op=bbb]{b} 
       \end{umlcallself}

       \begin{umlcallself}[op=bbbb]{b} 
       \end{umlcallself}   

        \begin{umlcall}[op=signalize witching]{b}{c} 
            \end{umlcall}                  
                \begin{umlcall}[op=send fartValue, type=synchron, return=backnforth]{b}{c}                 
                   \begin{umlcallself}[padding=1.5, op=search th ligth]{c} 
                   \end{umlcallself}                   
           \end{umlcall}
\end{umlcall}
%\umlsdnode[dt=5]{a}
%\umlsdnode[dt=5.5]{b}
%\umlsdnode[dt=7]{c}
\end{umlseqdiag}
\end{tikzpicture}
\end{figure}


\end{document}

我已经对这些\umlsdnode命令进行了注释,因为我的软件包版本似乎不包含这些命令。

答案2

这显示了 umlobjects,但我不能使用代码的注释部分:

\documentclass[]{scrreprt} 
\usepackage[ngerman, english]{babel} 
\usepackage{tikz}
\usepackage{verbatim}
\usetikzlibrary{positioning,shapes,shadows,arrows}
\usepackage{tikz-uml}
\let\umlnoteold\umlnote
\let\umlnote\relax
%\usepackage[simplified]{pgf-umlcd}


\begin{document}

\begin{figure}[h]
\centering
\resizebox{1\textwidth}{!}{%
\begin{tikzpicture}
%\pgfsetlayers{connections,activity,lifelines}
\tikzumlset{fill object = white, fill call = gray!20} 
\begin{umlseqdiag}
\umlactor{a}
\umlobject[x=4]{b}
\umlobject[x=13]{c}
\begin{umlcall}[op=blah, type=synchron, return=halb]{a}{b}

        \begin{umlcallself}[op=lögfkhjölgkjh]{b} 
       \end{umlcallself}

       \begin{umlcallself}[op=sieorjögdfljglö]{b} 
       \end{umlcallself}

       \begin{umlcallself}[op=pffffff]{b} 
       \end{umlcallself}       
        \begin{umlcall}[op=signalize witching]{b}{c} 
            \end{umlcall}                  
                \begin{umlcall}[op=send fartValue, type=synchron, return=backnforth]{b}{c}                 
                   \begin{umlcallself}[padding=1.5, op=search th ligth]{c} 
                   \end{umlcallself}                   
           \end{umlcall}
\end{umlcall}
\umlsdnode[dt=5]{a}
\umlsdnode[dt=5.5]{b}
\umlsdnode[dt=7]{c}
\end{umlseqdiag}
\end{tikzpicture}}
\caption{blaaaaah}
\label{fig:SDG}
\end{figure}




%
%\begin{figure}[h]
%\centering
%\resizebox{1\textwidth}{!}{%
%\begin{tikzpicture}
%
%    \begin{class}[text width =14 cm]{Meeeh}{0,0}
%\attribute{\# m\_actualinpuss:int}
%\attribute{\# m\_bufferFlood:buul}
%%%%%%
%\operation{+ deleteSuffers():void}
%\operation{+ Togglewitch(int, FatServer*, unint32\_t)}
%\end{class}
%    \begin{class}[text width =10 cm]{Slave}{-6,-14}
%\inherit{Meeeh}
%\attribute{- m\_...: ... int}
%%%%%%
%\operation{+ ....(int, ...)}
%\end{class}
%    \begin{class}[text width =10 cm]{Master}{6,-14}
%\inherit{Slave}
%\attribute{- m\_...: ... int}
%%%%%%
%\operation{+ ....(int, ...)}
%\end{class}
%    \begin{class}[text width =15 cm]{blabber}{-8,-18}
%\inherit{Slave}
%\attribute{- m\_bufferHamburger: unsigned int}
%\attribute{- m\_emptySlotCount:int}
%%%%%%
%\operation{+ nghjkldrt*)}
%\operation{+ \~{}ggllblabber()}
%\
%\end{class}
%    \begin{class}[text width =15 cm]{blubber}{8,-18}
%\inherit{Master}
%\attribute{-  m\_blub:bool}
%\attribute{-  m\_blahblah*}
%%%%%%
%\operation{+  getBlah():shared\_ptr$<$ShmSlotBlahBuffer$>$}
%\operation{+  blah():void}
%\end{class}
%
%\end{tikzpicture}}
%\caption{blah}
%\label{fig:KDG}
%\end{figure}
\end{document}

这让我可以使用这两个部分,但是 umlobjects 没有显示:

\documentclass[]{scrreprt} 
\usepackage[ngerman, english]{babel} 
\usepackage{tikz}
\usepackage{verbatim}
\usetikzlibrary{positioning,shapes,shadows,arrows}
\usepackage{tikz-uml}
\let\umlnoteold\umlnote
\let\umlnote\relax
\usepackage[simplified]{pgf-umlcd}


\begin{document}

\begin{figure}[h]
\centering
\resizebox{1\textwidth}{!}{%
\begin{tikzpicture}
\pgfsetlayers{connections,activity,lifelines}
\tikzumlset{fill object = white, fill call = gray!20} 
\begin{umlseqdiag}
\umlactor{a}
\umlobject[x=4]{b}
\umlobject[x=13]{c}
\begin{umlcall}[op=blah, type=synchron, return=halb]{a}{b}

        \begin{umlcallself}[op=lögfkhjölgkjh]{b} 
       \end{umlcallself}

       \begin{umlcallself}[op=sieorjögdfljglö]{b} 
       \end{umlcallself}

       \begin{umlcallself}[op=pffffff]{b} 
       \end{umlcallself}       
        \begin{umlcall}[op=signalize witching]{b}{c} 
            \end{umlcall}                  
                \begin{umlcall}[op=send fartValue, type=synchron, return=backnforth]{b}{c}                 
                   \begin{umlcallself}[padding=1.5, op=search th ligth]{c} 
                   \end{umlcallself}                   
           \end{umlcall}
\end{umlcall}
\umlsdnode[dt=5]{a}
\umlsdnode[dt=5.5]{b}
\umlsdnode[dt=7]{c}
\end{umlseqdiag}
\end{tikzpicture}}
\caption{blaaaaah}
\label{fig:SDG}
\end{figure}





\begin{figure}[h]
\centering
\resizebox{1\textwidth}{!}{%
\begin{tikzpicture}

    \begin{class}[text width =14 cm]{Meeeh}{0,0}
\attribute{\# m\_actualinpuss:int}
\attribute{\# m\_bufferFlood:buul}
%%%%%
\operation{+ deleteSuffers():void}
\operation{+ Togglewitch(int, FatServer*, unint32\_t)}
\end{class}
    \begin{class}[text width =10 cm]{Slave}{-6,-14}
\inherit{Meeeh}
\attribute{- m\_...: ... int}
%%%%%
\operation{+ ....(int, ...)}
\end{class}
    \begin{class}[text width =10 cm]{Master}{6,-14}
\inherit{Slave}
\attribute{- m\_...: ... int}
%%%%%
\operation{+ ....(int, ...)}
\end{class}
    \begin{class}[text width =15 cm]{blabber}{-8,-18}
\inherit{Slave}
\attribute{- m\_bufferHamburger: unsigned int}
\attribute{- m\_emptySlotCount:int}
%%%%%
\operation{+ nghjkldrt*)}
\operation{+ \~{}ggllblabber()}
\
\end{class}
    \begin{class}[text width =15 cm]{blubber}{8,-18}
\inherit{Master}
\attribute{-  m\_blub:bool}
\attribute{-  m\_blahblah*}
%%%%%
\operation{+  getBlah():shared\_ptr$<$ShmSlotBlahBuffer$>$}
\operation{+  blah():void}
\end{class}

\end{tikzpicture}}
\caption{blah}
\label{fig:KDG}
\end{figure}
\end{document}

答案3

我在序言中添加了以下两行,就在之前 \begin{document} ,这解决了我的问题。(相同的错误消息)。

\pgfdeclarelayer{connectionlayers}
\pgfsetlayers{connectionlayers,main} 

答案4

于是,我踢了

\let\umlnoteold\umlnote
\let\umlnote\relax
\usepackage[simplified]{pgf-umlcd}

输出并输出

\pgfsetlayers{connections,activity,lifelines}

\usepackage{tikz-uml}

并使用

\umlclass

代替

\begin{class}

完美工作!

相关内容