From ec14d89f021dfd980cdfa7d093dff1030c8abc1f Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 2 May 2013 21:47:19 +0000 Subject: dcpic (2may13) git-svn-id: svn://tug.org/texlive/trunk@30206 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/generic/dcpic/dcpic.sty | 818 ++++++++++++----------- Master/texmf-dist/tex/generic/dcpic/europroc.cls | 332 +++++++++ 2 files changed, 758 insertions(+), 392 deletions(-) create mode 100644 Master/texmf-dist/tex/generic/dcpic/europroc.cls (limited to 'Master/texmf-dist/tex/generic/dcpic') diff --git a/Master/texmf-dist/tex/generic/dcpic/dcpic.sty b/Master/texmf-dist/tex/generic/dcpic/dcpic.sty index 4c1ef123710..d6b4709a261 100644 --- a/Master/texmf-dist/tex/generic/dcpic/dcpic.sty +++ b/Master/texmf-dist/tex/generic/dcpic/dcpic.sty @@ -1,5 +1,5 @@ %% DC-PiCTeX -%% Copyright (c) 1990-2009 Pedro Quaresma, Coimbra, Portugal +%% Copyright (c) 1990-2013 Pedro Quaresma, University of Coimbra, Portugal %% 11/1990 (version 1.0); %% 10/1991 (version 1.1); %% 9/1993 (version 1.2); @@ -16,17 +16,19 @@ %% 8/2008 (version 4.3) %% 12/2008 (version 4.3.1) %% 12/2009 (version 4.3.2) +%% 4/2013 (version 4.4.0) +%% 5/2013 (version 5.0) -\immediate\write10{Package DCpic 2009/12/22 v4.3.2} +\immediate\write10{Package DCpic 2013/05/01 v5.0} -\ProvidesPackage{dcpic}[2009/12/22 v4.3.2] +\ProvidesPackage{dcpic}[2013/05/01 v5.0] %% Version X.Y.Z %% X - major versions %% Y - minor versions %% Z - bug corrections %% -%% Copyright (c) 1990-2009 Pedro Quaresma +%% Copyright (c) 1990-2013 Pedro Quaresma %% % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -42,8 +44,8 @@ % % This work consists of the files dcpic.sty. %% -%% Coimbra, 22 de Dezembro de 2009 (2009/12/22) -%% Pedro Quaresma de Almeida +%% Coimbra, 1st of May, 2013 (2013/05/01) +%% Pedro Quaresma %% %% DCpic is a package of \TeX\ macros for graph modelling in a %% (La)\TeX\ or Con\TeX t document. Its distinguishing features are: @@ -62,7 +64,7 @@ %% morphisms, linear and curved edges, and its labels. %% %% Example: -%% \begindc{\commdiag}[3] +%% \begindc{\commdiag}[30] %% \obj(10,15){$A$} %% \obj(25,15){$B$} %% \obj(40,15){$C$} @@ -85,7 +87,7 @@ %% 2 = "undigraph" (undirect graph) %% 3 = "cdigraph" with incircled objects %% 4 = "cundigraph" with incircled objects -%% (optional) #2 - magnification factor (default value, 30) +%% (optional) #2 - magnification factor (default value, 300) %% %% \enddc %% @@ -140,27 +142,28 @@ %% %% #1 and #2 - coordinates (beginning) %% #3 and #4 - coordinates (ending) -%%(optional)#5,#6 - correction factors (defaul values, 10 and 10) -%% #5 - actual beginning of the edge -%% #6 - actual ending of the edge +%%(optional)#5,#6 - correction factors (defaul values, 100 and 100 (10pt)) +%% #5 - actual beginning of the edge +%% #6 - actual ending of the edge %% #7 - text (morphism label) %%(optional)#8,#9 %% #8 - label placement %% 1 = "\atright", at right, default value %% -1 = "\atleft", at left -%% #9 - edge type +%% #9 - edge type %% 0 = "\solidarrow", default edge %% 1 = "\dashArrow" -%% 2 = "\solidline" -%% 3 = "\dashline" -%% 4 = "\dotline" -%% 5 = "\injectionarrow" --- old value 3 -%% 6 = "\aplicationarrow" --- old value 4 -%% 7 = "\surjectivearrow" --- old value 5 -%% 8 = "\equalline" (thanks to Ruben Debeerst), -%% 9 = "\doublearrow" -%% 10 = "\doubleopposite" -%% 11 = "nullarrow" (to allow adding labels to existing arrows) +%% 2 = "\dotArrow (thanks to Xingliang Liang ) +%% 3 = "\solidline" +%% 4 = "\dashline" +%% 5 = "\dotline" +%% 6 = "\injectionarrow" +%% 7 = "\aplicationarrow" +%% 8 = "\surjectivearrow" +%% 9 = "\equalline" (thanks to Ruben Debeerst ) +%% 10 = "\doublearrow" +%% 11 = "\doubleopposite" +%% 12 = "\nullarrow" (to allow adding labels to existing arrows) %% %% Notes: the equalline "arrow" does not provide a second label. %% @@ -182,71 +185,71 @@ %% Notes: insert a space after the command. %% the space after the list of points is mandatory %% -%% Exemples: -%%\documentclass[a4paper,11pt]{article} -%%\usepackage{dcpic,pictexwd} -%% -%%\begin{document} -%%\begindc[3] -%%\obj(14,11){$A$} -%%\obj(39,11){$B$} -%%\mor(14,12)(39,12){$f$}%[\atright,\solidarrow] -%%\mor(39,10)(14,10){$g$}%[\atright,\solidarrow] -%%\cmor((10,10)(6,11)(5,15)(6,19)(10,20)(14,19)(15,15)) -%% \pdown(2,20){$id_A$} -%%\cmor((40,7)(41,3)(45,2)(49,3)(50,7)(49,11)(45,12)) -%% \pleft(54,3){$id_B$} -%%\enddc -%% -%%\begindc{\commdiag}[3] -%%\obj(10,15)[A]{$A$} -%%\obj(40,15)[Aa]{$A$} -%%\obj(25,15)[B]{$B$} -%%\mor{A}{B}{$f$}%[\atright,\solidarrow] -%%\mor{B}{Aa}{$g$}%[\atright,\solidarrow] -%%\cmor((10,11)(11,7)(15,6)(25,6)(35,6)(39,7)(40,11)) -%% \pup(25,3){$id_A$} -%%\enddc -%% -%%\newcommand{\barraA}{\vrule height2em width0em depth0em} -%%\newcommand{\barraB}{\vrule height1.6em width0em depth0em} -%%\begindc{\commdiag}[35] -%%\obj(1,1)[Gr]{$G$} -%%\obj(3,1)[Grstar]{$G_{r^*}$} -%%\obj(5,1)[H]{$H$} -%%\obj(2,2)[SigmaG]{$\Sigma^G$} -%%\obj(6,2)[SigmaH]{$\Sigma^H$} -%%\obj(1,3)[Lm]{$L_m$} -%%\obj(3,3)[Krm]{$K_{r,m}$} -%%\obj(5,3)[Rmstar]{$R_{m^*}$} -%%\obj(1,5)[L]{$L$} -%%\obj(3,5)[Lr]{$L_r$} -%%\obj(5,5)[R]{$R$} -%%\obj(2,6)[SigmaL]{$\Sigma^L$} -%%\obj(6,6)[SigmaR]{$\Sigma^R$} -%%\mor{Gr}{SigmaG}{$\lambda^G$} -%%\mor{Grstar}{Gr}{$i_5$}[\atleft,\aplicationarrow] -%%\mor{Grstar}{H}{$r^*$}[\atright,\solidarrow] -%%\mor{H}{SigmaH}{$\lambda^H$}[\atright,\dashArrow] -%%\mor{SigmaG}{SigmaH}{$\varphi^{r^*}$}[\atright,\solidarrow] -%%\mor{Lm}{Gr}{$m$}[\atright,\solidarrow] -%%\mor{Lm}{L}{$i_2$}[\atleft,\aplicationarrow] -%%\mor{Krm}{Lm}{$i_3\quad$}[\atright,\aplicationarrow] -%%\mor{Krm}{Rmstar}{$r$} -%%\mor{Krm}{Lr}{$i_4$}[\atright,\aplicationarrow] -%%\mor{Krm}{Grstar}{$m$} -%%\mor{Rmstar}{R}{$i_6$}[\atright,\aplicationarrow] -%%\mor{Rmstar}{H}{$m^*$} -%%\mor{L}{SigmaL}{$\lambda^L$} -%%\mor{Lr}{L}{$i_1\quad$}[\atright,\aplicationarrow] -%%\mor{Lr}{R}{$r$} -%%\mor{R}{SigmaR}{$\lambda^R$}[\atright,\solidarrow] -%%\mor{SigmaL}{SigmaG}{$\varphi^m$}[\atright,\solidarrow] -%%\mor{SigmaL}{SigmaR}{$\varphi^r$} -%%\mor{SigmaR}{SigmaH}{$\varphi^{m^*}$} -%%\enddc -%% -%%\end{document} +%% Examples: +%% \documentclass[a4paper,11pt]{article} +%% \usepackage{dcpic,pictexwd} +%% +%% \begin{document} +%% \begindc[3] +%% \obj(14,11){$A$} +%% \obj(39,11){$B$} +%% \mor(14,12)(39,12){$f$}%[\atright,\solidarrow] +%% \mor(39,10)(14,10){$g$}%[\atright,\solidarrow] +%% \cmor((10,10)(6,11)(5,15)(6,19)(10,20)(14,19)(15,15)) +%% \pdown(2,20){$id_A$} +%% \cmor((40,7)(41,3)(45,2)(49,3)(50,7)(49,11)(45,12)) +%% \pleft(54,3){$id_B$} +%% \enddc +%% +%% \begindc{\commdiag}[3] +%% \obj(10,15)[A]{$A$} +%% \obj(40,15)[Aa]{$A$} +%% \obj(25,15)[B]{$B$} +%% \mor{A}{B}{$f$}%[\atright,\solidarrow] +%% \mor{B}{Aa}{$g$}%[\atright,\solidarrow] +%% \cmor((10,11)(11,7)(15,6)(25,6)(35,6)(39,7)(40,11)) +%% \pup(25,3){$id_A$} +%% \enddc +%% +%% \newcommand{\barraA}{\vrule height2em width0em depth0em} +%% \newcommand{\barraB}{\vrule height1.6em width0em depth0em} +%% \begindc{\commdiag}[35] +%% \obj(1,1)[Gr]{$G$} +%% \obj(3,1)[Grstar]{$G_{r^*}$} +%% \obj(5,1)[H]{$H$} +%% \obj(2,2)[SigmaG]{$\Sigma^G$} +%% \obj(6,2)[SigmaH]{$\Sigma^H$} +%% \obj(1,3)[Lm]{$L_m$} +%% \obj(3,3)[Krm]{$K_{r,m}$} +%% \obj(5,3)[Rmstar]{$R_{m^*}$} +%% \obj(1,5)[L]{$L$} +%% \obj(3,5)[Lr]{$L_r$} +%% \obj(5,5)[R]{$R$} +%% \obj(2,6)[SigmaL]{$\Sigma^L$} +%% \obj(6,6)[SigmaR]{$\Sigma^R$} +%% \mor{Gr}{SigmaG}{$\lambda^G$} +%% \mor{Grstar}{Gr}{$i_5$}[\atleft,\aplicationarrow] +%% \mor{Grstar}{H}{$r^*$}[\atright,\solidarrow] +%% \mor{H}{SigmaH}{$\lambda^H$}[\atright,\dashArrow] +%% \mor{SigmaG}{SigmaH}{$\varphi^{r^*}$}[\atright,\solidarrow] +%% \mor{Lm}{Gr}{$m$}[\atright,\solidarrow] +%% \mor{Lm}{L}{$i_2$}[\atleft,\aplicationarrow] +%% \mor{Krm}{Lm}{$i_3\quad$}[\atright,\aplicationarrow] +%% \mor{Krm}{Rmstar}{$r$} +%% \mor{Krm}{Lr}{$i_4$}[\atright,\aplicationarrow] +%% \mor{Krm}{Grstar}{$m$} +%% \mor{Rmstar}{R}{$i_6$}[\atright,\aplicationarrow] +%% \mor{Rmstar}{H}{$m^*$} +%% \mor{L}{SigmaL}{$\lambda^L$} +%% \mor{Lr}{L}{$i_1\quad$}[\atright,\aplicationarrow] +%% \mor{Lr}{R}{$r$} +%% \mor{R}{SigmaR}{$\lambda^R$}[\atright,\solidarrow] +%% \mor{SigmaL}{SigmaG}{$\varphi^m$}[\atright,\solidarrow] +%% \mor{SigmaL}{SigmaR}{$\varphi^r$} +%% \mor{SigmaR}{SigmaH}{$\varphi^{m^*}$} +%% \enddc +%% +%% \end{document} %%-----------------//------------- %% Modifications (9/1993) %% argument "distance" between de tip of the arrow and the objects @@ -254,7 +257,7 @@ %% %% 2/3/1995 (version 1.3) %% adds "the aplication arrow" (option 4); the distance between -%% the label and the "arrow" is now a fixed value (10 units). +%% the label and the "arrow" is now a fixed value (100 units). %% 15/7/1996 (version 2.1) %% The comand "\mor" has a new sintax. The 5th and 6th %% parameters are now the distance between the two objects and @@ -270,36 +273,28 @@ %% (after a conversation on EuroTeX 2001). %% %% 1/2002 (version 3.2) -%% Modifica{\c c}{\~a}o dos comandos "obj" e "mor" de forma a introduzir -%% a especifica{\c c}{\~a}o l{\'o}gica dos morfismos, isto {\'e}, passa-se a -%% dizer qual {\'e} o objecto de partida e/ou o objecto de chegada -%% em vez de ter de especificar o morfismo em termos de -%% coordenadas. -%% Por outro lado o tamanho das setas passa a ser ajustado -%% automaticamente em rela{\c c}{\~a}o ao tamanho dos objectos. +%% Modification of the commands "obj" and "mor" in such a way +%% that allows the logical specification of the morphisms, that +%% is, it is now possible to specify the starting object and the +%% ending object instead of specify the coordinates. +%% +%% The length of the arrows is automatically trimmed to the +%% objects' size. %% %% 5/2002 (version 4.0) -%% Modificação dos comandos "begindc" e "obj" -%% !!! Modificação da sintaxe destes comandos !!! -%% O comando "begindc" passou a ter um argumento (obrigatório) -%% que nos permite especificar o tipo de grafo que estamos a -%% querer especificar: -%% "commdiag" (0), para diagramas comutativos -%% "digraph" (1), para grafos orientados -%% "undigraph" (2), para grafos não orientados -%% O comando "obj" modificou a sua sintaxe passou a ter um (após -%% a especificação das coordenadas, um argumento opcional, um -%% argumento obrigatório, e um argumento opcional. O primeiro -%% argumento opcional dá-nos a etiqueta que serve como -%% referência para a especificação dos morfismos, na sua -%% ausência usa-se o argumento obrigatório para esse efeito, o -%% argumento obrigatório dá-nos o "conteúdo" do objecto, nos -%% diagramas comutativos é centrado no ponto dado pelas -%% coordenadas sendo o argumento seguinte simplesmente ignorado, -%% nos grafos o "conteúdo" é colocado numa posição a norte, a -%% noroeste, a este, ..., sendo que a posição concreta é -%% especificada pelo último dos argumentos deste comando, o -%% valor por omissão é o "norte". +%% New syntax for the commands "begindc" e "obj" +%% !!! New syntax !!! +%% The command "begindc" now have an obligatory argument, this +%% argument allows the specification of the graph type +%% "commdiag" (0), commutative diagrams +%% "digraph" (1), directed graphs +%% "undigraph" (2), undirected graphs +%% The command "obj" has a new syntax: after the coordinates +%% specification, an optional argument specifying a label, an +%% obligatory argument given the "value" of the object and the +%% final optional argument used in the graphs to set the +%% relative position of the "value" to the "dot" defining the +%% objects position, the default value is "north". %% %% 3/2003 (version 4.1) %% Responding to a request of Jon Barker I @@ -334,6 +329,16 @@ %% S ). %% The \d changed to \deuc (Euclidian Distance). The \x and \y %% changed to \xO \yO +%% 4/2013 (version 4.4.0) +%% Thanks to Xingliang Liang . He added a new +%% arrow "dotarrow". +%% 5/2013 (version 5.0) +%% The base scale of the graph has changed from 1pt to .1pt to +%% solve a problem with the implementation of the oblique +%% equalline (Thanks to Antonio de Nicola). +%% The LaTeX circle and oval commands where replaced by the +%% PiCTeX circulararc and ellipticalarc commands to avoid +%% differences in scales. %%-----------------//------------- \catcode`!=11 % ***** THIS MUST NEVER BE OMITTED (See PiCTeX) @@ -366,7 +371,6 @@ \newcount\tipografo% version 4.0 \newcount\distanciaobjmor% version 4.0 \newcount\tipoarco% version 4.0 -%\newif\ifarredondada% version 4.0 (initial value "false") \newif\ifpara% %% version 3.2 \newbox\caixa% @@ -390,7 +394,6 @@ \def\objChegada{}% \def\objNulo{}% - %% %% Stack specification %% @@ -461,20 +464,20 @@ #2=\aux \fi} - %% Name definitions for edge types and directions \def\solidarrow{0} \def\dashArrow{1} -\def\solidline{2} -\def\dashline{3} -\def\dotline{4} -\def\injectionarrow{5} -\def\aplicationarrow{6} -\def\surjectivearrow{7} -\def\equalline{8} -\def\doublearrow{9} -\def\doubleopposite{10} -\def\nullarrow{11} +\def\dotArrow{2} +\def\solidline{3} +\def\dashline{4} +\def\dotline{5} +\def\injectionarrow{6} +\def\aplicationarrow{7} +\def\surjectivearrow{8} +\def\equalline{9} +\def\doublearrow{10} +\def\doubleopposite{11} +\def\nullarrow{12} %% Name definitions for edge label placement \def\atright{-1} @@ -501,56 +504,43 @@ \def\west{7} \def\northwest{8} - - -%%Comando Interno -%% Ajusta a dist{\^a}ncia entre as setas e os objectos em fun{\c c}{\~a}o das -%% dimens{\~o}es destes {\'u}ltimos -%% \ajusta{x}{xl}{y}{yl}{d}{Objecto} -%% entrada -%% (x,y) e (xl,yl), coordenadas dos pontos de {\'\i}nicio e fim da seta -%% d, dist{\^a}ncia especificada pelo utilizador ou 10 (valor por -%% omiss{\~a}o), Objecto d{\'a}-nos a refer{\^e}ncia do objecto ao qual se est{\'a} a -%% efectuar o ajuste. -%% sa{\'\i}da -%% d, dist{\^a}ncia alterada. +%%Private Macro +%% Adjust the distance between the arrows and the objects regarding +%% the dimensions of the objects. +%% +%% \ajusta{x}{xl}{y}{yl}{d}{Object} (ajusta = adjust) +%% +%% Input +%% (x,y) e (xl,yl) - start, end coordinates of arrow +%% d - distance specified by the user (default value, 100) +%% Objecto - reference of the object pointed by the arrow +%% Output +%% d - adjusted distance %% -%% A dist{\^a}ncia alterada {\'e} o maior valor entre 10 e as dimens{\~o}es -%% apropriadas da caixa que cont{\^e}m o objecto. -%% Se o utilizador especificar um valor essa especifica{\c c}{\~a}o -%% n{\~a}o {\'e} alterada. -%% -%% Se a seta {\'e} horizontal usa-se o valor da largura -%% Se a seta {\'e} vertical usa-se: -%% o valor da altura se a seta est{\'a} no 1o ou 2o quadrante -%% o valor da profundidade se a seta est{\'a} no 3o ou 4o quadrante -%% Se a seta {\'e} {\'o}bliqua vai-se escolher o valor conforme: -%% de 315 a 45 graus usa-se a largura -%% de 45 a 135 graus usa-se a altura -%% de 135 a 225 graus usa-se a largura -%% de 225 a 315 graus usa-se a profundidade +%% The adjusted distance is the greatest value between 100 and the +%% object's box dimensions. If the user specify a value this is not +%% altered. +%% +%% If the arrow is horizontal the length is used. +%% If the arrow is vertical the height is used for arrows in the 1st +%% or 2nd quadrante, or the depth if the arrow is in the 3rd or 4th +%% quadrante. If the arrow is oblique the value is chosen accordingly: +%% from 315 to 45 degrees length is used +%% from 45 to 135 degrees height is used +%% from 135 to 225 degrees length is used +%% from 225 to 315 degrees depth is used \def\!ajusta#1#2#3#4#5#6{\aux=#5% \let\auxobj=#6% - \ifcase \tipografo % diagramas comutativos - \ifnum\number\aux=10 - \ajustadisttrue % se o valor é o valor por omissão ajusta + \ifcase \tipografo % commutative diagrams + \ifnum\number\aux=100 + \ajustadisttrue % if needed, adjust \else - \ajustadistfalse % caso contrário não ajusta + \ajustadistfalse % if not, keeps unchanged \fi - \else % grafos (dirigidos, não dirigidos, com molduras) + \else % graphs (directed, undirected, with frames) \ajustadistfalse -% \or % grafos não dirigidos -% \ajustadistfalse -% \else % grafos dirigidos com molduras circulares nos objectos -% \ifnum\number\aux=8 -% \ajustadisttrue % se o valor é o valor por omissão ajusta -% \else -% \ajustadistfalse % caso contrário não ajusta -% \fi \fi \ifajustadist -% \tiny Vou ajustar %%% -% \ifnum\number\aux=10% verificar se s{\~a}o os valores por omiss{\~a}o \let\pilhaaux=\pilha% \loop% \!topo{\pilha}% @@ -559,55 +549,54 @@ \ifcompara\nvaziafalse \else\!pilhanvazia\pilha \fi% \ifnvazia% \repeat% -%% rep{\~o}e os valores na pilha +%% push the values into the stack \let\pilha=\pilhaaux% \ifvazia% \ifdiferentes% %% -%% N{\~a}o {\'e} poss{\'\i}vel efectuar o ajuste dado o utilizador n{\~a}o ter -%% especificado uma etiqueta para o objecto em quest{\~a}o. {\'E} dado o -%% valor de 10, igual ao valor por omiss{\~a}o. +%% It is not possible to make de adjustment given the fact that the +%% user did not provide a label for the object in question. We set a +%% value equal to the default value (100) %% - \larg=1310720% n{\~a}o faz o ajuste - \prof=655360% - \alt=655360% + \larg=131072% these values are for unit of .1pt + \prof=65536% + \alt=65536% \fi% \fi% - \divide\larg by 131072 - \divide\prof by 65536 - \divide\alt by 65536 + \divide\larg by 13107% these values are for unit of .1pt + \divide\prof by 6553% + \divide\alt by 6553% \ifnum\number\yO=\number\yl -%% Caso 1 -- seta horizontal +%% Case 1 -- horizontal arrow %% -%% divide-se por 131072 para se obter metade da largura da caixa em -%% pontos (pt), isto dado que o texto est{\'a} centrado na caixa. Soma-se -%% mais tr{\^e}s, que constitue um ajuste imp{\'\i}rico. - \advance\larg by 3 +%% with the division by 13107 we get half the size of the box, for a +%% centered text, the adding of 30 is an empirical adjustment. + \advance\larg by 30 \ifnum\number\larg>\aux #5=\larg \fi \else \ifnum\number\xO=\number\xl \ifnum\number\yl>\number\yO -%% Caso 2.1 -- seta vertical de cima para baixa +%% Case 2.1 -- vertical arrow, down direction %% \ifnum\number\alt>\aux #5=\alt \fi \else -%% Caso 2.2 -- seta vertical de baixo para cima +%% Case 2.2 -- vertical arrow, up direction %% -%% divide-se por 65536 para se obter a altura da caixa em pt. O ajuste -%% de 5 foi obtido imp{\'\i}ricamente - \advance\prof by 5 +%% with the division by 6553 we get the box height. The adjustment +%% of 50 is an empirical adjustment. + \advance\prof by 50 \ifnum\number\prof>\aux #5=\prof \fi \fi \else -%% Caso 3 -- seta obl{\'\i}qua -%% Caso 3.1 de 315o a 45o; |x-xl|>|y-yl| e -%% Caso 3.3 de 135o a 225o; |x-xl|>|y-yl|; Largura +%% Case 3 -- oblique arrow +%% Case 3.1 --- from 315o to 45o; |x-xl|>|y-yl| +%% Case 3.3 --- from 135o to 225o; |x-xl|>|y-yl|; Length \auxqx=\xO \advance\auxqx by -\xl \!absoluto{\auxqx}{\auxqx}% @@ -615,38 +604,37 @@ \advance\auxqy by -\yl \!absoluto{\auxqy}{\auxqy}% \ifnum\auxqx>\auxqy - \ifnum\larg<10 - \larg=10 + \ifnum\larg<100 + \larg=100 \fi - \advance\larg by 3 + \advance\larg by 30 #5=\larg \else -%% Caso 3.2 de 45o a 135o; |x-xl|<|y-yl| e y>0; Largura +%% Case 3.2 --- from 45o to 135o; |x-xl|<|y-yl| e y>0; Length \ifnum\yl>\yO - \ifnum\larg<10 - \larg=10 + \ifnum\larg<100 + \larg=100 \fi - \advance\alt by 6 + \advance\alt by 60 #5=\alt \else -%% Caso 3.4 de 225o a 315o; |x-xl|<|y-yl| e y<0; Profundidade - \advance\prof by 11 +%% Case 3.4 -- from 225o to 315o; |x-xl|<|y-yl| e y<0; Depth + \advance\prof by 110 #5=\prof \fi \fi \fi \fi -\fi} % o ramo "else" {\'e} omisso - +\fi} % the branch else is missing -%%Comando Interno -%% C{\'a}lculo da Raiz Quadrada -%% raiz{n}{m} -%% entrada -%% n - natural -%% sa{\'\i}da -%% n - natural -%% m - maior natural contido na raiz quadrada de n +%%Private Macro +%% Square root +%% raiz{n}{m} (raiz = root) +%% -> +%% n - natural number +%% <- +%% n - natural number +%% m - greatest natural number less then the square root of n \def\!raiz#1#2{\auxa=#1% \auxb=1% \loop @@ -690,6 +678,8 @@ %%Private Macro %% Euclidean distance between two points %% +%% quadrado = square +%% %% quadrado{n}{m}{l} %% Input %% n - natural number @@ -701,90 +691,142 @@ \multiply \aux by \aux% #3=\aux} -%%Comando Interno -%% C{\'a}lculo auxiliar para determinar a dist{\^a}ncia entre o nome do -%% morfismo e a seta. -%% entrada -%% (x,y), (x',y') e o nome do morfismo -%% sa{\'\i}da -%% dnm - dist{\^a}ncia do nome ao morfismo respectivo devidamente -%% compensada pelo tamanho do objecto -%% Observa{\c c}{\~o}es -%% A compensa{\c c}{\~a}o s{\'o} est{\'a} a ser feita para setas -%% horizontais e verticais. As obl{\'\i}quas s{\~a}o tratadas de -%% outra forma. -%% algoritmo -%% caixa0 <- nome do morfismo -%% se x-xl = 0 entao {recta vertical} -%% aux <- largura da caixa0 -%% dnm <- convers{\~a}o-sp-pt(aux)/2+3 -%% sen{\~a}o {recta n{\~a}o vertical} -%% se y-yl = 0 entao {recta horizontal} -%% aux <- altura+profundidade da caixa0 -%% dnm <- convers{\~a}o-sp-pt(aux)/2+3 -%% sen{\~a}o {recta obl{\'\i}qua} +%%Private Macro +%% Euclidean distance between arrows and its tags +%% +%% Input +%% (x,y), (x',y') morphism's name (tag) +%% Output +%% dnm - distance between an arrow and its tags +%% (with a trim given by the tag's size +%% Observations +%% The trimming is for horizontal and vertical arrows +%% only. Oblique arrows are dealt in a different way +%% +%% Algorithm +%% caixa0 <- morfism name +%% if x-xl = 0 then {vertical arrow} +%% aux <- caixa0 width +%% dnm <- converstion-sp-pt(aux)/2+3 +%% else {non-vertical arrow} +%% if y-yl = 0 then {horizontal arrow} +%% aux <- caixa0 height+depth +%% dnm <- converstion-sp-pt(aux)/2+3 +%% else {oblique arrow} %% dnm <- 3 -%% fimse -%% fimse -%% fimalgoritmo +%% endif +%% endif +%% endalgorithm \def\!distnomemor#1#2#3#4#5#6{\setbox0=\hbox{#5}% \aux=#1 \advance \aux by -#3 \ifnum \aux=0 - \aux=\wd0 \divide \aux by 131072 - \advance \aux by 3 + \aux=\wd0 \divide \aux by 13107%2 + \advance \aux by 30 #6=\aux \else \aux=#2 \advance \aux by -#4 \ifnum \aux=0 - \aux=\ht0 \advance \aux by \dp0 \divide \aux by 131072 - \advance \aux by 3 + \aux=\ht0 \advance \aux by \dp0 \divide \aux by 13107%2 + \advance \aux by 30 #6=\aux% \else - #6=3 + #6=30 \fi \fi } - %% -%% O ambiente "begindc...enddc" +%% The environment "begindc...enddc" %% \def\begindc#1{\!ifnextchar[{\!begindc{#1}}{\!begindc{#1}[30]}} \def\!begindc#1[#2]{\beginpicture \let\pilha=\!vazia - \setcoordinatesystem units <1pt,1pt> + \setcoordinatesystem units <.1pt,.1pt> \expansao=#2 \ifcase #1 - \distanciaobjmor=10 + \distanciaobjmor=100 \tipoarco=0 % arrow \tipografo=0 % commutative diagram \or - \distanciaobjmor=2 + \distanciaobjmor=20 \tipoarco=0 % arrow \tipografo=1 % directed graph \or - \distanciaobjmor=1 - \tipoarco=2 % line + \distanciaobjmor=10 + \tipoarco=3 % line \tipografo=2 % undirected graph \or - \distanciaobjmor=8 + \distanciaobjmor=80 \tipoarco=0 % arrow \tipografo=3 % directed graph -% \arredondadotrue % objectos com molduras circulares \or - \distanciaobjmor=8 - \tipoarco=2 % line + \distanciaobjmor=80 + \tipoarco=3 % line \tipografo=4 % undirected graph -% \arredondadotrue % objectos com molduras circulares \fi} \def\enddc{\endpicture} +\def\drawarrowhead <#1> [#2,#3]{% + \!ifnextchar<{\!drawarrowhead{#1}{#2}{#3}}{\!drawarrowhead{#1}{#2}{#3}<\!zpt,\!zpt> }} -%% Public macro: "mor" +% Xingliang Liang +% ** \!ljoin (XCOORD,YCOORD) +% ** Draws a straight line starting at the last point specified +% ** by the most recent \!start, \!ljoin, or \!qjoin, and +% ** ending at (XCOORD,YCOORD). +\def\!ljoindummy (#1,#2){% + \advance\!intervalno by 1 + \!xE=\!M{#1}\!xunit \!yE=\!M{#2}\!yunit + \!rotateaboutpivot\!xE\!yE + \!xdiff=\!xE \advance \!xdiff by -\!xS%** xdiff = xE - xS + \!ydiff=\!yE \advance \!ydiff by -\!yS%** ydiff = yE - yS + \!Pythag\!xdiff\!ydiff\!arclength% ** arclength = sqrt(xdiff**2+ydiff**2) + \global\advance \totalarclength by \!arclength% + %\!drawlinearsegment% ** set by dashpat to \!linearsolid or \!lineardashed + \!xS=\!xE \!yS=\!yE% ** shift ending points to starting points + \ignorespaces} + +%% +%% \!drawarrowhead{4pt}{DimC}{DimD} from {\xa} {\ya} to {\xb} {\yb} %% +\def\!drawarrowhead#1#2#3<#4,#5> from #6 #7 to #8 #9 {% +% +% ** convert to dimensions + \!xloc=\!M{#8}\!xunit + \!yloc=\!M{#9}\!yunit + \!dxpos=\!xloc \!dimenA=\!M{#6}\!xunit \advance \!dxpos -\!dimenA + \!dypos=\!yloc \!dimenA=\!M{#7}\!yunit \advance \!dypos -\!dimenA + \let\!MAH=\!M% ** save current c/d mode + \!setdimenmode% ** go into dimension mode +% + \!xshift=#4\relax \!yshift=#5\relax% ** pick up shift + \!reverserotateonly\!xshift\!yshift% ** back rotate shift + \advance\!xshift\!xloc \advance\!yshift\!yloc +% +% ** draw shaft of arrow + \!xS=-\!dxpos \advance\!xS\!xshift + \!yS=-\!dypos \advance\!yS\!yshift + \!start (\!xS,\!yS) + \!ljoindummy (\!xshift,\!yshift) +% +% ** find 32*cosine and 32*sine of angle of rotation + \!Pythag\!dxpos\!dypos\!arclength + \!divide\!dxpos\!arclength\!dxpos + \!dxpos=32\!dxpos \!removept\!dxpos\!!cos + \!divide\!dypos\!arclength\!dypos + \!dypos=32\!dypos \!removept\!dypos\!!sin +% +% ** construct arrowhead + \!halfhead{#1}{#2}{#3}% ** draw half of arrow head + \!halfhead{#1}{-#2}{-#3}% ** draw other half +% + \let\!M=\!MAH% ** restore old c/d mode + \ignorespaces} + +%% Public macro: "mor" %% %% Funtion to built the "arrow" between two points %% @@ -874,38 +916,37 @@ \advance \deuc by \auxb% \!raiz{\deuc}{\deuc}% %% -%% the point (xa,ya) is at a distance #5 (default value 10) from the +%% the point (xa,ya) is at a distance #5 (default value 100) from the %% point (x,y) %% -%% como existem dois pontos em considera{\c c}{\~a}o, o ponto de partida e o -%% ponto de chegada, vai sei necess{\'a}rio recuperar de novo os seus -%% valores por pesquisa na pilha +%% given the fact that we have two points (start,end) we need to +%% recover their value searching the stack \auxa=#5 \!compara{\objNulo}{\objPartida}% - \ifdiferentes% S{\'o} vai fazer o ajuste quando {\'e} necess{\'a}rio + \ifdiferentes% adjusting only when needed \!ajusta{\xO}{\xl}{\yO}{\yl}{\auxa}{\objPartida}% \ajustatrue - \def\objPartida{}% re-inicializar o valor do Objecto de Partida + \def\objPartida{}% reset the value of the starting object \fi -%% vai guardar o valor de auxa (ap{\'o}s ajuste) para ser usado no caso -%% dos morfismos de injec{\c c}{\~a}o. +%% save the value of aux (after adjustment) to be used in the case of +%% an injective morphism \guardaauxa=\auxa %% \!ucoord{\number\xO}{\number\xl}{\number\xO}{\auxa}{\number\deuc}{\xa}{1}% \!ucoord{\number\yO}{\number\yl}{\number\yO}{\auxa}{\number\deuc}{\ya}{1}% -%% auxa vai ter o valor da dist{\^a}ncia entre os objectos menos a -%% dist{\^a}ncia da seta ao objecto (10 por omiss{\~a}o) +%% auxa has the value of the distance between the objects minus the +%% distance between the arrow and the objects (100 default value) \auxa=\deuc% %% -%% the point (xb,yb) is at a distance #6 (default value 10) from the +%% the point (xb,yb) is at a distance #6 (default value 100) from the %% point (xl,yl) %% \auxb=#6 \!compara{\objNulo}{\objChegada}% - \ifdiferentes% S{\'o} vai fazer o ajuste quando {\'e} necess{\'a}rio -% Vou ajustar + \ifdiferentes% adjusting only when needed +% adjustment \!ajusta{\xO}{\xl}{\yO}{\yl}{\auxb}{\objChegada}% - \def\objChegada{}% re-inicializar o valor do Objecto de Chegada + \def\objChegada{}% reset the value of the end object \fi \advance \auxa by -\auxb% \!ucoord{\number\xO}{\number\xl}{\number\xO}{\number\auxa}{\number\deuc}{\xb}{1}% @@ -930,48 +971,54 @@ \ifcase #9 % 0=solid arrow \arrow <4pt> [.2,1.1] from {\xa} {\ya} to {\xb} {\yb} \or % 1=dashed arrow - \setdashes - \arrow <4pt> [.2,1.1] from {\xa} {\ya} to {\xb} {\yb} - \setsolid -\or % 2=solid line + \setdashes <2pt> + \plot {\xa} {\ya} {\xb} {\yb} / + \setsolid% + \drawarrowhead <4pt> [.2,1.1] from {\xa} {\ya} to {\xb} {\yb} +\or % 2=dotted arrow (Xingliang Liang - 4.4.0) + \setdots <2pt> + \plot {\xa} {\ya} {\xb} {\yb} / + \setsolid% + \drawarrowhead <4pt> [.2,1.1] from {\xa} {\ya} to {\xb} {\yb} +\or % 3=solid line \setlinear \plot {\xa} {\ya} {\xb} {\yb} / -\or % 3=dashed line - \setdashes +\or % 4=dashed line + \setdashes <2pt> \setlinear \plot {\xa} {\ya} {\xb} {\yb} / \setsolid -\or % 4=dotted line - \setdots +\or % 5=dotted line + \setdots <2pt> \setlinear \plot {\xa} {\ya} {\xb} {\yb} / \setsolid -\or % 5=injective arrow -%% C{\'a}lculos auxiliares +\or % 6=injective arrow %% -%% 3 units, the radius for the tail of the arrow +%% 30 units, the radius for the tail of the arrow %% -%% repor o valor de auxa +%% recover the value of auxa \auxa=\guardaauxa -%% dar a compensa{\c c}{\~a}o para o "rabo" - \advance \auxa by 3% +%% makes an adjustment to cope with the tail of the arrow, giving +%% space to the semi-circle + \advance \auxa by 30% %% %% Note: the values of (xa,ya) will be modified, they will be %% "pushed" further away from (x,y) in order to acomodate the tail %% of the "arrow" %% -%% find the point (xd,yd), the center of a 3pt circle +%% find the point (xd,yd), the center of a 2pt (20*0.1) circle %% \!ucoord{\number\xO}{\number\xl}{\number\xO}{\number\auxa}{\number\deuc}{\xa}{1}% \!ucoord{\number\yO}{\number\yl}{\number\yO}{\number\auxa}{\number\deuc}{\ya}{1}% - \!ucoord{\number\yO}{\number\yl}{\number\xa}{3}{\number\deuc}{\xd}{-1}% - \!ucoord{\number\xO}{\number\xl}{\number\ya}{3}{\number\deuc}{\yd}{1}% + \!ucoord{\number\yO}{\number\yl}{\number\xa}{20}{\number\deuc}{\xd}{-1}% + \!ucoord{\number\xO}{\number\xl}{\number\ya}{20}{\number\deuc}{\yd}{1}% %% building the "arrow" \arrow <4pt> [.2,1.1] from {\xa} {\ya} to {\xb} {\yb} %% and its "tail" \circulararc -180 degrees from {\xa} {\ya} center at {\xd} {\yd} -\or % 6=maps "arrow" ("|-->") - \auxa=3 +\or % 7=maps "arrow" ("|-->") + \auxa=20 % %% %% Note: the values of xmed and ymed will be modified %% @@ -986,23 +1033,23 @@ %% and its "tail" \setlinear \plot {\xmed} {\ymed} {\xd} {\yd} / -\or % 7=surjective arrow ("-->>") +\or % 8=surjective arrow ("-->>") %% building arrow with the first tip \arrow <4pt> [.2,1.1] from {\xa} {\ya} to {\xb} {\yb} %% and the second tip \setlinear \arrow <6pt> [0,.72] from {\xa} {\ya} to {\xb} {\yb} -\or % 8=equalline +\or % 9=equalline %% by Ruben Debeerst: equal-line %% %% sets the separation (distance) between the two parallel lines, if -%% horizontal or vertical 1pt is enough, if not 2pt -\auxa=2 +%% horizontal or vertical 1pt (10*0.1) is enough, if not 1.1pt (11*0.1) +\auxa=11 \ifnum\number\yO=\number\yl -\auxa=1 +\auxa=10 \fi \ifnum\number\xO=\number\xl -\auxa=1 +\auxa=10 \fi %% the two parallel lines will be given by (xmed,ymed)(xd,yd), and %% (xe,ye)(xf,yf) @@ -1018,17 +1065,17 @@ \setlinear \plot {\xmed} {\ymed} {\xe} {\ye} / \plot {\xd} {\yd} {\xf} {\yf} / -\or % 9=double arrow -%% +\or % 10=double arrow +%% %% sets the separation (distance) between the two parallel lines, if -%% horizontal or vertical 2pt is enough, if not 3pt. The extra space +%% horizontal or vertical 2pt is enough, if not 2.5pt. The extra space %% is needed because of the arrow tip. -\auxa=3 +\auxa=25 \ifnum\number\yO=\number\yl -\auxa=2 +\auxa=20 \fi \ifnum\number\xO=\number\xl -\auxa=2 +\auxa=20 \fi %% the two parallel lines will be given by (xmed,ymed)(xd,yd), and %% (xe,ye)(xf,yf) @@ -1046,14 +1093,14 @@ \or % 10=double arrow, opposite directions %% %% sets the separation (distance) between the two parallel lines, if -%% horizontal or vertical 2pt is enough, if not 3pt. The extra space +%% horizontal or vertical 2pt is enough, if not 2.5pt. The extra space %% is needed because of the arrow tip. -\auxa=3 +\auxa=22 \ifnum\number\yO=\number\yl -\auxa=2 +\auxa=20 \fi \ifnum\number\xO=\number\xl -\auxa=2 +\auxa=20 \fi %% the two parallel lines will be given by (xmed,ymed)(xd,yd), and %% (xe,ye)(xf,yf) @@ -1074,11 +1121,11 @@ %% \fi %% The label positioning. -%% Se os morfismos s{\~a}o horizontais ou verticais constro{\'\i} uma caixa -%% centrada no ponto pr{\'e}viamente calculado. Se as setas s{\~a}o -%% obl{\'\i}quas coloca a caixa de forma a n{\~a}o colidir com o morfismo -%% tendo em aten{\c c}{\~a}o o quadrante assim como a posi{\c c}{\~a}o -%% relativa do morfismo e do respectivo nome. +%% If the arrows are horizontal or verticals the box is built centered +%% in the object center. If the arrows are oblique the box is built in +%% such a way to avoid the arrow label, having in account the +%% quadrante and the relative position of the arrow and the +%% corresponding label \auxa=\xl \advance \auxa by -\xO% \ifnum \auxa=0 @@ -1122,13 +1169,12 @@ } %% -%% Comando para construir a "seta" curvilinea entre dois objectos +%% Curved arrow command %% -%% \cmor(){} +%% \cmor(){