在 tikzumlmanual.pdf 的第 34 页,我找到了一个我想测试的用例系统示例。但我无法重做。
MWS 是:
\documentclass[12pt]{article}
\usepackage{geometry} % see geometry.pdf on how to lay out the page. There's lots.
\usepackage{tikz}
\usetikzlibrary{%
arrows,
shapes,
chains,
matrix,
positioning,
shapes.multipart,
calc,
scopes}
\usepackage{tikz-uml}
\usepackage{ifthen}
\usepackage{xstring}
\usepackage{pgfkeys}
\begin{document}
\begin{tikzpicture}
\begin{umlsystem}[x=4, fill=red!10]{The system}
\umlusecase{use case1}
\umlusecase[y=-2]{use case2}
\umlusecase[y=-4]{use case3}
\umlusecase[x=4, y=-2, width=1.5cm]{use case4 on 2 lines}
\umlusecase[x=6, fill=green!20]{use case5}
\umlusecase[x=6, y=-4]{use case6}
\end{umlsystem}
\umlactor{user}
\umlactor[y=-3]{subuser}
\umlactor [ x=14, y=-1.5 ] {admin}
\umlinherit{subuser}{user}
\umlassoc{user}{usecase -1}
\umlassoc{subuser}{usecase -2}
\umlassoc{subuser}{usecase -3}
\umlassoc{admin}{usecase -5}
\umlassoc{admin}{usecase -6}
\umlinherit{usecase -2}{usecase -1}
\umlVHextend{usecase −5}{usecase -4}
\umlinclude[name=incl ]{usecase-3}{usecase-4}
\umlnote[x=7, y=-7]{incl -1}{note on include dependency}
\end{tikzpicture}
\end{document}
答案1
这有效:
\documentclass[12pt]{article}
\usepackage{geometry} % see geometry.pdf on how to lay out the page. There's lots.
\usepackage{tikz}
\usetikzlibrary{%
arrows,
shapes,
chains,
matrix,
positioning,
shapes.multipart,
calc,
scopes}
\usepackage{tikz-uml}
\usepackage{ifthen}
\usepackage{xstring}
\usepackage{pgfkeys}
\begin{document}
\begin{tikzpicture}
\begin{umlsystem}[x=4, fill=red!10]{The system}
\umlusecase[name=case1]{use case1}
\umlusecase[name=case2,y=-2]{use case2}
\umlusecase[name=case3,y=-4]{use case3}
\umlusecase[name=case4,x=4, y=-2, width=1.5cm]{use case4 on 2 lines}
\umlusecase[name=case5,x=6, fill=green!20]{use case5}
\umlusecase[name=case6,x=6, y=-4]{use case6}
\end{umlsystem}
\umlactor{user}
\umlactor[y=-3]{subuser}
\umlactor[x=14, y=-1.5]{admin}
\umlinherit{subuser}{user}
\umlassoc{user}{case1}
\umlassoc{subuser}{case2}
\umlassoc{subuser}{case3}
\umlassoc{admin}{case5}
\umlassoc{admin}{case6}
\umlinherit{case2}{case1}
\umlVHextend{case5}{case4}
\umlinclude[name=incl]{case3}{case4}
\umlnote[x=7,y=-7]{incl-1}{note on include dependency}
\end{tikzpicture}
\end{document}
在我看来,该tikz-uml
图书馆至少可以在其文档方面做些改进。
我尝试在和命令incl
中使用,但不起作用,并且它抱怨形状未知。使用实际上有效。\umlinclude
\umlnote
incl-1
\umlinclude[name=incl]{case3}{case4}
\umlnote[x=7,y=-7]{incl-1}{note on include dependency}