From 459ec2f0a382382207286a0152410de2232ce17c Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 15 Jul 2022 21:48:04 +0000 Subject: tkzexample (15jul22) git-svn-id: svn://tug.org/texlive/trunk@63908 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/tkzexample/README.md | 37 ++ .../texmf-dist/doc/latex/tkzexample/tkzexample.pdf | Bin 0 -> 98599 bytes .../texmf-dist/doc/latex/tkzexample/tkzexample.tex | 535 +++++++++++++++++++++ .../texmf-dist/tex/latex/tkzexample/tkzexample.sty | 502 +++++++++++++++++++ Master/tlpkg/bin/tlpkg-ctan-check | 4 +- Master/tlpkg/libexec/ctan2tds | 1 + Master/tlpkg/tlpsrc/collection-pictures.tlpsrc | 1 + Master/tlpkg/tlpsrc/tkzexample.tlpsrc | 0 8 files changed, 1078 insertions(+), 2 deletions(-) create mode 100644 Master/texmf-dist/doc/latex/tkzexample/README.md create mode 100644 Master/texmf-dist/doc/latex/tkzexample/tkzexample.pdf create mode 100644 Master/texmf-dist/doc/latex/tkzexample/tkzexample.tex create mode 100644 Master/texmf-dist/tex/latex/tkzexample/tkzexample.sty create mode 100644 Master/tlpkg/tlpsrc/tkzexample.tlpsrc (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/tkzexample/README.md b/Master/texmf-dist/doc/latex/tkzexample/README.md new file mode 100644 index 00000000000..f36e8d2ebf2 --- /dev/null +++ b/Master/texmf-dist/doc/latex/tkzexample/README.md @@ -0,0 +1,37 @@ +# tkzexample.sty — Package for the documentation of all tkz-* packages. + +Release 1.45c 2022/07/14 + +## Note + +This package is highly experimental and subject to change without notice. tkzexample is a package to present examples and their sources. It is essential if you want to compile the documentation of my packages like \tkzname{tkz-euclide}. I needed for my first packages to work in UTF8 and to present my sources in French. These sources had accents so I had to adapt the code used by \tkzimp{T.Tantau} to present the examples of \tkzname{pgfmanual}. There are still some imperfections so I invite you to improve this code if necessary + +## Licence + +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt. +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% This work has the LPPL maintenance status “maintained”. +% The Current Maintainer of this work is Alain Matthes. + +## Installation + +The package `tkzexample.sty` is present in `TeXLive` and `MiKTeX`, use the +package manager to install. + + +## How to use it + +\begin{tkzexample}[options] + your code +\end{tkzexample} + + + +## Author + +Alain Matthes, 5 rue de Valence, Paris 75005, al (dot) ma (at) mac (dot) com diff --git a/Master/texmf-dist/doc/latex/tkzexample/tkzexample.pdf b/Master/texmf-dist/doc/latex/tkzexample/tkzexample.pdf new file mode 100644 index 00000000000..7382e0f97ef Binary files /dev/null and b/Master/texmf-dist/doc/latex/tkzexample/tkzexample.pdf differ diff --git a/Master/texmf-dist/doc/latex/tkzexample/tkzexample.tex b/Master/texmf-dist/doc/latex/tkzexample/tkzexample.tex new file mode 100644 index 00000000000..4ca74a9286a --- /dev/null +++ b/Master/texmf-dist/doc/latex/tkzexample/tkzexample.tex @@ -0,0 +1,535 @@ +% !TEX TS-program = lualatex +% encoding : utf8 +% Documentation of tkzexample.sty +% Copyright 2022 Alain Matthes +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% This work has the LPPL maintenance status “maintained”. +% The Current Maintainer of this work is Alain Matthes. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% doc tkzexample.sty encodage : utf8 % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% Créé par Alain Matthes le 21/03/2009 % +% Copyright (c) 2009, 2022 __AlterMundus__ All rights reserved.% +% version : 1.45c % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\PassOptionsToPackage{unicode}{hyperref} + +\documentclass[DIV = 14, + fontsize = 10, + index = totoc, + twoside, + cadre, + headings = small, + ]{tkz-doc} +%\usepackage{etoc} +\gdef\tkznameofpack{tkzexample.sty} +\gdef\tkzversionofpack{1.45c} +\gdef\tkzdateofpack{\today} +\gdef\tkznameofdoc{doc-tkzexample} +\gdef\tkzversionofdoc{1.45c} +\gdef\tkzdateofdoc{\today} +\gdef\tkzauthorofpack{Alain Matthes} +\gdef\tkzadressofauthor{} +\gdef\tkznamecollection{AlterMundus} +\gdef\tkzurlauthor{http://altermundus.fr} +\gdef\tkzengine{lualatex} +\gdef\tkzurlauthorcom{http://altermundus.fr} +\nameoffile{\tkznameofpack} +% -- Packages --------------------------------------------------- +\usepackage[dvipsnames,svgnames]{xcolor} +\usepackage{calc} +\usepackage{tkz-euclide,tkzexample,pgfornament} +\usetikzlibrary{backgrounds} +\usepackage[colorlinks,pdfencoding=auto, psdextra]{hyperref} +\hypersetup{ + linkcolor=Gray, + citecolor=Green, + filecolor=Mulberry, + urlcolor=NavyBlue, + menucolor=Gray, + runcolor=Mulberry, + linkbordercolor=Gray, + citebordercolor=Green, + filebordercolor=Mulberry, + urlbordercolor=NavyBlue, + menubordercolor=Gray, + runbordercolor=Mulberry, + pdfsubject={Euclidean Geometry}, + pdfauthor={\tkzauthorofpack}, + pdftitle={\tkznameofpack}, + pdfcreator={\tkzengine} +} + +\usepackage{fontspec} +\setmainfont{texgyrepagella}[ + Extension = .otf, + UprightFont = *-regular , + ItalicFont = *-italic , + BoldFont = *-bold , + BoldItalicFont = *-bolditalic +] +\setsansfont{texgyreheros}[ + Extension = .otf, + UprightFont = *-regular , + ItalicFont = *-italic , + BoldFont = *-bold , + BoldItalicFont = *-bolditalic , +] + +\setmonofont{lmmono10-regular.otf}[ + Numbers={Lining,SlashedZero}, + ItalicFont=lmmonoslant10-regular.otf, + BoldFont=lmmonolt10-bold.otf, + BoldItalicFont=lmmonolt10-boldoblique.otf, +] +\newfontfamily\ttcondensed{lmmonoltcond10-regular.otf} +%% (La)TeX font-related declarations: +\linespread{1.05} % Pagella needs more space between lines +%\usepackage{unicode-math} +\usepackage[math-style=literal,bold-style=literal]{unicode-math} +\usepackage{fourier-otf} +\let\rmfamily\ttfamily +\usepackage{multicol,lscape} +\usepackage[english]{babel} +\usepackage[normalem]{ulem} +\usepackage{multirow,multido,booktabs,cellspace} +\usepackage{shortvrb,fancyvrb,bookmark} + +\usetikzlibrary{snakes} + +%<-------------------------------------------------------------------------- +% settings styles +\tkzSetUpColors[background=white,text=black] +\AtBeginDocument{\MakeShortVerb{\|}} % link to shortvrb +%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––> + +\begin{document} +\parindent=0pt +\tkzTitleFrame{tkzexample\\Presentation tool} +\clearpage + + + \nameoffile{\tkznameofpack} +\defoffile{\tkzname{\tkznameofpack} is a package to present examples and their sources. It is essential if you want to compile the documentation of my packages like \tkzname{tkz-euclide}. I needed for my first packages to work in UTF8 and to present my sources in French. These sources had accents so I had to adapt the code used by \tkzimp{T.Tantau} to present the examples of \tkzname{pgfmanual}. There are still some imperfections so I invite you to improve this code if necessary}. + +\presentation + +\vfill + +Please report typos or any other comments to this documentation to: \href{mailto:al.ma@mac.com}{\textcolor{blue}{Alain Matthes}}. + +This file can be redistributed and/or modified under the terms of the \LaTeX{} +Project Public License Distributed from \href{http://www.ctan.org/}{CTAN}\ archives. + + + \clearpage + \tableofcontents + \clearpage +%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––> + +\colorlet{graphicbackground}{blue!10!white}% +\colorlet{codebackground}{blue!20!lightgray!20}% +\colorlet{numbackground}{blue!50!black!50}% +\colorlet{numcolor}{white}% + +\section{First example : no options} +\tkzname{\tkznameofpack} is based on the code of \tkzname{codeexample} of \tkzimp{T.Tantau} . I wanted to be able to use the accents of the French language in the sources. + +How to use this environment? Without any options, the interpretation of a code and the source of this code are placed one above the other. + +To do this, simply place the source code in a \tkzname{tkzexample}. The colors of the different boxes show their sizes. + +The colors are obtained as follows: + +|\colorlet{graphicbackground}{blue!10!white}| \\ +|\colorlet{codebackground}{blue!20!lightgray!20}|\\ + +\begin{tkzexample}[] +\begin{minipage}{8cm} +\subsubsection{Minipage and accents without options} +This is a test for "minipage" and accents èçéà\&§. +The brackets |[]| even without options are mandatory. +\end{minipage} +\end{tkzexample} + +\vspace{12pt} + +|\begin{tkzexample}[]|\\ +|\begin{minipage}{8cm}|\\ +|\subsubsection{Minipage and accents without options}|\\ +|This is a test for "minipage" and accents èçéà\&§. |\\ +| The brackets |[]| even without options are mandatory.|\\ +|\end{minipage}|\\ +|\end{tkzexample}|\\ + +\vspace{12pt} +You may notice already a small default, |[]| square brackets are mandatory even without option. + +\section{Inversion of the boxes: option \tkzname{overhang}} + +\tkzname{overhang} allows to swap the source and the result. + +|\begin{tkzexample}[overhang]|\\ +|\begin{tikzpicture}|\\ +| ...|\\ +|\end{tkzexample}|\\ + + +\begin{tkzexample}[overhang] +\begin{tikzpicture} + \tkzDefPoint(0,0){O} + \tkzDefPoint(1,0){a0} + \tkzDrawSegment(O,a0) + \foreach \i [count=\j] in {0,...,16}{% + \tkzDefPointWith[orthogonal normed](a\i,O) + \tkzGetPoint{a\j} + \pgfmathsetmacro{\c}{5*\i} + \tkzDrawPolySeg[fill=teal!\c](a\i,a\j,O)} + \end{tikzpicture} +\end{tkzexample} + +\newpage +\section{Boxes with the same width: option \tkzname{vbox}} + +In order to present the code under the interpretation, I set the vbox option so that the interpretation and the source are in a box of the same maximum width. + +\vspace{12pt} +|\begin{tkzexample}[vbox]|\\ +| ...|\\ +|\end{tkzexample}|\\ +\vspace{12pt} +which gives + +\begin{tkzexample}[vbox] +\begin{tikzpicture}[scale=1] + \tikzset{new/.style={color=orange,line width=.2pt}} + \tkzDefPoint(0,0){A}\tkzDefPoint(6,0){D} + \tkzDefPoint(8,0){B}\tkzDefPoint(4,0){I} + \tkzDefLine[orthogonal=through D](A,D) + \tkzInterLC[R](D,tkzPointResult)(I,4) \tkzGetSecondPoint{C} + \tkzDefLine[orthogonal=through C](I,C) \tkzGetPoint{c} + \tkzDefLine[orthogonal=through B](A,B) \tkzGetPoint{b} + \tkzInterLL(C,c)(B,b) \tkzGetPoint{T} + \tkzInterLL(A,T)(C,D) \tkzGetPoint{P} + \tkzDrawArc(I,B)(A) + \tkzDrawSegments(A,B A,T C,D I,C) \tkzDrawSegment[new](I,C) + \tkzDrawLine[add = 1 and 0](C,T) \tkzDrawLine[add = 0 and 1](B,T) + \tkzMarkRightAngle(I,C,T) + \tkzDrawPoints(A,B,I,D,C,T) + \tkzLabelPoints(A,B,I,D) \tkzLabelPoints[above right](C,T) + \tkzMarkSegment[pos=.25,mark=s|](C,D) \tkzMarkSegment[pos=.75,mark=s|](C,D) +\end{tikzpicture} +\end{tkzexample} + +\newpage + +\section{Side by side: option \tkzname{latex}} + +You must indicate the width of the box assigned to the interpretation, this is done with the option \tkzname{latex}: + +\subsubsection{\tkzname{latex=7cm}} +\begin{tkzexample}[latex=7cm] +\begin{tikzpicture}[scale=.5] +\tkzInit[xmin=-6,ymin=-4,xmax=6,ymax=6] +\tkzClip +\tkzSetUpLine[thin,color=teal] +\tkzDefPoint(0,0){O} +\tkzDefPoint(132:5){A} +\tkzDefPoint(4,0){B} +\foreach \ang in {5,10,...,360}{% + \tkzDefPoint(\ang:4){M} + \tkzDefLine[mediator](A,M) + \tkzGetPoints{x}{y} + \tkzDrawLine[add= 3 and 3](x,y)} +\end{tikzpicture} +\end{tkzexample} + +|\begin{tkzexample}[latex=7cm]|\\ +|...| \\ +|\end{tkzexample}| \\ +\subsubsection{\tkzname{latex=8cm}} +\begin{tkzexample}[latex=8cm] +\begin{tikzpicture}[scale=.5] +\tkzInit[xmin=-6,ymin=-4,xmax=6,ymax=6] +\tkzClip +\tkzSetUpLine[thin,color=magenta] +\tkzDefPoint(0,0){O} +\tkzDefPoint(132:4){A} +\tkzDefPoint(5,0){B} +\foreach \ang in {5,10,...,360}{% + \tkzDefPoint(\ang:5){M} + \tkzDefLine[mediator](A,M) + \tkzGetPoints{x}{y} + \tkzDrawLine[add= 3 and 3](x,y)} +\end{tikzpicture} +\end{tkzexample} + +|\begin{tkzexample}[latex=8cm]|\\ +|...| \\ +|\end{tkzexample}| \\ +\newpage +\section{Side by side: option \tkzname{width}} +If the option \tkzname{latex= x cm} allows to reserve a box of width x cm for the code, the option \tkzname{width= x cm} allows to reserve a box of width x cm for the result. + +We leave a box of 8cm for the result or drawing and the rest of the line will contain a minipage of 8cm. As you can see a new section has been created and the code is contained in a 8cm box + + +\begin{tkzexample}[overhang,width=6cm,code=red!10] +\begin{tikzpicture}[scale=.4] +\tkzDefPoints{0/0/P,5/0/Q,3/2/I} +\tkzDefCircle[orthogonal from=P](Q,I) +\tkzGetFirstPoint{E} +\tkzDrawCircles(P,E Q,E) +\tkzInterCC[common=E](P,E)(Q,E) \tkzGetFirstPoint{F} +\tkzDefPointOnCircle[through = center P angle 80 point E] + \tkzGetPoint{A} +\tkzInterLC[common=E](A,E)(Q,E) \tkzGetFirstPoint{C} +\tkzInterLL(A,F)(C,Q) \tkzGetPoint{D} +\tkzDrawLines[add=0 and .75](P,Q) +\tkzDrawLines[add=0 and 2](A,E) +\tkzDrawSegments(P,E E,F F,C A,F C,D) +\tkzDrawPoints(P,Q,E,F,A,C,D) +\tkzLabelPoints(P,Q,F,C,D) +\tkzLabelPoints[above](E,A) +\end{tikzpicture} +\end{tkzexample} + +\vspace{24pt} +The options used to get this result are : +\vspace{12pt} + +|\begin{tkzexample}[overhang,width=6cm,code=red!30]|\\ +|...| \\ +|\end{tkzexample}| \\ + + +\newpage +\section{Option \tkzname{code} and option \tkzname{graphic}} + +This option is used to color the background of the code. + +\vspace{24pt} + +|\begin{tkzexample}[overhang,width=9cm,code=gray!20,graphic=red!15]|\\ +|...| \\ +|\end{tkzexample}| \\ + +\begin{tkzexample}[overhang,width=9cm,code=gray!20,graphic=red!15] +\begin{tikzpicture}[scale=1] + \tkzDefPoint(2,3){A} + \tkzDefShiftPoint[A](30:3){B} + \tkzDefShiftPoint[A](-30:3){C} + \tkzDrawPolygon(A,B,C) + \tkzDrawPoints(A,B,C) + \tkzLabelPoints[right](B,C) + \tkzLabelPoints[above left](A) + \tkzMarkSegments[mark=|](A,B A,C B,C) +\end{tikzpicture} +\end{tkzexample} + + +\newpage +\section{Option \tkzname{num}} + +You can number the lines of code. \tkzname{numcolor} and \tkzname{numbkgcolor} are used to define the style of the numbering. + +\subsection{Example 1} +\begin{tkzexample}[width=6cm,num,numcolor=red,numbkgcolor=white,code style=\ttfamily] +\begin{tikzpicture}[scale=0.3] + \tkzDefPoint(-4,0){I} + \tkzDefPoint(4,0){J} + \tkzDefPoint(0,0){O} + \tkzInterCC(J,O)(O,J) \tkzGetPoints{L}{H} + \tkzInterCC(I,O)(O,I) \tkzGetPoints{K}{G} + \tkzInterLL(I,K)(J,H) \tkzGetPoint{M} + \tkzInterLL(I,G)(J,L) \tkzGetPoint{N} + \tkzDefPointsBy[symmetry=center J](L,H){D,E} + \tkzDefPointsBy[symmetry=center I](G,K){C,F} + \begin{scope}[line style/.style = {very thin,teal}] + \tkzDrawLines[add=1.5 and 1.5](I,K I,G J,H J,L) + \tkzDrawLines[add=.5 and .5](I,J) + \tkzDrawCircles(O,I I,O J,O) + \tkzDrawArc[delta=0,orange](N,D)(C) + \tkzDrawArc[delta=0,orange](M,F)(E) + \tkzDrawArc[delta=0,orange](J,E)(D) + \tkzDrawArc[delta=0,orange](I,C)(F) + \end{scope} +\end{tikzpicture} +\end{tkzexample} +this is obtained with:\\ + +|\begin{tkzexample}[width=6cm,num,numcolor=red,numbkgcolor=white,code style=\ttfamily]| \\ +|...| \\ +|\end{tkzexample}| \\ + + + +\subsection{Example 2} +\begin{tkzexample}[latex=5cm,code=red!20,num,small,hsep=24pt] + \begin{tikzpicture}[scale=.25] + \tkzDefPoints{0/0/A,12/0/B,6/12*sind(60)/C} + \foreach \density in {20,30,...,240}{% + \tkzDrawPolygon[fill=teal!\density](A,B,C) + \pgfnodealias{X}{A} + \tkzDefPointWith[linear,K=.15](A,B) \tkzGetPoint{A} + \tkzDefPointWith[linear,K=.15](B,C) \tkzGetPoint{B} + \tkzDefPointWith[linear,K=.15](C,X) \tkzGetPoint{C}} + \end{tikzpicture} +\end{tkzexample} + +\vspace{12pt} +|\begin{tkzexample}[latex=5cm,code=red!20,num,small]|\\ +|...|\\ +|\end{tkzexample}|\\ + +\newpage +\vspace{12pt} + The global num option allows to have a global numbering of the lines with the next code: + +\vspace{12pt} +|\begin{tkzexample}[latex=7cm,global num,small,hsep=1cm]|\\ + +|...|\\ + +|\end{tkzexample}| +\begin{tkzexample}[latex=7cm,global num,small,hsep=24pt] +\begin{tikzpicture} + \tkzSetUpCompass[color=purple,line width=1pt] + \tkzDefPoints{0/1/A,5/2/B,3/4/C} + \tkzDefEquiPoints[from=C,dist=1,show, + /tkzcompass/delta=20](A,B) + \tkzGetPoints{E}{H} + \tkzDrawLines[color=blue](C,E C,H A,B) + \tkzDrawPoints[color=blue](A,B,C) + \tkzDrawPoints[color=red](E,H) + \tkzLabelPoints(E,H) + \tkzLabelPoints[color=blue](A,B,C) +\end{tikzpicture} +\end{tkzexample} + + + + + +% \pgfqkeys{/tkzexample}{% +% every tkzexample/.style={width=8cm+7pt} +% } +% +% | \pgfqkeys{/tkzexample}{%| +% | every tkzexample/.style={width=8cm+7pt}| +% | }| + +\newpage +\section{Size option for code fonts} + The different size options for fonts are : + + \begin{enumerate} + +\item very small + +\begin{tkzexample}[width=8cm,very small] +\begin{tikzpicture}[scale=.75] + \tkzDefPoints{0/0/A,6/0/B} + \tkzDefMidPoint(A,B) + \tkzGetPoint{I} + \tkzDefPointWith[orthogonal,K=-.75](B,A) + \tkzGetPoint{C} + \tkzInterLC(B,C)(B,I) + \tkzGetPoints{F}{D} + \tkzDuplicateSegment(B,F)(A,F) + \tkzGetPoint{E} + \tkzDrawArc[delta=10](F,E)(B) + \tkzInterLC(A,B)(A,E) + \tkzGetPoints{N}{M} + \tkzDrawArc[delta=10](A,M)(E) + \tkzDrawLines(A,B B,C A,F) + \tkzCompass(B,F) + \tkzDrawPoints(A,B,C,F,M,E) + \tkzLabelPoints(A,B,C,F,M) + \tkzLabelPoints[above](E) +\end{tikzpicture} +\end{tkzexample} + +\item small + +\begin{tkzexample}[width=6cm,small] +\begin{tikzpicture}[scale=1.2] + \tkzDefPoints{1/3/A,4/2/B} + \tkzDefPointWith[linear,K=0.5](A,B) + \tkzGetPoint{C} + \tkzDrawPoints[color=red](A,B,C) + \tkzDrawSegment(A,B) + \tkzLabelPoints[above right=3pt](A,B,C) +\end{tikzpicture} +\end{tkzexample} + + +\item normal + +\begin{tkzexample}[width=6cm,normal] +\begin{tikzpicture}[scale=.75] + \tikzset{new/.style={color=orange, + line width=.2pt}} + \tkzDefPoints{0/0/O_1,0/1/O_2,0/3/A} + \tkzDefPoint(15:3){F} + \tkzInterLC(F,O_1)(O_1,A) + \tkzGetSecondPoint{E} + \tkzDefLine[parallel=through O_2](E,F) + \tkzGetPoint{x} + \tkzInterLC(x,O_2)(O_2,A) \tkzGetPoints{D}{C} + \tkzDrawCircles(O_1,A O_2,A) + \tkzDrawSegments[new](O_1,A E,F C,D) + \tkzDrawSegments[purple](A,E A,F) + \tkzDrawPoints(A,O_1,O_2,E,F,C,D) + \tkzLabelPoints(A,O_1,O_2,E,F,C,D) +\end{tikzpicture} +\end{tkzexample}\end{enumerate} + + + +\newpage +\section{Option \tkzname{code only}} + + +|\begin{tkzexample}[small,code only]| \\ +| \begin{minipage}{9cm}| \\ +| \thispagestyle{empty}| \\ +| \noindent| \\ +| \begin{tikzpicture}| \\ +| \draw (0,0) node[circle,| \\ +| shade,| \\ +| ball color=Peach,minimum size=2cm]{};| \\ +| \draw[snake = expanding waves,| \\ +| color = Peach,| \\ +| line width = 3pt](1.2,0)--(4,0);| \\ +| \end{tikzpicture}| \\ +| \end{minipage}| \\ +|\end{tkzexample}| + +The result + +\begin{tkzexample}[small,code only] + \begin{minipage}{9cm} + \begin{tikzpicture} + \draw (0,0) node[circle, + shade, + ball color=Peach,minimum size=2cm]{}; + \draw[snake = expanding waves, + color = Peach, + line width = 3pt](1.2,0)--(4,0); + \end{tikzpicture} +\end{minipage} +\end{tkzexample} + +\end{document} + diff --git a/Master/texmf-dist/tex/latex/tkzexample/tkzexample.sty b/Master/texmf-dist/tex/latex/tkzexample/tkzexample.sty new file mode 100644 index 00000000000..fd25ef8a844 --- /dev/null +++ b/Master/texmf-dist/tex/latex/tkzexample/tkzexample.sty @@ -0,0 +1,502 @@ +% Documentation of tkz-euclide +% Copyright 2022 Alain Matthes +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status “maintained”. +% +% The Current Maintainer of this work is Alain Matthes. + +% +% The author of the original code +% of the environment 'codeexample' is Till Tantau +% from the file pgfmanual-en-macros.tex +% (Copyright 2006 by Till Tantau) +% See the file doc/generic/pgf/licenses/LICENSE for more details. +% H I G H L Y E X P E R I M E N T A L +%<---------------------------------------------------------------------------> +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{tkzexample}[2022/07/14 v1.45c (code and graphic)] +\RequirePackage{calc,mdframed,fancyvrb} +\newif\iftkzcodesaved +\DeclareOption{saved}{\tkzcodesavedtrue} +\ProcessOptions\relax +%<---------------------------------------------------------------------------> +\colorlet{graphicbackground}{white} +\colorlet{codebackground}{white} +\colorlet{codeonlybackground}{white} +\colorlet{numbackground}{white} +\colorlet{textcodecolor}{black} +\colorlet{numcolor}{gray} +%<---------------------------------------------------------------------------> +\def\code@style{\small\ttfamily} +\makeatletter +\newcounter{code@cnt}% + +\ifx\scantokens\@undefined + \PackageError{tkzexample}{You need to use extended latex + (elatex) or (pdfelatex) to use this package}{} +\fi + +% Define \find@tkzexample such that it doesn't destroy catcodes: +\begingroup +\catcode`|=0 +\catcode`[= 1 +\catcode`]=2 +\catcode`\{=12 +\catcode `\}=12 +\catcode`\\=12 |gdef|find@tkzexample#1\end{tkzexample}[|endoftkzexample[#1]] +|endgroup + +\begingroup +\catcode`|=0 +\catcode`[= 1 +\catcode`]=2 +\catcode`\{=12 +\catcode `\}=12 +\catcode`\\=12 |gdef|find@tkzltxexample#1\end{tkzltxexample}[|endoftkzltxexample[#1]] +|endgroup + +% define \returntospace. +% +% It should define NEWLINE as {}, spaces and tabs as \space. +\begingroup +\catcode`\^=7 +\catcode`\^^M=13 +\catcode`\^^I=13 +\catcode`\ =13% +\gdef\returntospace{\catcode`\ =13\def {\space}\catcode`\^^I=13\def^^I{\space}\catcode`\^^M=13\def^^M{}}% +\endgroup + +\begingroup +\catcode`\%=13 +\catcode`\^^M=13 +\gdef\commenthandler{\catcode`\%=13\def%{\@gobble@till@return}} +\gdef\@gobble@till@return#1^^M{} +\gdef\@gobble@till@return@ignore#1^^M{\ignorespaces} +\gdef\typesetcomment{\catcode`\%=13\def%{\@typeset@till@return}} +\gdef\@typeset@till@return#1^^M{{\def%{\char`\%}\textsl{\char`\%#1}}\par} +\gdef\typesetcommentnum{\catcode`\%=13\def%{\@typeset@till@return@num}} +\gdef\@typeset@till@return@num#1^^M{{\def%{\char`\%}\textsl{\char`\%#1}} \@@par} +\endgroup + +\let\tkz@frameset\colorbox +\let\tkz@frameltxset\colorbox +\newwrite\fileexample +\newdimen\tkzexamplewidth +\newdimen\tkz@hsep +\tkz@hsep=0pt +\newif\ifcode@execute +\newif\ifcode@saved\code@savedfalse +\newif\ifnum@show \num@showfalse +\newif\ifcode@overhang +\newbox\tkzexamplebox +\newif\ifcode@vbox \code@vboxfalse +% +\pgfqkeys{/tkzexample}{% + execute code/.is if = code@execute, + show num/.is if = num@show, + overhang/.is if = code@overhang, + code only/.code = {\code@executefalse}, + width/.code = {\setlength\tkzexamplewidth{#1}}, + code/.code = {\colorlet{codebackground}{#1}}, + graphic/.code = {\colorlet{graphicbackground}{#1}}, + overhang/.code = {\code@overhangtrue}, + num/.code = {\num@showtrue\setcounter{code@cnt}{1}}, + numcolor/.code = {\colorlet{numcolor}{#1}}, + numbkgcolor/.code = {\colorlet{numbackground}{#1}}, + global num/.code = {\num@showtrue}, + code style/.code = {\def\code@style{#1}}, + normal/.code = {\def\code@size{\normalsize}}, + small/.code = {\def\code@size{\small}}, + very small/.code = {\def\code@size{\footnotesize}}, + right margin/.code = {\def\tkz@rightmargin{#1}}, + left margin/.code = {\def\tkz@leftmargin{#1}}, + inner left margin/.code = {\def\tkz@innerleftmargin{#1}}, + inner right margin/.code = {\def\tkz@innerrightmargin{#1}}, + inner top margin/.code = {\def\tkz@innertopmargin{#1}}, + inner bottom margin/.code = {\def\tkz@innerbottommargin{#1}}, + line frame width/.code = {\def\tkz@linewidth{#1}}, + frame code/.code = {\def\tkz@frameset{\fcolorbox{#1}}}, + frame tex/.code = {\def\tkz@frameltxset{\fcolorbox{#1}}}, + above skip/.code = {\def\tkz@above{#1}}, + below skip/.code = {\def\tkz@below{#1}}, + hsep/.code = {\setlength\tkz@hsep{#1}}, + pre/.code = {\def\code@pre{#1}}, + post/.code = {\def\code@post{#1}}, + latex/.code = {\setlength\tkzexamplewidth{#1}% + \def\code@preadd{\begin{minipage}{#1}}% + \def\code@postadd{\end{minipage}}}, + vbox/.code = {\code@vboxtrue + \def\code@preadd{\noindent + \vbox\bgroup + \setlength{\hsize}{\linewidth-6pt}% + }% + \def\code@postadd{\egroup}}, + every tkzexample/.style={width=6cm}, +}% +\def\code@size{}% +\def\code@pre{}% +\def\code@post{}% +\def\code@preadd{}% +\def\code@postadd{}% +\def\tkz@above{\par}% +\def\tkz@below{\par}% + +% execution du code +\def\tkz@result{% + \begin{minipage}[t]{\wd\tkzexamplebox}% + \hrule width0pt + \code@size + \box\tkzexamplebox + \leavevmode + \end{minipage}% +}% + +\newcommand\tkz@code[1]{% +\begin{minipage}[t]{\code@width}{% +\color{textcodecolor}% +\parskip=\z@ +\hrule width\z@ +\vskip-.25em +\let\do\@makeother +\dospecials +\frenchspacing +\code@style\code@size +\obeylines +\@vobeyspaces +\@tempswafalse +\ifnum@show + \typesetcommentnum + \def\par{% + \if@tempswa + \leavevmode\null\@@par\penalty\interlinepenalty + \everypar{\setlength\fboxsep{1pt}% + \noindent\parskip=0pt% + \llap{\colorbox{numbackground}{\textcolor{numcolor}{% + \footnotesize\number\value{code@cnt}}}\enspace}% + \stepcounter{code@cnt}}% + \else + \@tempswatrue + \ifhmode\@@par\penalty\interlinepenalty\fi% + \fi + }% + \everypar{\setlength\fboxsep{1pt}% + \noindent\parskip=0pt% + \llap{\colorbox{numbackground}{\textcolor{numcolor}{% + \footnotesize\number\value{code@cnt}}}\enspace}% + \stepcounter{code@cnt}% + }% +\else + \typesetcomment + \def\par{% + \if@tempswa + \leavevmode\null\@@par\penalty\interlinepenalty% + \else + \@tempswatrue + \ifhmode\@@par\penalty\interlinepenalty\fi% + \fi + }% +\fi +\obeylines +\ifcode@saved\input{#1}\else#1\fi% +}% end of content for the minipage +\end{minipage}% +}% + +\newcommand\tkz@codesplit[1]{% +\begin{mdframed}[linewidth = \tkz@linewidth, + leftmargin = \tkz@leftmargin, + rightmargin = \tkz@rightmargin, + backgroundcolor = codeonlybackground, + innerleftmargin = \tkz@innerleftmargin, + innertopmargin = \tkz@innertopmargin] +\begingroup +\color{textcodecolor}% +\parskip=\z@ +\hrule width0pt +\let\do\@makeother +\dospecials +\frenchspacing +\code@style\code@size +\obeylines +\@vobeyspaces +\@tempswafalse +\ifnum@show +\typesetcommentnum +\def\par{% + \if@tempswa + \leavevmode\null\@@par\penalty\interlinepenalty + \everypar{\setlength\fboxsep{1pt}% + \noindent\parskip=0pt% + \llap{\colorbox{numbackground}{\textcolor{numcolor}{% + \footnotesize\number\value{code@cnt}}}\enspace}% + \stepcounter{code@cnt}}% + \else + \@tempswatrue + \ifhmode\@@par\penalty\interlinepenalty\fi + \fi +}% +\everypar{\setlength\fboxsep{1pt}% + \noindent\parskip=0pt% + \llap{\colorbox{numbackground}{\textcolor{numcolor}{% + \footnotesize\number\value{code@cnt}}}\enspace}% + \stepcounter{code@cnt}% + }% +\else +\typesetcomment% +\def\par{% + \if@tempswa + \leavevmode\null\@@par\penalty\interlinepenalty% + \else + \@tempswatrue + \ifhmode\@@par\penalty\interlinepenalty\fi% + \fi +}% +\fi +\obeylines +\ifcode@saved\input{#1}\else #1\fi +\endgroup +\end{mdframed}% +}% + + +\def\tkzref{\arabic{section}-\arabic{subsection}-\arabic{subsubsection}}% +\def\tkzFileSavedPrefix{tkzFile}% +\def\tkz@File@Saved@Name{\tkzFileSavedPrefix-\tkzref}% + +\iftkzcodesaved +\def\tkzexample[#1]{% +\code@executetrue +\normalsize +\pgfkeys{/tkzexample/.cd, + right margin = 0pt, + left margin = 0pt, + line frame width = 0, + inner left margin = 0 pt, + inner right margin = 0 pt, + inner top margin = 6 pt, + inner bottom margin = 0 pt} +\pgfqkeys{/tkzexample}{every tkzexample,#1}% +\parindent0pt +\bgroup +\VerbatimEnvironment +\killienc\begin{VerbatimOut}{\tkz@File@Saved@Name.tex}}% +\def\endtkzexample{\end{VerbatimOut}% +\egroup +\ifcode@execute +\setbox\tkzexamplebox=\hbox{\input{\tkz@File@Saved@Name.tex}}% +\ifdim\wd\tkzexamplebox>\tkzexamplewidth% + \gdef\code@mid{\parskip2pt\par}% +% \hrule + %\def\code@mid{\hfill}% + \gdef\code@width{\linewidth}% +\else + \ifdim\tkz@hsep=0pt + \gdef\code@mid{\hfill}% + \else + \gdef\code@mid{\hskip\tkz@hsep}% + \fi + \gdef\code@width{\linewidth-1.5em-\tkz@hsep-\tkzexamplewidth}% + \fi + \par\noindent + \code@savedtrue + \ifcode@overhang + \tkz@frameset{codebackground}{\tkz@code{\tkz@File@Saved@Name.tex}}% + \else + \tkz@frameltxset{graphicbackground}{\tkz@result}% + \fi + \else% pas de code pas clair + \gdef\code@mid{\hfill}% + \gdef\code@width{\linewidth}% + \gdef\code@end{}% + \fi% fin pas de code + \code@mid + \ifcode@overhang\tkz@frameltxset{graphicbackground}{\tkz@result}% + \else + \tkz@frameset{codebackground}{\tkz@code{\tkz@File@Saved@Name.tex}}% + \fi +\tkz@below +}% +\else% end of code saved code et result ? +\def\tkzexample[#1]{% +\begingroup +\code@executetrue +\pgfkeys{/tkzexample/.cd, + right margin = 0pt, + left margin = 0pt, + line frame width = 0, + inner left margin = 0 pt, + inner right margin = 0 pt, + inner top margin = 6 pt, + inner bottom margin = 0 pt,} +\pgfqkeys{/tkzexample}{every tkzexample,#1}% +\parindent0pt +\begingroup +%\tkz@above +\let\do\@makeother +\dospecials +\obeylines +\@vobeyspaces +\catcode`\%=13 % +\catcode`\^^M=13 % +\find@tkzexample}% #1 est tout ce qui se trouve dans l'environnement +\def\endoftkzexample#1{% +\endgroup +\ifcode@execute % et \fcode@save ?? + \setbox\tkzexamplebox=\hbox{% + {\commenthandler + \protected@xdef\code@temp{#1}}% + \catcode`\^^M=9 % + {\ignorespaces\code@preadd\code@pre + \expandafter\scantokens\expandafter{\code@temp\ignorespaces}% + \code@post\code@postadd\ignorespaces}% + }% + \ifdim\wd\tkzexamplebox>\tkzexamplewidth + \def\code@mid{\par}% + \def\code@width{\linewidth-6pt}% + \else + \ifdim\tkz@hsep=0pt + \def\code@mid{\hfill}% + \else + \def\code@mid{\hskip\tkz@hsep}% + \fi% + \def\code@width{\linewidth-1.5em-\tkz@hsep-\tkzexamplewidth}% + \fi% + \par\noindent + \ifcode@overhang + \tkz@frameset{codebackground}{\tkz@code{#1}}% + \else + \tkz@frameltxset{graphicbackground}{\tkz@result}% + \fi +\else% pas de code execute + \def\code@mid{}% + \def\code@width{\linewidth-6pt}% + \def\code@end{}% + \fi% fin pas de code + \code@mid% + \ifcode@overhang% + \ifcode@execute\tkz@frameltxset{graphicbackground}{\tkz@result}\fi + \else% +\ifcode@execute\tkz@frameset{codebackground}{\tkz@code{#1}}\else + \par\vskip1em + \tkz@codesplit{#1} + %\tkz@frameset{codebackground}{\tkz@code{#1}}% +\fi + \fi + \tkz@below + \end{tkzexample}% +}% +\def\endtkzexample{\endgroup}% +\fi +%<---------------------------------------------------------------------------> +\pgfqkeys{/tkzltxexample}{% + width/.code = {\setlength\tkzltxexamplewidth{#1}}, + code/.code = {\colorlet{codeonlybackground}{#1}}, + show num/.is if = num@show, + num/.code = {\num@showtrue\setcounter{code@cnt}{1}}, + global num/.code = {\num@showtrue}, + numcolor/.code = {\colorlet{numcolor}{#1}}, + numbkgcolor/.code = {\colorlet{numbackground}{#1}}, + normal/.code = {\def\code@size{\normalsize}}, + small/.code = {\def\code@size{\small}}, + very small/.code = {\def\code@size{\footnotesize}}, + right margin/.code = {\def\tkz@rightmargin{#1}}, + left margin/.code = {\def\tkz@leftmargin{#1}}, + inner left margin/.code = {\def\tkz@innerleftmargin{#1}}, + inner right margin/.code = {\def\tkz@innerrightmargin{#1}}, + inner top margin/.code = {\def\tkz@innertopmargin{#1}}, + inner bottom margin/.code = {\def\tkz@innerbottommargin{#1}}, + line frame width/.code = {\def\tkz@linewidth{#1}}, + hsep/.code = {\def\tkz@hsep{#1}}, + typeset listing/.code = {#1}, + frame code/.code = {\def\tkz@frameset{\fcolorbox{#1}}}, + ignorespaces/.code = {\let\@gobble@till@return =% + \@gobble@till@return@ignore}, + leave comments/.code = {\def\code@catcode@hook{\catcode`\%=12}% + \let\commenthandler=\relax% + \let\typesetcomment=\relax}, + every tkzltxexample/.style = {width=8cm}, + vbox/.code = {\def\code@preadd{\noindent + \vbox\bgroup\setlength{\hsize}{\linewidth}}% + \def\code@postadd{\egroup}}% +} +\def\code@size{}% +% \def\code@pre{} +\def\code@post{}% +\def\code@pre{}% +\def\code@post{}% +\def\code@catcode@hook{}% + +\newdimen\tkzltxexamplewidth +\newbox\tkzltxexamplebox + +\def\tkzltxexample[#1]{% +\begingroup +\pgfkeys{/tkzltxexample/.cd, + right margin = 0pt, + left margin = 0pt, + line frame width = 0, + inner left margin = 0 pt, + inner right margin = 0 pt, + inner top margin = 6 pt, + inner bottom margin = 0 pt,} +\pgfqkeys{/tkzltxexample}{every tkzltxexample,#1}% +\parindent0pt +\begingroup% +\let\do\@makeother +\dospecials +\obeylines +\@vobeyspaces +\catcode`\%=13 % +\catcode`\^^M=13 % +\code@catcode@hook% +\relax% +\find@tkzltxexample} +\def\endoftkzltxexample#1{% +\endgroup% +\def\code@end{}% +\par\vskip1em +\tkz@codesplit{#1}% +\par +\code@post +\end{tkzltxexample}% +}% + +\def\endtkzltxexample{\endgroup} + + + +\newcommand\killienc{} +\@tempcnta128 +\@whilenum\@tempcnta<\@cclvi\do{% + \edef\killienc{\killienc\catcode\the\@tempcnta=12}% + \advance\@tempcnta\@ne} + +\def\tkz@ref{\arabic{section}-\arabic{subsection}-\arabic{subsubsection}} +\def\tkz@File@Saved@Name{\tkzFileSavedPrefix-\tkz@ref} +\pgfkeys{ +/tkzsavedcode/.cd, + prefix/.code = {\def\tkzFileSavedPrefix{#1}}} + +\newcommand{\tkzSavedCode}[1][]{% +\pgfkeys{% +tkzsavedcode/.cd, + prefix = tkzFile} +\pgfqkeys{/tkzsavedcode}{#1} +\renewenvironment{tkzexample}[1][]{% +\killienc\VerbatimOut{\tkz@File@Saved@Name.tex}}{% +\endVerbatimOut}} + +% \renewenvironment{tkzexample}[1][]{% +% \killienc \VerbatimOut{tkzeuc-\tkzref.tex}% +% }{% +% \endVerbatimOut +% } +% \fi +\endinput diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index 1c259bf7595..bdc3bba2fcd 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -795,7 +795,7 @@ my @TLP_working = qw( tikz-feynhand tikz-feynman tikz-imagelabels tikz-inet tikz-kalender tikz-karnaugh tikz-ladder tikz-lake-fig tikz-layers tikz-nef tikz-network tikz-opm tikz-optics - tikz-palattice tikz-planets tikz-qtree + tikz-page tikz-palattice tikz-planets tikz-qtree tikz-relay tikz-sfc tikz-swigs tikz-timing tikz-trackschematic tikz-truchet tikzbricks tikzcodeblocks tikzducks tikzinclude tikzlings tikzmark tikzmarmots tikzorbital @@ -805,7 +805,7 @@ my @TLP_working = qw( timbreicmc times timetable timing-diagrams tinos tipa tipa-de tipauni tipfr tiscreen titlecaps titlefoot titlepages titlepic titleref titlesec titling tkz-base tkz-berge tkz-doc tkz-euclide tkz-fct tkz-graph tkz-tab - tkz-orm tikz-page + tkz-orm tkzexample tlc-article tlc2 tlcockpit tlmgr-intro-zh-cn tlmgrbasics to-be-determined tocbibind tocdata tocloft tocvsec2 todo todonotes tokcycle tokenizer tonevalue toolbox tools diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds index 7fded9656ff..60e17082e60 100755 --- a/Master/tlpkg/libexec/ctan2tds +++ b/Master/tlpkg/libexec/ctan2tds @@ -1397,6 +1397,7 @@ chomp (my $ctan_root = `tlpkginfo --ctan-root`); 'tkz-kiviat', "die 'skipping, obsolete on ctan'", #"&MAKEtkz", 'tkz-linknodes',"die 'skipping, obsolete on ctan'",#"&MAKEtkz", 'tkz-tab', "&MAKEtkz", + 'tkzexample', "&MAKEflatten", 'tlaunch', "die 'skipping, siep installs by hand'", 'tlg2latex', "die 'skipping, not self-locating for default.py?'", 'tlmgrbasics', "&MAKEflatten", diff --git a/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc b/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc index ddd326e904b..41531df0716 100644 --- a/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc @@ -217,6 +217,7 @@ depend tkz-fct depend tkz-graph depend tkz-orm depend tkz-tab +depend tkzexample depend tonevalue depend tqft depend tsemlines diff --git a/Master/tlpkg/tlpsrc/tkzexample.tlpsrc b/Master/tlpkg/tlpsrc/tkzexample.tlpsrc new file mode 100644 index 00000000000..e69de29bb2d -- cgit v1.2.3