From f63e647a88edee003f483a9baf00fc4e58c2cbfc Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 12 Jul 2019 20:45:27 +0000 Subject: codeanatomy (12jul19) git-svn-id: svn://tug.org/texlive/trunk@51627 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/codeanatomy/README.md | 16 +++++++--- .../latex/codeanatomy/codeanatomy.lstlisting.pdf | Bin 123700 -> 123921 bytes .../latex/codeanatomy/codeanatomy.lstlisting.tex | 13 +++++--- .../doc/latex/codeanatomy/codeanatomy.pdf | Bin 96388 -> 97601 bytes .../doc/latex/codeanatomy/codeanatomy.usage.pdf | Bin 82656 -> 82738 bytes .../source/latex/codeanatomy/codeanatomy.dtx | 34 +++++++++++++++------ .../tex/latex/codeanatomy/codeanatomy.sty | 9 ++++-- 7 files changed, 49 insertions(+), 23 deletions(-) (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/latex/codeanatomy/README.md b/Master/texmf-dist/doc/latex/codeanatomy/README.md index bc619b60850..32d85cfa5ba 100644 --- a/Master/texmf-dist/doc/latex/codeanatomy/README.md +++ b/Master/texmf-dist/doc/latex/codeanatomy/README.md @@ -1,4 +1,5 @@ -# `codeanatomy` -- Draw Code Anatomy +`codeanatomy` -- Draw Code Anatomy +================================== (C) 2019 Hồng-Phúc Bùi @@ -11,20 +12,23 @@ This package just provides tools to draw those figures. Some illustrations can be found here: -https://introcs.cs.princeton.edu/java/home/ +https://introcs.cs.princeton.edu/java/home/ for example the origin illustation of static method in java: -## Licence +Licence +------- This package may be distributed and/or modified under the conditions of the LaTeX Project Public License (LPPL), either version 1.3c of this License or any later version. The latest version of this license is in the file https://www.latex-project.org/lppl.txt -## Build and Install (for Distributor) +Build and Install (for Distributor) +----------------------------------- + * To build the style file `codeanatomy.sty` just run **one** of ``` @@ -46,7 +50,9 @@ lualatex codeanatomy.lstlisting.tex (`lualatex` because of my name, really ego right! It needs unicode to be typeset correctly.) -## Development +Development +----------- + I try to use latex3 as much as posible. You can use ``` diff --git a/Master/texmf-dist/doc/latex/codeanatomy/codeanatomy.lstlisting.pdf b/Master/texmf-dist/doc/latex/codeanatomy/codeanatomy.lstlisting.pdf index f941650eab3..4279660c8c3 100644 Binary files a/Master/texmf-dist/doc/latex/codeanatomy/codeanatomy.lstlisting.pdf and b/Master/texmf-dist/doc/latex/codeanatomy/codeanatomy.lstlisting.pdf differ diff --git a/Master/texmf-dist/doc/latex/codeanatomy/codeanatomy.lstlisting.tex b/Master/texmf-dist/doc/latex/codeanatomy/codeanatomy.lstlisting.tex index 2c8e536dbc6..b8956cea221 100644 --- a/Master/texmf-dist/doc/latex/codeanatomy/codeanatomy.lstlisting.tex +++ b/Master/texmf-dist/doc/latex/codeanatomy/codeanatomy.lstlisting.tex @@ -438,10 +438,10 @@ if (!\cPart{e}{x > y}!) \fitExtrem{b}{(tr) (bl) (br)} % Annotation \codeAnnotation{eText} (1,3.5) {boolean\\expression} -\codeAnnotation{bText} (-1,1.125) {sequence\\of\\statements} +\codeAnnotation{bText} (-1,1.125) {sequence\\of \extremPoint{bPoint}[0.75ex]\\statements} % Arrow \draw[->,annotation] (eText) -- (e); -\draw[->,annotation] (bText) -- (b); +\draw[->,annotation] (bPoint) -- (b); \end{tikzpicture} \end{filecontents} @@ -514,14 +514,17 @@ for ( !\cPart{i}{int i = 0}!; !\cPart{c}{i <= n}!; !\cPart{u}{i++}! ) }; \fitExtrem{b}{(left) (right) (bottom)} % Annotations -\codeAnnotation{initText} (-1.5,2.7) {initialize another\\variable in a\\separate\\statement} -\codeAnnotation{iText} (1,3.5) {declare and initialize\\a loop control variable} +\codeAnnotation{initText} (-1.5,2.7) {initialize another\\ + variable in a \extremPoint{initPoint}[0.75ex]\\ + separate\\statement} +\codeAnnotation{iText} (1,3.5) {declare and initialize\\ + a loop control variable} \codeAnnotation{cText} (3.5,3) {loop-\\continuation\\condition} \codeAnnotation{uText} (6,3) {increment} \codeAnnotation{bText} (3.5,-0.25) {body} % arrows on the background {[on background layer] -\draw[->,annotation] (initText.350) -- (init.north west); +\draw[->,annotation] (initPoint) -- (init.north west); \draw[->,annotation] (iText) -- (i); \draw[->,annotation] (cText) -- (c); \draw[->,annotation] (uText) -- (u); diff --git a/Master/texmf-dist/doc/latex/codeanatomy/codeanatomy.pdf b/Master/texmf-dist/doc/latex/codeanatomy/codeanatomy.pdf index 5a4ba57817d..3348439ed5a 100644 Binary files a/Master/texmf-dist/doc/latex/codeanatomy/codeanatomy.pdf and b/Master/texmf-dist/doc/latex/codeanatomy/codeanatomy.pdf differ diff --git a/Master/texmf-dist/doc/latex/codeanatomy/codeanatomy.usage.pdf b/Master/texmf-dist/doc/latex/codeanatomy/codeanatomy.usage.pdf index df989ae7c00..5057ad4a547 100644 Binary files a/Master/texmf-dist/doc/latex/codeanatomy/codeanatomy.usage.pdf and b/Master/texmf-dist/doc/latex/codeanatomy/codeanatomy.usage.pdf differ diff --git a/Master/texmf-dist/source/latex/codeanatomy/codeanatomy.dtx b/Master/texmf-dist/source/latex/codeanatomy/codeanatomy.dtx index 093ca341ce7..4651dadeaaf 100644 --- a/Master/texmf-dist/source/latex/codeanatomy/codeanatomy.dtx +++ b/Master/texmf-dist/source/latex/codeanatomy/codeanatomy.dtx @@ -23,7 +23,7 @@ % % \iffalse %\NeedsTeXFormat{LaTeX2e}[2018/12/01] -%\ProvidesPackage{codeanatomy}[2019/07/10 v0.2-Alpha draw Code Anatomy] +%\ProvidesPackage{codeanatomy}[2019/07/12 v0.4-Alpha draw Code Anatomy] % \fi % % \iffalse @@ -38,6 +38,7 @@ \addbibresource{literatur.bib} \newcommand{\slsh}{\textbackslash{}} \newcommand{\TikZ}{Ti\textit{k}Z} +\newcommand{\fixedBug}[1]{\tikz[baseline=(X.base)]\node[cross out,draw] (X) {#1};} \def\thinmargin{\list{}{\rightmargin-50pt\leftmargin-90pt}\item[]} \let\endthinmargin=\endlist @@ -69,7 +70,7 @@ % % \title{^^A % \pkg{codeanatomy} -- Draw Code Anatomy^^A -% \thanks{This file describes \fileversion,^^A +% \thanks{This file describes \fileversion, ^^A % last revised \filedate.}\\[1ex]^^A % \normalsize{Reference}^^A % }^^A @@ -98,14 +99,15 @@ % ^^A %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \section{Implementation} % -% -% -% \subsection{Package Dependenies} % \changes{v0.2-Alpha} % {2019/07/10} % {This package does not load \pkg{xcolor} anymore. % It relies on \pkg{tikz}, that \pkg{tikz} loads \pkg{xcolor} % in a way that \pkg{codeanatomy} can define RGB color} +% +% +% \subsection{Package Dependenies} +% % \begin{macrocode} \RequirePackage{expl3} \RequirePackage{xparse} @@ -210,6 +212,11 @@ % |\tikz{\draw[] (1,0) circle(3ex); \draw[->,annotation] (0,0) -- (1,0);}|\\ % yields % \tikz{\draw[] (1,0) circle(3ex); \draw[->,annotation] (0,0) -- (1,0);} +% +% \changes{v0.4-Alpha} +% {2019/07/12} +% {Set \texttt{fill} to \texttt{annotationcolor} explicit for arrow style} +% % \begin{macrocode} \tikzset{annotation/.style={% preaction={ @@ -220,8 +227,11 @@ draw=annotationcolor,% arrows={-Latex[% round,% - color=annotationcolor] - } + color=annotationcolor, + fill=annotationcolor + ] + }, + shorten >=0.25pt } } % \end{macrocode} @@ -483,7 +493,7 @@ % ^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \section{Known Bugs} % -% \paragraph*{Arrows color} +% \paragraph*{\fixedBug{Arrows color}} % Arrows appear in some cases with mysterious color. I don't know why! % For example: % @@ -493,7 +503,9 @@ % |code with some long text\extremPoint{b}[-0.5ex]|\\ % |};|\\ % |\fitExtrem{l}{(a) (b)}|\\ -% |\codeAnnotation{n} (-2,0){here is\\a\extremPoint{point}\\long line}|\\ +% |\codeAnnotation{n} (-2,0){here is|\\ +% | a\extremPoint{point}[0.75ex][0.5ex]|\\ +% | long line}|\\ % |\draw[->, annotation] (point) -- (l);|\\ % |\end{tikzpicture}| % @@ -505,7 +517,9 @@ % code with some long text\extremPoint{b}[-0.5ex] % }; % \fitExtrem{l}{(a) (b)} -% \codeAnnotation{n} (-2,0){here is\\a\extremPoint{point}\\long line} +% \codeAnnotation{n} (-2,0){here is\\ +% a\extremPoint{point}[0.75ex][0.5ex]\\ +% long line} % \draw[->, annotation] (point) -- (l); % \end{tikzpicture} % diff --git a/Master/texmf-dist/tex/latex/codeanatomy/codeanatomy.sty b/Master/texmf-dist/tex/latex/codeanatomy/codeanatomy.sty index 5ffb96c0c15..8c4903fc38e 100644 --- a/Master/texmf-dist/tex/latex/codeanatomy/codeanatomy.sty +++ b/Master/texmf-dist/tex/latex/codeanatomy/codeanatomy.sty @@ -7,7 +7,7 @@ %% codeanatomy.dtx (with options: `package') %% \NeedsTeXFormat{LaTeX2e}[2018/12/01] -\ProvidesPackage{codeanatomy}[2019/07/10 v0.2-Alpha draw Code Anatomy] +\ProvidesPackage{codeanatomy}[2019/07/12 v0.4-Alpha draw Code Anatomy] \RequirePackage{expl3} \RequirePackage{xparse} @@ -64,8 +64,11 @@ draw=annotationcolor,% arrows={-Latex[% round,% - color=annotationcolor] - } + color=annotationcolor, + fill=annotationcolor + ] + }, + shorten >=0.25pt } } \tikzset{code annotation/.style={% -- cgit v1.2.3