这是我的 LaTeX 文档。
\documentclass{article}
\usepackage{tikz-uml}
\usepackage{tikz}
\usepackage[T1]{fontenc}
\usepackage{amssymb}
\usepackage{graphicx}
\begin{document}
\title{Diagrama Casos de uso en \LaTeX{} - Devoluci\'on a proveedores}
\author{Esteban Vera Valdez}
\maketitle
\begin{center}
\begin{tikzpicture}
\begin{umlsystem}[fill=red!10]{Sistema}
\setcounter{tikzumlUseCaseNum}{0}
\umlusecase{Solicitar inventario}
\umlusecase[x=2.3, y=-1.5, width=2.7cm]{Solicitar devoluci\'on}
\umlusecase[x=2.3, y=-3, width=2.3cm]{Generar documentaci\'on}
\umlusecase[y=-4.5]{Generar inventario}
\umlusecase[x=7.2, fill=green!20]{Solicitar docuentaci\'on}
\umlusecase[x=7.2, y=-1.5, fill=green!20]{Realiza la devoluci\'on}
\umlusecase[x=6.5, y=-3.8]{Recibe fac. y pedido}
\umlusecase[x=5.8, y=-5]{Registra datos}
\umlusecase[y=-6]{Almacenar datos}
\umlusecase[y=-7.5]{Almacenar prod.}
\umlusecase[y=-9]{Actualizar inventario}
\umlusecase[x=5.8, y=-7.4, width=2.6cm]{Lista productos defectuosos}
\end{umlsystem}
\umlactor[x=-4, y=-3.4]{Usuario}
\umlactor[x=-4, y=-7.5]{Sistema}
\umlactor[x=12,y=-1.5]{Proveedor}
\umlinherit{Usuario}{Sistema}
\umlassoc{Usuario}{usecase-1}
\umlassoc{Usuario}{usecase-2}
\umlassoc{Usuario}{usecase-3}
\umlassoc{Usuario}{usecase-7}
\umlassoc{Usuario}{usecase-8}
\umlassoc{Sistema}{usecase-4}
\umlassoc{Sistema}{usecase-9}
\umlassoc{Sistema}{usecase-10}
\umlassoc{Sistema}{usecase-11}
\umlassoc{Proveedor}{usecase-5}
\umlassoc{Proveedor}{usecase-6}
\umlinherit{usecase-1}{usecase-4}
\umlinherit{usecase-2}{usecase-5}
\umlinherit{usecase-6}{usecase-7}
\umlVHextend{usecase-8}{usecase-9}
\umlinclude[name=incl]{usecase-4}{usecase-12}
\umlnote[x=4.3, y=-9]{incl-1}{Muestra info del proveedor}
\end{tikzpicture}
\end{center}
\end{document}
答案1
您的图片似乎比 更宽\textwidth
。您可以使用
\makebox[\linewidth][c]{\begin{tikzpicture}...\end{tikzpicture}}
使整个图片相对于文本主体居中。
代码:
\documentclass{article}
\usepackage{tikz-uml}% loads also tikz, graphicx, xcolor,...
\usepackage[T1]{fontenc}
\usepackage{amssymb}
\usepackage{showframe}% only for the example to show the page layout
\begin{document}
\title{Diagrama Casos de uso en \LaTeX{} - Devoluci\'on a proveedores}
\author{Esteban Vera Valdez}
\maketitle
\begin{center}
\makebox[\linewidth][c]{%
\begin{tikzpicture}
\begin{umlsystem}[fill=red!10]{Sistema}
\setcounter{tikzumlUseCaseNum}{0}
\umlusecase{Solicitar inventario}
\umlusecase[x=2.3, y=-1.5, width=2.7cm]{Solicitar devoluci\'on}
\umlusecase[x=2.3, y=-3, width=2.3cm]{Generar documentaci\'on}
\umlusecase[y=-4.5]{Generar inventario}
\umlusecase[x=7.2, fill=green!20]{Solicitar docuentaci\'on}
\umlusecase[x=7.2, y=-1.5, fill=green!20]{Realiza la devoluci\'on}
\umlusecase[x=6.5, y=-3.8]{Recibe fac. y pedido}
\umlusecase[x=5.8, y=-5]{Registra datos}
\umlusecase[y=-6]{Almacenar datos}
\umlusecase[y=-7.5]{Almacenar prod.}
\umlusecase[y=-9]{Actualizar inventario}
\umlusecase[x=5.8, y=-7.4, width=2.6cm]{Lista productos defectuosos}
\end{umlsystem}
%
\umlactor[x=-4, y=-3.4]{Usuario}
\umlactor[x=-4, y=-7.5]{Sistema}
\umlactor[x=12,y=-1.5]{Proveedor}
%
\umlinherit{Usuario}{Sistema}
\umlassoc{Usuario}{usecase-1}
\umlassoc{Usuario}{usecase-2}
\umlassoc{Usuario}{usecase-3}
\umlassoc{Usuario}{usecase-7}
\umlassoc{Usuario}{usecase-8}
\umlassoc{Sistema}{usecase-4}
\umlassoc{Sistema}{usecase-9}
\umlassoc{Sistema}{usecase-10}
\umlassoc{Sistema}{usecase-11}
\umlassoc{Proveedor}{usecase-5}
\umlassoc{Proveedor}{usecase-6}
\umlinherit{usecase-1}{usecase-4}
\umlinherit{usecase-2}{usecase-5}
\umlinherit{usecase-6}{usecase-7}
\umlVHextend{usecase-8}{usecase-9}
\umlinclude[name=incl]{usecase-4}{usecase-12}
%
\umlnote[x=4.3, y=-9]{incl-1}{Muestra info del proveedor}
\end{tikzpicture}%
}
\end{center}
\end{document}
如果只需让红色框居中,则可以scope
使用选项添加一个overlay
。
代码:
\documentclass{article}
\usepackage{tikz-uml}% loads also tikz, graphicx, xcolor,...
\usepackage[T1]{fontenc}
\usepackage{amssymb}
\usepackage{showframe}% only for the example to show the page layout
\begin{document}
\title{Diagrama Casos de uso en \LaTeX{} - Devoluci\'on a proveedores}
\author{Esteban Vera Valdez}
\maketitle
\begin{center}
\makebox[\linewidth][c]{%
\begin{tikzpicture}
\begin{umlsystem}[fill=red!10]{Sistema}
\setcounter{tikzumlUseCaseNum}{0}
\umlusecase{Solicitar inventario}
\umlusecase[x=2.3, y=-1.5, width=2.7cm]{Solicitar devoluci\'on}
\umlusecase[x=2.3, y=-3, width=2.3cm]{Generar documentaci\'on}
\umlusecase[y=-4.5]{Generar inventario}
\umlusecase[x=7.2, fill=green!20]{Solicitar docuentaci\'on}
\umlusecase[x=7.2, y=-1.5, fill=green!20]{Realiza la devoluci\'on}
\umlusecase[x=6.5, y=-3.8]{Recibe fac. y pedido}
\umlusecase[x=5.8, y=-5]{Registra datos}
\umlusecase[y=-6]{Almacenar datos}
\umlusecase[y=-7.5]{Almacenar prod.}
\umlusecase[y=-9]{Actualizar inventario}
\umlusecase[x=5.8, y=-7.4, width=2.6cm]{Lista productos defectuosos}
\end{umlsystem}
\begin{scope}[overlay]
\umlactor[x=-4, y=-3.4]{Usuario}
\umlactor[x=-4, y=-7.5]{Sistema}
\umlactor[x=12,y=-1.5]{Proveedor}
%
\umlinherit{Usuario}{Sistema}
\umlassoc{Usuario}{usecase-1}
\umlassoc{Usuario}{usecase-2}
\umlassoc{Usuario}{usecase-3}
\umlassoc{Usuario}{usecase-7}
\umlassoc{Usuario}{usecase-8}
\umlassoc{Sistema}{usecase-4}
\umlassoc{Sistema}{usecase-9}
\umlassoc{Sistema}{usecase-10}
\umlassoc{Sistema}{usecase-11}
\umlassoc{Proveedor}{usecase-5}
\umlassoc{Proveedor}{usecase-6}
\umlinherit{usecase-1}{usecase-4}
\umlinherit{usecase-2}{usecase-5}
\umlinherit{usecase-6}{usecase-7}
\umlVHextend{usecase-8}{usecase-9}
\umlinclude[name=incl]{usecase-4}{usecase-12}
%
\umlnote[x=4.3, y=-9]{incl-1}{Muestra info del proveedor}
\end{scope}
\end{tikzpicture}%
}
\end{center}
\end{document}