texlive[65648] Master/texmf-dist: codeanatomy (26jan23)

commits+karl at tug.org commits+karl at tug.org
Fri Jan 27 23:00:16 CET 2023


Revision: 65648
          http://tug.org/svn/texlive?view=revision&revision=65648
Author:   karl
Date:     2023-01-27 23:00:15 +0100 (Fri, 27 Jan 2023)
Log Message:
-----------
codeanatomy (26jan23)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/codeanatomy/README.md
    trunk/Master/texmf-dist/doc/latex/codeanatomy/codeanatomy.lstlisting.pdf
    trunk/Master/texmf-dist/doc/latex/codeanatomy/codeanatomy.lstlisting.tex
    trunk/Master/texmf-dist/doc/latex/codeanatomy/codeanatomy.pdf
    trunk/Master/texmf-dist/doc/latex/codeanatomy/codeanatomy.usage.pdf
    trunk/Master/texmf-dist/doc/latex/codeanatomy/codeanatomy.usage.tex
    trunk/Master/texmf-dist/source/latex/codeanatomy/codeanatomy.dtx
    trunk/Master/texmf-dist/tex/latex/codeanatomy/codeanatomy.sty

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/codeanatomy/release-note-v0.4-Alpha.txt

Modified: trunk/Master/texmf-dist/doc/latex/codeanatomy/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/codeanatomy/README.md	2023-01-27 21:59:07 UTC (rev 65647)
+++ trunk/Master/texmf-dist/doc/latex/codeanatomy/README.md	2023-01-27 22:00:15 UTC (rev 65648)
@@ -1,6 +1,6 @@
-`codeanatomy` -- Draw Code Anatomy
-==================================
+# `codeanatomy` -- Draw Code Anatomy #
 
+
 (C) 2019 Hồng-Phúc Bùi
 
 The idea of this Package is to typeset illustrations of pieces of code with 
@@ -11,24 +11,24 @@
 This package just provides tools to draw those figures.
 
 Some illustrations can be found here: 
-
 <a href="https://introcs.cs.princeton.edu/java/home/">https://introcs.cs.princeton.edu/java/home/</a>
+For example: Anatomy of a static method:
 
-for example the origin illustation of static method in java: 
-<img src="https://introcs.cs.princeton.edu/java/11cheatsheet/images/function.png">
 
+_![Anatomy of a static method](https://introcs.cs.princeton.edu/java/11cheatsheet/images/function.png)_
 
-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 
 
 ```
@@ -50,9 +50,9 @@
 
 (`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 
 
 ```

Modified: trunk/Master/texmf-dist/doc/latex/codeanatomy/codeanatomy.lstlisting.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/codeanatomy/codeanatomy.lstlisting.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/codeanatomy/codeanatomy.lstlisting.tex	2023-01-27 21:59:07 UTC (rev 65647)
+++ trunk/Master/texmf-dist/doc/latex/codeanatomy/codeanatomy.lstlisting.tex	2023-01-27 22:00:15 UTC (rev 65648)
@@ -1,11 +1,12 @@
-\documentclass[full]{l3doc}
+\documentclass{article}
 
 \usepackage{fontspec}
+
 \usepackage[backend=biber]{biblatex}
 \addbibresource{literatur.bib}
 
+
 \usepackage{codeanatomy}
-
 \usepackage{listings}
 \lstset {
      basicstyle=\small\ttfamily%
@@ -17,11 +18,10 @@
     ,keepspaces=true
 }
 
-\def\thinmargin{\list{}{\rightmargin-30pt\leftmargin-70pt}\item[]}
-\let\endthinmargin=\endlist
 
-\usepackage{filecontents}
-
+%\usepackage{filecontents}
+% command from ltxdoc
+\newcommand{\pkg}[1]{\textsf{#1}}
 % others shortcuts
 \newcommand{\slsh}{\textbackslash{}}
 \newcommand{\TikZ}{Ti\textit{k}Z}
@@ -28,7 +28,7 @@
 \newcommand{\inputlisting}[1]{%
 \lstinputlisting[%
     basicstyle=\footnotesize\ttfamily%
-    ,xleftmargin=-70pt%
+    ,xleftmargin=-40pt%
     ,resetmargins=true%
     ,firstline=5%
     ,language=%
@@ -36,12 +36,13 @@
     ,escapeinside={}{}%
   ]{#1}%
 }
+\def\thinmargin{\list{}{\rightmargin-30pt\leftmargin-40pt}\item[]}
+\let\endthinmargin=\endlist
 
+
+\usepackage{readprov}     % need for \GetFileInfo{}
 \usepackage{hyperref}
 
-\GetFileInfo{codeanatomy.sty}
-\DoNotIndex{}
-
 \title{
   \pkg{codeanatomy} -- Draw Code Anatomy%
   \thanks{This file describes \fileversion,
@@ -50,7 +51,7 @@
 }
 
 \author{
- Hồng-Phúc Bùi
+ Hồng-Phúc Bùi%
  \thanks{
    E-mail:
    \href{mailto:Hồng-Phúc Bùi}
@@ -60,20 +61,21 @@
 
 \date{Released \filedate}
 
-\AtEndDocument{
-    \printbibliography
-}
 
+
 \begin{document}
 
+\GetFileInfo{codeanatomy.sty}
+
 \maketitle
 \tableofcontents
 
-\section{General Usage in Conjuntion with Package \pkg{listings}}
+
+\section{General Usage with Package \pkg{listings}}
 \subsection{Setup Package \pkg{listings}}
 The most important setup for the package \pkg{listings} is the delimiter to escape \LaTeX{}
-commands in Listing. With this escape delimiter we can mark a piece of code as with |\cPart|.
-In this example we use |!| and |!| as delimiter. Code between |!| and |!| is evaluated as 
+commands in Listing. With this escape delimiter we can mark a piece of code as with \verb|\cPart|.
+In this example we use \verb|!| and \verb|!| as delimiter. Code between \verb|!| and \verb|!| is evaluated as 
 \LaTeX{}-code.
 
 \lstset {    
@@ -99,13 +101,17 @@
 \end{thinmargin}
 
 
-Delimiter can also be reset in |document|-Environment, typical just before a new \verb:\begin{lstlisting}:
-environment so each anatomy can have different delimiter. The fact is, in this document I use |+| and |+| for 
-the above listing, so that I can typeset |!| in this listing.
+Delimiter can also be reset in \verb|document|-Environment, typical just before a new \verb:\begin{lstlisting}:
+environment so each anatomy can have different delimiter. The fact is, in this document I use \verb|+| and \verb|+| for 
+the above listing, so that I can typeset \verb|!| in this listing.
 
+You may also want to set option \verb|keepspaces| to \verb|true|, sothat your reader can easy copy past 
+your example code.
+
 \subsection{Typeset Code}
-The command |\codeBlock| does not work if the environment |lstlisting| is passed to its argument. So instead of 
-|\codeBlock| we must use the \TikZ{} command |\node|:
+% -----------------------
+The command \verb|\codeBlock| does not work if the environment \verb|lstlisting| is passed to its argument. So instead of 
+\verb|\codeBlock| we must use the \TikZ{} command \verb|\node|:
 
 \begin{thinmargin}
 \begin{tikzpicture}[remember picture]    
@@ -169,10 +175,10 @@
 \subsection{Mark Code}
 % --------------------
 
-The command |\cPart| can be used to mark single-line code parts. For 
-multiple-line code parts once can use |\extremPoint| to mark the outer most 
-points of code parts and |\fitExtrem| to cover exterm points of a code part.
-These commmands must be put in delimiter, here |!| and |!|.
+The command \verb|\cPart| can be used to mark single-line code parts. For 
+multiple-line code parts once can use \verb|\xxxPoint| family to mark the outer most 
+points of code parts and \verb|\fitExtrem| to cover exterm points of a code part.
+These commmands must be put between escape delimiter, here \verb|!| and \verb|!|.
 
 \begin{thinmargin}
 \begin{tikzpicture}[remember picture]    
@@ -181,7 +187,7 @@
 \begin{tikzpicture}[remember picture]
 \node(code) [anatomy] at (0,0) {
 +\texttt{\slsh{}begin\{lstlisting\}}+    
-!\cPart{fnHead}{function \cPart{fnName}{gcd}\cPart{paramList}{(p,q)}}! {
+!\cPart{fnHead}{function \cPart{fnName}{gcd} \cPart{paramList}{(p,q)}}! {
     +\cPart{ep1}{!\slsh{}mtPoint\{mostLeft\}!}+if (q === 0) {
         return q;                
     }else{
@@ -196,7 +202,7 @@
 \end{lstlisting}
 };
 % Annotations
-\codeAnnotation{epText} (11,2.5) {\texttt{extremPoint}-s mark\\outer most\\of the function body}
+\codeAnnotation{epText} (12,2.75) {xxx\texttt{Point}-s mark\\outer most\\of the function body}
 \codeAnnotation{cpText} (-2,3) {\texttt{cPart} marks a\\single line\\code part}
 % Arrows
 \draw[->,annotation] (epText) -- (ep1.south east);
@@ -229,19 +235,55 @@
 \caption{Code Listing with mark of code parts\label{fig:listing-code-parts}}
 \end{figure}
 
+
+\subsection{Highlight some tokens}
+
+\begin{filecontents}{recursive-with-bug.tex}
+\lstset{escapeinside={!}{!},basicstyle=\linespread{1.8}}
+\begin{tikzpicture}[remember picture]
+\tikzstyle{token} = [code part, fill=yellow]
+\tikzstyle{bug} = [code part, fill=red!50]
+\node(code) [anatomy] at (0,0) {
+\begin{lstlisting}
+function !\cPart[token]{fnName}{gcd}! (p,q) {
+    if (q === 0) {
+        return !\cPart[bug]{bug}{q}!;
+    } else {
+        let r = p % q;
+        return !\cPart[token]{recursive}{gcd}!(q, r);
+    }
+}
+\end{lstlisting}
+};
+\codeAnnotation{recursiveText}    (-1,2) {Function can\\call itself.}
+\codeAnnotation{bugText}         ( 5,2.25) {This is\\the bug.}
+
+\draw[->, annotation] (recursiveText) to[out=50, in=190] (fnName);
+\draw[->, annotation] (recursiveText) to[out=-20, in=175] (recursive.north west);
+\draw[->, annotation] (bugText)       to[out=190,in=-20] (bug.south east);
+\end{tikzpicture}
+\end{filecontents}
+
+%\begin{thinmargin}
+\inputlisting{recursive-with-bug.tex}
+%\end{thinmargin}
+
+\input{recursive-with-bug.tex}
+
+
+
+
+
 \subsection{Add Annotations to Listing}
 % -------------------------------------
-This step is the same as the description in the main document of package \pkg{codeanatomy}.
+This step is the same as the description in the usage document of package \pkg{codeanatomy}.
 Readers can typeset annotations to the above listing like an exercise.
 
 
 
 
-
-
 \section{Some examples}
 % ====================
-% Reset to standard
 
 Most of examples in this section are redrawn from the textbook~\autocite{sedgewick-wayne-2016}.
 
@@ -260,7 +302,7 @@
         !\hmtPoint{left}\iPart{assign}{
             \bgcode{// Prints "Hello World" in the terminal window}}
             \extremPoint{fnR} \extremPoint{mR}!
-        !\iPart{fnCall}{System.out.print( "Hello World");}\dmbPoint{mostBottom}!
+        !\iPart{fnCall}{System.out.print("Hello World");}\dmbPoint{mostBottom}!
     }!\mbPoint{mainBottom}!
 }
 \end{lstlisting}
@@ -276,6 +318,7 @@
 \codeAnnotation{functionBodyText} (2.5,-0.5) {body}
 \codeAnnotation{statement} (8,0) {statements}
 
+{[on background layer]
 \draw[->,annotation] (fileNameText) -- (class);
 \draw[->,annotation] (classNameText) -- (className);
 \draw[->,annotation] (classBodyText.south west) -- (classBody);
@@ -282,12 +325,13 @@
 \draw[->,annotation] (functionBodyText) -- (functionBody);
 \draw[->,annotation] (statement) -- (assign.353);
 \draw[->,annotation] (statement) -- (fnCall.350);
+}
 \end{tikzpicture}
 \end{filecontents}
 
-\begin{thinmargin}
+%\begin{thinmargin}
 \inputlisting{java-program.tex}
-\end{thinmargin}
+%\end{thinmargin}
 
 \input{java-program.tex}
 
@@ -486,7 +530,6 @@
     \inputlisting{anatomy-of-a-while-loop.tex}
 \end{thinmargin}
 
-{\sffamily test font if while do}
 
 \input{anatomy-of-a-while-loop.tex}
 
@@ -517,7 +560,7 @@
 \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\\
+\codeAnnotation{iText}       (1.2,3.5)   {declare and initialize\\
                                         a loop control variable}
 \codeAnnotation{cText}     (3.5,3)     {loop-\\continuation\\condition}
 \codeAnnotation{uText}       (6,3)     {increment}
@@ -562,15 +605,15 @@
 \fitExtrem{b}{(left) (right) (bottom)}
 
 % Annotation
-\codeAnnotation{sText}  (-0.7,5)    {signature}
-\codeAnnotation{rtText}    (2,5)    {return\\type}
-\codeAnnotation{fnText}  (  4,5)    {method\\name}
-\codeAnnotation{alText}  (  6,5)    {argument\\list}
-\codeAnnotation{atText}  (6.5,1.75) {argument\\type}
-\codeAnnotation{pvText}  (7.5,2.70) {parameter\\variable}
-\codeAnnotation{lvText} (-0.7,2.5)  {local\\variable}
-\codeAnnotation{bText}  (-0.7,1.5)  {method\\body}
-\codeAnnotation{rsText}  (3,-0.4) {return statement}
+\codeAnnotation{sText}  (-0.7,5.25)  {signature}
+\codeAnnotation{rtText}    (2,5.25)  {return\\type}
+\codeAnnotation{fnText}  (  4,5.25)  {method\\name}
+\codeAnnotation{alText}  (  6,5.25)  {argument\\list}
+\codeAnnotation{atText} (6.75,1.75)  {argument\\type}
+\codeAnnotation{pvText}  (7.5,2.70)  {parameter\\variable}
+\codeAnnotation{lvText} (-0.7,3)     {local\\variable}
+\codeAnnotation{bText}  (-0.7,1.5)   {method\\body}
+\codeAnnotation{rsText}  (3,-0.4)    {return statement}
 % Arrows
 \draw[->,annotation] (sText) -- (s.north west);
 \draw[->,annotation] (rtText) -- (rt);
@@ -590,5 +633,7 @@
 
 \input{anatomy-of-a-static-method.tex}
 
-\end{document}
 
+\printbibliography
+
+\end{document}
\ No newline at end of file

Modified: trunk/Master/texmf-dist/doc/latex/codeanatomy/codeanatomy.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/codeanatomy/codeanatomy.usage.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/codeanatomy/codeanatomy.usage.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/codeanatomy/codeanatomy.usage.tex	2023-01-27 21:59:07 UTC (rev 65647)
+++ trunk/Master/texmf-dist/doc/latex/codeanatomy/codeanatomy.usage.tex	2023-01-27 22:00:15 UTC (rev 65648)
@@ -237,6 +237,7 @@
 each others. 
 
 \begin{thinmargin}
+{\footnotesize
 \begin{tikzpicture}[remember picture]
 {[on background layer]\draw[code grid debug] (-0.5,-0.5) grid (10.5,4.5);}\\  
 \codeBlock{
@@ -258,16 +259,17 @@
 \slsh{}end\{tikzpicture\}
 }
  
-\codeAnnotation{nestedCodePartText}(11,6){\texttt{cPart} can be nested}
-\codeAnnotation{exText}            (15,3){\texttt{extremPoint}s\\are used to mark\\outer most points of\\a multiline code part}
+\codeAnnotation{nestedCodePartText}(11,5){\texttt{cPart} can be nested}
+\codeAnnotation{exText}            (15,2){\texttt{extremPoint}s\\are used to mark\\outer most points of\\a multiline code part}
 \codeAnnotation{fitExtemCmdText}   (6,-1){\texttt{fitExtrem} draws a rectangle\\which covers all passed extrem points}
 
-\draw[->, annotation] (nestedCodePartText) to[out=270,in=90] (nestedCodePart);
-\draw[->, annotation] (exText) to[out=145,in=320] (ep1.south east);
-\draw[->, annotation] (exText) to[out=190,in=300] (ep2.320);
-\draw[->, annotation] (exText) to[out=220,in=350] (ep3.340);
+\draw[->, annotation] (nestedCodePartText) to[out=200,in=40] (nestedCodePart);
+\draw[->, annotation] (exText) to[out=160,in=350] (ep1.south east);
+\draw[->, annotation] (exText) to[out=190,in=340] (ep2.320);
+\draw[->, annotation] (exText) to[out=195,in=350] (ep3.south east);
 \draw[->, annotation] (fitExtemCmdText) -- (fitExtemCmd);
 \end{tikzpicture} 
+}
 \end{thinmargin}
 
 
@@ -305,12 +307,12 @@
 \{[on background layer]\textbackslash{}draw[code grid debug]\\
                        \ptab\ptab (-0.5,-0.5) grid (6.5,4.5);\}\\
 \textbackslash{}codeBlock\{\%\\
-\slsh{}cPart\{functionHead\}                                \{function \slsh{}cPart\{functionName\}\{gcd\} \slsh{}cPart\{paramList\}\{(p, q)\}\} \slsh\{\\
+\slsh{}cPart\{functionHead\}                \{function \slsh{}cPart\{functionName\}\{gcd\} \slsh{}cPart\{paramList\}\{(p, q)\}\} \slsh\{\\
   \slsh\slsh[2.5pt]\\
-\slsh{}ptab\{\}\slsh{}mtPoint\{mostLeft\}          if (q === 0) \slsh\{                                                                                \slsh\slsh\\
-\slsh{}ptab\slsh{}ptab\{\}                                           return p;                                                                                       \slsh\slsh\\
-\slsh{}ptab\slsh                                                 \} else \slsh\{                                                                                     \slsh\slsh\\
-\slsh{}ptab\slsh{}ptab\{\}                                           return gcd(q, p\slsh\%q);       \slsh{}extremPoint\{mostRight\}                                 \slsh\slsh\\
+\slsh{}ptab\{\}\slsh{}mtPoint\{mostLeft\}        if (q === 0) \slsh\{                                                                                \slsh\slsh\\
+\slsh{}ptab\slsh{}ptab\{\}                           return p;                                                                                       \slsh\slsh\\
+\slsh{}ptab\slsh                                 \} else \slsh\{                                                                                     \slsh\slsh\\
+\slsh{}ptab\slsh{}ptab\{\}                           return gcd(q, p\slsh\%q);       \slsh{}extremPoint\{mostRight\}                                 \slsh\slsh\\
 \slsh{}ptab\slsh{}mbPoint\{mostBottom\}\slsh\}                                                                                                      \slsh\slsh\\
 \slsh\}                                             \\
 \} \\ 
@@ -373,11 +375,102 @@
 
 As we see in the previous section, the command |\codeBlock| cannot typeset whitespaces correctly as we 
 expect. A way to typeset code listing is using the package \pkg{listings}. See \texttt{codeanatomy.lstlisting.pdf}
+for more information.
 
-
 \section{Customize style}
-TODO
 
+\changes{v0.4-Beta}
+        {2023/01/24}
+        {Add Option \oarg{style} to \texttt{cPart} and \texttt{iPart}}
+
+Maybe we want to highlight the function name \texttt{gcd} with some background color like 
+figure~\ref{fig:function-with-highlight}. The best way to do this task is to assign this  
+highlight format to a \TikZ{} style --e.g. \texttt{jsid}-- and apply the style to the highlighted nodes. So they
+have the same format.
+
+
+% output the anatomy
+\begin{figure}[htpb]
+\centering
+\begin{tikzpicture}[remember picture]
+\tikzstyle{jsid} = [code part, fill=red!10]
+%{[on background layer]\draw[code grid debug](-0.5,-0.5) grid (9.5,4.5);}
+\codeBlock{
+\cPart{functionHead}{function \cPart[jsid]{functionName}{gcd} \cPart{parameterList}{(p, q)}}\{ \\[2.5pt] %
+\ptab{}\mtPoint{mostLeft} if (q === 0) \{\\
+\ptab\ptab{} return p; \\
+\ptab{}\} else \{\\
+\ptab\ptab{} return \cPart[jsid]{recursive}{gcd}(q, p \% q);\extremPoint{mostRight}\\
+\ptab{}\}\mbPoint{mostBottom}\\
+\}
+}
+
+\fitExtrem{functionBody}{ (mostLeft) (mostRight) (mostBottom) };
+
+% Anotation labels
+\codeAnnotation{functionHeadText}(-1,3)  {Function\\Head}
+\codeAnnotation{functionBodyText}(-1,1.5){Function\\Body}
+\codeAnnotation{functionNameText} (1,4)  {Function Name}
+\codeAnnotation{parameterListText}(4,4) {Paramter List}
+
+\codeAnnotation{recursiveText} (7.5,2) {Function can\\call itselft.}
+
+% Annotation labels to Code
+\draw[->, annotation] (functionBodyText) -- (functionBody);
+\draw[->, annotation] (functionHeadText) -- (functionHead);
+\draw[->, annotation] (functionNameText) -- (functionName);
+\draw[->, annotation] (parameterListText) -- (parameterList);
+
+\draw[->, annotation] (recursiveText) to[out=175,in=-15] (functionName);
+\draw[->, annotation] (recursiveText) to[out=180,in=45] (recursive.north east);
+
+\end{tikzpicture}
+\caption{Highlighted name of the function\label{fig:function-with-highlight}}
+\end{figure}
+
+
+%out the Source code
+
+\begin{thinmargin}
+{\footnotesize
+\begin{tikzpicture}[remember picture]
+\tikzstyle{smark} = [code part, fill=yellow]
+\codeBlock{
+\textbackslash{}begin\{tikzpicture\}[remember picture]\\
+\slsh{}tikzstyle\{\cPart[smark]{defstyle}{jsid}\} = [code part, fill=red!10]\\
+\slsh{}codeBlock\{\\
+\slsh{}cPart\{functionHead\}                \{function \slsh{}cPart[\cPart[smark]{u1}{jsid}]\{functionName\}\{gcd\} \slsh{}cPart\{parameterList\}\{(p, q)\}\} \slsh\{  \slsh\slsh[2.5pt]\\
+\slsh{}ptab\{\}\slsh{}mtPoint\{mostLeft\}        if (q === 0) \slsh\{                                                                           \slsh\slsh\\
+\slsh{}ptab\slsh{}ptab\{\}                           return p;                                                                                  \slsh\slsh\\
+\slsh{}ptab\{\}\slsh                            \} else \slsh\{                                                                                \slsh\slsh\\
+\slsh{}ptab\slsh{}ptab\{\}                           return \slsh{}cPart[\cPart[smark]{u2}{jsid}]\{recursive\}\{gcd\}(q, p\slsh\%q);       \slsh{}extremPoint\{mostRight\}\slsh\slsh\\
+\slsh{}ptab\{\}\slsh{}mbPoint\{mostBottom\}\slsh\}                                                                                                  \slsh\slsh\\
+\slsh\}                                             \\
+\} \\ 
+   \\
+\slsh{}fitExtrem\{functionBody\}\{(mostLeft) (mostRight) (mostBottom)\}\\ 
+\\
+\% Annotations \\
+\slsh{}codeAnnotation\{functionHeadText\} (-1,3)   \{Function\slsh\slsh{}Head\} \\
+\slsh{}codeAnnotation\{functionBodyText\} (-1,1.5) \{Function\slsh\slsh{}Body\} \\
+\slsh{}codeAnnotation\{functionNameText\} ( 1,4)   \{Function Name\} \\
+\slsh{}codeAnnotation\{parameterListText\}( 4,4)   \{Parameter List\} \\
+\\
+\% Annotation labels to code parts\\
+\slsh{}draw[->,annotation] (functionBodyText) -- (functionBody);\\
+\slsh{}draw[->,annotation] (functionHeadText) -- (functionHead);\\
+\slsh{}draw[->,annotation] (functionNameText) -- (functionName);\\
+\slsh{}draw[->,annotation] (parameterListText) -- (paramList);\\
+\\
+\slsh{}draw[->, annotation] (recursiveText) to[out=175,in=-15] (functionName);\\
+\slsh{}draw[->, annotation] (recursiveText) to[out=180,in=45] (recursive.north east);\\
+\slsh{}end\{tikzpicture\}
+}
+\end{tikzpicture} 
+}
+\end{thinmargin}
+
+\PrintChanges
 \end{documentation}
 \end{document}
 

Added: trunk/Master/texmf-dist/doc/latex/codeanatomy/release-note-v0.4-Alpha.txt
===================================================================
--- trunk/Master/texmf-dist/doc/latex/codeanatomy/release-note-v0.4-Alpha.txt	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/codeanatomy/release-note-v0.4-Alpha.txt	2023-01-27 22:00:15 UTC (rev 65648)
@@ -0,0 +1 @@
+Fix bug about fill color in arrow if its start point is placed in an anotation text


Property changes on: trunk/Master/texmf-dist/doc/latex/codeanatomy/release-note-v0.4-Alpha.txt
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/source/latex/codeanatomy/codeanatomy.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/codeanatomy/codeanatomy.dtx	2023-01-27 21:59:07 UTC (rev 65647)
+++ trunk/Master/texmf-dist/source/latex/codeanatomy/codeanatomy.dtx	2023-01-27 22:00:15 UTC (rev 65648)
@@ -23,7 +23,7 @@
 %
 % \iffalse
 %<package>\NeedsTeXFormat{LaTeX2e}[2018/12/01]
-%<package>\ProvidesPackage{codeanatomy}[2019/07/12 v0.4-Alpha draw Code Anatomy]
+%<package>\ProvidesPackage{codeanatomy}[2023/01/24 v0.4-Beta draw Code Anatomy]
 % \fi
 %
 % \iffalse
@@ -169,7 +169,7 @@
 %
 %
 % \DescribeMacro{code part}
-% \TikZ{} style to marce a piece of code in an anatomy: \\
+% \TikZ{} style to mark a piece of code in an anatomy: \\
 % |\tikz{\node(code) [code part] at (0,0) {let a = 12;};}|\\
 % yields  \tikz{\node(code) [code part] at (0,0) {let a = 12;};}
 %    \begin{macrocode}
@@ -186,7 +186,27 @@
 %    \end{macrocode}
 %
 %
+% \DescribeMacro{ignored code part}
+% \TikZ{} style to make a pice of code in an anatomy as not important in currently talking context
+% |\tikz{\node(ignore code) [ignored code part] at (0,0) {/*some comment*/} }|
+% yields \tikz{\node(ignore code) [ignored code part] at (0,0) {/*some comment*/} }
 %
+% \changes{v0.4-Beta}
+%         {2023/01/24}
+%         {Add new \TikZ{} Style \texttt{ignored code part}}%
+%
+%    \begin{macrocode}
+\tikzset{ignored code part/.style={%
+    code part,%
+    draw=none,color=bgcmdcolor,%
+    inner sep=0.75pt
+  }
+}
+%    \end{macrocode}
+%
+%
+%
+%
 % \DescribeMacro{fit extrem}
 % \TikZ{} style to mark a piece of multiple line code in an anatomy:\\
 % |\tikz{ \node(c)[fit extrem, fit={(0,0) (0.5,0.975) (1,0)}] {}; }|\\
@@ -278,22 +298,29 @@
 % This command can be used if there are no other packages to typeset code listing in use.
 %    \begin{macrocode}
 \NewDocumentCommand{\codeBlock}{m}%
-  {\node(code) [anatomy] at (0,0) {#1};}
+    {\node(code) [anatomy] at (0,0) {#1};}%
 %    \end{macrocode}
 %
 %
 % 
-% \DescribeMacro{\cPart} \marg{node name}\marg{piece of code}
+% \DescribeMacro{\cPart} \oarg{style} \marg{node name}\marg{piece of code}
 %
 % Assign a piece of typeset code --typical in one line-- to a \TikZ{} Node, so that it can
 % be annotated. 
 % \begin{itemize}
+%   \item \oarg{style} a defined \TikZ{} style to be applied to this node, the style |code part|
+%         is applied to the node per default.
 %   \item \marg{node name} is a unique \TikZ{} node name in the |tikzpicture| 
 %   \item \marg{piece of code} is a single code part to be marked.    
 % \end{itemize}
+%
+% \changes{v0.4-Beta}
+%         {2023/01/24}
+%         {Add option \oarg{style} to \texttt{cPart}}%
+%
 %    \begin{macrocode}
-\NewDocumentCommand{\cPart}{mm} %
-    {\tikzmarknode[code part]{#1}{#2}}
+\NewDocumentCommand\cPart{O{code part}mm}
+   {\tikzmarknode[#1]{#2}{#3}}
 %    \end{macrocode} 
 % 
 %
@@ -303,12 +330,19 @@
 % Assign a piece of typeset code --typical in one line-- to a \TikZ{} Node, so that it can
 % be annotated. It does not plot border around the pice of code as |\cPart| does.
 % \begin{itemize}
+%   \item \oarg{style} a defined \TikZ{} style to be applied to this node, the style |ignored code part|
+%         is applied to the node per default.
 %   \item \marg{node name} is a unique \TikZ{} node name in the |tikzpicture| 
 %   \item \marg{piece of code} is a single code part to be marked.
 % \end{itemize}
+%
+% \changes{v0.4-Beta}
+%         {2023/01/24}
+%         {Add option \oarg{style} to \texttt{iPart}}
+%
 %    \begin{macrocode}
-\NewDocumentCommand{\iPart}{mm} %
-    {\tikzmarknode[code part,draw=none,inner sep=0.75pt]{#1}{#2}}
+\NewDocumentCommand{\iPart}{O{ignored code part}mm} %
+    {\tikzmarknode[#1]{#2}{#3}}
 %    \end{macrocode} 
 % 
 %

Modified: trunk/Master/texmf-dist/tex/latex/codeanatomy/codeanatomy.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/codeanatomy/codeanatomy.sty	2023-01-27 21:59:07 UTC (rev 65647)
+++ trunk/Master/texmf-dist/tex/latex/codeanatomy/codeanatomy.sty	2023-01-27 22:00:15 UTC (rev 65648)
@@ -7,7 +7,7 @@
 %% codeanatomy.dtx  (with options: `package')
 %% 
 \NeedsTeXFormat{LaTeX2e}[2018/12/01]
-\ProvidesPackage{codeanatomy}[2019/07/12 v0.4-Alpha draw Code Anatomy]
+\ProvidesPackage{codeanatomy}[2023/01/24 v0.4-Beta draw Code Anatomy]
 
 \RequirePackage{expl3}
 \RequirePackage{xparse}
@@ -45,6 +45,12 @@
       font=\ttfamily
     }
 }
+\tikzset{ignored code part/.style={%
+    code part,%
+    draw=none,color=bgcmdcolor,%
+    inner sep=0.75pt
+  }
+}
 \tikzset{fit extrem/.style={%
       rectangle,%
       draw=annotationcolor,%
@@ -86,11 +92,11 @@
     }
 }
 \NewDocumentCommand{\codeBlock}{m}%
-  {\node(code) [anatomy] at (0,0) {#1};}
-\NewDocumentCommand{\cPart}{mm} %
-    {\tikzmarknode[code part]{#1}{#2}}
-\NewDocumentCommand{\iPart}{mm} %
-    {\tikzmarknode[code part,draw=none,inner sep=0.75pt]{#1}{#2}}
+    {\node(code) [anatomy] at (0,0) {#1};}%
+\NewDocumentCommand\cPart{O{code part}mm}
+   {\tikzmarknode[#1]{#2}{#3}}
+\NewDocumentCommand{\iPart}{O{ignored code part}mm} %
+    {\tikzmarknode[#1]{#2}{#3}}
 \NewDocumentCommand{\mtPoint}{m}
     {\tikzmarknode{#1}{\phantom{\rule[1.8ex]{0.1ex}{0.1ex}}}}
 \NewDocumentCommand{\hmtPoint}{m}



More information about the tex-live-commits mailing list.