diff options
author | Norbert Preining <norbert@preining.info> | 2024-11-25 03:03:33 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2024-11-25 03:03:33 +0000 |
commit | 61d4485d965015b67117e69d18337e54340de5ca (patch) | |
tree | 0f7fb405ac162c6e9dd5617ad6159077d50f6b6c /macros | |
parent | ab3e387a1833469d8e25383302cac8970b17ab69 (diff) |
CTAN sync 202411250303
Diffstat (limited to 'macros')
102 files changed, 4464 insertions, 2704 deletions
diff --git a/macros/generic/memoize/CHANGELOG.md b/macros/generic/memoize/CHANGELOG.md index 9d83b14920..a09bb62916 100644 --- a/macros/generic/memoize/CHANGELOG.md +++ b/macros/generic/memoize/CHANGELOG.md @@ -3,6 +3,41 @@ For the development history, see [Memoize's GitHub repository](https://github.com/sasozivanovic/memoize). +## 2024/11/24 v1.4.0 + +* New features: + * Support Beamer modes. + * Support externs typeset on landscape pages. + * Implement `salt` and related keys (used by Beamer mode support). + +* Minor changes: + * Allow changing `prefix` in `\mmznext`. + * To better support user interaction with foreign package support, any + unknown `/mmz` keys issued in the preamble are retried at `begindocument/end`. + +* Bugfixes: + * Allow for (expandable) macros in reference keys advised by `auto/ref`. + * Fix a regular expression in `memoize-clean.py`. + +* Documentation: + * Improve the troubleshooting sections (2.9, 3.1). + * Update and rewrite installation instructions. + * Fix some typos and formatting issues. + +* Under the hood: + * The Beamer support code now resides in a separate file, `memoize-beamer.code.tex`. + * Make PGF support produce nicer cc-memos. + +* Build system: + * A new, makefile-controlled system for compiling examples, which are now + compiled prior to compiling the manual. + * Implement a different way of automatically changing the version number in + the documentation. + * Compile the documentation through dedicated `latexmkrc` config files, using + an adapted `memoize_latexmkrc` example config for the manual. + * Partially change installation-related parts of the Makefile. + * Include the missing makefiles in CTAN & TDS zip files. + ## 2024/04/02 v1.3.0 * New defaults: diff --git a/macros/generic/memoize/INSTALL.md b/macros/generic/memoize/INSTALL.md index 99957a9181..483e9d0287 100644 --- a/macros/generic/memoize/INSTALL.md +++ b/macros/generic/memoize/INSTALL.md @@ -1,216 +1,178 @@ # Installation from the TDS archive -If Memoize is not (yet) offered by your TeX distribution, the easiest way to -install it is by downloading the TDS archive `memoize.tds.zip` from [Memoize's -CTAN page](https://ctan.org/pkg/memoize), and unpacking it into your `texmf` -directory. You will most likely also have to do the same for two auxiliary -packages Memoize depends on: [Advice](https://ctan.org/pkg/advice) and +Memoize is most probably already included in your TeX distribution, but if it +is not, the easiest way to install it is by downloading the TDS archive +`memoize.tds.zip` from [Memoize's CTAN page](https://ctan.org/pkg/memoize), and +unpacking it into your `texmf` directory. You will most likely also have to do +the same for two auxiliary packages Memoize depends on +[Advice](https://ctan.org/pkg/advice) and [CollArgs](https://ctan.org/pkg/collargs). -Read on only if you have an unstoppable urge to install from source and/or -compile the manual or the documented source code. +The TDS archives are also available through [Memoize's GitHub +releases](https://github.com/sasozivanovic/memoize/releases). This is where +you can find both the older versions of the package, and the work-in-progress +(wip) version (if any). Note that even though Memoize, Advice and CollArgs +share the GitHub repository, you have to download the TDS archive for each +package separately. Each release offers both the source code and the TDS +archive; download the latter, it follows the naming scheme +`memoize/advice/collargs-<date>-<version>-zip`, +e.g. `memoize-2024-04-02-v1.3.0.zip`. -# Installation from the source -# Getting the sources +# Installation from the sources -There are several options: +Read this if you want to install from source (for example, to test a +development version of the package) and/or compile the manual or the documented +source code. -* Download and unpack the zip archive of the package from [Memoize's CTAN - page](https://ctan.org/pkg/memoize). - -* Download and unpack the TDS archive, or copy the files from your local - distribution. The sources reside in `<texmf>/source/generic/memoize`. +Note that installation from the sources and compilation of the documentation +require a UNIX-like operating system (Windows Subsystem for Linux suffices) +with `make` and several other programs installed. In detail, Memoize's build +system utilizes standard utilities `make`, `bash`, `sed`, `grep`, `perl`, +`pandoc`, `xargs`, `zip`, plus the TeX-specific `latexmk` and `edtx2dtx`, which +should be included in your TeX distribution. -* Clone the [GitHub repository](https://github.com/sasozivanovic/memoize). +## For the impatient -## Generating runtime files +To download and install the files needed to use the most recent, possibly +development version of Memoize: -The easiest way to generate the runtime files is by running `make`. The -following command will generate (i) runtime TeX files for all supported formats -(currently: LaTeX, plain TeX and ConTeXt), and (ii) the man pages for the -accompanying scripts: +1. Clone the [Memoize's GitHub repository](https://github.com/sasozivanovic/memoize) -``` -make runtime -``` + git clone git@github.com:sasozivanovic/memoize.git -To only generate the runtime TeX files, execute +2. Switch to the newly created `memoize` directory: -``` -make memoize.sty -``` + cd memoize -Alternatively, you can generate the runtime files manually. The source of this -package was written using [EasyDTX](https://ctan.org/pkg/easydtx). Therefore, -you first have to convert the `.edtx` file into a regular `.dtx`: +3. Generate and install the runtime files: -``` -edtx2dtx memoize.edtx > memoize.dtx -``` + make install-all-runtimes -The next step is standard. Produce the runtime files by compiling the -installation file: -``` -tex memoize.ins -``` +## Getting the sources + +You can get the sources in several ways: -If you require the ConTeXt runtime, replace all instances of `\expanded` and -`\unexpanded` in `t-memoize.tex` by `\normalexpanded` and `\normalunexpanded`, -respectively. One way to do this is: +* Clone the [Memoize's GitHub repository](https://github.com/sasozivanovic/memoize). + + git clone git@github.com:sasozivanovic/memoize.git -``` -sed -i -s -e 's/\\\(un\)\?expanded/\\normal\1expanded/g;' t-memoize.tex -``` + Branch `main`, which is checked out by default, might contain work in + progress. To check out an older version, execute `git checkout <tag>`, for + example: -The man pages are produced by converting their MarkDown sources by `pandoc` -(execute this in the `doc` subdirectory): + git checkout memoize-1.4.0 + + For the list of tags, execute `git tag`, or visit [the list on + GitHub](https://github.com/sasozivanovic/memoize/tags). Note that the + installation instructions below only work for Memoize versions >= 1.4.0. -``` -pandoc memoize-extract.1.md -s -t man -o memoize-extract.1 -pandoc memoize-clean.1.md -s -t man -o memoize-clean.1 -``` +* Download a *source code* archive of a + [release](https://github.com/sasozivanovic/memoize/releases) on GitHub. -Additionally, links from `memoize-x.pl.1` and `memoize-x.py.1` to `memoize-x.1` -can be created by: +* Download the zip archive of the package from [Memoize's CTAN + page](https://ctan.org/pkg/memoize). Depending on what you want to produce, + you might also have to download the zip archives of packages + [Advice](https://ctan.org/pkg/advice) and + [CollArgs](https://ctan.org/pkg/collargs). Note that the contents of + directories `memoize`, `advice` and `collargs` within the respective zip + archives have to be merged into one and the same directory. -``` -echo .so man1/memoize-extract.1 > memoize-extract.pl.1 -echo .so man1/memoize-extract.1 > memoize-extract.py.1 -echo .so man1/memoize-clean.1 > memoize-clean.pl.1 -echo .so man1/memoize-clean.1 > memoize-clean.py.1 -``` +In principle, you could also get the sources from TDS archive(s), but this is +not recommended, as you would need to move the files around after unpacking, to +arrive at the directory structure from GitHub / CTAN zip archive. -## Installation +## Generating and installing the runtime files -It is recommended to install the files into a TDS-compliant `texmf` directory, -as usual. Inspect file `FILES` or the TDS archive `memoize.tds.zip` to see -what goes where. +The runtimes can be generated and installed using `make`. To generate and +install runtimes for Memoize, Advice and CollArgs in one go, execute -Next, the scripts residing in `<texmf>/scripts/memoize` should be linked into -some directory listed in the executable search `PATH`. The scripts are the -following: + make install-all-runtimes -* `memoize-extract.pl` -* `memoize-extract.py` -* `memoize-clean.pl` -* `memoize-clean.py` +In more detail, the following targets are available. -If you have downloaded the sources from GitHub, you can build the TDS -directories/archives of both Memoize and its auxiliary packages Advice and -CollArgs by issuing +* `runtimes` and `all-runtimes`: generate the runtime files -``` -make -``` +* `install-runtimes` and `install-all-runtimes`: (generate and) install the + runtime files -This command creates: +* `uninstall-runtimes` and `uninstall-all-runtimes`: uninstall the runtime files -* TDS directories `memoize.tds`, `advice.tds` and `collargs.tds`, +* `link-runtimes` and `link-all-runtimes`: (generate and) install the runtime + files by soft-linking rather than copying -* CTAN directories `ctan/memoize`, `ctan/advice` and `ctan/memoize`, +The `all` variants perform the action for all three packages (Memoize, Advice +and CollArgs), while the plain variants (without `all`) are limited to Memoize. +To perform an action only for Advice or Collargs, use the plain target but +specify the relevant Makefile (`Makefile.advice` or `Makefile.collargs`), e.g. -* TDS archives `memoize.tds.zip`, `advice.tds.zip` and `collargs.tds.zip` - inside the CTAN directories, and - -* CTAN archives `memoize.zip`, `advice.zip` and `collargs.zip` inside directory - `ctan`. - -The plain `make` shown above will also attempt to compile the documentation. -If you're not ready for that (yet), you can avoid that by executing this -instead: + make -f Makefile.advice install-runtimes -``` -make PDF= -``` +By default, the runtime files are installed to (or uninstalled from) the user +`texmf` directory, as returned by `kpsewhich -var-value TEXMFHOME`. To +(un)install into another directory, append `TEXMFHOME=<dir>` to the invocation +of `make`, e.g. -# Compiling the documentation + make install-runtimes TEXMFHOME=/home/user/my-texmf-directory -Compiling both the documented code listing and the manual requires a Unix-like -operating system. I have developed Memoize on Linux, but the documentation -should also be compilable under Cygwin on Windows (not tested). + +## Compiling the documentation The documentation of Advice and CollArgs, both their manuals and documented -code listings, is included within Memoize's documentation. - -## Getting the source - -In principle, the options are the same as for the installation from the source, -but the GitHub option is strongly preferred here, as the other two options -require manually copying the sources of Advice and CollArgs into the Memoize -directory. That said: - -* Clone the [GitHub repository](https://github.com/sasozivanovic/memoize). - You're done. - -* Download and unpack the zip archives of all three packages from their CTAN - pages: https://ctan.org/pkg/memoize, https://ctan.org/pkg/advice and - https://ctan.org/pkg/collargs. - - Copy `advice.edtx` and `collargs.edtx` into the Memoize directory, alongside - `memoize.edtx`. - -* From TDS archives (of all three packages), or your local distribution's - `<texmf>` folder. This is not straightforward: - - 1. Make a local copy of directory `<texmf>/source/generic/memoize`; we'll - call it "the Memoize directory". - - 2. Copy directory `<texmf>/doc/generic/memoize` into the the Memoize - directory as `doc`. - - 3. Copy `memoize-extract.pl`, `memoize-extract.py`, `memoize-clean.pl` and - `memoize-clean.py` from directory `<texmf>/scripts` into the Memoize - directory. - - 4. Copy `advice.edtx` from `<texmf>/source/generic/advice` and - `collargs.edtx` from `<texmf>/source/generic/collargs` into the the - Memoize directory. +code listings, is included within Memoize's documentation. The documentation +is compiled with LuaLaTeX. -## Compiling the documented code listing +To compile the documented code listing: -I have compiled the code docs with LuaLaTeX on a Linux system with -TeXLive 2023. If you have `make`, the easiest way to compile them is by -issuing + make doc/memoize-code.pdf + +To compile the manual: -``` -make doc/memoize-code.pdf -``` + make doc/memoize-doc.pdf -Alternatively, you can use `latexmk`, but you first have to convert the `.edtx` -sources of all three packages into `.dtx`, if you haven't done so yet: +Note that the compilation of the manual takes a while, and is preceded by the +compilation of the examples, which can be triggered separately by -``` -edtx2dtx memoize.edtx > memoize.dtx -edtx2dtx advice.edtx > advice.dtx -edtx2dtx collargs.edtx > collargs.dtx -``` + make -C doc/examples -Then, you can execute `latexmk` from the `doc` subdirectory: +By default, the manual is compiled with memoization disabled. To enable it, +change `\usepackage{nomemoize}` in `doc/memoize-doc.tex` to +`\usepackage{memoize}`. -``` -latexmk -lualatex -bibtex memoize-code -``` -To compile the code docs manually, three iterations of `lualatex memoize-code` -with `makeindex -s gind.ist memoize-code.idx` between them should suffice. +## Building the releases -## Compiling the manual +How do I build the CTAN release files? First, I change the values of variables +`VERSION`, `YEAR`, `MONTH` and `DAY` in `Makefile` (for Memoize), +`Makefile.advice` and `Makefile.collargs`. Then, I execute -I have compiled the manual with LuaLaTeX on a Linux system with TeXLive 2023, -`make`, `latexmk`, `perl` and `sed` installed. Furthermore, you absolutely -have to run the compilation with some form of `--shell-escape`, as it executes -`make` and `sed` to build the examples. (There is no way to compile these from -the command line, as the instructions are baked into the manual source.) + make version -Given all this, either of the following should do the trick: +which updates the version information in the source code, the scripts, the +documentation, the changelog and the manual pages. I next perform a sanity +check: -* `make doc/memoize.pdf` from the Memoize directory; + make versions-show -* `latexmk -lualatex -bibtex memoize` for the `doc` subdirectory; or +Finally, I build the CTAN release archives for all three packages, complete +with the TDS archives, by executing: -* quite a few runs of `lualatex memoize` interspersed by `makeindex memoize.idx`. - -If all worked well, you can change `\usepackage{nomemoize}` in -`doc/memoize.tex` to `\usepackage{memoize}` and observe Memoize at work. + make + +This command creates: + +* TDS directories `memoize.tds`, `advice.tds` and `collargs.tds`, + +* CTAN directories `ctan/memoize`, `ctan/advice` and `ctan/memoize`, + +* TDS archives `memoize.tds.zip`, `advice.tds.zip` and `collargs.tds.zip` + inside the CTAN directories, and + +* CTAN archives `memoize.zip`, `advice.zip` and `collargs.zip` inside directory + `ctan`. + +Invoking the plain `make` also compiles the documentation. This can +be avoided by executing + + make PDF= diff --git a/macros/generic/memoize/Makefile b/macros/generic/memoize/Makefile index 9fadae56ea..063f8028ab 100644 --- a/macros/generic/memoize/Makefile +++ b/macros/generic/memoize/Makefile @@ -10,17 +10,17 @@ all: ctan/memoize.zip # Prepare the CTAN submission. PACKAGE = memoize -VERSION = 1.3.0 +VERSION = 1.4.0 YEAR = 2024 -MONTH = 04 -DAY = 02 +MONTH = 11 +DAY = 24 FORMAT = generic COMMON = memoize nomemoize memoizable PLAIN = memoize-extract-one.tex GENERIC = memoizable.code.tex -LATEX = memoize-biblatex.code.tex +LATEX = memoize-biblatex.code.tex memoize-beamer.code.tex SOURCE = memoize.edtx memoize.ins SCRIPTS := memoize-extract memoize-clean @@ -37,51 +37,39 @@ SCRIPTS := $(SCRIPTS:%=%.pl) $(SCRIPTS:%=%.py) README = doc/README.memoize.md INSTALL = INSTALL.md CHANGELOG = CHANGELOG.md -MAKEFILE = Makefile +MAKEFILE = Makefile Makefile.package Makefile.runtimes Makefile.advice Makefile.collargs LICENCE = LICENCE PACKAGES.edtx = $(PACKAGES:%=%.edtx) +PACKAGES.dtx = $(PACKAGES:%=%.dtx) PACKAGES.ins = $(PACKAGES:%=%.ins) -makefiles = Makefile.package Makefile.runtimes Makefile.advice Makefile.collargs - codedoc-source = memoize-code.tex \ - memoize-code.sty memoize-doc-common.sty + memoize-code.sty memoize-doc-common.sty \ + memoize-code.latexmkrc manual-source = memoize-doc.tex \ memoize-doc.sty memoize-doc-common.sty yadoc.sty \ - memoize-doc.mst + memoize-doc.mst memoize-doc.latexmkrc PDF = memoize-doc.pdf memoize-code.pdf codedoc-source := $(codedoc-source:%=doc/%) manual-source := $(manual-source:%=doc/%) pdf := $(PDF:%=doc/%) -DOC = $(sort $(codedoc-source) $(manual-source)) $(pdf) $(man-src) +DOC = $(codedoc-source) $(manual-source) $(pdf) $(man-src) \ + doc/examples-src.zip doc/examples.zip -examples-src := Makefile ins.begin ins.mid ins.end -examples-src := $(examples-src:%=doc/examples/%) -#examples-src += $(shell git ls-files | grep ^doc/examples/.*dtx$) -examples-src += $(shell find doc/examples -name '*.dtx') +doc/examples-src.zip: $(examples-src) + $(MAKE) -C doc/examples examples-src.zip -# doc/attachments.lst is produced by compiling memoize.tex (without memoization). -# doc-examples will hold soft links to the relevant generated example files. -doc-examples := $(shell sed 's/^.* \(.*\) ##.*$$/\1/' doc/attachments.lst) -doc-examples := $(doc-examples:%=doc/examples/%) +doc/examples.zip: $(examples-src) + $(MAKE) -C doc/examples examples.zip ctan/$(PACKAGE).zip: $(TDS-BEGIN) -# Check for duplicate filenames: - echo $(doc-examples) | tr ' ' '\n' | uniq -d | ifne false - cd doc && zip ../$(TDS-DOC-DIR)/examples-src.zip $(examples-src:doc/%=%) -# For each line ($1 $2) in attachments.lst, link $1 to $2 ... - cd doc/examples && sed 's!^examples/!ln -sfr !' ../attachments.lst | sh -# ... and zip those links. - cd doc && zip -r ../$(TDS-DOC-DIR)/examples.zip $(doc-examples:doc/%=%) $(TDS-END) $(CTAN-BEGIN) - ln -sr $(TDS-DOC-DIR)/examples-src.zip $(CTAN-DIR)/doc - ln -sr $(TDS-DOC-DIR)/examples.zip $(CTAN-DIR)/doc $(CTAN-END) %.py.dtx: %.py @@ -93,20 +81,20 @@ ctan/$(PACKAGE).zip: | sed -e '/^% Local Variables:/Q' > $@ doc/memoize-code.pdf: $(codedoc-source) \ - $(PACKAGES.edtx) $(PACKAGES.ins) $(SCRIPTS:%=%.dtx) + $(PACKAGES.dtx) $(PACKAGES.ins) $(SCRIPTS:%=%.dtx) -doc/memoize.pdf: $(manual-source) $(examples-src) $(PACKAGES.edtx) +doc/memoize-doc.pdf: $(manual-source) $(PACKAGES.edtx) doc/examples.zip %.pdf: %.tex - latexmk -cd -lualatex -bibtex- $(LATEXMK) $< && touch $@ + latexmk -r $*.latexmkrc $(LATEXMK) $< -# Maintanence +# Maintenance test.tex = $(wildcard test*.tex) -.PHONY: all runtime force clean versions-show +.PHONY: all force clean versions-show .PRECIOUS: %.1 @@ -131,12 +119,14 @@ version: $(call EDIT-VERSION-MAN,doc/memoize-extract.1.md) $(call EDIT-VERSION-MAN,doc/memoize-clean.1.md) $(call EDIT-DATE-CHANGELOG,CHANGELOG.md) + $(call EDIT-VERSION-LATEX,doc/memoize-doc.tex,memoize) + $(call EDIT-VERSION-LATEX,doc/memoize-code.tex,memoize) define COLOR_VERSION grep -E --color '[0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2}|v?[0-9]\.[0-9]\.[0-9]([-a-z]*)|(January|February|March|April|May|June|July|August|September|October|November|December) [0-9]+, [0-9]{4}' endef versions-show: - @grep -E '%<latex>\\ProvidesPackage|^%<context>%D\s*(version|date)=' $(PACKAGES.edtx) | ${COLOR_VERSION} + @grep -E '\\ProvidesPackage|^%<context>%D\s*(version|date)=' $(PACKAGES.edtx) $(pdf:%.pdf=%.tex) | ${COLOR_VERSION} @grep __version__ *.py | ${COLOR_VERSION} @grep VERSION *.pl | ${COLOR_VERSION} @grep -E '^(footer|date):' doc/memoize-*.md | ${COLOR_VERSION} @@ -147,7 +137,7 @@ include Makefile.runtimes VERSION-MAN = of Memoize v$(VERSION) -.PHONY: all-runtimes link-all-runtimes unlink-all-runtimes test +.PHONY: all-runtimes link-all-runtimes install-all-runtimes unlink-all-runtimes test examples all-runtimes: runtimes $(MAKE) -f Makefile.advice runtimes @@ -157,9 +147,13 @@ link-all-runtimes: link-runtimes $(MAKE) -f Makefile.advice link-runtimes $(MAKE) -f Makefile.collargs link-runtimes -unlink-all-runtimes: unlink-runtimes - $(MAKE) -f Makefile.advice unlink-runtimes - $(MAKE) -f Makefile.collargs unlink-runtimes +install-all-runtimes: install-runtimes + $(MAKE) -f Makefile.advice install-runtimes + $(MAKE) -f Makefile.collargs install-runtimes + +uninstall-all-runtimes: uninstall-runtimes + $(MAKE) -f Makefile.advice uninstall-runtimes + $(MAKE) -f Makefile.collargs uninstall-runtimes test: cd testing && ./MakeTests.py diff --git a/macros/generic/memoize/Makefile.advice b/macros/generic/memoize/Makefile.advice new file mode 100644 index 0000000000..542868caa0 --- /dev/null +++ b/macros/generic/memoize/Makefile.advice @@ -0,0 +1,40 @@ +# Prepare the CTAN submission. + +# This file is indented to be used from Memoize's source directory, which +# should also contain the files assigned below to SOURCE. + +PACKAGE = advice +VERSION = 1.1.1 +YEAR = 2024 +MONTH = 03 +DAY = 15 + +FORMAT = generic + +COMMON = advice +GENERIC = advice-tikz.code.tex +SOURCE = advice.edtx advice.ins + +README = doc/README.advice.md +INSTALL = doc/INSTALL.advice.md +CHANGELOG = doc/CHANGELOG.advice.md +MAKEFILE = Makefile.runtimes +LICENCE = LICENCE + +ctan/$(PACKAGE).zip: + $(TDS-BEGIN) + cd $(TDS-SOURCE-DIR) && mv Makefile.runtimes Makefile + $(TDS-END) + $(CTAN-BEGIN) + cd $(CTAN-DIR) && mv Makefile.runtimes Makefile + $(CTAN-END) + +version: + $(call EDIT-VERSION-LATEX,advice.edtx,advice,$(YEAR)/$(MONTH)/$(DAY) v$(VERSION)) + $(call EDIT-VERSION-CONTEXT,advice.edtx,$(YEAR)-$(MONTH)-$(DAY),$(VERSION)) + $(call EDIT-DATE-CHANGELOG,doc/CHANGELOG.advice.md) + $(call EDIT-VERSION-LATEX,doc/memoize-doc.tex,advice) + $(call EDIT-VERSION-LATEX,doc/memoize-code.tex,advice) + +include Makefile.package +include Makefile.runtimes diff --git a/macros/generic/memoize/Makefile.collargs b/macros/generic/memoize/Makefile.collargs new file mode 100644 index 0000000000..ef18863a4d --- /dev/null +++ b/macros/generic/memoize/Makefile.collargs @@ -0,0 +1,39 @@ +# Prepare the CTAN submission. + +# This file is indented to be used from Memoize's source directory, which +# should also contain collargs.edtx and collargs.ins. + +PACKAGE = collargs +VERSION = 1.2.0 +YEAR = 2024 +MONTH = 03 +DAY = 15 + +FORMAT = generic + +COMMON = collargs +SOURCE = collargs.edtx collargs.ins + +README = doc/README.collargs.md +INSTALL = doc/INSTALL.collargs.md +CHANGELOG = doc/CHANGELOG.collargs.md +MAKEFILE = Makefile.runtimes +LICENCE = LICENCE + +ctan/$(PACKAGE).zip: + $(TDS-BEGIN) + cd $(TDS-SOURCE-DIR) && mv Makefile.runtimes Makefile + $(TDS-END) + $(CTAN-BEGIN) + cd $(CTAN-DIR) && mv Makefile.runtimes Makefile + $(CTAN-END) + +version: + $(call EDIT-VERSION-LATEX,collargs.edtx,collargs,$(YEAR)/$(MONTH)/$(DAY) v$(VERSION)) + $(call EDIT-VERSION-CONTEXT,collargs.edtx,$(YEAR)-$(MONTH)-$(DAY),$(VERSION)) + $(call EDIT-DATE-CHANGELOG,doc/CHANGELOG.collargs.md) + $(call EDIT-VERSION-LATEX,doc/memoize-doc.tex,collargs) + $(call EDIT-VERSION-LATEX,doc/memoize-code.tex,collargs) + +include Makefile.package +include Makefile.runtimes diff --git a/macros/generic/memoize/Makefile.package b/macros/generic/memoize/Makefile.package new file mode 100644 index 0000000000..b407904877 --- /dev/null +++ b/macros/generic/memoize/Makefile.package @@ -0,0 +1,224 @@ +# This Makefile must be included at the end of the including file. + +latex = $(COMMON:%=%.sty) $(LATEX) +plain = $(COMMON:%=%.tex) $(PLAIN) +context = $(COMMON:%=t-%.tex) $(CONTEXT) + +TEX = $(latex) $(plain) $(context) $(GENERIC) + +RUNTIME = $(TEX) $(SCRIPTS) $(MAN) + +ALL = $(RUNTIME) $(SOURCE) $(DOC) \ + $(README) $(INSTALL) $(CHANGELOG) $(LICENCE) $(MAKEFILE) + +ctan/$(PACKAGE).zip: $(ALL) + +CTAN-DIR = ctan/$(PACKAGE) +CTAN-DOC-DIR = ctan/$(PACKAGE)/doc + +format-dir = $(subst context,context/third,$(FORMAT)) + +TDS-DIR = texmf/$(PACKAGE).tds +TDS-SCRIPTS-DIR = $(TDS-DIR)/scripts/$(PACKAGE) +TDS-DOC-DIR = $(TDS-DIR)/doc/$(format-dir)/$(PACKAGE) +TDS-SOURCE-DIR = $(TDS-DIR)/source/$(format-dir)/$(PACKAGE) +TDS-MAN-DIR = $(TDS-DIR)/doc/man/man +TDS-ALL-DIRS = $(TDS-SCRIPTS-DIR) $(TDS-SOURCE-DIR) $(TDS-DOC-DIR) \ + $(TDS-DIR)/tex/{latex,plain,generic}/$(PACKAGE) \ + $(TDS-DIR)/tex/context/third/$(PACKAGE) \ + $(TDS-MAN-DIR){1,2,3,4,5,6,7,8,9} + +readme?md = README$(findstring .md, $(suffix $(README))) +install?md = INSTALL$(findstring .md, $(suffix $(INSTALL))) +changelog?md = CHANGELOG$(findstring .md, $(suffix $(CHANGELOG))) +licence?md = LICENCE$(findstring .md, $(suffix $(LICENCE))) + +man1 = $(filter %.1,$(MAN)) +man2 = $(filter %.2,$(MAN)) +man3 = $(filter %.3,$(MAN)) +man4 = $(filter %.4,$(MAN)) +man5 = $(filter %.5,$(MAN)) +man6 = $(filter %.6,$(MAN)) +man7 = $(filter %.7,$(MAN)) +man8 = $(filter %.8,$(MAN)) +man9 = $(filter %.9,$(MAN)) + +define MAKE-CTAN + $(CTAN-BEGIN) + $(CTAN-END) +endef + +define CTAN-BEGIN + rm -rf $(CTAN-DIR) ctan/$(PACKAGE).zip + mkdir -p $(CTAN-DIR) $(CTAN-DOC-DIR) + $(call cp,$(SOURCE) $(SCRIPTS) $(CTAN),$(CTAN-DIR)) + $(call cp,$(README),$(CTAN-DIR)/$(readme?md)) + $(call cp,$(INSTALL),$(CTAN-DIR)/$(install?md)) + $(call cp,$(CHANGELOG),$(CTAN-DIR)/$(changelog?md)) + $(call cp,$(LICENCE),$(CTAN-DIR)/$(licence?md)) + $(call cp,$(MAKEFILE),$(CTAN-DIR)) + $(call cp,$(DOC),$(CTAN-DOC-DIR)) +endef + +define CTAN-END + if [[ -d $(TDS-DIR) ]] ; then \ + cd $(TDS-DIR) && \ + zip -r $(PACKAGE).tds.zip * ; \ + fi + if [[ -a $(TDS-DIR)/$(PACKAGE).tds.zip ]] ; then \ + mv $(TDS-DIR)/$(PACKAGE).tds.zip ctan ; \ + fi + rmdir -p --ignore-fail-on-non-empty `find $(CTAN-DIR) -type d` + cd ctan && zip -r $(PACKAGE).zip $(PACKAGE) $(PACKAGE).tds.zip + cp ctan/$(PACKAGE).zip ctan/$(PACKAGE)-$(YEAR)-$(MONTH)-$(DAY)-v$(VERSION).zip +endef + +define MAKE-TDS + $(TDS-BEGIN) + $(TDS-END) +endef + +define TDS-BEGIN + rm -rf $(TDS-DIR) + $(TDS-MKDIR) + $(TDS-CP) +endef +define TDS-MKDIR + mkdir -p $(TDS-ALL-DIRS) +endef +define TDS-CP + $(call cp,$(latex),$(TDS-DIR)/tex/latex/$(PACKAGE)) + $(call cp,$(plain),$(TDS-DIR)/tex/plain/$(PACKAGE)) + $(call cp,$(context),$(TDS-DIR)/tex/context/third/$(PACKAGE)) + $(call cp,$(GENERIC),$(TDS-DIR)/tex/generic/$(PACKAGE)) + $(call cp,$(SCRIPTS),$(TDS-SCRIPTS-DIR)) + $(call cp,$(SOURCE),$(TDS-SOURCE-DIR)) + $(call cp,$(MAKEFILE),$(TDS-SOURCE-DIR)) + $(call cp,$(DOC),$(TDS-DOC-DIR)) + $(call cp,$(README),$(TDS-DOC-DIR)/$(readme?md)) + $(call cp,$(INSTALL),$(TDS-DOC-DIR)/$(install?md)) + $(call cp,$(CHANGELOG),$(TDS-DOC-DIR)/$(changelog?md)) + $(call cp,$(LICENCE),$(TDS-DOC-DIR)/$(licence?md)) + $(call cp,$(man1),$(TDS-MAN-DIR)1) + $(call cp,$(man2),$(TDS-MAN-DIR)2) + $(call cp,$(man3),$(TDS-MAN-DIR)3) + $(call cp,$(man4),$(TDS-MAN-DIR)4) + $(call cp,$(man5),$(TDS-MAN-DIR)5) + $(call cp,$(man6),$(TDS-MAN-DIR)6) + $(call cp,$(man7),$(TDS-MAN-DIR)7) + $(call cp,$(man8),$(TDS-MAN-DIR)8) + $(call cp,$(man9),$(TDS-MAN-DIR)9) +endef + +define TDS-END + $(TDS-FILES) + $(TDS-PRUNE) +endef +define TDS-FILES + cd $(TDS-DIR) ; find . -type f | sed 's!^\./!!' \ + > doc/$(format-dir)/$(PACKAGE)/FILES +endef +define TDS-PRUNE + rmdir -p --ignore-fail-on-non-empty `find $(TDS-DIR) -type d` +endef + +%.1: %.1.md + pandoc $< -s -t man -o $@ +%.2: %.2.md + pandoc $< -s -t man -o $@ +%.3: %.3.md + pandoc $< -s -t man -o $@ +%.4: %.4.md + pandoc $< -s -t man -o $@ +%.5: %.5.md + pandoc $< -s -t man -o $@ +%.6: %.6.md + pandoc $< -s -t man -o $@ +%.7: %.7.md + pandoc $< -s -t man -o $@ +%.8: %.8.md + pandoc $< -s -t man -o $@ +%.9: %.9.md + pandoc $< -s -t man -o $@ + +.PHONY: runtimes link-runtimes install-runtimes uninstall-runtimes version +.IGNORE: uninstall-runtimes + +cp=$(intcmp $(words $(1)),0,,,cp $(1) $(2)) + +runtimes: $(RUNTIME) + +TEXMFHOME=$(shell kpsewhich -var-value TEXMFHOME) + +link-runtimes: + $(eval TDS-DIR=$(TEXMFHOME)) + $(eval cp=$$(intcmp $$(words $$(1)),0,,,ln -srf $$(1) $$(2))) + $(TDS-MKDIR) + $(TDS-CP) + $(TDS-PRUNE) + texconfig rehash + +install-runtimes: + $(eval TDS-DIR=$(TEXMFHOME)) + $(TDS-MKDIR) + $(TDS-CP) + $(TDS-PRUNE) + texconfig rehash + +uninstall-runtimes: + $(eval TDS-DIR=$(TEXMFHOME)) + $(eval cp=$$(intcmp $$(words $$(1)),0,,,\ + if [[ -d $$(2) ]] ; then rm -f $$(foreach f,$$(1),$$(2)/$$(notdir $$(f))) ; \ + else rm -f $$(2) ; fi \ + )) + $(TDS-CP) + $(TDS-PRUNE) + texconfig rehash + + +# $1 = source file, $2 = package name +VERSION-LATEX = $(YEAR)/$(MONTH)/$(DAY) v$(VERSION) +define EDIT-VERSION-LATEX + sed -Ei 's!\\ProvidesPackage\{$(2)\}\[[0-9]{4}/[0-9]{1,2}/[0-9]{1,2} v[-0-9.a-z]* !\\ProvidesPackage{$(2)}[$(VERSION-LATEX) !' $(1) +endef + +# $1 = source file +# This assumes that all the \modules in the file have the same date and version. +VERSION-CONTEXT = $(VERSION) +DATE-CONTEXT = $(YEAR)-$(MONTH)-$(DAY) +define EDIT-VERSION-CONTEXT + sed -Ei 's!(%D *version=)[-0-9.a-z]*,!\1$(VERSION-CONTEXT),!;s!(%D *date=)[-0-9]*,!\1$(DATE-CONTEXT),!' $(1) +endef + +# $1 = source .pl file, $2 = version +VERSION-PERL = $(YEAR)/$(MONTH)/$(DAY) v$(VERSION) +define EDIT-VERSION-PERL + sed -i "s!^my \$$VERSION = .*!my \$$VERSION = '$(VERSION-PERL)';!" $(1) +endef + +# $1 = source .py file, $2 = version +VERSION-PYTHON = $(YEAR)/$(MONTH)/$(DAY) v$(VERSION) +define EDIT-VERSION-PYTHON + sed -i "s!^__version__ = .*!__version__ = '$(VERSION-PYTHON)'!" $(1) +endef + +# $1 = source file +VERSION-MAN = $(VERSION) +DATE-MAN = $(shell LANG=en date -d '$(YEAR)-$(MONTH)-$(DAY)' +"%B %d, %Y") +# This assumes that the source filename is file.<N>.md, because it strips away two suffixes. +define EDIT-VERSION-MAN + sed -i '/^date:/c date: $(DATE-MAN)' $(1) + sed -i '/^footer:/c footer: $(basename $(basename $(notdir $(1)))) $(VERSION-MAN)' $(1) +endef + +# $1 = source file, $2 = package name +VERSION-PLAIN = $(VERSION-LATEX) +define EDIT-VERSION-PLAIN + sed -Ei 's!^(%<[^\>]*>% Package $(2) ).*!\1$(VERSION-PLAIN)!' $(1) +endef + +# Change the date of the latest release (identified by the version) of the package. +define EDIT-DATE-CHANGELOG + sed -Ei 's!^(#+|Manual: Memoize) [0-9]{4}/[0-9]{1,2}/[0-9]{1,2} +v$(VERSION)!\1 $(YEAR)/$(MONTH)/$(DAY) v$(VERSION)!' $(1) +endef + diff --git a/macros/generic/memoize/Makefile.runtimes b/macros/generic/memoize/Makefile.runtimes new file mode 100644 index 0000000000..421bcdbfc9 --- /dev/null +++ b/macros/generic/memoize/Makefile.runtimes @@ -0,0 +1,8 @@ +.PRECIOUS: %.dtx + +%.dtx: %.edtx + edtx2dtx $< > $@ + +%.sty %.tex t-%.tex &: %.ins %.dtx + tex $< + sed -i -s -e 's/\\\(un\)\?expanded/\\normal\1expanded/g;' t-$*.tex diff --git a/macros/generic/memoize/doc/memoize-clean.1.md b/macros/generic/memoize/doc/memoize-clean.1.md index 2d64fb5999..504a563309 100644 --- a/macros/generic/memoize/doc/memoize-clean.1.md +++ b/macros/generic/memoize/doc/memoize-clean.1.md @@ -2,8 +2,8 @@ title: memoize-clean section: 1 header: User Manual -footer: memoize-clean of Memoize v1.3.0 -date: April 02, 2024 +footer: memoize-clean of Memoize v1.4.0 +date: November 24, 2024 hyphenate: false --- diff --git a/macros/generic/memoize/doc/memoize-code.latexmkrc b/macros/generic/memoize/doc/memoize-code.latexmkrc new file mode 100644 index 0000000000..b0777230aa --- /dev/null +++ b/macros/generic/memoize/doc/memoize-code.latexmkrc @@ -0,0 +1,6 @@ +$pdf_mode = 1; +$pdflatex = "lualatex %O %S"; +$bibtex = 0; +$makeindex = "makeindex -s gind.ist %S"; +$do_cd = 1; +$silent = 1; diff --git a/macros/generic/memoize/doc/memoize-code.pdf b/macros/generic/memoize/doc/memoize-code.pdf Binary files differindex 6d179fcbe6..ff6e8c8c22 100644 --- a/macros/generic/memoize/doc/memoize-code.pdf +++ b/macros/generic/memoize/doc/memoize-code.pdf diff --git a/macros/generic/memoize/doc/memoize-code.tex b/macros/generic/memoize/doc/memoize-code.tex index 28aa812334..8b29c1609b 100644 --- a/macros/generic/memoize/doc/memoize-code.tex +++ b/macros/generic/memoize/doc/memoize-code.tex @@ -15,7 +15,7 @@ \usepackage{memoize-code} % Also loads memoize-doc-common -\pdfsystem{makeindex -s gind.ist \jobname.idx} +%\pdfsystem{makeindex -s gind.ist \jobname.idx} \CodelineIndex \EnableCrossrefs @@ -25,14 +25,26 @@ \emailsymbol~\url(mailto:){saso.zivanovic@guest.arnes.si}\\ \homepagesymbol~\url(http://){spj.ff.uni-lj.si/zivanovic}\\ \faGithub~\url(https://){github.com/sasozivanovic}} - -\datefrompackageversion{collargs} -\edef\allpackagever{CollArgs v\packagever} -\datefrompackageversion{advice} -\epreto\allpackagever{Advice v\packagever, } -\datefrompackageversion{memoize} -\epreto\allpackagever{Memoize v\packagever, } -\let\packagever\allpackagever +\packageversion{% + \ParseProvidesPackage + \ProvidesPackage{memoize}[2024/11/24 v1.4.0 Fast and flexible externalization] + \begin{tabular}{c} + Memoize v\packagever\\ + \csuse{@date} + \end{tabular} + \ParseProvidesPackage + \ProvidesPackage{advice}[2024/03/15 v1.1.1 Extend commands and environments] + \begin{tabular}{c} + Advice v\packagever\\ + \csuse{@date} + \end{tabular} + \ParseProvidesPackage + \ProvidesPackage{collargs}[2024/03/15 v1.2.0 Collect arguments of any command] + \begin{tabular}{c} + Collargs v\packagever\\ + \csuse{@date} + \end{tabular} +} \hypersetup{ % pdftitle={Memoize}, diff --git a/macros/generic/memoize/doc/memoize-doc-common.sty b/macros/generic/memoize/doc/memoize-doc-common.sty index 7f2a783a8d..08b3b10d65 100644 --- a/macros/generic/memoize/doc/memoize-doc-common.sty +++ b/macros/generic/memoize/doc/memoize-doc-common.sty @@ -48,22 +48,14 @@ \usepackage{pdftexcmds} \let\pdfsystem\pdf@system -% version and date -\def\datefrompackageversion#1{% - \setbox0=\hbox{% - \def\ProvidesPackage##1[##2]{% - \gdef\@packagever{##2}% - \endinput - }% - \input{#1.sty}% - }% - \expandafter\parsepackagever@\@packagever\parsepackagever@ -} -\def\parsepackagever@#1/#2/#3 v#4 #5\parsepackagever@{% - \year=#1\relax\month=#2\relax\day=#3\relax - \def\packagever{#4}\def\packagedesc{#5}% +\def\ParseProvidesPackage\ProvidesPackage#1[#2/#3/#4 v#5 #6]{% + \def\packagename{#1}% + \year=#2\relax\month=#3\relax\day=#4\relax + \def\packagever{#5}\def\packagedesc{#6}% + \ignorespaces } +\newcommand\packageversion{\def\@packageversion} \renewcommand\maketitle{% \begingroup \mmzset{disable, auto={tcolorbox}{clear options}}% \mmznext does not work here -- todo: maybe it does now @@ -76,8 +68,7 @@ tikznode lower, adjusted title=\@title, ] - \packagever\\ - \@date + \@packageversion \tcblower \Large\@author \end{tcolorbox} @@ -149,6 +140,19 @@ {http://mirrors.ctan.org/graphics/pgf/base/doc/pgfmanual.pdf} {\S#1 of the Ti\emph{k}Z \& \textsc{PGF} manual}% } +\newcommand\ManualBeamer[1][]{% + \href + {http://mirrors.ctan.org/macros/latex/contrib/beamer/doc/beameruserguide.pdf} + {#1\ifstrempty{#1}{}{ }the Beamer manual}% +} +\newcommand\TeXbyTopic[1][]{% + \href + {http://mirrors.ctan.org/info/texbytopic/TeXbyTopic.pdf} + {TeX by Topic\ifstrempty{#1}{}{, #1}}% +} +\newcommand\TeXbook[1][]{% + \hologo{TeX}book\ifstrempty{#1}{}{, #1}% +} \newcommand\Alt{\,$\vert$\,} \newcommand\hyp{\discretionary{}{}{}} \newcommand\fncomma{\ensuremath{{^,}}} @@ -169,3 +173,5 @@ \NewDocumentCommand\pkg{O{\pkgcolor}m}{{% \hypercolor{url}{#1}% \href{https://ctan.org/pkg/#2}{\texttt{#2}}}} + +\NewDocumentCommand\Href{O{Hyperlink}mm}{{\hypercolor{url}{#1}\href{#2}{#3}}}
\ No newline at end of file diff --git a/macros/generic/memoize/doc/memoize-doc.latexmkrc b/macros/generic/memoize/doc/memoize-doc.latexmkrc new file mode 100644 index 0000000000..23a90dd6fa --- /dev/null +++ b/macros/generic/memoize/doc/memoize-doc.latexmkrc @@ -0,0 +1,276 @@ +$pdf_mode = 1; +$pdflatex = "lualatex %O %S"; +$bibtex = 0; +$do_cd = 1; +$silent = 1; +$max_repeat = 6; # we need six cycles for a fresh compilation with memoization + +push @generated_exts, "cpt"; +push @generated_exts, "mmz"; +push @generated_exts, "memo"; +push @generated_exts, "listing"; + +###################################################################### +### from <texmf>/doc/support/latexmk/example_rcfiles/memoize_latexmkrc +### with partially silenced output and +### memoize-extract.pl --> memoize-extract.py, because the perl-based +### extraction chokes on some externs. + +#print "============= I am memoize's latexmkrc. John Collins 2024-03-29\n"; + +# This rc file shows how to use latexmk with the memoize package. +# +# The memoize package (https://www.ctan.org/pkg/memoize) implements +# externalization and memoization of sections of code in a TeX document. +# It allows the compilation of the document to reuse results of +# compilation-intensive code, with a consequent speeding up of runs of +# *latex. Such compilation intensive code is commonly encountered, for +# example, in making pictures by TikZ. +# +# When a section of code to be memoized is encountered, an extra page is +# inserted in the document's pdf file containing the results of the +# compilation of the section of code. Then a script, memoize-extract.pl or +# memoize-extract.py, is run to extract the extra parts of the the +# document's pdf file to individual pdf files (called externs). On the +# next compilation by *latex, those generated pdf files are used in place +# of actually compiling the corresponding code (unless the section of code +# has changed). +# +# This latexmkrc file supports this process by configuring latexmk so that +# when a compilation by *latex is done, a memoize-extract script is run +# immediately afterwards. If any new externs are generated, latexmk +# notices that and triggers a new compilation, as part of its normal mode +# of operation. +# +# The memoize package itself also runs memoize-extract at the start of each +# compilation. If latexmk has already run memoize-extract, that extra run +# of memoize-extract finds that it has nothing to do. The solution here is +# more general: (a) It handles the case where the memoize package is +# invoked in the .tex file with the external=no option. (b) It handles the +# situation where the aux and out directories are different, which is not +# the case for the built-in invocation. (c) It nicely matches with +# latexmk's general methods of determining how many runs of *latex are +# needed. +# +# Needs latexmk v. >= 4.84, memoize >= 1.2.0 (2024/03/15). +# TeX Live 2024 (or later, presumably). +# Tested on TeX Live 2024 on macOS, Ubuntu, Windows, +# with pdflatex, lualatex, and xelatex. +# Needs perl module PDF::API2 to be installed. +# On TeXLive on Windows, also put +# TEXLIVE_WINDOWS_TRY_EXTERNAL_PERL = 1 +# in the texmf.cnf file in the root directory of the TeX Live installation. + +# ==> However, there are some anomalies on Windows, which haven't been sorted out +# yet. These notably concern memoize-clean +# +# ==> Fails on MiKTeX on Windows: memoize-extract refuses to create pdf file???? +# I haven't yet figured out the problem. +# ==> Also trouble on MiKTeX on macOS: the memoize-extract.pl.exe won't run. + +# You can have separate build and output directories, e.g., by + #$out_dir = 'output'; + #$aux_dir = 'build'; +# or they can be the same, e.g., by + # $out_dir = $aux_dir = 'output'; + + +# Which program and extra options to use for memoize-extract and memoize-clean. +# Note that these are arrays, not simple strings. +our @memoize_extract = ( 'memoize-extract.py' ); +our @memoize_clean = ( 'memoize-clean.py' ); + +# Specification of the basic memoize files to delete in a clean-up +# operation. The generated .memo and .pdf files have more specifications, +# and we use memoize-clean to delete those, invoked by a cleanup hook. +push @generated_exts, 'mmz', 'mmz.log'; + +# Subroutine mmz_analyzes analyzes .mmz file, if it exists **and** was +# generated in current compilation, to determine whether there are new +# extern pdfs to be generated from memo files and pdf file. Communicate +# to subtroutine mmz_extract_new a need to make new externs by setting the +# variable to a non-zero value for $mmz_has_new. Let the value be the +# name of the mmz file; this is perhaps being too elaborate, since the +# standard name of the mmz file can be determined + +add_hook( 'after_xlatex_analysis', \&mmz_analyze ); +add_hook( 'after_main_pdf', \&mmz_extract_new ); + +# !!!!!!!!!!!!!!!!!!!! Uncomment the following line **only** if you really +# want latexmk's cleanup operations to delete Memoize's memoization +# files. In a document where these files are time-consuming to make, i.e., +# in the main use case for the memoize package, the files are precious and +# should only need deleted when that is really needed. +# +# add_hook( 'cleanup', \&mmz_cleanup ); + +# Whether there are new externs to be made: +my $mmz_has_new = ''; +# Scope of this variable: private, from here to end of file. + + +#----------------------------------------------------- + +sub mmz_analyze { + use strict; + #print "============= I am mmz_analyze \n"; + #print " Still to deal with provoking of rerun if directory made\n"; + + # Analyzes mmz file if generated on this run. + # Then 1. Arranges to trigger making of missing extern pdfs, if needed. + # 2. Sets dependencies on the extern pdfs. This ensures that, in + # the case that one or more extern pdfs does not currently + # exist, a rerun of *latex will triggered after it/they get + # made. + # Return zero on success (or nothing to do), and non-zero otherwise. + + # N.B. Current (2024-03-11) hook implementation doesn't use return + # values from hook subroutines. Future implementation might. + # So I'll provide a return value. + + my $base = $$Pbase; + my $mmz_file = "$aux_dir1$base.mmz"; + + # Communicate to subroutine mmz_extract_new about whether new extern + # pdf(s) are to be made. Default to assuming no externs are to be + # made: + $mmz_has_new = ''; + + if (! -e $mmz_file) { + #print "mmz_analyze: No mmz file '$mmz_file', so memoize is not being used.\n"; + return 0; + } + + # Use (not-currently-documented) latexmk subroutine to detemine + # whether mmz file was generated in current run: + if ( ! test_gen_file_time( $mmz_file) ) { + warn "mmz_analyze: Mmz file '$mmz_file' exists, but wasn't generated\n", + " on this run so memoize is not **currently** being used.\n"; + return 0; + } + + # Get dependency information. + # We need to cause not-yet-made extern pdfs to be trated as source + # files for *latex. + my $mmz_fh = undef; + if (! open( $mmz_fh, '<', $mmz_file ) ) { + warn "mmz_analyze: Mmz file '$mmz_file' exists, but I can't read it:\n", + " $!\n"; + return 1; + } + my @externs = (); + my @dirs = (); + while ( <$mmz_fh> ) { + s/\s*$//; # Remove trailing space, including new lines + if ( /^\\mmzNewExtern\s+{([^}]+)}/ ) { + # We have a new memo item without a corresponding pdf file. + # It will be put in the aux directory. + my $file = "$aux_dir1$1"; + #print "mmz_analyze: new extern for memoize: '$file'\n"; + push @externs, $file; + } + elsif ( /^\\mmzPrefix\s+{([^}]+)}/ ) { + # Prefix. + my $prefix = $1; + if ( $prefix =~ m{^(.*)/[^/]*} ) { + my $dir = $1; + push @dirs, "$aux_dir1$1"; + + } + } + } + close $mmz_fh; + foreach (@dirs) { + if ( ! -e ) { + my @cmd = ( @memoize_extract, '--mkdir', $_ ); + print "mmz_analyze: Making directory '$_' safely by running\n", + " @cmd\n"; + mkdir $_; + } + } + + rdb_ensure_files_here( @externs ); + + # .mmz.log is read by Memoize package after it does an internal + # extract, so it appears as an INPUT file in .fls. But it was created + # earlier in the same run by memoize-extract, so it's not a true + # dependency, and should be removed from the list of source files: + rdb_remove_files( $rule, "$mmz_file.log" ); + + if (@externs ) { + $mmz_has_new = $mmz_file; + } + return 0; +} + +#----------------------------------------------------- + +sub mmz_extract_new { + use strict; + #print "============= I am mmz_extract_new \n"; + + # If there are new extern pdf files to be made, run memoize-extract to + # make them. + # Situation on entry: + # 1. I'm in the context of a rule for making the document's pdf file. + # When new extern pdf files are to be made, the document's pdf + # file contains the pages to be extracted by memoize-extract. + # Given the rule context, the name of the document's pdf file is + # $$Pdest. + # 2. $mmz_has_new was earlier set to the name of the mmz file with + # the information on the files used for memoization, but only if + # there are new extern pdf(s) to be made. + # 3. If it is empty, then no extern pdfs are to be made. This covers + # the case that the memoize package isn't being used. + # Return zero on success (or nothing to do), and non-zero otherwise. + + if ( $mmz_has_new eq '' ) { return 0; } + + my $mmz_file = $mmz_has_new; + my ($mmz_file_no_path, $path) = fileparse( $mmz_file ); + my $pdf_file = $$Pdest; + + # The directory used by memoize-extract for putting the generated + # extern pdfs is passed in the TEXMF_OUTPUT_DIRECTORY environment + # variable. (The need for this way of passing information is + # associated with some security restrictions that apply when + # memoize-extract is called directly from the memoize package in a + # *latex compilation.) + local $ENV{TEXMF_OUTPUT_DIRECTORY} = $aux_dir; + for ('TEXMF_OUTPUT_DIRECTORY') { + print "mmz_extract_new : ENV{$_} = '$ENV{$_}'\n"; + } + # So we should give the name of the mmz_file to memoize-extract without + # the directory part. + my @cmd = (@memoize_extract, '--format', 'latex', + '--pdf', $pdf_file, $mmz_file_no_path ); + + if ( ! -e $pdf_file ) { + warn "mmz_extract_new: Cannot generate externs here, since no pdf file generated\n"; + return 1; + } + elsif ( ! test_gen_file($pdf_file) ) { + warn "mmz_extract_new: Pdf file '$pdf_file' exists, but wasn't\n", + " generated on this run. I'll run memoize-extract. Pdf file may contain\n", + " extra pages generated by the memoize package.\n"; + return 1; + } + print "make_extract_new: Running\n @cmd\n"; + return system @cmd; +} + +#----------------------------------------------------- + +sub mmz_cleanup { + use strict; + print "============= I am mmz_cleanup \n"; + my @cmd = ( @memoize_clean, '--all', '--yes', + '--prefix', $aux_dir, + "$aux_dir1$$Pbase.mmz" ); + print "mmz_cleanup: Running\n @cmd\n"; + my $ret = system @cmd; + say "Return code $ret"; + return $ret; +} + +#----------------------------------------------------- diff --git a/macros/generic/memoize/doc/memoize-doc.pdf b/macros/generic/memoize/doc/memoize-doc.pdf Binary files differindex 2f08ae2f30..9d7b51480a 100644 --- a/macros/generic/memoize/doc/memoize-doc.pdf +++ b/macros/generic/memoize/doc/memoize-doc.pdf diff --git a/macros/generic/memoize/doc/memoize-doc.sty b/macros/generic/memoize/doc/memoize-doc.sty index 77b3048bb6..74f694264a 100644 --- a/macros/generic/memoize/doc/memoize-doc.sty +++ b/macros/generic/memoize/doc/memoize-doc.sty @@ -56,6 +56,9 @@ % The following doesn't work perfectly, but it's good enough. auto key={/tcb/breakable}{run if memoizing, outer handler=\makeunmemoizableunless{false}}, auto key={/tcb/float}{run if memoizing, outer handler=\makeunmemoizableunless{}}, + auto=\Emph{nomemoize,args=m}, % why do I need to specify args? + auto=\EmphTT{nomemoize,args=m}, + auto=\EmphVerbatim{nomemoize,args=v}, } \def\makeunmemoizableunless#1#2\pgfeov{% @@ -191,15 +194,11 @@ }, }, } -\def\examplepdfpath{\examplepath.c1.pdf} -\NewDocumentCommand{\includeexamplepdf}{ O{} O{\examplepdfpath} D(){} m}{% +\NewDocumentCommand{\includeexamplepdf}{ O{} O{\examplename} D(){\exampledotc} m}{% \mbox{% - \tcbincludegraphics[reset,capture=hbox,graphics options={clip,#4},#1]{#2}#3% + \tcbincludegraphics[reset,capture=hbox,graphics options={clip,#4},#1]{\exampledir#2#3.pdf}% }% }% -\def\ExampleName#1{\edef\examplename{#1}\ignorespaces} -\def\makeexample#1{\pdfsystem{make -C \exampledir\space#1}\ignorespaces} -% \def\makeexample#1{\pdfsystem{make -B -C \exampledir\space#1}} \def\examplepath{\exampledir\examplename} \RequirePackage{intopdf} \RequirePackage{fontawesome} @@ -215,67 +214,44 @@ fonttitle={\small\hypercolor{link}{white}}, }, example title/.default=\examplename.tex, - attachment/.estore in=\attachmentpath, - attachment name/.estore in=\attachmentname, - attachment name/.default=noname.tex, + attachment/.estore in=\attachmentname, no attachment/.style={attach/.style={}}, - attachment=\jobname.listing.attachment, - attachment name, - % attach example/.style={ - % attachment/.expanded=\examplepath.tex.work, - % attachment name/.expanded=\examplename.tex, - % attach, - % }, attach/.style={ overlay app={% \node at (frame.north east) [ fill=white, draw=gray, thick, ellipse, inner xsep=-0.5mm, inner ysep=0, shift={(-2mm,-2mm)}, rotate=45, ]{% - \pdfsystem{make -f examples/Makefile \attachmentpath}% - \expandafter\myattachandlink\expandafter[\attachmentname]{\attachmentpath}[application/x-tex]{Click here to open the code.}{\rotatebox{-45}{\faPaperclip}} + \expandafter\attachandlink\expandafter[\attachmentname]{\attachmentsdir\attachmentname}[application/x-tex]{Click here to open the code.}{\rotatebox{-45}{\faPaperclip}} }; } }, - excerpt/.code 2 args={% - \makeexample{#2.excerpt SOURCE=#1}% - }, } \NewDocumentCommand\attachexample{O{\examplename.tex} O{\examplepath.tex.c1.attachment}}{% - {\textsuperscript{\kern-0.25em \expandafter\myattachandlink\expandafter[#1]{#2}[application/x-tex]{Click here to open the code.}{\rotatebox{-45}{\faPaperclip}}\kern-0.25em \relax}}} -\newcommand\myattachandlink[2][\filename]{% - \begingroup - \def\filename{#2}% - \immediate\write\attachments{#2 #1 ## line \the\inputlineno}% - \ifmemoizing - \xtoksapp\mmzCCMemo{% - \immediate\write\attachments{#2 #1 ## line \the\inputlineno}% - }% - \fi - \expanded{% - \endgroup - \noexpand\attachandlink[#1]{#2}% - }% -} -\newwrite\attachments -\immediate\openout\attachments attachments.lst -\AtEndDocument{\immediate\closeout\attachments} + {\textsuperscript{\kern-0.25em \expandafter\attachandlink\expandafter[#1]{#2}[application/x-tex]{Click here to open the code.}{\rotatebox{-45}{\faPaperclip}}\kern-0.25em \relax}}} \NewTCBInputListing{\tcbinputexample}{ - >{\edef\ProcessedArgument} D(){\examplename} O{.tex} O{.c1} +m } + >{\edef\ProcessedArgument} m O{.tex} D(){} +m } {% + /utils/exec={% + \edef\examplename{#1}% + \edef\exampledotc{#3}% + },% /mmz/context={dtxmd5sum=\csuse{pdf@filemdfivesum}{\exampledir#1#2.dtx}}, example title={#1#2}, % enlarge left by=\leftmargin,% this takes care of using this box in lists listing and comment, - one file/.style={ + no .listing/.style={ listing file={\exampledir#1#2#3}, - attachment={\exampledir#1#2#3}, + %attachment path={\exampledir#1#2#3}, + %attachment path={\exampledir attachments/#1#2}, + %attachment={#1#2}, }, listing file=\exampledir#1#2#3.listing, - /utils/exec={\edef\examplepdfpath{\exampledir#1#3.pdf}},% - attachment=\exampledir#1#2#3.attachment, - attachment name=#1#2,% + %attachment path=\exampledir#1#2#3.attachment, + %attachment path=\exampledir attachments/#1#2, + %attachment name=#1#2,% + attachment=#1#2,% #4, attach, } @@ -286,10 +262,10 @@ listing and compile/.style={ listing and comment, comment={% - \input\examplepath.tex.c#1 + \input\examplepath.tex#1% } }, - listing and compile/.default=1, + listing and compile/.default=, } \pgfkeys{ @@ -317,7 +293,7 @@ \renewcommand\abstractname{\vskip-\baselineskip} % sections -\newtcbox{\section@box}[3]{tile,before=\noindent,after=, +\newtcbox{\section@box}[3]{/mmz/disable,tile,before=\noindent,after=, fontupper=\normalfont#1\bfseries,capture=minipage, colback=emphcolor, boxsep=0mm,top=#2,bottom=#2,left=\oddsidemargin+1in,right=\oddsidemargin+1in, @@ -344,7 +320,7 @@ \@startsection{subsubsection}{2}{\z@}% {-3.25ex\@plus -1ex \@minus -.2ex}{1.5ex \@plus .2ex}% {\section@box{}{2mm}{}}} -\newtcbox{\paragraph@box}{tile,before=,after=,capture=hbox, +\newtcbox{\paragraph@box}{/mmz/disable,tile,before=,after=,capture=hbox, fontupper=\normalfont\normalsize\bfseries\hypercolor{link}{black}\vphantom{dj}, box align=base, boxsep=0mm, @@ -420,52 +396,10 @@ \usepackage{xstring} \usepackage{placeins} -\NewDocumentCommand\makeexcerpt{ m O{.tex} D(){../../memoize.edtx} }{% - \ExampleName{#1}% - \makeexample{#1#2.excerpt SOURCE=#3}% - \ignorespaces -} - -\newcommand\sed[2]{% - \begingroup - \def\cmd##1{\noexpand\\##1}% - \def\0{\bslash0}% - \def\1{\bslash1}% - \def\2{\bslash2}% - \def\3{\bslash3}% - \def\4{\bslash4}% - \def\5{\bslash5}% - \def\6{\bslash6}% - \def\7{\bslash7}% - \def\8{\bslash8}% - \def\9{\bslash9}% - \def~{\noexpand~}% - \def\n{\string\n}% - \def\({\bslash(}% - \def\){\bslash)}% - \let\lbrace\sedlbrace - \let\rbrace\sedrbrace - \edef\nobrace{[^\sedlbrace\sedrbrace]} - \edef\marg{{[^\sedrbrace]*}}% - \def\repeat##1{\bslash\sedlbrace##1\bslash\sedrbrace}% - \pdfsystem{sed -i "#1" #2}% - \endgroup -} -\begingroup -\catcode`\(=1 -\catcode`\)=2 -\catcode`\{=12 -\catcode`\}=12 -\gdef\sedlbrace({)% -\gdef\sedrbrace(})% -\endgroup - \usepackage{pifont} \newcommand\yes{{\small\ding{51}}} % pifont \newcommand\no{{\small\ding{55}}} % pifont -%\newcommand\oarg[1]{{\ttfamily[}\meta{#1}{\ttfamily]}} - \definecolor{Option}{rgb}{0.118,0.546,0.222} \definecolor{Definition}{rgb}{0.784,0.06,0.176} \definecolor{ExampleFrame}{rgb}{0.628,0.705,0.942} diff --git a/macros/generic/memoize/doc/memoize-doc.tex b/macros/generic/memoize/doc/memoize-doc.tex index 69f723441e..34b1a72926 100644 --- a/macros/generic/memoize/doc/memoize-doc.tex +++ b/macros/generic/memoize/doc/memoize-doc.tex @@ -1,7 +1,8 @@ \documentclass[a4paper,11pt]{article} \usepackage[margin=2cm,top=1cm,bottom=1cm,nohead,includefoot]{geometry} -\usepackage{nomemoize} +% The perl-based extraction chokes on some externs. +\usepackage[extract=python]{nomemoize} \usepackage{memoize-doc} \mmzset{ % recompile, @@ -13,14 +14,16 @@ % trace, } \def\exampledir{examples/} +\def\attachmentsdir{examples/attachments/} \title{\pkg[white]{Memoize}} +\ParseProvidesPackage +\ProvidesPackage{memoize}[2024/11/24 v1.4.0 Fast and flexible externalization] +\packageversion{v\packagever\\\csuse{@date}} \author{Sašo Živanović\\[2mm] \emailsymbol~\url(mailto:){saso.zivanovic@guest.arnes.si}\\ \homepagesymbol~\url(http://){spj.ff.uni-lj.si/zivanovic}\\ \faGithub~\url(https://){github.com/sasozivanovic}} -\datefrompackageversion{memoize} -\preto\packagever{v} \hypersetup{ pdftitle={Memoize}, @@ -30,7 +33,7 @@ } \usepackage{makeidx} -\pdfsystem{makeindex -s memoize-doc.mst \jobname.idx} +% \pdfsystem{makeindex -s memoize-doc.mst \jobname.idx} \makeindex \usepackage[hangindent=1em,justific=raggedright,font=small,totoc]{idxlayout} \appto\indexfont{\def\pkgcolor{gray}} @@ -106,6 +109,11 @@ }, file={name=texmf.cnf}, env={name=tcblisting, pkg=tcolorbox}, + scope={ + keypath=/tcb, pkg=tcolorbox, + key={name=breakable}, + key={name=float}, + }, cmd={name=vref, pkg=varioref}, cmd={name=cref, pkg=cleveref}, cmd={name=crefrange, pkg=cleveref}, @@ -183,8 +191,6 @@ \vfill -\ExampleName{titlepage} -\makeexample{\examplename.pdf N=2} % N=2, because we show the .mmz file later \begingroup \tcbset{page box/.style={ box align=center,boxsep=2mm,top=0pt,bottom=0pt,left=0pt,right=0pt, @@ -193,27 +199,27 @@ \begin{tcboxedraster} [raster columns=1] {title=The two steps of externalization of graphics in Memoize} - \tcbinputexample{ + \tcbinputexample{titlepage}{ title=\tt doc.tex, listing only, remember as=tex, } \begin{tcolorbox}[example title=doc.pdf, no attachment, remember as=pdf1] - \includeexamplepdf[page box=extern1]{page=1,trim=1in 1in 1in 1in}\hfill - \includeexamplepdf[page box=extern2]{page=2,trim=1in 1in 1in 1in}\hfill - \includeexamplepdf[page box=extern3]{page=3,trim=1in 1in 1in 1in}\hfill - \includeexamplepdf[page box=docpage]{page=4}% + \includeexamplepdf[page box=extern1][titlepage](.c1){page=1,trim=1in 1in 1in 1in}\hfill + \includeexamplepdf[page box=extern2][titlepage](.c1){page=2,trim=1in 1in 1in 1in}\hfill + \includeexamplepdf[page box=extern3][titlepage](.c1){page=3,trim=1in 1in 1in 1in}\hfill + \includeexamplepdf[page box=docpage][titlepage](.c1){page=4}% \end{tcolorbox} \vspace{10mm} \begin{tcboxedraster}[raster columns=3, raster column skip=1cm]{blankest} \begin{tcolorbox}[example title=.pdf]\centering - \includeexamplepdf[page box=externfile1]{page=1,trim=1in 1in 1in 1in}\hfill + \includeexamplepdf[page box=externfile1][titlepage](.c1){page=1,trim=1in 1in 1in 1in}\hfill \end{tcolorbox} \begin{tcolorbox}[example title=.pdf]\centering - \includeexamplepdf[page box=externfile2]{page=2,trim=1in 1in 1in 1in}\hfill + \includeexamplepdf[page box=externfile2][titlepage](.c1){page=2,trim=1in 1in 1in 1in}\hfill \end{tcolorbox} \begin{tcolorbox}[example title=.pdf]\centering - \includeexamplepdf[page box=externfile3]{page=3,trim=1in 1in 1in 1in}\hfill + \includeexamplepdf[page box=externfile3][titlepage](.c1){page=3,trim=1in 1in 1in 1in}\hfill \end{tcolorbox} \end{tcboxedraster} \end{tcboxedraster} @@ -225,7 +231,7 @@ We all love Ti\emph{k}Zlings! \def\mytikzling#1#2{% \tcbox[blankest, baseline=1mm, remember as=used extern #1] - {\tikz[x=0.3cm,y=0.3cm]{#2;}}}% + {\tikz[x=0.3cm,y=0.3cm]{#2}}}% \mytikzling1{\penguin} is a penguin, \mytikzling2{\koala} is a koala, and \mytikzling3{\owl} is an owl. @@ -237,8 +243,12 @@ \begin{tcolorbox}[colback=emphcolor, fontupper=\footnotesize] This manual also documents packages Advice - ({\datefrompackageversion{advice}v\packagever}) and CollArgs - ({\datefrompackageversion{collargs}v\packagever}). These are auxiliary + ({\ParseProvidesPackage + \ProvidesPackage{advice}[2024/03/15 v1.1.1 Extend commands and environments] + v\packagever}) and CollArgs + ({\ParseProvidesPackage + \ProvidesPackage{collargs}[2024/03/15 v1.2.0 Collect arguments of any command] + v\packagever}). These are auxiliary packages which were developed alongside Memoize, but are distributed as independent packages as they might be useful outside the context of Memoize, as well. See sections~\ref{sec:advice} and \ref{sec:ref:advice} for Advice, and @@ -537,7 +547,7 @@ it when I add more keys. ~\mmzset~{ auto = \qrcode{memoize, args=om}, auto = \mycite{cite}, - extract = python, + padding = 2in, record = makefile, } \end{tcblisting} @@ -551,7 +561,7 @@ it when I add more keys. \end{tcblisting} \begin{tcblisting}{listing only, bad} ~\mmzset~{ - extract=tex, + recompile, no verbatim, prefix=memos/ @@ -673,9 +683,10 @@ config will in turn override the system-wide one. This should not concern you too much, because you will probably only want to use the user-wide config anyway, which might look something like this: -\ExampleName{memoize} -\makeexample{\examplename.cfg.c1} -\tcbinputexample[.cfg]{listing only} +\tcbinputexample{memoize-example}[.cfg]{ + title=\tt memoize.cfg, + listing only +} (The \refmmz{extract} line above ``permanently'' selects the Python-based internal extraction method, which uses script \refscript{memoize-extract.py}. @@ -698,10 +709,9 @@ same logic can be used to base a user-wide config on the system-wide one. \subsection{Let's see if it works!} \label{sec:tut:test} -\ExampleName{test} \noprint{\refcmd{tikz}\refenv{tikzpicture}\refenv{forest}}% -Take example file \texttt{\examplename.tex},\footnote{Where can you find +Take example file \texttt{test.tex},\footnote{Where can you find the example files? For one, they are integrated into this manual, so if your PDF viewer supports attachments, you can simply click on the paperclip icon on the top right of the example box (even if you're offline). Otherwise, @@ -733,8 +743,7 @@ twice. are now embedded into the main document. \end{itemize} -\makeexample{\examplename.pdf} -\tcbinputexample{ +\tcbinputexample{test}{ sidebyside, comment={\centering \includeexamplepdf[extern page,left=2mm,right=2mm]{page=1,trim=1in 1in 1in 1in}\quad @@ -776,9 +785,7 @@ or by making it the argument of the \Emph{\refcmd{mmz}} command. The only difference between the two is that the environment, but not the command, ignores any spaces surrounding the given code. -\ExampleName{manual} -\makeexample{\examplename.pdf} -\tcbinputexample{ +\tcbinputexample{manual}{ sidebyside, lefthand ratio=0.528, comment={\centering \includeexamplepdf[extern page]{page=1,trim=1in 1in 1in 1in}\hfill @@ -800,14 +807,12 @@ externalize \TikZ pictures in general (so you have \refmmz{deactivate}d automemoization of the \cs{tikz} command, as explained at the end of section~\ref{sec:tut:test}), but that you want to easily memoize selected pictures. You could define a memoized variant of the \cs{tikz} command, as shown -below (and similary for the environment). (Note the |%| comment characters in +below (and similarly for the environment). (Note the |%| comment characters in the definition of |\mmztikz|. The definition was intentionally broken into several lines to remind you that the spaces around the argument of \refcmd{mmz} matter.) -\ExampleName{mmztikz} -\makeexample{\examplename.pdf} -\tcbinputexample{ +\tcbinputexample{mmztikz}{ comment={\centering \includeexamplepdf[extern page]{page=1,trim=1in 1in 1in 1in} \quad @@ -835,9 +840,7 @@ circuits.\footnote{In section~\ref{sec:tut:test}, we learned that also offers key \refmmz{activate}, but you probably won't have to use it, as an \refmmz{auto} declaration automatically activates the submitted command.} -\ExampleName{automemoize-environment} -\makeexample{\examplename.pdf} -\tcbinputexample{ +\tcbinputexample{automemoize-environment}{ sidebyside, lefthand ratio=0.6, comment={\centering \includeexamplepdf[extern page]{page=1,trim=1in 1in 1in 1in,scale=0.8} @@ -879,9 +882,7 @@ Below, we write |args=om| because command \cs{qrcode} (of package \pkg{qrcode}) takes two arguments: a bracketed optional argument, followed by a mandatory argument (in braces). -\ExampleName{automemoize-command} -\makeexample{\examplename.pdf} -\tcbinputexample{ +\tcbinputexample{automemoize-command}{ sidebyside, lefthand ratio=0.603, top=0mm, comment={\centering \includeexamplepdf[extern page]{page=1,trim=1in 1in 1in 1in}\quad @@ -917,16 +918,14 @@ node with a red background. Let's say we compile the document (with memoization) and then change this style to set the yellow background. Curiously, the node will remain red. -\ExampleName{recompile} -\makeexample{\examplename.pdf N=3} \begin{tcbraster}[raster columns=2, raster valign=top, raster column skip=4mm] - \tcbinputexample{ + \tcbinputexample{recompile}(.c1){ after title pre={\ (version~1)}, comment={\centering \includeexamplepdf[document page]{page=2} }, } - \tcbinputexample[.tex][.c2]{ + \tcbinputexample{recompile}(.c2){ no attachment, after title pre={\ (version~2)}, comment={\centering @@ -947,7 +946,7 @@ automemoization). After the compilation, we should remove the \refmmz{recompile} directive, otherwise, Memoize will produce the extern page again and again). -\tcbinputexample[.tex][.c3]{ +\tcbinputexample{recompile}(.c3){ no attachment, after title pre={\ (version~3)}, sidebyside, lefthand ratio=0.6, @@ -971,9 +970,7 @@ The simplest way to achieve the former is by using key \Emph{\refmmz{disable}}; by putting it into a \hologo{TeX} group, we can localize its effect to the selected pictures. -\ExampleName{disable} -\makeexample{\examplename.pdf} -\tcbinputexample{ +\tcbinputexample{disable}{ sidebyside, lefthand ratio=0.6, top=0mm, % manual top, bottoms and \\[...] to fit the page @@ -1002,20 +999,13 @@ selected pictures. mark the parts of the document where memoization is \emph{disabled}.) \end{tcolorbox} -\makeexample{disable-bad.tex.c1} -\makeexample{disable-good.tex.c1} -\makeexample{disable-nomemoize.tex.c1} -\makeexample{disable-nommz.tex.c1} -\makeexample{disable-auto-cmd.tex.c1} -\makeexample{disable-auto-env.tex.c1} - \begin{tcbraster}[raster columns=2, raster equal height=rows] - \tcbinputexample(disable-bad){ + \tcbinputexample{disable-bad}{ listing and comment, bad, mark region={4}{7}, comment={\raggedright The upper \refcmd{mmzset}\braces{\refmmz{disable}} does not have the intended effect, i.e.\ it doesn't apply to the whole document!}} - \tcbinputexample(disable-good){ + \tcbinputexample{disable-good}{ listing and comment, mark region={4}{10}, comment={\raggedright The upper \refcmd{mmzset}\braces{\refmmz{disable}} applies to the entire document, as expected.}} @@ -1028,9 +1018,9 @@ memoization (triggered using environment \refenv{memoize} or macro \refcmd{mmz}) off and on. \begin{tcbraster}[raster columns=2, raster equal height=rows] - \tcbinputexample(disable-nomemoize){listing and comment, mark region={2}{2}, + \tcbinputexample{disable-nomemoize}{listing and comment, mark region={2}{2}, comment=\raggedright Disable using the dedicated environment.} - \tcbinputexample(disable-nommz){listing and comment, mark region={2}{2}, + \tcbinputexample{disable-nommz}{listing and comment, mark region={2}{2}, comment=\raggedright Disable using the dedicated command.} \end{tcbraster} @@ -1048,12 +1038,12 @@ autodisabling |\foo| prevents memoization of the inner \cs{tikz}, even though that command is normally automemoized. \begin{tcbraster}[raster columns=2, raster equal height=rows] - \tcbinputexample(disable-auto-cmd){ + \tcbinputexample{disable-auto-cmd}{ listing and comment, mark region={3}{3}, mark region={5}{5}, comment=\raggedright Autodisable within a command., } - \tcbinputexample(disable-auto-env){ + \tcbinputexample{disable-auto-env}{ listing and comment, mark region={3}{5}, comment=\raggedright Autodisable within an environment., @@ -1073,18 +1063,16 @@ What I like to do is load the package using |\usepackage[readonly]{memoize}|, work on stuff, and once I'm happy with the most recent pictures, remove \refmmz{readonly} from the package options for one compilation. -\ExampleName{readonly} -\makeexample{\examplename.pdf N=2} \begin{tcbraster}[raster columns=5, raster valign=top, raster column skip=4mm] - \tcbinputexample{ + \tcbinputexample{readonly}(.c1){ raster multicolumn=2, after title pre={\ (work in progress)}, comment={\centering \includeexamplepdf[document page]{page=1} }, } - \tcbinputexample[.tex][.c2]{ + \tcbinputexample{readonly}(.c2){ raster multicolumn=3, no attachment, title={\tt readonly.tex} (the final version), @@ -1117,9 +1105,7 @@ observe that \code{emph/.meaning to context} below is executed within \cs{tikzset} (where key \code{emph} was defined), not \refcmd{mmzset}; see \PGFmanual{87} to learn about key handlers. -\ExampleName{meaning-to-context} -\makeexample{\examplename.pdf N=2} -\tcbinputexample{ +\tcbinputexample{meaning-to-context}(.c1){ after title pre={\ (version~1)}, sidebyside, comment={\centering @@ -1127,7 +1113,7 @@ observe that \code{emph/.meaning to context} below is executed within }, } -\tcbinputexample[.tex][.c2]{ +\tcbinputexample{meaning-to-context}(.c2){ after title pre={\ (version~2)}, sidebyside, comment={\centering @@ -1179,20 +1165,16 @@ details.\cprotect\footnote{If you're using the \hologo{TeX}-based extraction accompanied by a \hologo{TeX} log file (|.log|) produced during the compilation that extracted the extern.} -\ExampleName{clean-house} -\makeexample{\examplename.pdf} {% - \relaxmmzcommands - \edef\marshal{% - \noexpand\def\noexpand\mynewextern\examplename - }\marshal.memo.dir/#1-#2.pdf\relax{% + \relaxmmzcommands + \def\mynewextern clean-house.memo.dir/#1-#2.pdf\relax{% \forestset{ append={[#1.memo\vphantom{p},pointcolor,name=cmemo]}, append={[#1-#2.memo\vphantom{p},pointcolor,name=ccmemo]}, append={[#1-#2.pdf,pointcolor,name=extern]}, }% } - \tcbinputexample{ + \tcbinputexample{clean-house}{ middle=1mm, comment={% \begin{tcolorbox}[reset, left=2mm, top=0mm, bottom=0mm, right=0mm, @@ -1234,20 +1216,16 @@ a dedicated directory) depicted above is courtesy of key \refmmz{memo dir}, which is in effect by default since Memoize version 1.3.0. Here's how a dirty house, which we can produce using key \refmmz{no memo dir}, would look like: -\ExampleName{dirty-house} -\makeexample{\examplename.pdf} { \relaxmmzcommands - \edef\marshal{% - \noexpand\def\noexpand\mynewextern\examplename - }\marshal.#1-#2.pdf\relax{% + \def\mynewextern dirty-house.#1-#2.pdf\relax{% \forestset{ append={[\examplename.#1.memo\vphantom{p},pointcolor]}, append={[\examplename.#1-#2.memo\vphantom{p},pointcolor]}, append={[\examplename.#1-#2.pdf,pointcolor]}, }% } - \tcbinputexample{ + \tcbinputexample{dirty-house}{ middle=1mm, comment={% \begin{tcolorbox}[reset, left=2mm, top=0mm, bottom=0mm, @@ -1380,13 +1358,9 @@ externs in directory \code{\meta{name}.memo.dir}.\footnote{Use key the auxiliary files.} (As you can see below on the left, \meta{name} may contain a directory part.) -\ExampleName{book} -\makeexample{\examplename.tex.c1} -\makeexample{chapters/chapter1.tex.c1} - \begin{tcbraster}[raster columns=2, raster valign=top] - \tcbinputexample{listing only} - \tcbinputexample(chapters/chapter1){listing only} + \tcbinputexample{book}{listing only} + \tcbinputexample{chapters/chapter1}{listing only} \end{tcbraster} In the above example, the individual chapters reside in files stored in the @@ -1445,8 +1419,6 @@ set), you will have a reasonably up-to-date set of externs. \end{tcblisting} \end{tcboxedraster} -\ExampleName{memoize.cfg._region_} -\makeexample{\examplename.tex.c1} \begin{tcolorbox}[title=For \Emacs users] I often use this \refmmz{readonly} trick myself, but with a twist. As an Emacs user, I don't use a \hologo{TeX}-based mechanism (such as the \pkg{docmute} package) to @@ -1477,9 +1449,8 @@ set), you will have a reasonably up-to-date set of externs. adapt the trick to use \refmmz{no memo dir} or an arbitrary \refmmz{prefix}.} - \tcbinputexample{ + \tcbinputexample{memoize-region}[.cfg]{ title=\tt memoize.cfg, - attachment name=memoize-region.cfg, listing only, } \end{tcolorbox} @@ -1489,17 +1460,13 @@ set), you will have a reasonably up-to-date set of externs. \label{sec:tut:beamer} Memoize ships with built-in support for the most widespread \hologo{LaTeX} -presentation class, Beamer, in the sense that it can externalize a picture -which changes from overlay to overlay. Before we learn how to use that -functionality, however, there's a peculiarity about loading Memoize in Beamer -to address. - -\ExampleName{beamer} -\makeexample{\examplename.pdf} +presentation class, Beamer. It allows for externalizing a picture which +changes from overlay to overlay, or which depends on the Beamer mode. However, +loading Memoize in Beamer is a bit peculiar: -\tcbinputexample{ +\tcbinputexample{beamer}{ comment and listing, - listing options app={lastline=2}, + listing options app={lastline=2}, % todo: firstline/lastline --> Makefile warning, no attachment, title=, % comment={Beamer opens the document PDF while loading the class, while @@ -1532,7 +1499,7 @@ any other options processed by \pkg{pgfkeys}.\footnote{Read The implementation only uses Memoize's public interface, so understanding it should help if you need to support some other presentation package.} -\tcbinputexample{ +\tcbinputexample{beamer}{ listing options app={firstline=3}, middle=1mm, comment={\def\dpwidth{0.27\linewidth}\def\epwidth{0.15\linewidth}% @@ -1551,6 +1518,12 @@ any other options processed by \pkg{pgfkeys}.\footnote{Read overlays. \end{tcolorbox} +Similarly, the externalized picture might depend on the Beamer mode (|beamer|, +|handout|, |trans| or |article|; for details, see \ManualBeamer[part IV of]). +In this case, use \refmmz{beamer mode to prefix}, but note that this key must +be invoked from \refcmd{mmzset} or \refcmd{mmznext}; it won't work if it is +executed in the memoized code. + \subsection{When stuff sticks out} \label{sec:tut:padding} @@ -1573,12 +1546,9 @@ temporarily disabled. In effect, the \refkey{/tikz/overlay} key on the pin below will fool \hologo{TeX} into thinking that the node is all there is to the picture, so centering will work as desired. -\ExampleName{overlay} -\makeexample{\examplename.pdf N=4} -\tcbinputexample{ +\tcbinputexample{overlay}(.c1){ after title pre={\ (no memoization)}, comment={\centering - % \includeexamplepdf[document page]{page=1,trim=1.8in 7.4in 1.8in 1.7in} \includeexamplepdf[document page]{page=1} }, } @@ -1595,9 +1565,9 @@ pin!\footnote{On the first compilation, the document page containing the figure than the extern file. But on the second compilation, when Memoize actually uses the extern, the pin disappears.} -\tcbinputexample[.tex][.c2]{ +\tcbinputexample{overlay}(.c2){ after title pre={\ (memoization without padding)}, - attachment name=\examplename-no-padding.tex, + attachment=overlay-no-padding.tex, sidebyside, lefthand ratio=0.3, comment={\centering \includeexamplepdf[size=minimal,boxrule=0.5mm,extern page, @@ -1618,9 +1588,9 @@ pin is only partially visible.\footnote{You might wonder why I didn't make the would be huge, most often bigger than the document pages, and remember that the externs are first dumped into the document, where they can bother you.} -\tcbinputexample[.tex][.c3]{ +\tcbinputexample{overlay}(.c3){ after title pre={\ (memoization with default padding)}, - attachment name=\examplename-default-padding.tex, + attachment=overlay-default-padding.tex, listing and comment, middle=0.9mm, comment={\centering @@ -1634,11 +1604,11 @@ The solution is to set the padding manually. Below, I used \refmmz{padding if you're not bothered by a large extern, you can just use \Emph{\refmmz{padding}}, which sets all four sides at once. By the way, having too much padding (almost) never hurts, and as you see, you can use (simple) -arithmetics in the value of these keys. +arithmetic in the value of these keys. -\tcbinputexample[.tex][.c4]{ +\tcbinputexample{overlay}(.c4){ after title pre={\ (memoization with extra padding)}, - attachment name=\examplename-extra-padding.tex, + attachment=overlay-extra-padding.tex, listing and comment, middle=0.9mm, comment={\centering @@ -1656,27 +1626,32 @@ everything works as it should! -\subsection{The verbatim mode} +\subsection{When things (seem to) go wrong} \label{sec:tut:verbatim} -Not all code will peacefully submit to memoization. In particular, this is the -case for environments which process the environment body verbatim (or perform -some other kind of \refcmd{catcode} magic). A simple environment of this kind is the -standard \hologo{LaTeX} \refenv{verbatim}, but let us illustrate the issue with -\refenv{tcblisting}, which typesets a code listing alongside its compiled effect. -(This environment is defined by the |listings| library of package \pkg{tcolorbox} -and was used extensively during the production of this manual.) To manually -memoize a \refenv{tcblisting} environment, we enclose it in a \refenv{memoize} -environment with a \Emph{\refmmz{verbatim}} key in the optional argument --- -without this key, the example below would produce nothing but -errors.\footnote{Memoize also offers a \emph{partial} verbatim mode, triggered - by key \refmmz{verb}; in this mode, the braces retain their usual category - codes. Also note that the effect of \refmmz{verbatim} can be ``undone'' by - key \refmmz{no verbatim}.} - -\ExampleName{verbatim-manual} -\makeexample{\examplename.pdf} -\tcbinputexample{ +Not all code will peacefully submit to memoization, at least not out of the +box. For one, this is the case for code containing a command or environment +which changes the category code of some character(s). Most notably, +\refcmd{catcode}s are changed by so-called verbatim environments like the +standard \hologo{LaTeX} \refenv{verbatim}, but other commands and environments +effect category code changes as well; one example is command \cs{matrix} (of +\TikZ{} library |matrix|). The solution is to use key +\Emph{\refmmz{verbatim}}, which instructs Memoize to collect the code ``as-is'' +(in \hologo{TeX}nical terms, under a catcode regime where all characters have +category code 12) and rescan it (with \cs{scantokens}) when starting the +memoization.\footnote{Memoize also offers a \emph{partial} verbatim mode, + triggered by key \refmmz{verb}; in this mode, the braces retain their usual + category codes. Also note that the effect of \refmmz{verbatim} can be + ``undone'' by key \refmmz{no verbatim}.} + +Let us illustrate the issue with environment \refenv{tcblisting} (library +|listings| of package \pkg{tcolorbox}), which typesets a code listing alongside +its compiled effect. To successfully manually memoize this environment, we +have to enclose it in a \refenv{memoize} environment containing key +\refmmz{verbatim} in the optional argument --- without +this key, the example below would produce nothing but errors. + +\tcbinputexample{verbatim-manual}{ sidebyside, comment={\centering \includeexamplepdf[extern page]{page=1,trim=1in 1in 1in 1in}\\[1ex] @@ -1687,19 +1662,15 @@ errors.\footnote{Memoize also offers a \emph{partial} verbatim mode, triggered Using \refmmz{verbatim} from \refcmd{mmzset} or \refcmd{mmznext} works just as well, and the latter can be very useful with automemoization, when some -environment (say, \env{tcolorbox}) generally does not require the verbatim mode, -but a specific occurrence does (say, because it contains some verbatim -construction such as \verb!|!\meta{verbatim text}\verb!|! of the \pkg{ltxdoc} -class). - -However, for an environment such as |tcblisting|, it makes the most sense to -declare it verbatim in general, so that all instances of the environment will -be processed in the verbatim mode. This is simple to do: add \refmmz{verbatim} -to the \refmmz{auto} keylist. - -\ExampleName{verbatim-auto} -\makeexample{\examplename.pdf} -\tcbinputexample{ +environment (say, \env{tcolorbox} of package \pkg{tcolorbox}) generally does +not require the verbatim mode, but a specific occurrence does (say, because it +contains a verbatim construct such as \verb!|!\meta{verbatim text}\verb!|! of +the \pkg{ltxdoc} class). However, for an environment such as |tcblisting|, it +makes the most sense to declare it verbatim in general, so that all instances +of the environment will be processed in the verbatim mode. This is simple to +do: add \refmmz{verbatim} to the \refmmz{auto} keylist. + +\tcbinputexample{verbatim-auto}{ sidebyside, % lefthand ratio=0.62, comment={\centering \footnotesize @@ -1720,6 +1691,49 @@ automemoization for \cs{tikz} was declared unless you've read section~\ref{sec:tut:automemoization-details} or looked at the Memoize's source code). +One other situation where a piece of code cannot be memoized out of the box is +when it is designed to operate in the vertical mode;\footnote{``Horizontal mode + is typically used to make lines of text; vertical mode is typically used to + stack the lines of a paragraph on top of each other.'' (\TeXbyTopic[\S6])} +examples include the standard \hologo{LaTeX} \refenv{verbatim} environment +(again) and environment \env{algorithmic} of bundle \pkg{algorithms}. The +problem arises because by default, Memoize collects the typeset material into a +horizontal box (\cs{hbox}), i.e.\ in the horizontal mode (note that there is no +way for Memoize to detect the mode required by the memoized code in advance). +Luckily, Memoize provides an easy solution: we simply have to instruct it to +memoize into a vertical box (\cs{vbox}), which we can achieve by writing +\Emph{\refmmz{capture}|=|\refmmz{capture=vbox}}, exemplified below with +environment \env{algorithmic}.\footnote{Note that this solution does not work + for commands and environments which operate in \emph{external} vertical mode; + see section~\ref{sec:limits} for details.} + +\tcbinputexample{capture}{ + sidebyside, lefthand ratio=0.53, middle=0pt, + comment={\centering + \includeexamplepdf[left=0.9em, right=0.9em]{page=2} + } +} + +\newcommand\ProblemsWithMemoization[1][above]{% + Some situations where memoization of otherwise healthy code produces errors + have easy solutions like the two presented #1. In other situations, like + those listed in section~\ref{sec:limits}, memoization is genuinely + impossible. Yet other situations lie somewhere in-between. Memoization is + possible, but implementing it requires some work and knowledge (of the rest + of this manual). To top it off, it is often hard to know which kind of + situation one is dealing with, not least because \hologo{TeX}'s error + messages can be quite uninformative on the subject. + + \Href{https://github.com/sasozivanovic/memoize/wiki}{Memoize wiki} on GitHub + lists several commands and environments, marking the issues which they + present to memoization, and providing solutions where possible. The list + will hopefully grow to encompass many commonly used commands, but if the + command you're struggling with is not there, feel free to drop me an email, + or (even better) post a question to + \Href{https://tex.stackexchange.com}{\hologo{TeX} StackExchange} (use tag + \texttt{memoize}).} + +\ProblemsWithMemoization \subsection{The final version of your document} \label{sec:tut:final} @@ -1736,7 +1750,7 @@ for two reasons: \end{itemize} Below, we list several ways of fully disabling Memoize. You're of course -already familar with the first two ways, but what's this \refpkg{nomemoize} +already familiar with the first two ways, but what's this \refpkg{nomemoize} package? The rationale behind this package is that if you want to be absolutely sure that there is no trace of memoization in your document (for example, see the \refmmz{disable} -- \refmmz{enable} pitfall in @@ -1794,8 +1808,8 @@ waiting for extraction). -\subsection{Good to know} -\label{sec:tut:good-to-know} +\subsection{The limits} +\label{sec:limits} \paragraph{Line- and page-breaking} An extern can't be broken across lines or @@ -1810,26 +1824,50 @@ or pages on subsequent compilations. If you try, the compilation will succeed --- without an error! --- but your externalized text will end up in a single line, as shown below. -\ExampleName{no-linebreaking} -\makeexample{\examplename.pdf N=2} -\tcbinputexample{ +\tcbinputexample{no-linebreaking}(.c1){ bad, comment={\centering \includeexamplepdf[extern page,to be continued on right] {page=1,trim=1in 1in 14in 1in}\\[1ex] \includeexamplepdf[document page]{page=2}\\[1ex] - \includeexamplepdf[document page,title=the expected document page] - [\examplepath.c2.pdf]{page=1} + \includeexamplepdf[document page,title=the expected document page](.c2){page=1} }, } -That said, you \emph{can} externalize a paragraph or some other vertical mode -material using \refmmz{capture}|=|\refmmz{capture=vbox}, but beware that the -vertical spacing between the memoized material and its surroundings might -change. +\paragraph{External vertical mode} + +Attempting to memoize a command or environment which operates in +\emph{external} vertical mode (called simply ``vertical mode'' in \TeXbook) +will fail, because Memoize can only operate in \emph{internal} vertical +mode.\footnote{In vertical mode, \hologo{TeX} is ``building the main vertical + list, from which the pages of output are created'', while it is ``building a + vertical list for a vbox'' in internal vertical mode. Similarly, in + horizontal mode, \hologo{TeX} is ``building a horizontal list for a + paragraph,'' while it is ``building a horizontal list for an hbox'' in + restricted horizontal mode. (All quotes are from \TeXbook[85].)} + +At one hand, any command or environment which needs interact with the page +breaking mechanism, like a command designed to break its output across pages, +has to operate in external vertical mode. An example of such an environment is +a \env{tcolorbox} with key \refkey{/tcb/breakable} or \refkey{/tcb/float}. On +the other hand, Memoize can only externalize boxes, and to gather typeset +material in a box, it needs to operate either in restricted horizontal mode (by +default) or internal vertical mode (when asked to do so by +\refmmz{capture}|=|\refmmz{capture=vbox}). + +In a nutshell, Memoize is inherently incompatible with external vertical mode. +For example, an attempt to memoize a breakable \env{tcolorbox} will fail --- +even if the environment ends up producing a non-broken box. As far as I see, +the only way to support memoization of a command which has to operate in +external mode is from within the package defining the command; the command must +be reimplemented in a Memoize-friendly fashion, perhaps using the ideas +presented in sections~\ref{sec:memoizable-design} +and~\ref{sec:memoization-complex-single-driver}. -\paragraph{\env{remember picture}} + + +\paragraph{\refkey{/tikz/remember picture}} \TikZ pictures using this key cannot be externalized. Memoize will silently refuse to externalize any \TikZ picture using @@ -1887,7 +1925,7 @@ time \refcmd{begin}\meta{environment name} is executed, like when you use the environment normally in your document, or when some macro expands so that it produces both \cs{begin}\meta{environment name} and \cs{end}\meta{environment name} simultaneously --- so there would be no problem above if - |\end{minipage}| occured in the beginning code of \env{sectionbox}. The idiom + |\end{minipage}| occurred in the beginning code of \env{sectionbox}. The idiom presented above is problematic for memoization because at the time \hologo{TeX} executes |\begin{sectionbox}|, putting |\begin{minipage}| into the input stream, |\end{sectionbox}| is not yet executed and remains as it is. The @@ -1902,8 +1940,6 @@ there is only |\end{sectionbox}|, and this results in the |Environment "minipage" ended as "sectionbox"| error.} \begingroup -\ExampleName{sectionbox} -\makeexample{\examplename.tex.c1} \mmzset{disable} \begin{tcbraster}[raster equal height] \begin{tcblisting}{listing only, bad, valign=center} @@ -1919,7 +1955,7 @@ there is only |\end{sectionbox}|, and this results in the |Environment % ... } \end{tcblisting} -\tcbinputexample{ +\tcbinputexample{sectionbox}{ bad, comment={\small\tt ! Package collargs Error: Environment\\"minipage" ended as "sectionbox". @@ -2169,7 +2205,7 @@ load Memoize. Out of the box, Memoize stores memos and externs in a separate directory, \code{\meta{document name}.memo.dir}, creating this directory if it does not exist. This behaviour, illustrated in section~\ref{sec:tut:memodir}, is -trigerred by key \refmmz{memo dir}, which is in effect by default since Memoize +triggered by key \refmmz{memo dir}, which is in effect by default since Memoize version~1.3.0. It is however worth noting that something rather unusual is happening behind @@ -2216,7 +2252,7 @@ neither Perl nor Python (note that this does not apply to \TeXLive, as works with the built-in Perl). Of course, this situation is undesirable in and of itself, as it forces the author to fall back to the slower \hologo{TeX}-based extraction by issuing -\code{\refmmz{extract}=\refmmz{extract=tex}}, but note that it will additionaly +\code{\refmmz{extract}=\refmmz{extract=tex}}, but note that it will additionally prevent the execution of the default \refmmz{mkdir command}. Possible workarounds include either undoing the effect of \refmmz{memo dir} by issuing \refmmz{no memo dir}, or changing the \refmmz{mkdir command} to a command like @@ -2271,8 +2307,6 @@ learn about key \refmmz{context}, the backbone of the cross-referencing support in Memoize. (The inner workings of the context are further explained in section~\ref{sec:c-memos}.) -\ExampleName{ref} -\makeexample{\examplename.pdf N=7} When the memoized code contains a \cs{ref} referring to a label given in another part of the document, the code is recompiled when (and only when) the reference @@ -2284,7 +2318,7 @@ of \href{https://ctan.org/pkg/tikzlings}{Ti\emph{k}Zlings}, so that their externs don't disturb us, and we can focus on the \cs{tikz} command, which does get externalized and contains a \cs{ref}.) -\tcbinputexample[.tex][.c3]{ +\tcbinputexample{ref}(.c3){ after title pre={\ (with stable output after three compilations)}, middle=1mm, comment={\centering @@ -2297,7 +2331,7 @@ the ``normal'' nor the memoized reference is yet updated, as expected --- in this compilation, the new value of the penguin label only makes it into the |.aux| file. -\tcbinputexample[.tex][.c4]{ +\tcbinputexample{ref}(.c4){ after title pre={\ (after the first compilation with the added owl)}, no attachment, comment={\centering @@ -2310,7 +2344,7 @@ penguin label, and the \cs{ref} inside the automemoized \cs{tikz} command forces recompilation of the extern (\emph{how} this is done will be explained later). -\tcbinputexample[.tex][.c5]{ +\tcbinputexample{ref}(.c5){ after title pre={\ (after the second compilation with the added owl)}, comment only, no attachment, comment={\centering @@ -2322,7 +2356,7 @@ later). In the next compilation, the resulting PDF is finally stabilized, as the updated extern is (extracted and) included into the document. -\tcbinputexample[.tex][.c6]{ +\tcbinputexample{ref}(.c6){ after title pre={\ (after the third compilation with the added owl)}, comment only, no attachment, comment={\centering @@ -2342,13 +2376,11 @@ This framework is a generalization of automemoization: we use the familiar \refmmz{auto}, but with advice offered by \Emph{\refmmzauto{ref}} rather than \refmmzauto{memoize}. -{\ExampleName{vref} -\makeexample{\examplename.tex.c1} -\tcbinputexample{listing only}} +\tcbinputexample{vref}{listing only} Key \refmmzauto{ref} only works for commands which operate on a single reference key. However, that single key (which must be enclosed in braces) may -be preceded by optional argumen(s) of any kind. Extensions to \refcmd{ref}, +be preceded by optional argument(s) of any kind. Extensions to \refcmd{ref}, e.g.\ the \pkg{hyperref}'s variant, which accepts an optional |*|, work out of the box. Furthermore, Memoize offers support for cross-referencing commands which work on multireferences and reference ranges, such as \pkg{cleveref}'s @@ -2366,7 +2398,7 @@ thing is that we don't get the extern page containing This is so because by default, Memoize aborts a memoization containing an undefined reference. -\tcbinputexample[.tex][.c1]{ +\tcbinputexample{ref}(.c1){ after title pre={\ (after the fresh compilation of the original example)}, comment only, no attachment, comment={\centering @@ -2380,12 +2412,12 @@ containing the \cs{label} much later but enjoy the speed-up offered by Memoize until then. In that case, apply the \refmmz{auto} key \Emph{\refmmzauto{force ref}} to \cs{ref}. -\tcbinputexample[.tex][.c7]{ +\tcbinputexample{ref}(.c7){ after title pre={\ (after the fresh compilation with \refmmzauto{force ref})}, - attachment name=\examplename-force.tex, + attachment=ref-force.tex, comment={\centering - \includeexamplepdf[extern page][\examplepath.c1.pdf]{page=1,trim=1in 1in 1in 1in}\quad - \includeexamplepdf[document page][\examplepath.c1.pdf]{page=2} + \includeexamplepdf[extern page](.c1){page=1,trim=1in 1in 1in 1in}\quad + \includeexamplepdf[document page](.c1){page=2} } } @@ -2407,16 +2439,14 @@ recompiled whenever the font size changes. Below, we change the font size using command |\small|; changing the default size with a class option such as |12pt| works as well. -\ExampleName{fontsize} -\makeexample{\examplename.pdf N=2} -\tcbinputexample{ +\tcbinputexample{fontsize}(.c1){ sidebyside, lefthand ratio=0.7, after title pre={\ (the first version)}, comment={ \includeexamplepdf[extern page]{page=1,trim=1in 1in 1in 1in} } } -\tcbinputexample[.tex][.c2]{ +\tcbinputexample{fontsize}(.c2){ sidebyside, lefthand ratio=0.7, after title pre={\ (the second version)}, no attachment, comment={ @@ -2477,9 +2507,7 @@ will be one and the same board! The solution is to provide the correct context: we dig into the \pkg{skak} sources and realize that the current board is stored in macro |\csname chessgame.skak.mainline\endcsname|. -\ExampleName{skak} -\makeexample{\examplename.pdf} -\tcbinputexample{ +\tcbinputexample{skak}{ sidebyside, lefthand ratio=0.48, comment={ \includeexamplepdf[extern page]{page=1,trim=1in 1in 1in 1in,scale=0.45}\quad @@ -2506,37 +2534,35 @@ depends on some macro or style which gets redefined? The answer was the example from that section a bit further. We will propose no new solution or workaround, but deepen our understanding of the issue. -\ExampleName{redefinitions} -\makeexample{\examplename.pdf N=6} \tcbset{ recompile step/.style={ sidebyside, lefthand ratio=0.74, title=, - comment={\includeexamplepdf[blankest][\examplepath.c\theenumi.pdf]{#1}}, + comment={\includeexamplepdf[blankest][redefinitions](.c\theenumi){#1}}, /utils/exec={\addtocounter{enumi}{1}}, enhanced, overlay app={\node[at=(frame.north west), font=\scriptsize, circle, fill=black!80!white, text=white, inner sep=1pt]{\theenumi};}, }, } \begin{tcboxedraster}[raster columns=1]{% - title=Working on \texttt{\examplename.tex}, enhanced, breakable} + title=Working on \texttt{redefinitions.tex}, enhanced, breakable} \setcounter{enumi}{0}% \tcbox[blankest]{I like red. My emphasized nodes will have red background.} - \tcbinputexample[.tex][.c1]{recompile step={page=2}} + \tcbinputexample{redefinitions}(.c1){recompile step={page=2}} \tcbox[blankest]{Hmm, this particular node is really important, let me put the text in italics as well!} - \tcbinputexample[.tex][.c2]{recompile step={page=2}, no attachment} + \tcbinputexample{redefinitions}(.c2){recompile step={page=2}, no attachment} \tcbox[blankest]{You know what? Perhaps yellow background would work better --- in general.} - \tcbinputexample[.tex][.c3]{recompile step={page=1}, bad, no attachment} + \tcbinputexample{redefinitions}(.c3){recompile step={page=1}, bad, no attachment} \tcbox[blankest]{How come my node is still red?! Oh yes, I changed the style, so I have to recompile the extern!} - \tcbinputexample[.tex][.c4]{recompile step={page=2}, no attachment} + \tcbinputexample{redefinitions}(.c4){recompile step={page=2}, no attachment} \tcbox[blankest]{Ahh, yellow background, that's much better. But you know what, this double emphasis won't do after all, let me go back to the upright shape.} - \tcbinputexample[.tex][.c5]{recompile step={page=1}, bad, no attachment} + \tcbinputexample{redefinitions}(.c5){recompile step={page=1}, bad, no attachment} \tcbox[blankest]{Red???!???!? Ok, I know that recompiling will help, but what happened here?} - \tcbinputexample[.tex][.c6]{recompile step={page=2}, no attachment} + \tcbinputexample{redefinitions}(.c6){recompile step={page=2}, no attachment} \end{tcboxedraster} What happened is that the externs from steps~1 and~5 share the very same code. @@ -2593,9 +2619,7 @@ overwriting the first one. The second compilation pulls in the externs --- or rather, the single extern --- resulting in the document containing the second progressbar in the place of the first one as well. -\ExampleName{progressbar} -\makeexample{\examplename.pdf N=2} -\tcbinputexample{ +\tcbinputexample{progressbar}(.c1){ bad, float, comment={ \begin{tcbitemize}[raster columns=3,raster equal height,halign=center,valign=center] @@ -2606,7 +2630,7 @@ progressbar in the place of the first one as well. \tcbitem[title=After extern extraction\vphantom{p\textsuperscript{nd}}] \includeexamplepdf[my boxed title=the extern file,attach shifted boxed title to top right,remember as=externfile]{page=2,trim=1in 1in 1in 1in} \tcbitem[title=After 2\textsuperscript{nd} compilation] - \includeexamplepdf[document page,remember as=doc][\examplepath.c2.pdf]{page=1} + \includeexamplepdf[document page,remember as=doc](.c2){page=1} \end{tcbitemize} \begin{tikzpicture}[remember picture,overlay] \draw[->, thick, red] (extern1.east) to[out=east, in=west] ([yshift=0.5ex]externfile.west); @@ -2736,10 +2760,7 @@ stretch and shrink for |1ex|); furthermore, the default value of |before| contains |\centering| to center the box horizontally (centering is of course only observable when we change the width of the box). -\ExampleName{poormansbox} -\makeexample{\examplename.sty} -\makeexample{\examplename.pdf} -\tcbinputexample{ +\tcbinputexample{poormansbox}{ sidebyside, lefthand ratio=0.482, comment={\centering \includeexamplepdf[document page,left=0pt,right=0pt] @@ -2762,7 +2783,7 @@ section~\ref{sec:memoization-complex-single-driver}, the implementation will have to pay special attention to nesting (which presents no problem to the implementation in this section). -As you can see in the package listing below (\texttt{\examplename.sty}), the +As you can see in the package listing below (\texttt{poormansbox.sty}), the implementation of our environment is straightforward. We first define the configuration command |\pmbset| and the option keys (we're using \pkg{pgfkeys}), and set the option defaults. Then, we move on to the @@ -2770,10 +2791,9 @@ environment itself: we apply the given options, execute the pre-code, typeset the box (which is a |minipage| of the given width, potentially wrapped in a |\fbox|), and execute the post-code. -\tcbinputexample[.sty]{listing only, float} +\tcbinputexample{poormansbox}[.sty]{listing only, float} -\ExampleName{poormansbox-memoizable} -Now let's make our |poormansbox| externalizable (\texttt{\examplename.sty}). As +Now let's make our |poormansbox| externalizable (\texttt{poormansbox-memoizable.sty}). As announced above, the idea is to split the definition of the environment into the outer part (below, the user-level environment |poormansbox|), which (applies the options and) executes the pre- and the post-code, and the inner @@ -2792,13 +2812,11 @@ extern (the fixed-size box) at subsequent compilations.\cprotect\footnote{You part of the definition as an environment (|@poormansbox|) as well, and embed it into the user-level environment using the following idiom: |\newenvironment{poormansbox}[2][]{...\begin{@poormansbox}}{\end{@poormansbox}...}|. - However, as illustrated in section~\ref{sec:tut:good-to-know}, automemoizing + However, as illustrated in section~\ref{sec:limits}, automemoizing an environment indirectly embedded in such a way produces an error, because Memoize is prevented from collecting the environment body.} -\makeexample{\examplename.sty} -\makeexample{\examplename.pdf}% just to know if it compiles fine -\tcbinputexample[.sty]{listing only, float} +\tcbinputexample{poormansbox-memoizable}[.sty]{listing only, float} Looking at the definition of the internal |\@poormansbox| command, it might strike you as weird that we have equipped this command with an optional @@ -2849,7 +2867,7 @@ carefully read |poormansbox|'s documentation. Even worse, the above \refcmd{mmzset} command will not work unless surrounded by |\makeatletter| and |\makeatother|, as it refers to an internal control sequence containing |@|. Well, Memoize offers \refmmz{auto csname}, \refmmz{activate csname} and -\refmmz{deactivate csname}, so that |@| catagory code manipulations can be +\refmmz{deactivate csname}, so that |@| category code manipulations can be omitted by writing \refcmd{mmzset}\bracestt{\refmmz{deactivate csname}|=@poormansbox|}, but still. @@ -2870,24 +2888,12 @@ even if this might actually count as an advantage, as the discrepancy will at least inform the author who refuses to read the fine material accompanying our |poormansbox| that something funky is going on. -\begingroup -\relaxmmzcommands -\def\mmzNewCMemo#1{% fetch the last c-memo filename - \def\mycmemo{#1}% -} -\input{\examplepath.mmz.c1} -\sed{% - s/[]]\lbrace/]\n\space\space\space\space\space\space\space - \space\space\space\space\space\space\space\lbrace/; -}{\exampledir\mycmemo} -\tcbinputlisting{ +\tcbinputexample{poormansbox-memoizable}[.cmemo]{ listing only, - listing file=\exampledir\mycmemo, - example title, title=the c-memo of the last \texttt{poormansbox} environment, - left=0.5em, right=0em, + no attachment, } -\endgroup + In a nutshell, automemoizing an internal command might be counter-intuitive for the author. But the core idea --- to support memoization of a resistant @@ -2997,16 +3003,14 @@ identify the extern: the extern produced by \refcmd{mmz} was overwritten by the extern produced by \refcmd{Memoize}, in the fashion of the |progressbar| example from section~\ref{sec:tut:redefinitions}. -\ExampleName{memoize-internal} -\makeexample{\examplename.pdf N=2} -\tcbinputexample{ +\tcbinputexample{memoize-internal}(.c1){ comment={% \includeexamplepdf[document page, after title pre={\ (after the first compilation)} ]{page=3}\hfill \includeexamplepdf[document page, after title pre={\ (after the second compilation)} - ][\examplepath.c2.pdf]{page=1} + ](.c2){page=1} }, } @@ -3131,20 +3135,11 @@ Let us take a look at the contents of a cc-memo in detail. Here's a typical cc-memo (it belongs to the titlepage penguin): \begingroup -\relaxmmzcommands -\def\mmzNewCCMemo#1{% fetch the first cc-memo filename - \def\myccmemo{#1}% - \endinput -} -\input{\exampledir titlepage.mmz.c1} -\sed{% - s/\cmd{quitvmode} \cmd{mmzIncludeExtern}/\cmd{quitvmode}\n\cmd{mmzIncludeExtern}/; - s/\(\marg\)\cmd{global}/\1\n\cmd{global}/; -}{\exampledir\myccmemo} -\tcbinputlisting{ +\input{\exampledir titlepage.ccmemo}% --> \mymemo +\tcbinputexample{titlepage}[.ccmemo]{ listing only, - listing file=\exampledir\myccmemo, - example title=\myccmemo, + no attachment, + example title=\mymemo, } \endgroup @@ -3161,9 +3156,10 @@ two commands. The first one is \refcmd{quitvmode} and it is included if the extern was \refmmz{capture}d into a horizontal box (which is the usual situation). The second one is \refcmd{mmzIncludeExtern}, and it is this command which actually includes the extern into the document upon inputting the -cc-memo. The core code is executed without introducing any groups, i.e.\ the -effect of any local assignments in the cc-memo will persist into the code -following the memoized code. +cc-memo. (The third command above, \refcmd{mmzStepPgfPictureId}, is written +by PGF support, see section~\ref{sec:support:pgf}.) The core code is executed +without introducing any groups, i.e.\ the effect of any local assignments in +the cc-memo will persist into the code following the memoized code. Command \refcmd{mmzIncludeExtern} takes nine parameters. The first is the sequential number of the extern associated with the cc-memo, starting with 0; @@ -3180,16 +3176,14 @@ described in section~\ref{sec:tut:automemoization-details}, Memoize hacks \refcmd{label} to support \cs{label}s inside memoized code --- the following code ``just works.'' -\ExampleName{label} -\makeexample{\examplename.pdf N=3} -\tcbinputexample{ +\tcbinputexample{label}(.c1){ comment={\centering \includeexamplepdf[document page, after title pre={\ (compilation 1)}, left=1.5mm, right=1mm]{page=2}\quad \includeexamplepdf[document page, after title pre={\ (compilation 2)}, - left=1.5mm, right=1mm][\examplepath.c2.pdf]{page=1}\quad + left=1.5mm, right=1mm](.c2){page=1}\quad \includeexamplepdf[document page, after title pre={\ (compilation 3)}, - left=1.5mm, right=1mm][\examplepath.c3.pdf]{page=1} + left=1.5mm, right=1mm](.c3){page=1} }, } @@ -3223,23 +3217,11 @@ into \cs{@currentlabel} and to execute \cs{label}\marg{label name}. In effect, compilation, even if the memoized code itself is not compiled. \begingroup -\relaxmmzcommands -\def\mmzNewCCMemo#1{% fetch the first cc-memo filename - \def\myccmemo{#1}% - \endinput -} -\input{\examplepath.mmz.c1} -\sed{% - s/~//g; - s/\cmd{quitvmode} \cmd{mmzLabel}/\cmd{quitvmode}\n\cmd{mmzLabel}/; - s/\(\marg\)\cmd{mmzIncludeExtern}/\1\n\cmd{mmzIncludeExtern}/; - s/\(\cmd{mmzLabel}\) *\(\marg\marg\) */~\1\2~\space/g; - s/\(\marg\marg\marg\)\(\marg\marg\marg\marg\marg\)/\1\space\2/; -}{\exampledir\myccmemo} -\tcbinputlisting{float, +\input{\exampledir label.ccmemo} +\tcbinputexample{label}[.ccmemo]{float, listing only, right=1.5mm, - listing file=\exampledir\myccmemo, - example title=\myccmemo, + example title=\mymemo, + no attachment, } \endgroup @@ -3320,16 +3302,11 @@ are lost in the c-memo replica (unless \refmmz{verbatim} is in effect), but we will only see this once we arrive at the \pkg{beamer} example below. \begingroup -\relaxmmzcommands -\def\mmzNewCMemo#1{% fetch the first c-memo filename - \def\mycmemo{#1}% - \endinput -} -\input{\exampledir titlepage.mmz.c1} -\tcbinputlisting{ +\input{\exampledir titlepage.cmemo} +\tcbinputexample{titlepage}{% todo listing only, - listing file=\exampledir\mycmemo, - example title=\mycmemo, + listing file=\exampledir\mymemo, + example title=\mymemo, } \endgroup @@ -3343,20 +3320,11 @@ cross-reference macro to token register \refcmd{mmzContextExtra}, holding the context expression additions. \begingroup -\relaxmmzcommands -\def\mmzNewCMemo#1{% fetch the first c-memo filename - \def\mycmemo{#1}% - \endinput -} -\input{\exampledir ref.mmz.c1} -\sed{% - s/~//g; - s/\cmd{global}.*\marg/~\0~/; -}{\exampledir\mycmemo} -\tcbinputlisting{ +\input{\exampledir ref.cmemo} +\tcbinputexample{ref}[.cmemo]{ listing only, - listing file=\exampledir\mycmemo, - example title=\mycmemo, + no attachment, + example title=\mymemo, } \endgroup @@ -3379,12 +3347,9 @@ environment, |listii|. While it prefixes each item by an indented referencing works as usual. However, problems arise when we automemoize the inner environment. -\ExampleName{label+} -\makeexample{\examplename.tex.c1 N=6} -\makeexample{\examplename.pdf N=2} -\tcbinputexample{ +\tcbinputexample{label+}(.c1){ sidebyside, lefthand ratio=0.53, - comment={\centering\includeexamplepdf[document page][\examplepath.c2.pdf]{page=1}}, + comment={\centering\includeexamplepdf[document page](.c2){page=1}}, } While the result looks fine at first, changing the order of |listii| @@ -3393,22 +3358,11 @@ problem: the reference at the bottom will remain unchanged. This is so because the reference text is baked into the cc-memo, as shown below. \begingroup -\relaxmmzcommands -\def\mmzNewCCMemo#1{% fetch the first cc-memo filename - \def\myccmemo{#1}% - \endinput -} -\input{\examplepath.mmz.c1} -\sed{% - s/~//g; - s/\cmd{mmzLabel} \marg\marg/~\0~/; - s/\(\marg\)\(\cmd{mmzIncludeExtern}\)/\1 \2/; - s/\(\marg\marg\marg\)\(\marg\marg\marg\marg\marg\)/\1\space\2/; -}{\exampledir\myccmemo} -\tcbinputlisting{ +\input{\exampledir label+.ccmemo} +\tcbinputexample{label+}[.ccmemo]{ listing only, - listing file=\exampledir\myccmemo, - example title=\myccmemo, + no attachment, + example title=\mymemo, } \endgroup @@ -3416,14 +3370,14 @@ How can we remedy this? The manual option is to force the recompilation of the extern by putting an (invisible) reference to the outer item into the inner item: add |\label{item:pets}| to item ``pets'' and refer to it at ``dog'' by \refcmd{mmzNoRef}|{item:pets}|.% -\attachexample[\examplename mmzNoRef.tex][\examplepath.tex.c3.attachment] +\attachexample[label+mmzNoRef.tex][\exampledir label+.tex.c3.attachment] An automatic variant of the recompilation solution is to add \cs{@currentlabel} to the context upon memoizing |listii|. This can be achieved by adding \refmmz{context}|={@currentlabel={\csuse{@currentlabel}}}| to the \refmmz{auto} declaration for |listii|. The downside of this approach is that every |listii| will get reexternalized upon movement, whether it actually contains a label or -not.\attachexample[\examplename context.tex][\examplepath.tex.c4.attachment] +not.\attachexample[label+context.tex][\exampledir label+.tex.c4.attachment] In fact, given that the externs produced by the inner environment do not contain the value of the outer counter, it seems wasteful to recompile any @@ -3440,7 +3394,7 @@ the extern. Note again, however, that this solution can only work when the value of the outer counter does not appear in the extern, i.e.\ it would not work the ``dog'' item was prefixed by |1a)| rather than simply |a)|. In those cases, one should deploy one of the other solutions.% -\attachexample[\examplename listii.tex][\examplepath.tex.c5.attachment] +\attachexample[label+listii.tex][\exampledir label+.tex.c5.attachment] The final solution, presented below, is an elaboration on the second one. Rather than append \cs{@currentlabel} to the context immediately upon beginning @@ -3473,8 +3427,8 @@ code which directly manipulates settings macros like \refcmd{AdviceOuterHandler} (for the full list, see section~\ref{sec:tut:automemoization-details} or~\ref{sec:ref:advice}). -\tcbinputexample[.tex][.c6]{listing only, float, - attachment name=\examplename auto.tex, +\tcbinputexample{label+}(.c6){listing only, float, + attachment=label+auto.tex, } Within \refcmd{AdviceSetup}, we prefix (using macro \cs{preto} of package @@ -3541,11 +3495,13 @@ these files. An easy way to achieve this is to furnish them with a dummy should be understood as relative to our memoized picture, i.e.\ as the final overlay containing the memoized picture.}\footnote{Actually, putting this \cs{only} command only into the first cc-memo would suffice, but would be - harder to implement.} but there is a problem: the final overlay number is -unknown when we're memoizing our picture --- it is unknown even when we're -memoizing the picture on final overlay itself (we simply don't know yet that -this overlay will end up being the final one), let alone during the memoization -on the first overlay. + harder to implement.}\footnote{In the actual implementation, the \meta{final + overlay number} is also prefixed by \code{all:}, to have this work in all + Beamer modes.} but there is a problem: the final overlay number is unknown +when we're memoizing our picture --- it is unknown even when we're memoizing +the picture on final overlay itself (we simply don't know yet that this overlay +will end up being the final one), let alone during the memoization on the first +overlay. The solution exploits the fact that \emph{the c-memo is rewritten at each memoization}: at each memoization of our picture, we store the the @@ -3556,9 +3512,7 @@ macro definition, and then use the defined macro, |\mmzBeamerOverlays|, in the overlay specification of the dummy |\only|. Below, you can see all this in code, as the argument to \refmmz{at begin memoization}. -\ExampleName{per-overlay-v1} -\makeexample{\examplename.sty} -\tcbinputexample[.sty]{ +\tcbinputexample{per-overlay-v1}[.sty]{ listing only, title={The implementation of \refmmz{per overlay} (first attempt)}, } @@ -3626,22 +3580,20 @@ value of |beamerpauses| at utilization. This leads to the \medskip % manual, to avoid an orphan -\ExampleName{per-overlay} -\makeexcerpt{per-overlay} -\tcbinputexample[.tex][.excerpt]{% - listing only, one file, - left=0pt, % manual indentation gobble +\tcbinputexample{per-overlay}[.excerpt]{% + listing only, no .listing, title={The implementation of \refmmz{per overlay}}, } Are we done? Almost. The final issue is that once we have introduced support for pauses, we have to relativize |\mmzBeamerOverlays| (the final overlay number) to |beamerpause|. So instead of a simple |\gdef\mmzBeamerOverlays| in -the first version, we define |\mmzSetBeamerOverlays|\nohyphen\marg{beamer - pauses}\marg{final overlay number}, which sets |\mmzBeamerOverlays| only if -\meta{beamer pauses} argument matches the value of |beamerpauses| (at its -invocation in the c-memo). Well, the macro has some other housekeeping to do -as well: it is self-replicating, so that during potential memoization, the +the first version, we define +\docaux{cmd}{mmzSetBeamerOverlays}\nohyphen\marg{beamer pauses}\marg{final + overlay number}, which sets |\mmzBeamerOverlays| only if \meta{beamer pauses} +argument matches the value of |beamerpauses| (at its invocation in the c-memo). +Well, the macro has some other housekeeping to do as well: it is +self-replicating, so that during potential memoization, the |\mmzBeamerOverlays| values belonging to non-current |beamerpauses| values get rewritten into the c-memo.\footnote{As replication should only occur during memoization (actually, it \emph{can} only occur then, anyway), the @@ -3659,49 +3611,66 @@ only the instance with the greatest \meta{final overlay number} is replicated.) We are now truly done, and we can look at the final result, the c-memo and the cc-memo belonging to the extern on the first overlay of the example from -section~\ref{sec:tut:beamer}. Specifically, look at the |\mmzSetBeamerOverlays -{1}{2}|, which says that the extern chain started when |beamerpauses| equals 1 -should continue up to overlay 2, and at the (expanded) context included at the -end of the cc-memo, courtesy of \refmmz{include context in ccmemo}, where you -can see that the cc-memo will be used when on the first overlay (|overlay=1|) -when preceded by no \cs{pause} command (|pauses=1|). +section~\ref{sec:tut:beamer}. Specifically, look at the +\code{\refcmd{mmzSetBeamerOverlays}\braces{1}\braces{2}}, which says that the +extern chain started when |beamerpauses| equals 1 should continue up to overlay +2, and at the (expanded) context included at the end of the cc-memo, courtesy +of \refmmz{include context in ccmemo}, where you can see that the cc-memo will +be used when on the first overlay (|overlay=1|) when preceded by no \cs{pause} +command (|pauses=1|). \begingroup -\relaxmmzcommands -\def\mmzNewCMemo#1{% fetch the first c-memo filename - \def\mycmemo{#1}% -} -\def\mmzNewCCMemo#1{% fetch the first cc-memo filename - \def\myccmemo{#1}% - \endinput +\input{\exampledir beamer.cmemo} +\tcbinputexample{beamer}[.cmemo]{ + listing only, + no attachment, + example title=\mymemo, } -\input{\exampledir beamer.mmz.c1} -\sed{% - s/~//g; - s/\cmd{mmzSetBeamerOverlays} \marg\marg/~\0~/; -}{\exampledir\mycmemo} -\sed{% - s/~//g; - s/overlay=[0-9]*/~\0~/; - s/pauses=[0-9]*/~\0~/; - s/\(\cmd{quitvmode}\) \(\cmd{only}\)/\1\n\2/; - s/\rbrace\(\cmd{mmzIncludeExtern}\)/\rbrace\percentchar\n\1/; - s/\rbrace\(\cmd{setcounter}\)/\rbrace\percentchar\n\1/; - s/\(\marg\)\cmd{global}/\1\n\cmd{global}/; -}{\exampledir\myccmemo} - -\tcbinputlisting{ +\input{\exampledir beamer.ccmemo} +\tcbinputexample{beamer}[.ccmemo]{ listing only, - listing file=\exampledir\mycmemo, - example title=\mycmemo, + no attachment, + example title=\mymemo, } +\endgroup + -\tcbinputlisting{ - listing only, - listing file=\exampledir\myccmemo, - example title=\myccmemo, +\paragraph{An application of \refmmz{salt}} + +Knowing the role of a c-memo in driving the creation of Beamer overlays, we are +ready for an application of a key from the \refmmz{salt} family. Key +\refmmz{salt} has a similar effect to \refmmz{context}: it contributes towards +an md5 sum of a memo. However, unlike \refmmz{context}, \refmmz{salt} impacts +the code hash, which is actually the md5 sum of the concatenation of the salt +and the memoized code. (As this md5 sum is calculated prior to memoization, +using \refmmz{salt} and friends during memoization has no effect.) + +While \refmmz{salt} and \refmmz{context} are most often interchangeable, the +following example crucially requires the former. The goal is to have the memos +and externs depend on the definition of command \cs{N}. In non-Beamer +documents, we can achieve this by putting the meaning of \cs{N} into the +context. In Beamer documents, however, this does not work. Each meaning of +\cs{N} should form a separate chain of externs, and these chains may be of +different length (and in the example, they are). As we are storing the length +of the chains in c-memos (in \refcmd{mmzSetBeamerOverlays}), it follows that +each value of \cs{N} should receive its own c-memo. A c-memo is identified by +a single md5 sum, the code md5 sum, so the meaning of \cs{N} must contribute +towards this md5 sum. In other words, we must salt the memoized code with the +meaning of \cs{N}. Below, if we had put \cs{N} into the context rather than +the salt, the two frames would create the same number of overlays: two, the +number of overlays created by the final frame. + + +\tcbinputexample{salt}{ + sidebyside, lefthand ratio=0.65, + comment={\centering + \includeexamplepdf[extern page,left=2mm,right=2mm]{page=1,trim=1in 1in 1in 1in}\\[1ex] + \includeexamplepdf[extern page,left=2mm,right=2mm]{page=3,trim=1in 1in 1in 1in}\\[1ex] + \includeexamplepdf[extern page,left=2mm,right=2mm]{page=5,trim=1in 1in 1in 1in}\\[1ex] + \includeexamplepdf[extern page,left=2mm,right=2mm]{page=7,trim=1in 1in 1in 1in}\\[1ex] + \includeexamplepdf[extern page,left=2mm,right=2mm]{page=9,trim=1in 1in 1in 1in} + }, } -\endgroup \subsection{Record files} @@ -3734,19 +3703,13 @@ to safely remove stale memos and externs. Let us take a look at the \dmmz file produced by the titlepage illustration. In fact, we have two versions of this file, as it changes upon the second compilation. -\ExampleName{titlepage} -\makeexample{\examplename.pdf N=2} -\sed{% - s/~//g; - s/\cmd{mmzNewExtern}/~\0~/; -}{\examplepath.mmz.c1} -\tcbinputexample[.mmz][.c1]{ - listing only, one file, no attachment, float, +\tcbinputexample{titlepage}[.mmz-pre]{ + listing only, no .listing, no attachment, float, after title pre={\ (after the first compilation)}, listing options app={breakatwhitespace=false,prebreak=\coloredpercentchar}, } -\tcbinputexample[.mmz][.c2]{ - listing only, one file, no attachment, float, +\tcbinputexample{titlepage}[.mmz-post]{ + listing only, no .listing, no attachment, float, after title pre={\ (after subsequent compilations)}, listing options app={breakatwhitespace=false,prebreak=\coloredpercentchar}, } @@ -3874,13 +3837,9 @@ Memoize. The second type lists the new externs, each preceded by its page number in the |.pdf|; this file could be fed to a custom extern extraction tool. -\ExampleName{record-files} -\makeexample{\examplename.tex.c1} -\tcbinputexample{listing only} +\tcbinputexample{record-files}{listing only} -\ExampleName{record-extern-pages} -\makeexample{\examplename.tex.c1} -\tcbinputexample{listing only} +\tcbinputexample{record-extern-pages}{listing only} Finally, note that (unlike memos and externs) record files are auxiliary files and may be deleted at any time after the extraction of the externs produced in @@ -3958,12 +3917,11 @@ memoization. The driver compiles the code into a horizontal or vertical box depending on the value of key \refmmz{capture}. Let us look at the definition of the driver line by line: -\makeexcerpt{single-extern-driver} -\tcbinputexample[.tex][.excerpt]{% - listing only, one file, +\tcbinputexample{single-extern-driver}[.excerpt]{% + listing only, no .listing, listing options app={numbers=left, numberstyle=\tiny, numbersep=0.5em}, title=The default memoization driver, - float, + float, no attachment, } \begin{enumerate} @@ -4011,7 +3969,7 @@ You might wonder why the construction of the extern pages and the cc-memo (and actually, of the c-memo as well) is indirect, as described above. \begin{itemize} \item For one, the indirect construction facilitates potential abortion of - memoization (see section~\ref{sec:tut:good-to-know}). With the indirect route, + memoization (see section~\ref{sec:limits}). With the indirect route, aborting is easy --- as nothing was permanently written anywhere yet, Memoize simply skips the final part of the process, where extern boxes are shipped into extern pages and the memo registers written into memo files --- and also @@ -4038,21 +3996,15 @@ externalize any typeset output --- simply because it does not call of a (pgfmath) computation (let's pretend that the computation is time-consuming). -\ExampleName{pgfmathparse} -\makeexample{\examplename.pdf} \begingroup -\relaxmmzcommands -\def\mmzNewCCMemo#1{% fetch the first cc-memo filename - \def\myccmemo{#1}% - \endinput -} -\input{\examplepath.mmz.c1} -\tcbinputexample{% +\input{\exampledir pgfmathparse.ccmemo} +\tcbinputexample{pgfmathparse}{% comment={% - \tcbinputlisting{ - listing only, width=.4\linewidth, nobeforeafter, - listing file=\exampledir\myccmemo, - example title, title=the cc-memo, + \tcbinputexample{pgfmathparse}{ + listing only, no attachment, + width=.4\linewidth, nobeforeafter, + listing file=\exampledir\mymemo, + title=the cc-memo, }\quad \includeexamplepdf[document page]{page=1} }, @@ -4081,9 +4033,7 @@ executed \emph{after} closing the memoization group. Let us consider an alternative implementation of the same goal of memoizing the result of a pgfmath computation, showcasing a couple of useful tricks. -\ExampleName{pgfmathparse-embellished} -\makeexample{\examplename.pdf} -\tcbinputexample{listing only} +\tcbinputexample{pgfmathparse-embellished}{listing only} For one, this ``embellished'' example reminds us that we can list the \refmmz{driver} key among the auto-options (even if I don't really recommend @@ -4100,7 +4050,7 @@ In the first version of the example, we have appended the same code to macro surprise here, as we want the effect of memoization and utilization to be the same. In the embellished version, we advertise another way to achieve the same effect, a way which might be useful for complicated drivers: we simply smuggle -out the entire cc-memo. The idea works even when memoization procudes externs; +out the entire cc-memo. The idea works even when memoization produces externs; in that case, however, the driver also has to say \cs{mmzkeepexternstrue} --- conditional \refcmd{ifmmzkeepexterns} decides whether Memoize keeps the externs around, in memory, even after shipping them out (but they are always gone at @@ -4126,10 +4076,7 @@ entire countdown would be seen as a single, unbreakable box. To externalize it properly, the chunks of the countdown that should appear on separate pages must be externalized into separate externs, as shown below. -\ExampleName{countdown} -\makeexample{\examplename.sty N=2} -\makeexample{\examplename.pdf} -\tcbinputexample{% +\tcbinputexample{countdown}(.c1){% listing options app={ basicstyle=\ttfamily\footnotesize, }, @@ -4145,7 +4092,7 @@ be externalized into separate externs, as shown below. }% \def\mmzNewExtern##1##2##3##4{\mmzUsedExtern{##1}} \def\myexternname##1{extern \dots\texttt{\mytemp##1.pdf}}% - \input{\examplepath.mmz}% + \input{\examplepath.mmz.c1}% \begin{tabular}{ccc} \includeexamplepdf[extern page,title/.expand once=\myexternname{}] {page=2,trim=1in 1in 1in 1in,scale=0.333}& @@ -4200,7 +4147,7 @@ example.\cprotect\footnote{The \refmmz{auto} declaration of |\countdown| adds (rather than at the end of memoization), so we expand it when applying the auto-options.} -\tcbinputexample[.sty]{listing only, after title pre={\ (version 1)}} +\tcbinputexample{countdown}[.sty](.c1){listing only, after title pre={\ (version 1)}} Of course, the chunks of the countdown should only be externalized when the code is actually being memoized, and not, say, when Memoize is disabled or @@ -4244,8 +4191,10 @@ below.\footnote{You shouldn't directly use the plain \hologo{TeX} integrated drivers of potentially recursive commands; we will talk about this in section~\ref{sec:memoization-complex-single-driver}.} -\tcbinputexample[.sty][.c2]{listing only, after title pre={\ (version 2)}, - attachment name=\examplename-integrated-driver.sty, +\tcbinputexample{countdown}[.sty](.c2){ + listing only, + after title pre={\ (version 2)}, + attachment=countdown-integrated-driver.sty, } @@ -4262,9 +4211,6 @@ submit the inner command to automemoization. However, the vanilla flavour of this approach had a negative impact on the user interface to automemoization. In this section, we will deploy the memoization driver to overcome the issue. -\ExampleName{poormansbox-driver} -\makeexample{\examplename.sty} -\makeexample{\examplename.pdf N=2} Let us revisit the |poormansbox| example from section~\ref{sec:memoizable-design}. Remember that that environment produced @@ -4273,18 +4219,20 @@ post-code, and that the issue was that the pre- and the post-code should not be memoized, but rather executed at every invocation of the command, as it was primarily intended to put some stretchable vertical space around the box. -The document source\attachexample\ and the resulting PDF of the example are the -same as in section~\ref{sec:memoizable-design}, so we will not repeat them -here, but jump directly into a revised definition of the environment. We will -retain the core idea from the original implementation: the outer command will -execute the pre- and the post-code, and the inner command will typeset the box. -But unlike in the original implementation, we will not automemoize the inner, -internal command (this was the source of the author's discomfort) but the outer, +The document +source\attachexample[poormansbox-driver.tex][\exampledir poormansbox.tex.attachment] +and the resulting PDF of the example are the same as in +section~\ref{sec:memoizable-design}, so we will not repeat them here, but jump +directly into a revised definition of the environment. We will retain the core +idea from the original implementation: the outer command will execute the pre- +and the post-code, and the inner command will typeset the box. But unlike in +the original implementation, we will not automemoize the inner, internal +command (this was the source of the author's discomfort) but the outer, user-level command --- and we will equip it with a custom memoization driver. The major idea here is to have the driver compose a cc-memo which not only includes the extern, but also executes the outer command. -\tcbinputexample[.sty]{listing only, float} +\tcbinputexample{poormansbox-driver}[.sty]{listing only, float} In detail, the implementation (partially shown in the |.sty| listing) is as follows. The outer command (|\poormansbox@outer|) first applies the options @@ -4305,24 +4253,12 @@ cc-memo,\cprotect\footnote{As you can see, in the cc-memo the outer command is i argument to |\poormansbox@outer| there is a call to \refcmd{mmzIncludeExtern}. \begingroup -\relaxmmzcommands -\def\mmzNewCCMemo#1{% - \def\mmzNewCCMemo##1{% fetch the second cc-memo filename - \def\myccmemo{##1}% - \endinput - }% -} -\input{\examplepath.mmz.c1} -\sed{% - s/~//g; - s/\(\cmd{csuse} *{poormansbox@outer}\) *\({\nobrace*\marg\nobrace*}\)\({.*}\rbrace\)/~\1~\2~\3~/; - s/\(\marg\marg\marg\)\(\marg\marg\marg\marg\marg\)/\1\space\2/; -}{\exampledir\myccmemo} -\tcbinputlisting{ +\input{\exampledir poormansbox-driver.ccmemo} +\tcbinputexample{poormansbox-driver}[.ccmemo]{ listing only, left=1.5mm, right=1mm, listing options app={basicstyle=\tt\small}, - listing file=\exampledir\myccmemo, - example title, title=the second poor man's box's cc-memo, + title=the second poor man's box's cc-memo, + no attachment, }% \endgroup @@ -4525,7 +4461,7 @@ aborted. The bottom-line is that run conditions repeat across handlers, so it makes sense to separate them out as an independent component of the framework, with the added bonus that the system can make sure that an invocation of a advised command which does not satisfy the run conditions -will incur as litte overhead as possible. +will incur as little overhead as possible. \paragraph{Bailout handler} An automemoized command applies the next-options (set by \refcmd{mmznext}), but @@ -4702,9 +4638,8 @@ command. For a \hologo{LaTeX} environment, the advised command is actually \refcmd{begin}, and this is why the call of \refcmd{AdviceGetOriginal} is of course followed by the environment name. -\makeexcerpt{_auto-memoize-inner} -\tcbinputexample[.tex][.excerpt]{% - listing and comment, one file, no attachment, +\tcbinputexample{_auto-memoize-inner}[.excerpt]{% + listing and comment, no .listing, no attachment, title={The implementation of the \refmmzauto{inner handler} for automemoization}, comment={% @@ -4724,9 +4659,8 @@ invokes the argument collector, which then calls the inner handler; remember that the invocation of \refcmd{AdviceCollector} is the sole function of the default outer handler. -\makeexcerpt{_auto-memoize-outer} -\tcbinputexample[.tex][.excerpt]{% - listing only, one file, no attachment, +\tcbinputexample{_auto-memoize-outer}[.excerpt]{% + listing only, no .listing, no attachment, title={The implementation of the \refmmzauto{outer handler} for automemoization}, } @@ -4742,9 +4676,8 @@ memoizing or regularly compiling some code submitted to memoization (see the diagram in section~\ref{sec:Memoize}). Note that it is not necessary to invoke \refcmd{AdviceRunfalse} in branches where the run conditions are not satisfied. -\makeexcerpt{_auto-run-if-memoization-is-possible} -\tcbinputexample[.tex][.excerpt]{% - listing only, one file, no attachment, +\tcbinputexample{_auto-run-if-memoization-is-possible}[.excerpt]{% + listing only, no .listing, no attachment, title={The implementation of \refmmzauto{run if memoization is possible}}, } @@ -4760,9 +4693,8 @@ something important nevertheless: by consuming the next-options, the \refmmzauto{bailout handler} makes sure they will not erroneously apply to the next instance of (auto)memoization. -\makeexcerpt{_auto-memoize-bailout} -\tcbinputexample[.tex][.excerpt]{% - listing only, one file, no attachment, +\tcbinputexample{_auto-memoize-bailout}[.excerpt]{% + listing only, no .listing, no attachment, title={The implementation of the \refmmzauto{bailout handler} for automemoization}, } @@ -4793,9 +4725,7 @@ handler receives the arguments of the handled command ``as they are,'' i.e.\ uncollected. It then asks \refcmd{mmzNoRef} to do the real job of getting the reference key into the context, and finally executes the original \cs{ref}. -\ExampleName{_auto-ref} -\makeexample{\examplename.tex.c1} -\tcbinputexample{% +\tcbinputexample{auto-ref}{% listing only, no attachment, title={\hypercolor{link}{white}A simplified\footnotemark{} definition of \refmmzauto{ref}}, @@ -4818,9 +4748,8 @@ i.e.\ outer handler, never even gets executed; note the absence of \refcmd{AdviceRuntrue}, which implies \refcmd{AdviceRunfalse}, which triggers the execution of the original command after the run conditions are ``checked.'' -\makeexcerpt{_auto-abort} -\tcbinputexample[.tex][.excerpt]{% - listing only, one file, no attachment, +\tcbinputexample{_auto-abort}[.excerpt]{% + listing only, no .listing, no attachment, title={The definition of \refmmzauto{abort}}, } @@ -4844,9 +4773,7 @@ will be boxed (|\fboxWrap|); under |/two|, in will be parenthesized effect, the box will appear within parenthesis; if we reverse the activation order, the parenthesis will appear inside the box. -\ExampleName{chained-advice} -\makeexample{\examplename.tex.c1 N=2} -\tcbinputexample{comment=\input{\examplepath.tex.c2}} +\tcbinputexample{chained-advice}{comment=\input{\examplepath}} First of all, looking at the code above, you have probably noticed the absence of key \refmmz{auto}. This is because by default, \refkey{/handlers/.install @@ -4880,9 +4807,7 @@ inner handler, which we invoke by \refcmd{AdviceInnerHandler}; in the false branch, we omit the optional argument, passing it an (additionally) braced |{#2}|. -\ExampleName{om-collector-NewDocumentCommand} -\makeexample{\examplename.tex.c1} -\tcbinputexample{listing only} +\tcbinputexample{om-collector-NewDocumentCommand}{listing only} Defining a functionally equivalent collector using \cs{newcommand} would be a bit more involved, as \hologo{LaTeX2e} does not offer a standardized way to @@ -4890,9 +4815,7 @@ test for the \emph{presence} of the optional argument. Consider the following collector, whose optional argument has the same default value as the advised command. Is it functionally equivalent to the one above? -\ExampleName{om-collector-newcommand} -\makeexample{\examplename.tex.c1} -\tcbinputexample{listing only} +\tcbinputexample{om-collector-newcommand}{listing only} While there will be no visual difference, there is a difference under the hood. If you compile both documents, you will see that the first one creates three @@ -4968,9 +4891,7 @@ immediately following |#1| is not braced, so braced, behind its \meta{next-code} argument, |\PrintAndDo\makebox|, yielding |\PrintAndDo|\hyp|\makebox{[5em][r]{text}}|.\par} -\ExampleName{collargs-makebox} -\makeexample{\examplename.tex.c1} -\tcbinputexample{listing and compile} +\tcbinputexample{collargs-makebox}{listing and compile} Seeing the arguments of |\makebox| without the immediately preceding |\makebox| might seem strange, but remember that \refcmd{CollectArguments} is about the @@ -5003,9 +4924,7 @@ containing paragraph tokens).\footnote{CollArgs automatically adapts to the \cs{end}\meta{name} in \hologo{plainTeX} and by \cs{start}\meta{name} and \cs{stop}\meta{name} in \hologo{ConTeXt}.} -\ExampleName{collargs-minipage} -\makeexample{\examplename.tex.c1} -\tcbinputexample{comment=\input{\examplepath.tex.c1}} +\tcbinputexample{collargs-minipage}{comment=\input{\examplepath.tex}} You might wonder why didn't we provide \refcmd{CollectArguments} in the previous example with argument specification |omb| --- after all, the @@ -5031,12 +4950,11 @@ grabbed environment body with the begin tag \refcmd{begin}\marg{environment section~\ref{sec:ref:collargs} for the full reference on the verbatim mode and its limitations. -% A harmless warning: +% .dtx has separate versions for listing and compilation, because compilation +% of the multi-line version yields: % Missing character: There is no ^M (U+000D) in font [lmmono10-regular]:! % because \texttt in the example is fed a (verbatim) carriage return -\ExampleName{collargs-verbatim} -\makeexample{\examplename.tex.c1} -\tcbinputexample{listing and compile} +\tcbinputexample{collargs-verbatim}{listing and compile} Finally, CollArgs extends the \hologo{LaTeX3}\slash\pkg{xparse} specification by modifier \docref{xparse:amp}, which allows the user to specify options which @@ -5100,9 +5018,8 @@ command was defined using \cs{NewDocumentCommand} or similar, and use \refcmd{AdviceArgs} (line~4), which also receives the argument specification when given by the user via key \refmmzauto{args}. -\makeexcerpt{_advice-CollectArgumentsRaw}(../../advice.edtx) -\tcbinputexample[.tex][.excerpt]{% - listing only, one file, no attachment, +\tcbinputexample{_advice-CollectArgumentsRaw}[.excerpt]{% + listing only, no .listing, no attachment, listing options app={numbers=left, numberstyle=\tiny, numbersep=0.5em}, title={The definition of the initial collector}, } @@ -5202,7 +5119,7 @@ Load Memoize by |\input memoize|. As package options cannot be provided in using key \refmmz{extract}; I recommend doing this immediately after loading the package. This key may be invoked with or without a value. In the latter case, Memoize will extract using the package default method -\refmmz{extract=perl}, unless its has been overriden from +\refmmz{extract=perl}, unless its has been overridden from \reffile{memoize.cfg}. Furthermore, as \hologo{plainTeX} has no concept of a document body, the text @@ -5217,13 +5134,9 @@ time the meaning of this control sequence is still primitive. In particular, this means that Memoize must be loaded before \pkg{atbegshi}. \begin{tcboxedraster}[raster column skip=1cm]{blankest} - \ExampleName{plainTeX}% - \makeexample{\examplename.tex.c1}% - \tcbinputexample{listing only, title=A minimal \hologo{plainTeX} example} + \tcbinputexample{plainTeX}{listing only, title=A minimal \hologo{plainTeX} example} % - \ExampleName{ConTeXt}% - \makeexample{\examplename.tex.c1}% - \tcbinputexample{listing only, title=A minimal \hologo{ConTeXt} example} + \tcbinputexample{ConTeXt}{listing only, title=A minimal \hologo{ConTeXt} example} \end{tcboxedraster} \paragraph{\hologo{ConTeXt}}{} @@ -5658,6 +5571,37 @@ on how to handle this properly. \end{doc} \begin{doc}{ + key={name=salt, par=\meta{tokens}, desc={cumulative, no default, + initially empty}}, + key={name=clear salt}, + key={name=meaning to salt, + par=\marg{comma-separated list of commands and environment names}}, + key={name=csname meaning to salt, par=\marg{control sequence name}}, + key={name=key meaning to salt, + par=\marg{full path to a pgfkeys command key}}, + key={name=key value to salt, + par=\marg{full path to a pgfkeys value key}}, + keypath={/handlers}, desc=handler, + key={name=.meaning to salt}, + key={name=.value to salt}, + } + These keys manipulate the \emph{salt} expression, internally stored in token + register \docaux{cmd}{mmzSalt}. Fully expanded (at the beginning of + memoization), this expression is prepended to the memoized code and + contributes to its code md5 sum. In other words, two pieces of the same code + memoized under a different expansion of the salt will behave as if they + contained different code; most importantly, they will have distinct c-memos. + + The keys listed above behave in the same way as their \refmmz{context} + counterparts used outside memoization, i.e.\ in the same way as the local + variant of the \refmmz{context} keys. Using the salt keys during memoization + has no effect. + + While salt and context are mostly interchangeable, one example where only the + salt can do the job is presented in the Beamer section~\ref{sec:per-overlay}. +\end{doc} + +\begin{doc}{ cmd={name=mmzNoRef, par=\marg{reference key}, desc=\hologo{LaTeX} only}, cmd={name=mmzForceNoRef, par=\marg{reference key}, desc=\hologo{LaTeX} only}, } @@ -5920,7 +5864,7 @@ on how to handle this properly. \begin{doc}{ cmd={name=mmzExternalizeBox, par=\marg{box}\marg{token register}}, } - This macro is indended to be called by memoization drivers to produce an + This macro is intended to be called by memoization drivers to produce an extern page. The given \meta{box} is dumped into the document as a separate extern page, while the \meta{token register} receives the cc-memo extern inclusion code. @@ -5977,7 +5921,7 @@ on how to handle this properly. defined to include the extern file into the document. However, it sometimes makes sense to execute the cc-memo contents immediately after memoization; for example, if memoization produces several externs, intricately integrated - into the surrouding environment, it might be cumbersome to replicate their + into the surrounding environment, it might be cumbersome to replicate their typesetting both in the memoizing compilation and in the cc-memo code --- easier to build up the cc-memo code and execute it right after memoization. This is why Memoize, just before executing the contents of \refmmz{after @@ -6640,7 +6584,7 @@ Perl- and Python-based extraction is triggered by using \hologo{TeX}-based extraction, externalization using Memoize is extremely fast compared to the \TikZ's externalization library. Adding the regular compilation time of one minute to the above numbers, we arrive - at the maximum externalization time of about two minues, whereas my + at the maximum externalization time of about two minutes, whereas my estimate for the production of all 160 externs using \TikZ's externalization would be an \emph{hour} or more. \item The Python script cannot extract externs out of PDFs created without @@ -6698,9 +6642,8 @@ Perl- and Python-based extraction is triggered by \refmmz[show keypath]{record/record type/new extern} key for and \meta{record type}. - \makeexcerpt{tex-extraction-options} - \tcbinputexample[.tex][.excerpt]{% - listing only, one file, no attachment, title={The initial value of + \tcbinputexample{tex-extraction-options}[.excerpt]{% + listing only, no .listing, no attachment, title={The initial value of \refmmz{tex extraction options}}, } @@ -6720,9 +6663,8 @@ Perl- and Python-based extraction is triggered by \code{-output-driver 'xdvipdfmx -V $N$'}.} note that Memoize defines \docref{reg:pdfmajorversion} and \docref{reg:pdfminorversion} in \hologo{LuaTeX}. - \makeexcerpt{tex-extraction-script} - \tcbinputexample[.tex][.excerpt]{% - listing only, one file, title=The initial value of \refmmz{tex extraction + \tcbinputexample{tex-extraction-script}[.excerpt]{% + listing only, no .listing, title=The initial value of \refmmz{tex extraction script}, no attachment} As the value of \refmmz{tex extraction script} is fully expanded when used, @@ -6901,7 +6843,7 @@ Perl- and Python-based extraction is triggered by } When given this option, the script removes \emph{all} memos and externs belonging to the document, not just the stale ones, i.e.\ it effectively - ignores the occurences of \refcmd{mmzUsedCMemo} and friends in the \dmmz + ignores the occurrences of \refcmd{mmzUsedCMemo} and friends in the \dmmz file. \end{doc} \begin{doc}{ @@ -7263,7 +7205,7 @@ headers. As the advice is normally automatically activated upon declaration with \refmmz{auto}, explicit activation is rarely needed, but see \refmmz{auto'}. - The effect of these keys under the deffered activation regime is described in + The effect of these keys under the deferred activation regime is described in \refmmz{activation}. Note that I sometimes speak of (de)activating a command, and sometimes of @@ -8005,7 +7947,7 @@ At the moment, Advice only implements specific support for \TikZ, by defining a This command collects the arguments in the format expected by \refcmd{tikz}, and executes macro \refcmd{AdviceInnerHandler} with the collected arguments given as a single braced argument. The collector supports both the group and the - semicolor invocation of |\tikz|, i.e.\ both |\tikz{...}| and |\tikz...;|. + semicolon invocation of |\tikz|, i.e.\ both |\tikz{...}| and |\tikz...;|. This command is only available upon |\input|ting file \docaux{file}{advice-tikz.code.tex}. @@ -8523,7 +8465,7 @@ be generalized to \meta{namespace} and \meta{setup key} of }|\marg{argument specification}\marg{next-code}| \end{tcblisting} - Withing the option-setting code, the programmer may also deploy macro + Within the option-setting code, the programmer may also deploy macro \refcmd{collargsSet}, which processes the \meta{options} in the keylist format. One idea could be to execute this macro at the end of the low-level options; this would set the ``defaults'' using the fast programmer's @@ -8654,10 +8596,10 @@ grab the environment body in the verbatim mode.) ... \end{foo} \end{tcblisting} - \ExampleName{_collargs-verbatim} - \makeexample{\examplename.tex.c1} - \tcbinputexample{listing only, no attachment, mark region={1}{3}, - example title=\texttt{ignore nesting=true}} + \tcbinputexample{collargs-ignore-nesting-true}{ + listing only, no attachment, mark region={1}{3}, + example title=\texttt{ignore nesting=true} + } \end{tcbraster} This key applies not only to argument type \docref{xparse:b} (in either @@ -8690,11 +8632,11 @@ grab the environment body in the verbatim mode.) environment |foo|. \begin{tcbraster} - \ExampleName{_collargs-ignore-other-tags} - \makeexample{\examplename.tex.c1 N=2} - \tcbinputexample{listing only, no attachment, mark region={3}{3}, + \tcbinputexample{collargs-ignore-other-tags}(.c1){ + listing only, no attachment, mark region={3}{3}, example title=\texttt{ignore other tags=false}} - \tcbinputexample[.tex][.c2]{listing only, no attachment, mark region={3}{5}, + \tcbinputexample{collargs-ignore-other-tags}(.c2){ + listing only, no attachment, mark region={3}{5}, example title=\texttt{ignore other tags=true}} \end{tcbraster} @@ -8748,9 +8690,7 @@ grab the environment body in the verbatim mode.) \refcollargs{verbatim}. And we use \refcollargs{no delimiters} to get rid of the braces around the footnote text.) - \ExampleName{collargs-processor} - \makeexample{\examplename.tex.c1} - \tcbinputexample{comment=\input{\examplepath.tex.c1}} + \tcbinputexample{collargs-processor}{comment=\input{\examplepath.tex}} \end{doc} \begin{doc}[ @@ -8813,11 +8753,7 @@ grab the environment body in the verbatim mode.) braces. \end{enumerate*} - \ExampleName{collargs-expandable-processor} - \makeexample{\examplename.tex.c1} - \tcbinputexample{comment=\input{\examplepath.tex.c1}, - %listing options app={numbers=left, numberstyle=\tiny, numbersep=0.5em}, - } + \tcbinputexample{collargs-expandable-processor}{comment=\input{\examplepath.tex}} \end{doc} \begin{doc}[ @@ -8833,9 +8769,7 @@ grab the environment body in the verbatim mode.) Any user-specified pre- or post-processing will still be applied (and usually is, when this key is used). - \ExampleName{collargs-nodelimiters} - \makeexample{\examplename.tex.c1} - \tcbinputexample{comment=\small\input{\examplepath.tex.c1}} + \tcbinputexample{collargs-nodelimiters}{comment=\small\input{\examplepath.tex}} \end{doc} \begin{doc}[% @@ -8873,9 +8807,7 @@ grab the environment body in the verbatim mode.) definition of \cs{mmz@remove@quotes} and advising of \cs{blx@bbl@entry} in the Memoize source.} - \ExampleName{collargs-return-plain} - \makeexample{\examplename.tex.c1} - \tcbinputexample{comment=\small\input{\examplepath.tex.c1}} + \tcbinputexample{collargs-return-plain}{comment=\small\input{\examplepath.tex}} \item When set to \refcollargs{return=no}, the collected arguments are not inserted into the input stream; \meta{next-code} can access them through \refcmd{collargsArgs}, a token register dedicated to holding the @@ -8896,9 +8828,7 @@ grab the environment body in the verbatim mode.) conditional to true if any argument was found, and test for that conditional in the \meta{next-code}.) - \ExampleName{collargs-return-no} - \makeexample{\examplename.tex.c1} - \tcbinputexample{comment=\small\input{\examplepath.tex.c1}} + \tcbinputexample{collargs-return-no}{comment=\small\input{\examplepath.tex}} \end{itemize} \end{doc} @@ -8949,7 +8879,7 @@ grab the environment body in the verbatim mode.) collect |[{]}]| with \refcmd{CollectArguments}|[|\refmmz{verbatim}|]{o}|, we will get |{| (and most likely an error, as well), because in the \refmmz{verbatim} mode, braces do not have their grouping function. Using - the \refmmz{verb} mode solves the problem: occuring within braces, the first + the \refmmz{verb} mode solves the problem: occurring within braces, the first |]| is ``invisible'' to \refcmd{CollectArguments}|[|\refmmz{verb}|]|, so the optional argument is correctly recognized as ending at the second |]|. @@ -9086,10 +9016,8 @@ but having been assigned category code 12, it cannot perform this function, resulting in error |! Missing $ inserted| %$ once \hologo{TeX} encounters the superscript character |^|. -\ExampleName{collargs-transition-ok} -\makeexample{\examplename.tex.c1} -\tcbinputexample{sidebyside, lefthand ratio=0.6, - comment=\input{\examplepath.tex.c1}} +\tcbinputexample{collargs-transition-ok}{sidebyside, lefthand ratio=0.6, + comment=\input{\examplepath.tex}} Well --- this is what \emph{would} happen if CollArgs didn't address the transition issue described above. In fact, the above example compiles just @@ -9106,10 +9034,8 @@ category code of |@| to 11 (``letter''), so |@| may help form the control word \emph{before} control sequence |\@author| is constructed, even if it precedes it immediately. -\ExampleName{collargs-transition-cs} -\makeexample{\examplename.tex.c1} \long\def\ShowArgs#1{Collected: ``{\color{red}\tt\detokenize{#1}}''} -\tcbinputexample{comment=\input{\examplepath.tex.c1}} +\tcbinputexample{collargs-transition-cs}{comment=\input{\examplepath.tex}} In the second line of the example, our clever invocation of |\@author| is immediately preceded by a call to \refcmd{CollectArguments}, which tries to @@ -9158,10 +9084,8 @@ disappearing along with the rest of the line. Once CollArgs sets to find the (verbatim) mandatory argument, the rest of the line is already gone, so it searches for, and finds, this argument in the next line. -\ExampleName{collargs-transition-comment} -\makeexample{\examplename.tex.c1} \long\def\ShowArgs#1{Collected: ``{\color{red}\tt\detokenize{#1}}''} -\tcbinputexample{listing and text} +\tcbinputexample{collargs-transition-comment}{listing and text} Nothing can be done here --- commenting deletes information, irrevocably --- and in a similar fashion, nothing can be done to catch a verbatim end-of-line @@ -9181,6 +9105,7 @@ as follows: \docref{xparse:o}, \docref{xparse:d}, \docref{xparse:s}, \subsection{Support for specific classes and packages} \subsubsection{PGF} +\label{sec:support:pgf} \PGF support defines commands \refcmd{mmzPgfAtBeginMemoization} and \refcmd{mmzPgfAtEndMemoization}, and appends them to hooks \refmmz{at begin @@ -9191,9 +9116,8 @@ Note that environment \env{pgfpicture} is \emph{not} submitted to automemoization. Doing this would probably not be a good idea, as it is used by many other commands and environments. -\makeexcerpt{_support-pgf} -\tcbinputexample[.tex][.excerpt]{% - listing only, one file, no attachment, +\tcbinputexample{_support-pgf}[.excerpt]{% + listing only, no .listing, no attachment, title=\hypercolor{url}{white}\PGF support, } @@ -9217,7 +9141,8 @@ by many other commands and environments. memoization}, remembers the PGF picture ID at the beginning of memoization. Command \refcmd{mmzPgfAtEndMemoization}, executed in hook \refmmz{at end memoization}, checks whether the ID was advanced during memoization, and if - so, appends to the cc-memo the code advancing the ID counter accordingly. + so, appends to the cc-memo an invocation of macro + \docaux{cmd}{mmzStepPgfPictureId} advancing the ID counter accordingly. Note that out of the box, \refcmd{mmzPgfAtBeginMemoization} and \refcmd{mmzPgfAtEndMemoization} reside in their respective hooks at all @@ -9236,9 +9161,8 @@ prevented by \code{\refmmz{deactivate}=\refenv{tikzpicture}} and\slash or command \refcmd{tikz} requires a dedicated argument collector, \refcmd{AdviceCollectTikZArguments}. -\makeexcerpt{_support-tikz} -\tcbinputexample[.tex][.excerpt]{% - listing only, one file, no attachment, +\tcbinputexample{_support-tikz}[.excerpt]{% + listing only, no .listing, no attachment, title=\hypercolor{url}{white}\TikZ support, } @@ -9252,9 +9176,8 @@ prevented by \code{\refmmz{deactivate}=\refenv{forest}} and\slash or command \refcmd{Forest} is defined by \refcmd{NewDocumentCommand}, which makes specifying option \refmmzauto{args} unnecessary. -\makeexcerpt{_support-forest} -\tcbinputexample[.tex][.excerpt]{% - listing only, one file, no attachment, +\tcbinputexample{_support-forest}[.excerpt]{% + listing only, no .listing, no attachment, title=\pkg[white]{Forest} support, } @@ -9267,7 +9190,10 @@ In the Beamer class, Memoize cannot be loaded in the standard way, by writing case because Beamer opens the document PDF while loading the class, while Memoize requires the PDF from the previous compilation intact in order to extract the externs. The workaround is to load Memoize by writing -|\RequirePackage{memoize}| \emph{before} |\documentclass{beamer}|. +|\RequirePackage{memoize}| \emph{before} |\documentclass{beamer}|. (The +workaround is unnecessary when loading package \pkg{beamerarticle}, which runs +the beamer in the |article| mode. In fact, this package may be loaded before +or after Memoize.) \begin{doc}{easy, key={name=per overlay,desc=style}} Applying this style to a piece of memoized code contained in a Beamer @@ -9281,6 +9207,26 @@ extract the externs. The workaround is to load Memoize by writing trivial, but only deploys the public interface offered by Memoize. \end{doc} +\begin{doc}{easy, key={name=beamer mode to prefix,desc=style}} + Executing this key appends the beamer mode (|beamer|, |handout|, |trans| or + |article|) to the \refmmz{prefix}. Use it when the externalized picture + should come out different in different modes. + + It is fine to apply the key only to selected pieces of memoized code, either + via \refcmd{mmzset} or \refcmd{mmznext}. + + Note that Beamer mode |second| is special. Under the hood, it is implemented + as the default mode |beamer|. This key therefore does not facilitate having + one set of externs for the single screen mode and another set for the two + screen mode. + + A simple way of executing this key for every Beamer document, and not + producing an error for non-Beamer documents, is to include it in + \reffile{memoize.cfg} like this: \code{beamer mode to prefix/.try}. The + \code{.try} handler (see \PGFmanual{87.4.8}) works because \refmmz{beamer + mode to prefix} is only defined when Beamer is loaded. +\end{doc} + \subsubsection{Biblatex} \begin{doc}{ @@ -9465,10 +9411,10 @@ The changelogs of Memoize, Advice and CollArgs can be found in the documentation directory of the respective package, i.e.\ in \code{\meta{texmf}/doc/generic/\meta{package}/CHANGELOG.md}. They are written in the MarkDown format. Here are direct links to these changelogs on -CTAN: -\href{https://mirrors.ctan.org/macros/generic/memoize/CHANGELOG.md}{Memoize}, -\href{https://mirrors.ctan.org/macros/generic/advice/CHANGELOG.md}{Advice}, -\href{https://mirrors.ctan.org/macros/generic/collargs/CHANGELOG.md}{CollArgs}. +GitHub: +\href{https://github.com/sasozivanovic/memoize/blob/main/CHANGELOG.md}{Memoize}, +\href{https://github.com/sasozivanovic/memoize/blob/main/doc/CHANGELOG.advice.md}{Advice}, +\href{https://github.com/sasozivanovic/memoize/blob/main/doc/CHANGELOG.collargs.md}{CollArgs}. \subsection{Known issues} \label{sec:known-issues} @@ -9654,7 +9600,7 @@ Errors: combination with the paranoid \docref{openout_any} setting (which is the default). - If the source of the error remains a mistery, I suggest inspecting the + If the source of the error remains a mystery, I suggest inspecting the following sources of information, to help you with your investigation: \begin{itemize} \item Can you can run the extraction script by hand? Open the terminal, go @@ -9776,12 +9722,16 @@ This warning means that either: \item you are trying to (auto)memoize a \refenv{tikzpicture} with \refkey{/tikz/remember picture} set, or more generally, some code which contains \refcmd{savepos} --- this can't be done, see - section~\ref{sec:tut:good-to-know}; or + section~\ref{sec:limits}; or \item an error occurred during memoization --- in this case, Memoize cowardly refuses to proceed with memoization, see section~\ref{sec:known-issues} for details. \end{itemize} +\paragraph*{Memoization yields errors} while the original, non-memoized code +compiles fine. + +\ProblemsWithMemoization[in section~\ref{sec:tut:verbatim}] \subsection{License} diff --git a/macros/generic/memoize/doc/memoize-extract.1.md b/macros/generic/memoize/doc/memoize-extract.1.md index 190d6efb9a..0b34875a8a 100644 --- a/macros/generic/memoize/doc/memoize-extract.1.md +++ b/macros/generic/memoize/doc/memoize-extract.1.md @@ -2,8 +2,8 @@ title: memoize-extract section: 1 header: User Manual -footer: memoize-extract of Memoize v1.3.0 -date: April 02, 2024 +footer: memoize-extract of Memoize v1.4.0 +date: November 24, 2024 hyphenate: false --- @@ -90,8 +90,8 @@ library [pdfrw2](https://pypi.org/project/pdfrw2). This script respects the restrictions on file input and output imposed by the TeX configuration, more precisely, the variables *openin_any* and *openout_any* of the **kpathsea** library (https://tug.org/kpathsea). You can inspect the -values of these variables by executing '**kpsewhich** -var-value=openin_any' and -'**kpsewhich** -var-value=openout_any'. The interpretation is as follows: +values of these variables by executing `kpsewhich -var-value=openin_any` and +`kpsewhich -var-value=openout_any`. The interpretation is as follows: **a** (or **y** or **1**) any : Allows any file to be opened. @@ -121,7 +121,7 @@ values of these variables by executing '**kpsewhich** -var-value=openin_any' and **11** : An error also reported back to the compilation when given option - **\--format**. Currently, either: (i) a currupted document PDF, or (ii) + **\--format**. Currently, either: (i) a corrupted document PDF, or (ii) a kpathsea permission error. Other exit codes are as produced by the underlying scripting language (Perl of diff --git a/macros/generic/memoize/memoize-clean.pl b/macros/generic/memoize/memoize-clean.pl index b2d9c90c4a..062619fd2b 100755 --- a/macros/generic/memoize/memoize-clean.pl +++ b/macros/generic/memoize/memoize-clean.pl @@ -19,7 +19,7 @@ # <texmf>/doc/generic/memoize/FILES. my $PROG = 'memoize-clean.pl'; -my $VERSION = '2024/04/02 v1.3.0'; +my $VERSION = '2024/11/24 v1.4.0'; use strict; use Getopt::Long; diff --git a/macros/generic/memoize/memoize-clean.py b/macros/generic/memoize/memoize-clean.py index 74b8d9b57a..a90f4cb92f 100755 --- a/macros/generic/memoize/memoize-clean.py +++ b/macros/generic/memoize/memoize-clean.py @@ -18,7 +18,7 @@ # The files belonging to this work and covered by LPPL are listed in # <texmf>/doc/generic/memoize/FILES. -__version__ = '2024/04/02 v1.3.0' +__version__ = '2024/11/24 v1.4.0' import argparse, re, sys, pathlib, os @@ -111,8 +111,8 @@ tbdeleted = [] def populate_tbdeleted(folder, basename_prefix): re_aux = re.compile( re.escape(basename_prefix) + - '[0-9A-F]{32}(?:-[0-9A-F]{32})?' - '(?:-[0-9]+)?(?:\.memo|(?:-[0-9]+)?\.pdf|\.log)$') + r'[0-9A-F]{32}(?:-[0-9A-F]{32})?' + r'(?:-[0-9]+)?(?:\.memo|(?:-[0-9]+)?\.pdf|\.log)$') try: for f in folder.iterdir(): if re_aux.match(f.name) and (args.all or f not in keep): diff --git a/macros/generic/memoize/memoize-extract.pl b/macros/generic/memoize/memoize-extract.pl index 0f2cfa3a22..3aac84a482 100755 --- a/macros/generic/memoize/memoize-extract.pl +++ b/macros/generic/memoize/memoize-extract.pl @@ -19,7 +19,7 @@ # <texmf>/doc/generic/memoize/FILES. my $PROG = 'memoize-extract.pl'; -my $VERSION = '2024/04/02 v1.3.0'; +my $VERSION = '2024/11/24 v1.4.0'; use strict; use File::Basename qw/basename/; diff --git a/macros/generic/memoize/memoize-extract.py b/macros/generic/memoize/memoize-extract.py index e1fcbe5ad3..44e4ae9a39 100755 --- a/macros/generic/memoize/memoize-extract.py +++ b/macros/generic/memoize/memoize-extract.py @@ -18,7 +18,7 @@ # The files belonging to this work and covered by LPPL are listed in # <texmf>/doc/generic/memoize/FILES. -__version__ = '2024/04/02 v1.3.0' +__version__ = '2024/11/24 v1.4.0' import argparse, re, sys, os, subprocess, itertools, traceback, platform from pathlib import Path, PurePath diff --git a/macros/generic/memoize/memoize.edtx b/macros/generic/memoize/memoize.edtx index d974aff72a..96f53611ef 100644 --- a/macros/generic/memoize/memoize.edtx +++ b/macros/generic/memoize/memoize.edtx @@ -1,4 +1,4 @@ -% memoize.edtx (this is not a .dtx file; to produce a .dtx, process it with edtx2dtx) +% Memoize.edtx (this is not a .dtx file; to produce a .dtx, process it with edtx2dtx) % %% This file is a part of Memoize, a TeX package for externalization of %% graphics and memoization of compilation results in general, available at @@ -90,55 +90,55 @@ % % \paragraph{Identification} of |memoize|, |memoizable| and |nomemoize|. %<*mmz> -%<latex>\ProvidesPackage{memoize}[2024/04/02 v1.3.0 Fast and flexible externalization] +%<latex>\ProvidesPackage{memoize}[2024/11/24 v1.4.0 Fast and flexible externalization] %<context>%D \module[ %<context>%D file=t-memoize.tex, -%<context>%D version=1.3.0, +%<context>%D version=1.4.0, %<context>%D title=Memoize, %<context>%D subtitle=Fast and flexible externalization, %<context>%D author=Saso Zivanovic, -%<context>%D date=2024-04-02, +%<context>%D date=2024-11-24, %<context>%D copyright=Saso Zivanovic, %<context>%D license=LPPL, %<context>%D ] %<context>\writestatus{loading}{ConTeXt User Module / memoize} %<context>\unprotect %<context>\startmodule[memoize] -%<plain>% Package memoize 2024/04/02 v1.3.0 +%<plain>% Package memoize 2024/11/24 v1.4.0 %</mmz> %<*mmzable> -%<latex>\ProvidesPackage{memoizable}[2024/04/02 v1.3.0 A programmer's stub for Memoize] +%<latex>\ProvidesPackage{memoizable}[2024/11/24 v1.4.0 A programmer's stub for Memoize] %<context>%D \module[ %<context>%D file=t-memoizable.tex, -%<context>%D version=1.3.0, +%<context>%D version=1.4.0, %<context>%D title=Memoizable, %<context>%D subtitle=A programmer's stub for Memoize, %<context>%D author=Saso Zivanovic, -%<context>%D date=2024-04-02, +%<context>%D date=2024-11-24, %<context>%D copyright=Saso Zivanovic, %<context>%D license=LPPL, %<context>%D ] %<context>\writestatus{loading}{ConTeXt User Module / memoizable} %<context>\unprotect %<context>\startmodule[memoizable] -%<plain>% Package memoizable 2024/04/02 v1.3.0 +%<plain>% Package memoizable 2024/11/24 v1.4.0 %</mmzable> %<*nommz> -%<latex>\ProvidesPackage{nomemoize}[2024/04/02 v1.3.0 A no-op stub for Memoize] +%<latex>\ProvidesPackage{nomemoize}[2024/11/24 v1.4.0 A no-op stub for Memoize] %<context>%D \module[ %<context>%D file=t-nomemoize.tex, -%<context>%D version=1.3.0, +%<context>%D version=1.4.0, %<context>%D title=Memoize, %<context>%D subtitle=A no-op stub for Memoize, %<context>%D author=Saso Zivanovic, -%<context>%D date=2024-04-02, +%<context>%D date=2024-11-24, %<context>%D copyright=Saso Zivanovic, %<context>%D license=LPPL, %<context>%D ] %<context>\writestatus{loading}{ConTeXt User Module / nomemoize} %<context>\unprotect %<context>\startmodule[nomemoize] -%<mmz>% Package nomemoize 2024/04/02 v1.3.0 +%<mmz>% Package nomemoize 2024/11/24 v1.4.0 %</nommz> % % \paragraph{Required packages} and \hologo{LaTeX}ization of \hologo{plainTeX} @@ -955,11 +955,14 @@ \ifmemoizing \else \ifmemoize - % Compute \meta{code md5sum} off of the first argument, and globally + % Compute \meta{code md5sum} off of the salted source code, and globally % store it into |\mmz@code@mdfivesum| --- globally, because we need it in % utilization to include externs, but the |\Memoize| group is closed (by - % |\mmzMemo|) while inputting the cc-memo. - \xdef\mmz@code@mdfivesum{\pdf@mdfivesum{\the\mmz@mdfive@source}}% + % |\mmzMemo|) while inputting the cc-memo. + \xdef\mmz@code@mdfivesum{\pdf@mdfivesum{% + \expanded{\the\mmzSalt}% + \the\mmz@mdfive@source + }}% \mmz@trace@code@mdfive % Recompile mode forces memoization. \ifnum\mmz@mode=\mmz@mode@recompile\relax @@ -1251,7 +1254,7 @@ % extern-inclusion code to the cc-memo, and (v) puts the box into the % document (again prefixing it with |\quitvmode| if necessary). (The listing % region markers help us present this code in the manual.) -% \begin{listingregion}{single-extern-driver.tex} +% \begin{listingregion}{single-extern-driver} \long\def\mmzSingleExternDriver#1{% \xtoksapp\mmzCCMemo{\mmz@maybe@quitvmode}% \setbox\mmz@box\mmz@capture{#1}% @@ -1480,17 +1483,50 @@ % /handlers/.value to context} % Utilities to put the meaning of various stuff into |context|. % \indentmacrocode - meaning to context/.code={\forcsvlist\mmz@mtoc{#1}}, - csname meaning to context/.code={\mmz@mtoc@csname{#1}}, - key meaning to context/.code={% + meaning to context/.code={\mmz@Cos\forcsvlist\mmz@mtoc{#1}}, + csname meaning to context/.code={\mmz@Cos\mmz@mtoc@csname{#1}}, + key meaning to context/.code={\mmz@Cos \forcsvlist\mmz@mtoc\mmz@mtoc@keycmd{#1}}, - key value to context/.code={\forcsvlist\mmz@mtoc@key{#1}}, - /handlers/.meaning to context/.code={\expanded{% + key value to context/.code={\mmz@Cos\forcsvlist\mmz@mtoc@key{#1}}, + /handlers/.meaning to context/.code={\mmz@Cos\expanded{% \noexpand\mmz@mtoc@csname{pgfk@\pgfkeyscurrentpath/.@cmd}}}, - /handlers/.value to context/.code={% + /handlers/.value to context/.code={\mmz@Cos \expanded{\noexpand\mmz@mtoc@csname{pgfk@\pgfkeyscurrentpath}}}, } +% \begin{macro}{\mmzSalt} +% \begin{key}{salt, clear salt, meaning to salt, csname meaning to salt, +% key meaning to salt, key value to salt, +% /handlers/.meaning to salt, /handlers/.value to salt} +% Salt functions in the same way as context outside memoization, but it +% contributes to the source code hash, i.e.\ |\mmzSalt| is expanded when +% computing |\mmz@code@mdfivesum| in |\Memoize|. It was realized that it +% is needed for full Beamer support, +% see \href{https://github.com/sasozivanovic/memoize/issues/27}{GitHub +% issue \#27}. +\newtoks\mmzSalt +\mmzset{ + salt/.code=\expandafter\toksapp\expandafter\mmzSalt{#1,}, + clear salt/.value forbidden, + clear salt/.code=\mmzSalt{}, + meaning to salt/.code={\mmz@coS\forcsvlist\mmz@mtoc{#1}}, + csname meaning to salt/.code={\mmz@coS\mmz@mtoc@csname{#1}}, + key meaning to salt/.code={\mmz@coS + \forcsvlist\mmz@mtoc\mmz@mtoc@keycmd{#1}}, + key value to salt/.code={\mmz@coS + \forcsvlist\mmz@mtoc@key{#1}}, + /handlers/.meaning to salt/.code={\mmz@coS\expanded{% + \noexpand\mmz@mtoc@csname{pgfk@\pgfkeyscurrentpath/.@cmd}}}, + /handlers/.value to salt/.code={\mmz@coS + \expanded{\noexpand\mmz@mtoc@csname{pgfk@\pgfkeyscurrentpath}}}, +} +% \end{key} +% \end{macro} +% +% The following macros are shared between context and salt, so they should be +% preceded by either |\mmz@Cos| (for context) or |\mmz@coS| (for salt). % \noindentmacrocode +\def\mmz@Cos{\def\mmz@context@or@salt{context}} +\def\mmz@coS{\def\mmz@context@or@salt{salt}} \def\mmz@mtoc#1{% \collargs@cs@cases{#1}% {\mmz@mtoc@cmd{#1}}% @@ -1512,14 +1548,17 @@ \expandafter\mmz@mtoc@csname\expandafter{\string#1}% } \def\mmz@mtoc@csname#1{% - \pgfkeysvalueof{/mmz/context/.@cmd}% - \detokenize{#1}={\expandafter\meaning\csname#1\endcsname}% + \pgfkeysvalueof{/mmz/\mmz@context@or@salt/.@cmd}% + \detokenize{#1}% + \ifcsname#1\endcsname + ={\expandafter\meaning\csname#1\endcsname}% + \fi \pgfeov } \def\mmz@mtoc@key#1{\mmz@mtoc@csname{pgfk@#1}} \def\mmz@mtoc@keycmd#1{\mmz@mtoc@csname{pgfk@#1/.@cmd}} \def\mmz@mtoc@error@notcsorenv#1{% - \PackageError{memoize}{'\detokenize{#1}' passed to key 'meaning to context' + \PackageError{memoize}{'\detokenize{#1}' passed to key 'meaning to \mmz@context@or@salt' is neither a command nor an environment}{}% } % \end{key} @@ -1770,6 +1809,14 @@ \fi \mmz@trace@resource{#1}% \fi + % Map the extern sequential number to the path to the extern. We need this + % so that |prefix| can be changed via |\mmznext|. The problem is that when a + % cc-memo is utilized, |\mmzMemo| closes the Memoize group; the |prefix| is + % thereby forgotten. But at the point of execution of |\mmzResource|, the + % |prefix| setting is still known and can be baked into + % |\mmz@resource@<seq>|, which will be inspected by |\mmzIncludeExtern|. + \csxdef{mmz@resource@\the\mmz@seq}{\mmz@prefix@dir#1}% + \global\advance\mmz@seq1 } % \end{macro} % @@ -1830,6 +1877,8 @@ }% \fi }% + % Reset |\mmz@seq| for |\mmzResorce|. + \global\mmz@seq=0 % Input the cc-memo if it exists. \IfFileExists{\mmz@ccmemo@path}{% \ifmmz@direct@ccmemo@input @@ -2099,6 +2148,7 @@ }% }% %</context> + \mmz@shipout@unrotate % % We complete the page setup by setting the content offset. \hoffset\dimexpr\mmz@padding@left - \pdfhorigin\relax @@ -2198,6 +2248,24 @@ \edef\mmz@inverse@mag{\expandafter\mmz@Pgf@geT\the\dimexpr 1000pt/\mag}% }} % \end{macro} +% +% +% \begin{macro}{\mmz@shipout@unrotate} +% Remove any rotation attribute given to the PDF page. I don't know enough +% about PDF page attributes to be sure this works in general. I have tested +% the code on simple documents with \hologo{LaTeX} and \hologo{plainTeX} in +% \hologo{TeX}live 2023 and 2024. It seems that the ``unrotation'' is +% unnecessary with \hologo{LaTeX3}'s PDF management module (activated by +% |\DocumentMetadata{}| before the document class declaration). +\ifdef\XeTeXversion{% + \def\mmz@shipout@unrotate{}% +}{% + \def\mmz@shipout@unrotate{% + %<latex>\IfPDFManagementActiveTF{}{\pdfpageattr{/Rotate 0}}% + %<plain,context>\pdfpageattr{/Rotate 0}% + }% +} +% \end{macro} % % \begin{macro}{\mmzRegularPages} % This counter holds the number of pages shipped out by the format's shipout @@ -2237,14 +2305,18 @@ % % \begin{macro}{\mmz@include@extern} % This macro, called from cc-memos as |\mmzIncludeExtern|, inserts an extern -% file into the document. |#1| is the sequential number, |#2| is either -% |\hbox| or |\vbox|, |#3|, |#4| and |#5| are the (expected) width, height -% and the depth of the externalized box; |#6|--|#9| are the paddings (left, -% bottom, right, and top). -\def\mmz@include@extern#1#2#3#4#5#6#7#8#9{% - % Set the extern sequential number, so that we open the correct extern file - % (|\mmz@extern@basename|). - \mmz@seq=#1\relax +% file into the document. We first look up the path to the extern based on +% the extern sequential number; the dictionary was set up by |\mmzResource| +% statements in the cc-memo. +\def\mmz@include@extern#1{% + \expandafter\expandafter\expandafter\mmz@include@extern@i + \expandafter\expandafter\expandafter{% + \csname mmz@resource@#1\endcsname}% +} +% |#1| is the path to the extern filename, |#2| is either |\hbox| or |\vbox|, +% |#3|, |#4| and |#5| are the (expected) width, height and the depth of the +% externalized box; |#6|--|#9| are the paddings (left, bottom, right, and top). +\def\mmz@include@extern@i#1#2#3#4#5#6#7#8#9{% % Use the primitive PDF graphics inclusion commands to include the extern % file. Set the correct depth or the resulting box, and shift it as % specified by the padding. @@ -2253,7 +2325,7 @@ \lower\dimexpr #5+#7\relax\hbox{% \hskip -#6\relax \setbox0=\hbox{% - \mmz@insertpdfpage{\mmz@extern@path}{1}% + \mmz@insertpdfpage{#1}{1}% }% \unhbox0 }% @@ -2792,14 +2864,14 @@ \mmzset{ tex extraction command/.initial=pdftex, tex extraction options/.initial={% -% \begin{listingregion}{tex-extraction-options.tex} +% \begin{listingregion}{tex-extraction-options} -halt-on-error -interaction=batchmode -jobname "\externbasepath" % \end{listingregion} }, tex extraction script/.initial={% -% \begin{listingregion}{tex-extraction-script.tex} ^^A todo: context +% \begin{listingregion}{tex-extraction-script} ^^A todo: context \def\noexpand\fromdocument{\jobname.pdf}% \def\noexpand\pagenumber{\pagenumber}% \def\noexpand\expectedwidth{\expectedwidth}% @@ -3024,7 +3096,7 @@ % We cheat and let the |run conditions| do the work --- it is cheaper to just % always abort than to invoke the outer handler. (As we don't set % |\AdviceRuntrue|, the run conditions will never be satisfied.) -% \begin{listingregion}{_auto-abort.tex} +% \begin{listingregion}{_auto-abort} \mmzset{ auto/abort/.style={run conditions=\mmzAbort}, } @@ -3052,7 +3124,7 @@ % These run conditions are used by |memoize| and |noop|: Memoize should be % enabled, but we should not be already within Memoize, i.e.\ memoizing or % normally compiling some code submitted to memoization. -% \begin{listingregion}{_auto-run-if-memoization-is-possible.tex} +% \begin{listingregion}{_auto-run-if-memoization-is-possible} \def\mmz@auto@rc@if@memoization@possible{% \ifmemoize \ifinmemoize @@ -3095,14 +3167,14 @@ % option application local, the outer handler opens a group, which is % expected to be closed by the inner handler. This key is used by % |memoize| and |noop command|. -% \begin{listingregion}{_auto-memoize-outer.tex} +% \begin{listingregion}{_auto-memoize-outer} \def\mmz@auto@outer{% \begingroup \mmzAutoInit \AdviceCollector } % \end{listingregion} -% \begin{listingregion}{_auto-memoize-bailout.tex} +% \begin{listingregion}{_auto-memoize-bailout} \def\mmz@auto@bailout{% \mmznext{}% } @@ -3153,7 +3225,7 @@ % executing |\Memoize| closes the memoization group and we lose the current % value of |\ifmmz@ignorespaces|. (We also can't use |\aftergroup|, % because closing the group is not the final thing |\Memoize| does.) -% \begin{listingregion}{_auto-memoize-inner.tex} +% \begin{listingregion}{_auto-memoize-inner} \long\def\mmz@auto@memoize#1{% \expanded{% \noexpand\Memoize @@ -3259,13 +3331,11 @@ % indexing. Note that the latter is a straightforward instance of replication. % %<*latex> -% \begin{listingregion}{_auto-memoize-ref.tex} \mmzset{ auto/.cd, ref/.style={outer handler=\mmz@auto@ref\mmzNoRef, run if memoizing}, force ref/.style={outer handler=\mmz@auto@ref\mmzForceNoRef, run if memoizing}, } -% \end{listingregion} \mmzset{ auto=\ref{ref}, auto=\pageref{ref}, @@ -3292,7 +3362,7 @@ % |#1| should be either |\mmzNoRef| or |\mmzForceNoRef|. |#2| will receive % any optional arguments of |\ref| (or |\pageref|, or whatever), and |#3| in % |\mmz@auto@ref@i| is the cross-reference key. -% \begin{listingregion}{_auto-memoize-ref.tex} +% \begin{listingregion}{_auto-memoize-ref} \def\mmz@auto@ref#1#2#{\mmz@auto@ref@i#1{#2}} \def\mmz@auto@ref@i#1#2#3{% #1{#3}% @@ -3308,7 +3378,8 @@ % appends the reference key to the context. |\mmzNoRef| only does that if % the reference is defined, otherwise it aborts the memoization. \def\mmzForceNoRef#1{% - \mmz@mtoc@csname{r@#1}% + \mmz@Cos + \expandafter\mmz@mtoc@csname\expandafter{\expanded{r@#1}}% \ignorespaces } \def\mmzNoRef#1{% @@ -3391,18 +3462,41 @@ % % \section{Support for various classes and packages} % +% As the support for foreign classes and packages is only loaded in +% |begindocument/before|, any keys defined there are undefined in the preamble, +% and can only be used in the document body. We don't want to burden the +% author with this detail, so we try executing any unknown keys once again at +% |begindocument/end|. +\def\mmz@unknown{} +\mmzset{ + .unknown/.code={% + \eappto\mmz@unknown{,\pgfkeyscurrentkey={#1}}% + }, + begindocument/end/.append code={% + \pgfkeyslet{/mmz/.unknown/.@cmd}\undefined + \expandafter\pgfkeysalso\expandafter{\mmz@unknown}% + }, +} +% %<*latex> \AddToHook{shipout/before}[memoize]{\global\advance\mmzExtraPages-1\relax} \AddToHook{shipout/after}[memoize]{\global\advance\mmzExtraPages1\relax} \mmzset{auto=\DiscardShipoutBox{ outer handler=\global\advance\mmzExtraPages1\relax\AdviceOriginal}} %</latex> +% An auxiliary macro for loading the support code |memoize-*.code.tex| from +% hook |begindocument/before|, where |@| already has catcode `other'. The +% |\input| statement should be enclosed in |\mmz@makeatletter| and +% |\mmz@restoreatcatcode|. +\def\mmz@makeatletter{% + \edef\mmz@restoreatcatcode{\catcode`\noexpand\@\the\catcode`\@\relax}% + \catcode`\@=11 +} % % Utility macro for clarity below. |#1| is the name of the package which should % be loaded (used with \hologo{LaTeX}) and |#2| is the name of the command % which should be defined (used with \hologo{plainTeX} and \hologo{ConTeXt}) -% for |#3| to be executed at the beginning of the document. We make sure that -% we can use |#1| etc.\ inside |#3|. +% for |#3| to be executed at the beginning of the document. \def\mmz@if@package@loaded#1#2#3{% \mmzset{% begindocument/before/.append code={% @@ -3421,6 +3515,8 @@ %<plain>\pgfpicture %<context>\startpgfpicture }{% + % We have very little code here, so we don't bother introducing + % |memoize-pgf.code.tex|. \def\mmzPgfAtBeginMemoization{% \edef\mmz@pgfpictureid{% \the\pgf@picture@serial@count @@ -3432,15 +3528,13 @@ }% \ifx\mmz@temp=0 \else - \xtoksapp\mmzCCMemo{% - \unexpanded{% - \global\expandafter\advance\csname pgf@picture@serial@count\endcsname - }% - \mmz@temp - }% + \xtoksapp\mmzCCMemo{\noexpand\mmzStepPgfPictureId{\mmz@temp}}% \fi }% - % \begin{listingregion}{_support-pgf.tex} + \def\mmzStepPgfPictureId##1{% + \global\advance\pgf@picture@serial@count##1\relax + }% + % \begin{listingregion}{_support-pgf} \mmzset{% at begin memoization=\mmzPgfAtBeginMemoization, at end memoization=\mmzPgfAtEndMemoization, @@ -3460,7 +3554,7 @@ \input advice-tikz.code.tex % We define and activate the automemoization handlers for the \TikZ; command % and environment. - % \begin{listingregion}{_support-tikz.tex} + % \begin{listingregion}{_support-tikz} \mmzset{% auto={tikzpicture}{memoize}, auto=\tikz{memoize, collector=\AdviceCollectTikZArguments}, @@ -3477,7 +3571,7 @@ % defined using |xparse|, so |args| is unnecessary. %<*latex> \mmz@if@package@loaded{forest}{\Forest}{% - % \begin{listingregion}{_support-forest.tex} + % \begin{listingregion}{_support-forest} \mmzset{ auto={forest}{memoize}, auto=\Forest{memoize}, @@ -3492,30 +3586,53 @@ % The Beamer code is explained in \MS\ref{sec:per-overlay}. % %<*latex> -\AddToHook{begindocument/before}{\@ifclassloaded{beamer}{% - % \begin{listingregion}{per-overlay.tex} - \mmzset{per overlay/.style={ - /mmz/context={% - overlay=\csname beamer@overlaynumber\endcsname, - pauses=\ifmemoizing - \mmzBeamerPauses - \else - \expandafter\the\csname c@beamerpauses\endcsname - \fi - }, - /mmz/at begin memoization={% - \xdef\mmzBeamerPauses{\the\c@beamerpauses}% - \xtoksapp\mmzCMemo{% - \noexpand\mmzSetBeamerOverlays{\mmzBeamerPauses}{\beamer@overlaynumber}}% - \gtoksapp\mmzCCMemo{% - \only<\mmzBeamerOverlays>{}}% - }, - /mmz/at end memoization={% - \xtoksapp\mmzCCMemo{% - \noexpand\setcounter{beamerpauses}{\the\c@beamerpauses}}% +\AddToHook{begindocument/before}{% + \@ifclassloaded{beamer}{% + \mmz@makeatletter + \input{memoize-beamer.code.tex}% + \mmz@restoreatcatcode + }{}% + \@ifpackageloaded{beamerarticle}{% + \mmz@makeatletter + \input{memoize-beamer.code.tex}% + \mmz@restoreatcatcode + }{}% +} +%</latex> +%</mmz> +%<*beamer> +\mmzset{ + per overlay/.code={}, + beamer mode to prefix/.style={ + prefix=\mmz@prefix@dir\mmz@prefix@name\beamer@currentmode_mode. + }, +}% +\@ifclassloaded{beamer}{% + % \begin{listingregion}{per-overlay} + \mmzset{ + per overlay/.style={ + /mmz/context={% + overlay=\csname beamer@overlaynumber\endcsname, + pauses=\ifmemoizing + \mmzBeamerPauses + \else + \expandafter\the\csname c@beamerpauses\endcsname + \fi + }, + /mmz/at begin memoization={% + \xdef\mmzBeamerPauses{\the\c@beamerpauses}% + \xtoksapp\mmzCMemo{% + \noexpand\mmzSetBeamerOverlays{\mmzBeamerPauses}{\beamer@overlaynumber}}% + \gtoksapp\mmzCCMemo{% + \only<all:\mmzBeamerOverlays>{}}% + }, + /mmz/at end memoization={% + \xtoksapp\mmzCCMemo{% + \noexpand\setcounter{beamerpauses}{\the\c@beamerpauses}}% + }, + /mmz/per overlay/.code={}, }, - /mmz/per overlay/.code={}, - }} + } \def\mmzSetBeamerOverlays#1#2{% \ifnum\c@beamerpauses=#1\relax \gdef\mmzBeamerOverlays{#2}% @@ -3529,8 +3646,9 @@ \fi }% % \end{listingregion} -}{}} -%</latex> +}% +%</beamer> +%<*mmz> % % \subsection{Biblatex} % \label{sec:biblatex} @@ -3540,7 +3658,9 @@ \mmzset{ biblatex/.code={% \mmz@if@package@loaded{biblatex}{}{% + \mmz@makeatletter \input memoize-biblatex.code.tex + \mmz@restoreatcatcode \mmzset{#1}% }% }, @@ -3548,10 +3668,8 @@ %</latex> %</mmz> %<*biblatex> -\edef\memoizeresetatcatcode{\catcode`\noexpand\@\the\catcode`\@\relax}% -\catcode`\@=11 \mmzset{% - % Advise macro |\entry| occuring in |.bbl| files to collect the entry, + % Advise macro |\entry| occurring in |.bbl| files to collect the entry, % verbatim. |args|: |m| = citation key, |&&{...}u| = the entry, verbatim, % braced --- so |\blx@bbl@entry| will receive two mandatory arguments. auto=\blx@bbl@entry{ @@ -3677,6 +3795,7 @@ \expandafter{\mmz@biblatex@keys}% } \def\mmz@biblatex@do@context@one#1{% + \mmz@Cos \mmz@mtoc@csname{mmz@bbl@#1}% \ifcsdef{mmz@bbl@#1}{}{\mmzAbort}% } @@ -3808,7 +3927,6 @@ auto=\citelist{cite, args=l*mlm}, auto=\citefield{cite, args=l*mlm}, } -\memoizeresetatcatcode %</biblatex> %<*mmz> % @@ -3968,4 +4086,4 @@ % TeX-engine: luatex % TeX-master: "doc/memoize-code.tex" % TeX-auto-save: nil -% End:
\ No newline at end of file +% End: diff --git a/macros/generic/memoize/memoize.ins b/macros/generic/memoize/memoize.ins index 74b0bc1b3e..a161150615 100644 --- a/macros/generic/memoize/memoize.ins +++ b/macros/generic/memoize/memoize.ins @@ -37,5 +37,6 @@ \file{memoizable.code.tex}{\from{memoize.dtx}{mmzable,generic}}% \file{memoize-extract-one.tex}{\from{memoize.dtx}{extract-one}}% \file{memoize-biblatex.code.tex}{\from{memoize.dtx}{biblatex}}% + \file{memoize-beamer.code.tex}{\from{memoize.dtx}{beamer}}% } \endbatchfile diff --git a/macros/latex/contrib/jpnedumathsymbols/README.md b/macros/latex/contrib/jpnedumathsymbols/README.md index cd06e3eeda..e40e5987e6 100644 --- a/macros/latex/contrib/jpnedumathsymbols/README.md +++ b/macros/latex/contrib/jpnedumathsymbols/README.md @@ -8,11 +8,13 @@ Mathematical equation representation in Japanese education differs somewhat from Documents for this package are available in English and Japanese. -## Achknowledgements +## Acknowledgements \arc is by [Prof. Shingo SAITO](http://www.artsci.kyushu-u.ac.jp/~ssaito/jpn/tex/tips/misc.html#arc). I would like to thank him. -\parallel is by [Mr./Ms. Ohishi](https://oku.edu.mie-u.ac.jp/~okumura/texfaq/qa/8814.html). I would like to thank him/her. +\parallel is by [Mr./Ms. Ohishi](https://okumuralab.org/~okumura/texfaq/qa/8814.html). I would like to thank him/her. + +environment align** and gather** are by [Mr./Ms. Krypf](https://qiita.com/Krypf/items/f69fb363dc182f9fbb66). I would like to thank him/her. This package is inspired by [emath package by Kazuhiro Okuma (a.k.a. tDB)](http://emath.s40.xrea.com/). I would like to thank him. @@ -26,11 +28,13 @@ This package released under [the MIT license](https://ctan.org/license/mit). ## Revision History +- Version 1.3 2024-11-24 + - Rewrited README and documents. - Version 1.2 2024-11-22 - Adjusted the position of \sqrt, \notparallel and \similar. - Add \eand*, \eor*, \simul*, \vvec, \vvec*, \vinp, \tsum, \expectation, \variance, \deviation, \nomination*, equation**, align** and gather**. - Version 1.1 2022-07-10 - - Rewrite README. + - Rewrited README. - License changed from GNU/GPL to MIT (stopped using codes under GNU/GPL). - Added the document (jpnedumathsymbols.pdf). - Added the [curriculum] option, and the default is changed to [nocurriculum]. diff --git a/macros/latex/contrib/jpnedumathsymbols/jpnedumathsymbols.pdf b/macros/latex/contrib/jpnedumathsymbols/jpnedumathsymbols-doc.pdf Binary files differindex 919ac312cd..23c8ae136d 100644 --- a/macros/latex/contrib/jpnedumathsymbols/jpnedumathsymbols.pdf +++ b/macros/latex/contrib/jpnedumathsymbols/jpnedumathsymbols-doc.pdf diff --git a/macros/latex/contrib/jpnedumathsymbols/jpnedumathsymbols.tex b/macros/latex/contrib/jpnedumathsymbols/jpnedumathsymbols-doc.tex index 369ebb299a..d1f678a4f3 100644 --- a/macros/latex/contrib/jpnedumathsymbols/jpnedumathsymbols.tex +++ b/macros/latex/contrib/jpnedumathsymbols/jpnedumathsymbols-doc.tex @@ -1021,6 +1021,7 @@ It follows that the number of primes is infinite.\QED It follows that the number of primes is infinite.\QED \end{macroexample} +\hspace*{0.14\textwidth}These codes are by \href{https://qiita.com/Krypf/items/f69fb363dc182f9fbb66}{Mr./Ms. Krypf}. \begin{lstlisting} \begin{equation**}{label1} A=B @@ -1057,10 +1058,14 @@ I would like to thank him. |\arc|は\href{http://www.artsci.kyushu-u.ac.jp/~ssaito/jpn/tex/tips/misc.html#arc}{斎藤新悟氏}によるものです。お礼申しあげます。 -|\parallel| is by \href{https://oku.edu.mie-u.ac.jp/~okumura/texfaq/qa/8814.html}{Mr./Ms. Ohishi}. +|\parallel| is by \href{https://okumuralab.org/~okumura/texfaq/qa/8814.html}{Mr./Ms. Ohishi}. I would like to thank him/her. -|\parallel|は\href{https://oku.edu.mie-u.ac.jp/~okumura/texfaq/qa/8814.html}{大石氏}によるものです。お礼申しあげます。 +|\parallel|は\href{https://okumuralab.org/~okumura/texfaq/qa/8814.html}{大石氏}によるものです。お礼申しあげます。 + +Environment |align**| and |gather**| are by \href{https://qiita.com/Krypf/items/f69fb363dc182f9fbb66}{Mr./Ms. Krypf}. I would like to thank him/her. + +|align**| 環境と |gather**| 環境は \href{https://qiita.com/Krypf/items/f69fb363dc182f9fbb66}{Krypf氏}によるものです。お礼申しあげます。 This package is inspired by \href{http://emath.s40.xrea.com/}{emath package by Kazuhiro Okuma (a.k.a. tDB)}. I would like to thank him. diff --git a/macros/latex/contrib/jpnedumathsymbols/jpnedumathsymbols.sty b/macros/latex/contrib/jpnedumathsymbols/jpnedumathsymbols.sty index a9fa06f72e..3b376d95ea 100644 --- a/macros/latex/contrib/jpnedumathsymbols/jpnedumathsymbols.sty +++ b/macros/latex/contrib/jpnedumathsymbols/jpnedumathsymbols.sty @@ -11,7 +11,7 @@ %% % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{jpnedumathsymbols}[2024/11/22 v1.2] +\ProvidesPackage{jpnedumathsymbols}[2024/11/24 v1.3] % %% [nofrac] \newif\if@jpnedu@symbol@nofrac diff --git a/macros/latex/contrib/lastpage/README b/macros/latex/contrib/lastpage/README index b7c3c78bb2..aec0c6a6fd 100644 --- a/macros/latex/contrib/lastpage/README +++ b/macros/latex/contrib/lastpage/README @@ -1,4 +1,4 @@ -README for lastpage package, 2024-07-07, v2.1c +README for lastpage package, 2024-11-24, v2.1d TABLE OF CONTENTS @@ -8,10 +8,9 @@ TABLE OF CONTENTS 2 Download 3 Installation 4 Additional Packages -5 Package Compatibility -6 Authors/Maintainer -7 Bug Reports -8 Known Problems +5 Authors/Maintainer +6 Bug Reports +7 Known Problems 1 INTRODUCTION @@ -25,8 +24,7 @@ When more than one page numbering scheme is used, or another package has output after this package, or the number of pages instead of the last page's name is needed, or the page numbers exceed a certain range, there might be problems, -which can be solved by using the pageslts package instead -[which needs updating to current LaTeX-format and therefore might fail]. +which can be solved by using the pageslts package instead. This material is published under the LPPL 1.3c: This work may be distributed and/or modified under the conditions of the LaTeX Project @@ -47,9 +45,9 @@ https://ctan.org/pkg/lastpage Also a ZIP file is provided that contains the files: the manual (lastpage.pdf), the example (lastpage-example.tex), -the compiled example (lastpage-example.pdf), +the compiled example (lastpage-example.pdf), driver (lastpage.drv), lastpage.dtx, -installation file (lastpage.ins), +installation file (lastpage.ins), the style files (lastpage.sty, lastpage209.sty, lastpage2e.sty, lastpageclassic.sty, lastpagemodern.sty), and this README, already sorted in a TDS tree: @@ -115,23 +113,16 @@ the documentation), see "7.1 Downloads" in the manual https://mirror.ctan.org/macros/latex/contrib/lastpage/lastpage.pdf -5 PACKAGE COMPATIBILITY -======================= - -lastpage is not compatible with the ancient version 2.0 -(and earlier) of the endfloat package. The recent version of -endfloat is available at https://ctan.org/pkg/endfloat - -6 AUTHORS/MAINTAINER +5 AUTHORS/MAINTAINER ==================== -* Author of the original main code: +* Author of the original main code: Jeffrey P. Goldberg (Thanks!) * Author of the recent package and current maintainer: H.-Martin Münch -7 BUG REPORTS +6 BUG REPORTS ============= A bug report should contain: @@ -158,7 +149,8 @@ Bug reports can be send to the maintainer: <Martin [dot] Muench [at] Uni-Bonn [dot] de> -8 KNOWN PROBLEMS +7 KNOWN PROBLEMS ================ -Really a lot, see chapter 3 of the documentation!
\ No newline at end of file +In simple cases none, but otherwise a lot, +see chapter 3 of the documentation!
\ No newline at end of file diff --git a/macros/latex/contrib/lastpage/lastpage-example.pdf b/macros/latex/contrib/lastpage/lastpage-example.pdf Binary files differindex db990f6942..97bde626ae 100644 --- a/macros/latex/contrib/lastpage/lastpage-example.pdf +++ b/macros/latex/contrib/lastpage/lastpage-example.pdf diff --git a/macros/latex/contrib/lastpage/lastpage.dtx b/macros/latex/contrib/lastpage/lastpage.dtx index c447d39cc6..db3eb4548d 100644 --- a/macros/latex/contrib/lastpage/lastpage.dtx +++ b/macros/latex/contrib/lastpage/lastpage.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % File: lastpage.dtx -% Version: 2024-07-07 v2.1c +% Version: 2024-11-24 v2.1d % Info: Refers to last page's name % % Copyright © 2010 - 2024 by @@ -9,7 +9,7 @@ % Portions of code copyrighted by other people as marked. % % This package was invented by Jeffrey P. Goldberg. -% I thought that a replacement was needed and therefore created the pageslts package, +% I thought that an enhancement was needed and therefore created the pageslts package, % https://ctan.org/pkg/pageslts. Nevertheless, for compatibility with existing % documents/packages as well as for the low amount of resources needed by the % lastpage package (no new counter!), I updated this package. @@ -65,7 +65,7 @@ \input docstrip.tex \Msg{**********************************************************************} \Msg{* Installation *} -\Msg{* Package: lastpage 2024-07-07 v2.1c Refers to last page's name (HMM)*} +\Msg{* Package: lastpage 2024-11-24 v2.1d Refers to last page's name (HMM)*} \Msg{**********************************************************************} \keepsilent @@ -77,7 +77,7 @@ This is a generated file. Project: lastpage -Version: 2024-07-07 v2.1c +Version: 2024-11-24 v2.1d Info: Refers to last page's name Copyright (C) 2010 - 2024 by @@ -99,7 +99,7 @@ This work has the LPPL maintenance status "maintained". The Current Maintainer of this work is H.-Martin Muench. This package was invented by Jeffrey P. Goldberg. -I thought that a replacement was needed and therefore created the pageslts package, +I thought that an enhancement was needed and therefore created the pageslts package, https://ctan.org/pkg/pageslts. Nevertheless, for compatibility with existing documents/packages as well as for the low amount of resources needed by the lastpage package (no new counter!), I updated this package. @@ -182,9 +182,8 @@ In memoriam % % \begin{macrocode} %<*driver> -\NeedsTeXFormat{LaTeX2e}[2023-11-01] -\ProvidesFile{lastpage.drv}% - [2024-07-07 v2.1c Refers to last page's name (HMM)] +\NeedsTeXFormat{LaTeX2e}[2024-06-01] +\ProvidesFile{lastpage.drv}[2024-11-24 v2.1d Refers to last page's name (HMM)] \documentclass{ltxdoc}[2024/02/08]% v2.1j Standard LaTeX documentation class \usepackage{holtxdoc}[2019/12/09]% v0.30 Private additional ltxdoc support (HO) \hypersetup{% @@ -230,26 +229,27 @@ In memoriam % }%^^A % \expandafter\endgroup\x % -% \DoNotIndex{\@auxout,\@evenfoot,\@firstofone,\@firstoftwo,\@ifl@t@r,\@ifpackagelater,\@ifpackageloaded} -% \DoNotIndex{\@ifundefined,\@kernel@reserved@label@data,\@mainaux,\@number,\@oddfoot} -% \DoNotIndex{\addtocounter,\AddToHook,\arabic,\begin} -% \DoNotIndex{\bigskip,\clearpage,\csname,\detokenize,\documentclass,\EdefUnescapeString,\empty,\end} -% \DoNotIndex{\endcsname,\enddocument,\expanded,\ExplSyntaxOff,\ExplSyntaxOn,\fmtversion} -% \DoNotIndex{\g,\gdef,\here,\hfil,\Hy@temp,\Hy@unicodefalse} -% \DoNotIndex{\hypersetup,\if,\if@filesw,\if@nobreak,\ifHy@hypertexnames,\ifHy@pageanchor,\ifHy@plainpages} -% \DoNotIndex{\ifdim,\ifnum,\IfPackageAtLeastTF,\IfPackageLoadedTF,\ifvmode,\ifx,\immediate,\input} -% \DoNotIndex{\label,\lastpage,\lastpage-example.tex,\lastpage.dtx,\lastpage.sty,\lastpagee.sty} -% \DoNotIndex{\lastpageclassic.sty,\lastpagemodern.sty,\LaTeX,\LaTeX-kernel,\listfiles} -% \DoNotIndex{\makeatletter,\makeatother,\markboth,\meaning,\mbox,\message,\MessageBreak} -% \DoNotIndex{\NeedsTeXFormat,\newcommand,\newcounter,\newline,\newpage,\nobreak} -% \DoNotIndex{\noindent,\normalsize,\numexpr,\origenddocument,\PackageError,\PackageWarning} -% \DoNotIndex{\PackageWarningNoLine,\pagenumbering,\pageref,\pdfstringdef,\protect,\ProvidesPackage} -% \DoNotIndex{\qquad,\RequirePackage,\section,\ShowHook,\slshape,\smallskip,\space,\test,\textbf} -% \DoNotIndex{\textit,\textquotedblleft,\textquotedblright,\textsf,\texttt,\the,\thepage} -% \DoNotIndex{\today,\upshape,\url,\usepackage,\value,\verb,\wd,\write,\xlastpage@rmpage,\xxlastpage@rmpage} +% \DoNotIndex{\@auxout,\@evenfoot,\@firstofone,\@firstoftwo,\@ifl@t@r,\@ifpackagelater,\@ifpackageloaded,% +% \IfPackageAtLeastF,\IfPackageLoadedT,\IfPackageLoadedTF,% +% \@ifundefined,\@kernel@reserved@label@data,\@mainaux,\@number,\@oddfoot,% +% \addtocounter,\AddToHook,\arabic,\begin,% +% \bigskip,\clearpage,\csname,\detokenize,\documentclass,\EdefUnescapeString,\empty,\end,% +% \endcsname,\enddocument,\expanded,\ExplSyntaxOff,\ExplSyntaxOn,\fmtversion,% +% \g,\gdef,\here,\hfil,\Hy@temp,\Hy@unicodefalse,\Hy@EveryPageAnchor,% +% \hypersetup,\if,\if@filesw,\if@nobreak,\ifHy@hypertexnames,\ifHy@pageanchor,\ifHy@plainpages,% +% \ifdim,\ifnum,\ifvmode,\ifx,\immediate,\input,% +% \label,\lastpage,\lastpage-example.tex,\lastpage.dtx,\lastpage.sty,\lastpagee.sty,% +% \lastpageclassic.sty,\lastpagemodern.sty,\LaTeX,\LaTeX-kernel,\listfiles,% +% \makeatletter,\makeatother,\markboth,\meaning,\mbox,\message,\MessageBreak,% +% \NeedsTeXFormat,\newcommand,\newcounter,\newline,\newpage,\nobreak,% +% \noindent,\normalsize,\numexpr,\origenddocument,\PackageError,\PackageNoteNoLine,\PackageWarning,% +% \PackageWarningNoLine,\pagenumbering,\pageref,\pdfstringdef,\protect,\ProvidesPackage,% +% \qquad,\renewcommand,\RequirePackage,\section,\ShowHook,\slshape,\smallskip,\space,\test,\textbf,% +% \textit,\textquotedblleft,\textquotedblright,\textsf,\texttt,\the,\thepage,% +% \today,\upshape,\url,\usepackage,\value,\verb,\wd,\write,\xlastpage@rmpage,\xxlastpage@rmpage} % % \title{The \xpackage{lastpage} package} -% \date{2024-07-07 v2.1c} +% \date{2024-11-24 v2.1d} % \author{H.-Martin Münch\\\xemail{Martin.Muench at Uni-Bonn.de}\\ % invented by Jeffrey P. Goldberg\\\xemail{jeffrey+news at goldmark.org}} % @@ -283,26 +283,17 @@ In memoriam % If any damage occurs by the use of information presented there, % only the author of the respective pages might be liable, % not the one who has referred to those pages. -% -% \bigskip -% -% \textbf{Note: At several places in this manual as alternative the \pkg{pageslts} -% package is \textquotedblleft advertised\textquotedblright. The current version -% 2015/12/21 v1.2f of that package has not yet been updated to the new hook mechanism. -% In special cases (for example }|\pagenumbering{fnsymbol}|\textbf{) the current version -% of that package combined with a current \LaTeX-format fails. Together with a lot of -% other packages (small to large, public as well as private, some probably obsolete) -% it is in my update queue.} -% % \newpage -% % \tableofcontents % % \section{Introduction} % \indent This \LaTeX{} package puts the label \texttt{LastPage} -% (at end of the document) into the \xfile{aux} file, allowing the user to refer -% to the last page of a document via |\pageref{LastPage}|. -% This might be particularly useful in places like headers or footers. +% (at end of the document via hook |enddocument/afterlastpage|, +% for older formats via |\AtEndDocument|, for \LaTeX2.09{} via +% redefining |\enddocument|) into the \xfile{aux} file, +% allowing the user to refer to the last page of a document via +% |\pageref{LastPage}|. This might be particularly useful +% in places like headers or footers. % % \bigskip % @@ -326,7 +317,7 @@ In memoriam % (or |\input{lastpage.sty}| if |\usepackage| is unknown). % % \indent For example for various draft forms it is desirable to have a -% page reference to the last page, so that e.\,g. page footers can +% page reference to the last page, so that e.\,g.\ page footers can % contain something like \textquotedblleft page $N$ of $K$\textquotedblright, % where $N$ is the current page and $K$ is the last page. Once the package % is loaded, anywhere in the text references can be made to the label @@ -352,23 +343,22 @@ In memoriam % % The \xpackage{lastpage} package does not provide the words % \textquotedblleft page\textquotedblright{} or \textquotedblleft of\textquotedblright{}, -% but e.\,g. the \xclass{handout} class uses \textquotedblleft of\textquotedblright{} in +% but e.\,g.\ the \xclass{handout} class uses \textquotedblleft of\textquotedblright{} in % the definition of the footer. (In the \texttt{lastpage-example} also % |\@evenfoot| is redefined, but it is not the \xpackage{lastpage} \emph{package} % redefining this.) If you want to change \textquotedblleft page\textquotedblright{} or -% \textquotedblleft of\textquotedblright{} (e.\,g. to another language), you therefore +% \textquotedblleft of\textquotedblright{} (e.\,g.\ to another language), you therefore % have got to look in the used class/package(s)/preamble instead of in the % \xpackage{lastpage} package.\bigbreak % % If the total \emph{number} of pages of a document is needed, % the kernel already gives this by |\makeatletter\@abspage@last\makeatother|, % |\thetotalpages|, and |\PreviousTotalPages| (needing at least two compiler runs). -% \newpage % % \section{Some \textsc{Warnings}\label{sec:warn}} % \subsection{\texttt{\textbackslash AtEndDocument}\label{ssec:aed}} % \indent {\bfseries |\AtEndDocument| is not used by the \pkg{lastpagemodern.sty} -% version of the lastpage package, requiring \LaTeX -format 2023-06-01 +% version of the lastpage package, requiring \LaTeX -format 2024-06-01 % or newer. Instead |\AddToHook{enddocument/afterlastpage}| is used % and the problem does not arise.} % \bigskip @@ -411,7 +401,7 @@ In memoriam % \subsection{Interaction with ancient versions of the \xpackage{endfloat} package\label{sec:endfloat}} % % \indent {\bfseries |\AtEndDocument| is not used by the \pkg{lastpagemodern.sty} -% version of the lastpage package, requiring \LaTeX -format 2023-06-01 +% version of the lastpage package, requiring \LaTeX -format 2024-06-01 % or newer. Instead |\AddToHook{enddocument/afterlastpage}| is used % and the problem does not arise.} % @@ -446,7 +436,7 @@ In memoriam % (with \textbf{s} at the end) at your disposal for remediation.) % % \subsection{No write access to the \xfile{aux} file} -% Some packages (e.\,g. \xpackage{tikz} and \xpackage{selectp}) sometimes prevent +% Some packages (e.\,g.\ \xpackage{tikz} and \xpackage{selectp}) sometimes prevent % the output to the \xfile{aux} file. In that case a warning is issued. This is % no problem as long as there is another compilation run where the label to the % last page can be placed via the \xfile{aux} file. @@ -465,7 +455,7 @@ In memoriam % The \xpackage{pageslts} package puts |\lastpageref{LastPages}| % (with \textbf{s} at the end) at your disposal for remediation, % giving the number of pages and linking to the last page, if linking is provided -% for examaple by the \pkg{hyperref} package. +% for examaple by the \xpackage{hyperref} package. % % \subsection{\texttt{\textbackslash addtocounter\{page\}\{\ldots\} and % % \texttt{\textbackslash setcounter\{page\}\{\ldots\}}}} @@ -496,14 +486,14 @@ In memoriam % page numbering schemes are not provided.\newline % The \xpackage{pageslts} package does this with labels % \texttt{pagesLTS.<numbering scheme>}, where \texttt{<numbering scheme>} is -% e.\,g. arabic, roman, Roman, alph, or Alph.\linebreak +% e.\,g.\ arabic, roman, Roman, alph, or Alph.\linebreak % For fnsymbol please use |\lastpageref{pagesLTS.fnsymbol}| instead of\newline % |\pageref{pagesLTS.fnsymbol}|. % % \subsection{Current page} % The command |\thepage| gives the \textbf{name} of the current page % in the current page numbering scheme, which is different from the -% current total/absolute page number e.\,g. with a second +% current total/absolute page number e.\,g.\ with a second % page numbering scheme, |\addtocounter{page}{...}|, or |\setcounter{page}{...}|, % and it will not be an arabic number at all, % if the current page numbering scheme is not arabic.\newline @@ -541,25 +531,40 @@ In memoriam % \end{tabular}\\[1ex] % \texttt{MAX} = \texttt{2147483647} % \end{quote} -% \textquotedblright{} (\textsc{Heiko Oberdiek}: -% The \xpackage{alphalph} package, 2010/04/18, v2.3, first table, p.~2). +% \textquotedblright\ (\xpackage{alphalph} package manual, 2019/12/09, v2.6, +% first table, p.~2). % % \noindent When \textit{any} page is out of that range, there will be a counter overflow.\newline % \xpackage{lastpage} probably is not the right package to be asked % to correct this anyway, but the \xpackage{pageslts} package % (with appropriate options) can do this. % +% When MAX is exceeded via +% |\setcounter{<name>}{| something greater than MAX (or smaller then $-$MAX) |}|, +% then the error +% \begin{quote} +% \begin{verbatim} +% ! Number too big. +% I can only go up to 2147483647='17777777777="7FFFFFFF, +% so I'm using that number instead of yours. +% \end{verbatim} +% \end{quote} +% \vspace{-\baselineskip} +% will arise. But if the counter has a value of $2\,147\,483\,647 = {}$MAX, +% and |\addtocounter{<name>}{+1}| is tried, no error is issued, but +% |\arabic{<name>}| prints $-2147483648$, and further |\addtocounter{<name>}{+1}|s +% give $-2147483647$, $-2147483646$ and so on.\\ +% For a counter value of $-2\,147\,483\,647 = -$MAX and |\addtocounter{<name>}{-1}|s +% after $-2147483647$ it is printed $-2147483648$, $2147483647$, $2147483646$ and so on +% (without any message in the \xfile{log} file about any possible issue). +% % \subsection{Other packages manipulating \texttt{\textbackslash lastpage@putlabel}} % The \xpackage{revtex4} class redefines the |\lastpage@putlabel| command -% (with outdated two arguments), and the \xpackage{pageslts} package -% \textquotedblleft kills\textquotedblright{} the |\lastpage@putlabel| command, -% because that package uses more advanced labels.\newline -% None of the definitions or commands of the other packages are altered, -% but |\lastpage@putlabel| was replaced by |\lastpage@putl@bel|. -% Because \linebreak |\lastpage@putlabel| is no longer called, now there should not be any -% double definitions of the \texttt{lastpage} label. -% -% \subsection{\texttt{\textbackslash pagenumbering\{fnsymbol\}}} +% to place a label |LastPage|.\newline +% |\lastpage@putlabel| in the \xpackage{lastpage} package was replaced by |\lastpage@putl@bel|, +% but the |LastPage| label could become defined more than once. +% +% \subsection{\texttt{\textbackslash pagenumbering\{fnsymbol\}}\label{subsec:fnsymbol}} % When using the foot-note-symbols as page numbers, % it can be necessary to declare in the document's preamble: % \begin{verbatim} @@ -570,27 +575,18 @@ In memoriam % \DeclareTextCommand{\textparagraph}{PD1}{¶} % \DeclareTextCommand{\textbardbl}{PD1}{‖} % \end{verbatim} -% \newpage % % \section{Alternatives\label{sec:Alternatives}} % There are similar packages, which do (or do not) similar things (or even more). % As I neither know what exactly you want to accomplish when using this package % (e.\,g.~page number vs. page name, hyperlinks or not), nor what resources -% you have (e.\,g.~\TeX, \LaTeX2e, $\varepsilon$-\TeX{}, \LaTeX-format as recent -% as 2022-11-01 or newer), here is a list of some possible alternatives: -% -% \DescribeMacro{pageslts}\vspace*{-\baselineskip} +% your system has (e.\,g.~\TeX, \LaTeX2e, $\varepsilon$-\TeX{}, \LaTeX-format as recent +% as 2024-06-01 or newer), here is a list of some possible alternatives: % \begin{description} -% \item[-] -% \textbf{Note: The current version 2015/12/21 v1.2f of the \pkg{pageslts} package -% has not yet been updated to the new hook mechanism. In special cases (for example }% -% |\pagenumbering{fnsymbol}|\textbf{) the current version of that package combined -% with a current \LaTeX-format fails. Together with several other packages -% (small to large, public as well as private, some probably obsolete) it is -% in the update queue.}\newline +% \item[-]\DescribeMacro{pageslts} % The \xpackage{pageslts} package first started as a revision of this -% \xpackage{lastpage} package, but it became obvious that a replacement was -% needed to accomplish what the \xpackage{pageslts} package does. For backward +% \xpackage{lastpage} package, but I~thought that an enhancement was needed +% to accomplish what the \xpackage{pageslts} package does. For backward % compatibility, a label named |LastPage| is provided. % Thus |\usepackage{lastpage}| can be replaced by\newline % |\usepackage[pagecontinue=false,alphMult=0,AlphMulti=0,|\newline @@ -601,14 +597,17 @@ In memoriam % |fnsymbolmult=true,romanMult=true,RomanMulti=true]{pageslts}|.\newline % Benefits of \xpackage{pageslts} package (with appropriate options) are: % \begin{description} -% \item[+] Labels \texttt{LastPage} (|\AtEndDocument|) and\newline -% \texttt{VeryLastPage} (|\AfterLastShipout|),\newline -% allowing the user to refer to the (very) last page of a document. +% \item[+] Labels \texttt{LastPage} (|\AddToHook{enddocument/afterlastpage}|, +% formerly |\AtEndDocument|; same as the \xpackage{LastPage} package) and +% \texttt{VeryLastPage} (also |\AddToHook{enddocument/afterlastpage}|, +% but formerly\newline% +% |\AfterLastShipout|), allowing the user to refer to the +% (very) last page of a document. % \item[+] For example, when more than one page numbering scheme is used, -% the label \texttt{LastPage}\textbf{s} gives the total \textit{number} of pages. +% the label \mbox{\texttt{LastPage}\textbf{s}} gives the total \textit{number} of pages. % \item[+] At the last page of each page numbering scheme a label\newline % \texttt{pagesLTS.<numbering scheme>} is placed, where -% \texttt{<numbering scheme>} is e.\,g. arabic, roman, Roman, alph, or Alph. +% \texttt{<numbering scheme>} is e.\,g.\ arabic, roman, Roman, alph, or Alph. % For fnsymbol please use |\lastpageref{pagesLTS.fnsymbol}| instead of\newline % |\pageref{pagesLTS.fnsymbol}|. % \item[+] When the same numbering scheme is used twice, the page numbers @@ -619,58 +618,46 @@ In memoriam % \textit{name} in the current page numbering scheme. % |\theCurrentPageLocal| gives the current number of pages in the current % page numbering scheme. |\thepage| and |\theCurrentPageLocal| are different -% e.\,g. when |\addtocounter{page}{...}| or |\setcounter{page}{...}| were used. +% e.\,g.\ when |\addtocounter{page}{...}| or |\setcounter{page}{...}| were used. % \item[+] At the first page of the document a label \texttt{pagesLTS.0} is created. -% \item[+] The \xpackage{alphalph} package is supported, i.\,e. +% \item[+] The \xpackage{alphalph} package is supported, i.\,e.\ % % page numbers alph or Alph $>26$ and fnsymbol $>9$ can be used % (with according options set). Even zero and negative page numbers can be used % with \texttt{arabic}, \texttt{alph}, \texttt{Alph}, \texttt{roman}, \texttt{Roman}, % and \texttt{fnsymbol} page numbering (with \xpackage{alphalph} package and % according options). -% \item[+] It is checked whether a (very) old \xpackage{endfloat} package -% is in use. If it is, a warning or even an error message is given, -% depending on \xpackage{endfloat} version. -% \item[+] A rerun warning is given, when labels have changed. % \end{description} -% Further labels are provided for special cases. -% \end{description} +% Further labels are provided for special cases.\\ +% \url{https://ctan.org/pkg/pageslts} % -% \DescribeMacro{totpages}\vspace{-\baselineskip} -% \begin{description} -% \item[-] The \xpackage{totpages} package provides a \texttt{totpages} label similar to -% \texttt{LastPages}\newline -% |\AtEndDocument| (instead of |\AfterLastShipout|, as done by \xpackage{pageslts}). +% \item[-]\DescribeMacro{LaTeX-kernel} +% The number of pages is nowadays available via |\@abspage@last|,\linebreak +% |\thetotalpages|, and |\PreviousTotalPages| from the kernel, +% but when more than one page numbering scheme is used +% (for example pages I~to X and then 1~to 10, thus number of pages +% \hbox{\textquotedblleft 20\textquotedblright ,} but name of the last page +% \hbox{\textquotedblleft 10\textquotedblright ),} +% or when or the fnsymbol page numbering scheme is used, or another package +% has output after this package, or the page numbers exceed a certain range, +% there might be issues. (Is the total number of pages wanted? Or is the name +% of the last page sought?)\newline +% |\the\ReadonlyShipoutCounter| contains the number of currently shipped out pages, +% i.\,e.\ current page minus one. +% +% \item[-]\DescribeMacro{totpages} +% The \xpackage{totpages} package provides a \texttt{totpages} label similar to +% \texttt{LastPages}, but |\AtEndDocument| instead of hook |enddocument/afterlastpage| +% of the \pkg{pageslts} package. % The \xpackage{totpages} package additionally computes the number of paper sheets % needed to (double) print the document (with one, two, three,\ldots{} pages on % one sheet of paper) (which can be achieved also with the \xpackage{papermas} package, % an extension of the \xpackage{pageslts} package, which further allows to compute -% the mass of that printed version of the document, useful e.\,g. when sending it -% by mail to determine the postage). -% \end{description} +% the mass of that printed version of the document, useful e.\,g.\ when sending it +% by mail to determine the postage).\\ +% \url{https://ctan.org/pkg/totpages} % -% \DescribeMacro{nofm.sty}\vspace{-\baselineskip} -% \begin{description} -% \item[-] \textquotedblleft There is a package \xpackage{nofm.sty} available, -% but some versions of it are defective, and most don't work with \xpackage{fancyhdr} -% because they take over the complete page layout.\textquotedblright (\textsc{Piet van % -% Oostrum}: Page layout in \LaTeX{}, March~2, 2004, section~16; fancyhdr.pdf)\newline -% \xpackage{nofm} as of 1991/02/25 (without version number), available at\newline -% \href{https://mirror.ctan.org/obsolete/macros/latex209/contrib/misc/nofm.sty}{% -% https://mirror.ctan.org/obsolete/macros/latex209/contrib/misc/nofm.sty}, \linebreak -% does not work with e.\,g. \xpackage{hyperref}, redefines |\enddocument| -% as well as |\@oddhead|, |\@evenhead|, |\@oddfoot|, and |\@evenfoot|.\newline -% If you know the (CTAN) location of a \textbf{working}~(!) version, -% please send an e-mail to the \xpackage{lastpage} maintainer, thanks! -% \end{description} -% -% \DescribeMacro{count1to}\vspace{-\baselineskip} -% \begin{description} -% \item[-] You may want to have a look at the \xpackage{count1to} package. -% \end{description} -% -% \DescribeMacro{totalcount}\vspace{-\baselineskip} -% \begin{description} -% \item[-] The \xpackage{totalcount} package provides |\totalpages|. +% \item[-]\DescribeMacro{totalcount} +% The \xpackage{totalcount} package provides |\totalpages|. % If there are only arabic page numbers consecutively running from 1 to the last page, % this works. But for example % @@ -688,62 +675,66 @@ In memoriam % % prints \textquotedblleft Page L of 50\textquotedblright, % where the number of pages is one (and no hyperlink is provided to the -% last page even if \xpackage{hyperref} is used). -% \end{description} -% -% \DescribeMacro{zref}\vspace{-\baselineskip} -% \begin{description} -% \item[-] The \xpackage{zref} package of \textsc{Heiko Oberdiek} requires -% $\varepsilon$-\TeX{}. \xpackage{lastpageclassic} does not require $\varepsilon$-\TeX{}, -% but if you already have $\varepsilon$-\TeX{} (and use \xpackage{lastpagemodern}), -% you may also have a look at the extensive \xpackage{zref} package, -% whether it suits your needs better (or additionally or whatsoever). -% \end{description} +% last page even if \xpackage{hyperref} is used).\\ +% \url{https://ctan.org/pkg/totalcount} +% +% \item[-]\DescribeMacro{totcount} +% The \xpackage{totcount} package provides the last value of a counter, thus also the value +% of the \texttt{page} counter. You do not get a hyperlink to the last page, only the numerical +% value of the last page name is given \mbox{(i.\,e.~X+72} pages gives 72 instead of 82 +% as total number of pages), and the number of pages can be changed for example +% by |\addtocounter|.\\ +% \url{https://ctan.org/pkg/totcount} +% \pagebreak % -% \DescribeMacro{memoir}\vspace{-\baselineskip} -% \begin{description} -% \item[-] The \xpackage{memoir} \emph{class} provides |\thelastpage| (page number printed -% on last page) and |\thelastsheet| (number of pages). -% \end{description} -% -% \DescribeMacro{LaTeX-kernel}\vspace{-\baselineskip} -% \begin{description} -% \item[-] The number of pages is nowadays available via |\@abspage@last|, -% |\thetotalpages|, and |\PreviousTotalPages| from the kernel, -% but when more than one page numbering scheme is used -% (for example pages I~to X and then 1~to 10, thus number of pages -% \hbox{\textquotedblleft 20\textquotedblright ,} but name of the last page -% \hbox{\textquotedblleft 10\textquotedblright ),} -% or when or the fnsymbol page numbering scheme is used, or another package -% has output after this package, or the page numbers exceed a certain range, -% there might be issues. (Is the total number of pages wanted? Or is the name -% of the last page sought?) +% \item[-]\DescribeMacro{nofm} +% \textquotedblleft There is a package \xpackage{nofm.sty} available, but some versions +% of it are defective, and most don't work with \xpackage{fancyhdr} because they take over +% the complete page layout.\textquotedblright{} (\textsc{Piet van Oostrum}: +% Page layout in \LaTeX , March~2, 2004, section~16; fancyhdr.pdf)\\ +% \xpackage{nofm} as of 1991/02/25 (without version number), available at\\ +% \url{https://mirror.ctan.org/obsolete/macros/latex209/contrib/misc/nofm.sty},\\ +% does not work with e.\,g.\ \xpackage{hyperref}, redefines |\enddocument| +% as well as |\@oddhead|, |\@evenhead|, |\@oddfoot|, and |\@evenfoot|.\\ +% If you know the (\url{https://CTAN.org}) location of a +% \textbf{working}~(!) version, please send me an e-mail, thanks! +% +% \item[-]\DescribeMacro{count1to} +% The \xpackage{count1to} package \textquotedblleft sets |\count1| to |\count8| +% with the values of page to subparagraph. |\count9| is used to flag odd +% pages. \ldots\ [T]he code for the TotalPages +% label\textquotedblright\ (package manual, 2024-06-13) has been removed +% from the current package version.\\ +% \url{https://ctan.org/pkg/count1to} +% +% \item[-]\DescribeMacro{zref} +% The \xpackage{zref} package \textquotedblleft implements an extensible referencing +% system\textquotedblright\ (package manual, 2023-09-14).\\ +% \url{https://ctan.org/pkg/zref} +% +% \item[-]\DescribeMacro{memoir} +% The \xpackage{memoir} \emph{class} provides |\thelastpage| (page number printed +% on last page) and |\thelastsheet| (number of pages).\\ +% \url{https://ctan.org/pkg/memoir} % \end{description} % % \bigskip % % \noindent (You programmed or found another alternative, -% which is available at \url{CTAN.org}?\newline -% OK, send an e-mail to me with the name, location at \url{CTAN.org}, +% which is available at\newline +% \url{https://CTAN.org}? +% OK, send an e-mail to me with the name, location at CTAN, % and a short notice, and I will probably include it in the list above.) -% \smallskip -% -% \noindent About how to get those packages, please see subsection~\ref{ss:Downloads}. +% \newpage % % \section{Example} -% % \begin{macrocode} %<*example> \documentclass[british]{article}[2024/02/08]% v1.4n Standard LaTeX document class \makeatletter -\@ifl@t@r\fmtversion{2022/11/01}{% - \AddToHook{enddocument/afterlastpage}[lastpage]{% - \message{^^JLaTeX Info: Executing hook `enddocument/afterlastpage'.}}% -}{\AtEndDocument{\message{^^JLaTeX Info: Executing hook `AtEndDocument'.}}% - } \usepackage[draft]{showkeys}[2024/05/23]% v3.21 Show cite and label keys (DPC, MH) %% Use final instead of draft to hide the keys. %% -\usepackage[pdfpagelabels=true,hyperindex=false]{hyperref}[2024-01-20]% v7.01h +\usepackage[pdfpagelabels=true,hyperindex=false]{hyperref}[2024-10-30]% v7.01k \@ifpackageloaded{hyperref}{% Hypertext links for LaTeX \hypersetup{extension=pdf,% plainpages=false,% @@ -755,11 +746,11 @@ In memoriam pdfview=Fit,% pdfstartview=Fit,% pdfpagelayout=SinglePage% -}}{\usepackage{url}[2013/09/16]}% v3.4 -\usepackage{lastpage}[2024/07/07]% v2.1c -\renewcommand{\@evenfoot}{% +}}{\usepackage{url}[2013/09/16]}% v3.4 Verb mode for urls, etc. +\usepackage{lastpage}[2024/11/24]% v2.1d Refers to last page's name (HMM; JPG)] +\renewcommand{\@evenfoot}{{% \normalsize\slshape \today\hfil \upshape % - page \thepage{} of \pageref{LastPage}} + page \thepage{} of \pageref{LastPage}}} \renewcommand{\@oddfoot}{\@evenfoot} \makeatother \listfiles @@ -768,7 +759,7 @@ In memoriam \section*{Example for lastpage} \markboth{Example for lastpage}{Example for lastpage} This example demonstrates the use of package\newline -\textsf{lastpage}, v2.1c as of 2024-07-07 (HMM; JPG).\newline +\textsf{lastpage}, v2.1d as of 2024-11-24 (HMM; JPG).\newline The package takes no options.\newline For more details please see the documentation!\newline @@ -850,10 +841,12 @@ The code does not generally work even without hyperref. \noindent does work (two compilations needed), because \verb|\lastpage@lastpage| contains the name of the page, \mbox{example:} \begin{verbatim} -Page \thepage{} is (not) page \makeatletter\lastpage@lastpage\makeatother. +Page \thepage{} is (not) page +\makeatletter\lastpage@lastpage\makeatother. \end{verbatim} prints:\newline -Page \thepage{} is (not) page \makeatletter\lastpage@lastpage\makeatother. +Page \thepage{} is (not) page +\makeatletter\lastpage@lastpage\makeatother. \newline This can be broken for example by \verb|\pagenumbering{fnsymbol}| (because then \verb|\edef\here{\thepage}| does not work). @@ -866,7 +859,7 @@ Last page's name (LastPage): \pageref{LastPage} With modern \LaTeX{} it is possible to say: \begin{quote} \begin{verbatim} -\NeedsTeXFormat{LaTeX2e}[2023-11-01] +\NeedsTeXFormat{LaTeX2e}[2024-06-01] \documentclass{article} \pagenumbering{fnsymbol} \begin{document} @@ -904,7 +897,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \DescribeMacro{lastpage.sty} % We first need to determine whether we are on \TeX~2.09 or \LaTeX2e.\newline % (That line, which is too long for the documentation, reads:\newline -% |\def\loadlastpage{\ProvidesPackage{lastpage}[2024/07/07 v2.1c lastpage:|\linebreak +% |\def\loadlastpage{\ProvidesPackage{lastpage}[2024/11/24 v2.1d lastpage:|\linebreak % | 2.09 or 2e? (HMM)]\relax\RequirePackage{lastpage2e}}|.) % % \begin{macrocode} @@ -912,7 +905,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook %% Part of the "lastpage" package %% loads either lastpage2.09.sty for TeX 2.09 or lastpage2e.sty for LaTeX 2e %% with code from https://groups.google.com/g/comp.text.tex/c/-Qmhj1ZI4xM -\def\loadlastpage{\ProvidesPackage{lastpage}[2024/07/07 v2.1c lastpage: 2.09 or 2e? (HMM)]\relax\RequirePackage{lastpage2e}} +\def\loadlastpage{\ProvidesPackage{lastpage}[2024/11/24 v2.1d lastpage: 2.09 or 2e? (HMM)]\relax\RequirePackage{lastpage2e}} \begingroup \expandafter \ifx \csname documentclass\endcsname\relax \endgroup \expandafter \input{lastpage209.sty} \else \endgroup \expandafter \loadlastpage @@ -952,13 +945,14 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook %<*lastpage2e> %% Part of the "lastpage" package \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{lastpage2e}[2024/07/07 v2.1c % - Decide which 2e lastpage version to use (HMM)] -\@ifl@t@r\fmtversion{2023/06/01}{\RequirePackage{lastpagemodern}}{% +\ProvidesPackage{lastpage2e}[2024/11/24 v2.1d % + Decide which 2e lastpage version to use (HMM)] +\@ifl@t@r\fmtversion{2024/06/01}{\RequirePackage{lastpagemodern}}{% \RequirePackage{lastpageclassic}} \message{^^J} %</lastpage2e> % \end{macrocode} +% \newpage % % \DescribeMacro{lastpageclassic.sty} % In case of older \LaTeX-formats \pkg{lastpageclassic.sty} is loaded: @@ -967,7 +961,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook %<*lastpageclassic> %% Part of the "lastpage" package \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{lastpageclassic}[2024/07/07 v2.1c % +\ProvidesPackage{lastpageclassic}[2024/11/24 v2.1d % Refers to last page's name (HMM; JPG)] %% allows for things like "Page \thepage{} of \pageref{LastPage}" %% to get "Page 7 of 9" @@ -1031,7 +1025,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \end{macrocode} % % |\lastpage@putlabel|, used by older versions of this package, -% is redefined e.\,g. by \xpackage{revtex}, \xpackage{frenchle}, +% is redefined e.\,g.\ by \xpackage{revtex}, \xpackage{frenchle}, % \xpackage{PPRcorners}, and old versions of \xpackage{hyperref}. % While now |\lastpage@putl@bel| is used instead, \xpackage{revtex} % could also define a label \texttt{LastPage}, @@ -1126,6 +1120,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \end{macrocode} % \end{macro} +% \newpage % % \begin{macro}{\lastpage@putlabelhyper}% % \indent When \xpackage{hyperref} has been loaded, the label is set with the @@ -1176,12 +1171,11 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \end{macrocode} % % We do not count the pages ourselves, and so they could have been changed by -% e.\,g. |\pagenumbering{...}|, |\addtocounter{page}{...}|,\newline +% e.\,g.\ |\pagenumbering{...}|, |\addtocounter{page}{...}|,\newline % |\setcounter{page}{...}|. Thus the page might have the number one % while not being the first page at all. Using the \xpackage{everyshi} % package would help, but this package should not require other packages. -% The \xpackage{pageslts} package does a better handling, but requires -% some other packages.\newline +% The \xpackage{pageslts} package does a better handling.\newline % We will make a mistake here at most once: % % \begin{macrocode} @@ -1227,7 +1221,6 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \end{macrocode} % \end{macro} -% \newpage % % \begin{macro}{\lastpage@putlabelNR} % \indent The \xpackage{nameref} package redefines |\label| to have five arguments @@ -1284,8 +1277,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook Press Ctrl+Z to exit.\MessageBreak% But it is OK if the .aux file was already updated\MessageBreak% by a previous compiler run\MessageBreak% - and would not have changed anyway.\MessageBreak% - }% + and would not have changed anyway.}% \fi% \fi% } @@ -1384,8 +1376,8 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \begin{macrocode} %<*lastpagemodern> %% Part of the "lastpage" package -\NeedsTeXFormat{LaTeX2e}[2023-06-01] -\ProvidesPackage{lastpagemodern}[2024-07-07 v2.1c % +\NeedsTeXFormat{LaTeX2e}[2024-06-01] +\ProvidesPackage{lastpagemodern}[2024-11-24 v2.1d % Refers to last page's name (HMM; JPG)] %% allows for things like "Page \thepage{} of \pageref{LastPage}" %% to get "Page 7 of 9" or "Page VII of IX"; @@ -1445,21 +1437,23 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % if it is associated with the same page.) Therefore we define % % \begin{macrocode} -\AddToHook{begindocument/end}{\gdef\lastpage@putlabel{\relax}} +\AddToHook{begindocument/end}{% + \IfPackageLoadedT{pageslts}{% + \PackageNoteNoLine{lastpage}{Packages pageslts and lastpage used.\MessageBreak% + lastpage is not necessary when loading pageslts}% + }% + \gdef\lastpage@putlabel{\relax}% + } % \end{macrocode} % -% Because |\lastpage@putlabel| might be (re)defined later, depending on the order -% in which the packages are loaded, we will do this again at the end of the document. -% % \begin{macro}{\protected@iwrite} % \indent We need an |\immediate\protected@write|. Just |\immediate\write| had led to errors, % for example when packages like \pkg{babel-greek} re-defined |\roman|\ % -% (thanks to Ulrike Fischer for the report). +% (thanks to \textsc{Ulrike Fischer} for the report). % % \begin{macrocode} -%% from https://tex.stackexchange.com/a/12811/542425 -%% with thanks to Prof. Enrico Gregorio +%% Code provided by Prof. Enrico Gregorio at https://tex.stackexchange.com/a/542425 \long\def\protected@iwrite#1#2#3{% \begingroup% #2% @@ -1478,21 +1472,40 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \begin{macrocode} \newcommand{\lastpage@makeHy}{% \gdef\lastpage@Hy{}% - \IfPackageLoadedTF{hyperref}{% + \IfPackageLoadedT{hyperref}{% \ifHy@pageanchor% - \@ifundefined{@currentHpage}{% - \PackageError{lastpage}{% - Kernel command \string\@currentHpage\space is undefined}{% - Please contact the lastpage maintainer.}% % \end{macrocode} % |\gdef\lastpage@Hy{}|, but that was already done at the beginning of this command. % \begin{macrocode} - }{\xdef\lastpage@Hptest{Doc-Start}% - \ifx\lastpage@Hptest\@currentHpage\relax% - \gdef\lastpage@Hy{\@currentHpage}% + \def\lastpage@Hptest{Doc-Start}% + \ifx\lastpage@Hptest\@currentHpage\relax% + \gdef\lastpage@Hy{\@currentHpage}% + \else% + \edef\lastpage@Hptest{\@currentHpage}% + \ifx\lastpage@Hptest\empty\relax% +% \end{macrocode} +% |\gdef\lastpage@Hy{}|, but that was already done at the beginning of this command. +% \begin{macrocode} \else% - \edef\lastpage@Hptest{\@currentHpage}% - \ifx\lastpage@Hptest\empty\relax% + \def\lastpage@Hptest{page.}% + \ifx\lastpage@Hptest\@currentHpage\relax + \def\lastpage@Hptest{\csname @fnsymbol\endcsname \c@page }% + \ifx\lastpage@Hptest\thepage\relax% + \ifnum\value{page}=3\else% + \PackageWarningNoLine{lastpage}{You should add a\MessageBreak + \string\DeclareTextCommand{...}{PD1}{...}\MessageBreak% + (see the lastpage package manual, 3.13 % + \string\pagenumbering{fnsymbol})\MessageBreak% + to your document's preamble}% +% \end{macrocode} +% See \autoref{subsec:fnsymbol}: \nameref{subsec:fnsymbol}, page~\pageref{subsec:fnsymbol}. +% \begin{macrocode} + \fi% + \fi% + \PackageWarningNoLine{lastpage}{% + \string\@currentHpage\space is\MessageBreak% + just "page." without number,\MessageBreak% + \string\lastpage@lastpageHy\space is now let empty}% % \end{macrocode} % |\gdef\lastpage@Hy{}|, but that was already done at the beginning of this command. % \begin{macrocode} @@ -1510,14 +1523,14 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook \string\@currentHpage\space is\MessageBreak% \meaning\@currentHpage\MessageBreak% not beginning with "page.",\MessageBreak% - \string\lastpage@lastpageHy\space is now let empty.}% + \string\lastpage@lastpageHy\space is now let empty}% \fi% \fi% \fi% - }% + \fi% \fi% - }{}% - }% + }% + } % \end{macrocode} % \end{macro} @@ -1537,39 +1550,32 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % |\else#4| means, that it did not start with |page.|, and whatever it is, % we cannot use this |#4| for |\lastpage@Hy|. % \end{macro} +% % \begin{macro}{\lastpage@putl@bel} % \indent This command does the writing of the label. -% If the \xpackage{pageslts} package is used, this \xpackage{lastpage} package -% is not needed at all. The \xpackage{LastPage} label would even be defined twice. -% Thus, if \xpackage{pageslts} is used, here nothing is done. -% -% \begin{macrocode} -\newcommand{\lastpage@putl@bel}{% - \IfPackageLoadedTF{pageslts}{\relax}{% -% \end{macrocode} -% \noindent Otherwise the label is set: -% \noindent If the \xpackage{hyperref} package is used, but page-anchors are disabled, +% If the \xpackage{hyperref} package is used, but page-anchors are disabled, % the hyperlinking will not work. (The warning will also be shown, when only -% |\pageref*{LastPage}| is used (or neither one), but without messing with |\pageref| -% we cannot detect this.) +% |\pageref*{LastPage}| is used (or neither |\pageref{LastPage}| nor |\pageref*{LastPage}|), +% but without messing with |\pageref| we cannot detect this.) % % \begin{macrocode} - \IfPackageLoadedTF{hyperref}{% - \IfPackageAtLeastTF{hyperref}{2023-11-07}{\relax}{% - \PackageError{lastpage}{hyperref package version too old}{% - required version: 2023-11-07 or newer, found version:\MessageBreak% - \csname ver@hyperref.sty\endcsname\MessageBreak% - Update hyperref or use lastpageclassic.sty instead of\MessageBreak% - lastpagemodern.sty!}}% - \ifHy@pageanchor\else% - \PackageWarningNoLine{lastpage}{% - The \string\pageref{LastPage} link does not work\MessageBreak% - using hyperref with disabled option `pageanchor'.\MessageBreak% - Better enable `pageanchor' or use\MessageBreak% - \string\pageref*{LastPage} (not generating a link)}% - \fi% - }{}% - \begingroup% +\newcommand{\lastpage@putl@bel}{% + \IfPackageLoadedT{hyperref}{% + \IfPackageAtLeastF{hyperref}{2024-10-30}{% + \PackageError{lastpage}{hyperref package version too old}{% + required version: 2024-10-30 or newer, found version:\MessageBreak% + \csname ver@hyperref.sty\endcsname\MessageBreak% + Update hyperref or use lastpageclassic.sty instead of\MessageBreak% + lastpagemodern.sty!}}% + \ifHy@pageanchor\else% + \PackageWarningNoLine{lastpage}{% + The \string\pageref{LastPage} link does not work\MessageBreak% + using hyperref with disabled option `pageanchor'.\MessageBreak% + Better enable `pageanchor' or use\MessageBreak% + \string\pageref*{LastPage} (not generating a link)}% + \fi% + }% + \begingroup% % \end{macrocode} % % \noindent Since the page has been put out, we are on the page \textit{after} that page. @@ -1578,7 +1584,15 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % it is probably easier to understand.) % % \begin{macrocode} - \addtocounter{page}{-1}% + \addtocounter{page}{-1}% +% \end{macrocode} +% +% If the \xpackage{pageslts} package is used, this \xpackage{lastpage} package +% is not needed at all. The \xpackage{LastPage} label would even be defined twice. +% Thus, if \xpackage{pageslts} is used, here nothing is done. +% +% \begin{macrocode} + \IfPackageLoadedTF{pageslts}{% then pageslts writes the label for "LastPage". % \end{macrocode} % % \noindent Simply using |\label| for \texttt{LastPage} would not work, @@ -1586,37 +1600,38 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % may be no more invocations of the output routines. % To force the write out, we need to do an |\immediate| protected write % into the \xfile{aux} file. +% % \begin{macrocode} - \protected@iwrite\@auxout{}{\string\newlabel{LastPage}{% - {\@currentlabel}{\thepage}{\@currentlabelname}% - {\IfPackageLoadedTF{hyperref}{\ifHy@pageanchor\@currentHpage\fi% - }{\@currentHref}}% - {\@kernel@reserved@label@data}}% + }{\protected@iwrite\@auxout{}{\string\newlabel{LastPage}{% + {\@currentlabel}{\thepage}{\@currentlabelname}% + {\IfPackageLoadedTF{hyperref}{\ifHy@pageanchor\@currentHpage\fi% + }{\@currentHref}}% + {\@kernel@reserved@label@data}}% }% + }% % \end{macrocode} % \noindent We also save the values, so that we can later (next rerun) check, % whether they have been saved in the \xfile{aux} file. % % \begin{macrocode} - \protected@iwrite\@auxout{}{% - \string\gdef\string\lastpage@lastpage{\thepage}}% - \lastpage@makeHy% - \protected@iwrite\@auxout{}{% - \string\gdef\string\lastpage@lastpageHy{\lastpage@Hy}}% + \protected@iwrite\@auxout{}{% + \string\gdef\string\lastpage@lastpage{\thepage}}% + \lastpage@makeHy% + \protected@iwrite\@auxout{}{% + \string\gdef\string\lastpage@lastpageHy{\lastpage@Hy}}% % \end{macrocode} % % \noindent After the write-out we restore the page number again, % since there might be other things still to be done. % % \begin{macrocode} - \addtocounter{page}{+1}% - \endgroup% - }% + \addtocounter{page}{+1}% + \endgroup% } % \end{macrocode} % \end{macro} -%\pagebreak +% % \begin{macro}{\lastpage@fileswtest} % \indent \hspace*{2em}Later it will be determined whether it is allowed to write % to the \xfile{aux} file. If it was \emph{not} allowed, it is checked @@ -1684,14 +1699,12 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % % \begin{macrocode} \AddToHook{enddocument/afterlastpage}{% - \IfPackageLoadedTF{pageslts}{\relax}{% - \gdef\lastpage@putlabel{??}% - \ifx\lastpage@lastpage\lastpage@putlabel\relax% - \AddToHook{enddocument/info}{% - \PackageWarning{lastpage}{Rerun to get the references right}% - }% - \fi% - }% + \gdef\lastpage@putlabel{??}% + \ifx\lastpage@lastpage\lastpage@putlabel\relax% + \AddToHook{enddocument/info}{% + \PackageWarning{lastpage}{Rerun to get the references right}% + }% + \fi% \gdef\lastpage@putlabel{\relax}% % \end{macrocode} % @@ -1705,7 +1718,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % We put in a |\message| to show, in what order things (which were called) are done. % % \begin{macrocode} - \message{^^Jenddocument/afterlastpage: lastpage setting LastPage.^^J}% + \message{^^Jenddocument/afterlastpage (AED): lastpage setting LastPage.^^J}% \IfPackageLoadedTF{french}{% \addtocounter{page}{+1}\lastpage@putl@bel\addtocounter{page}{-1}% }{\IfPackageLoadedTF{frenchle}{% @@ -1722,10 +1735,8 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % (if \xpackage{hyperref} has been loaded) |\lastpage@fileswtestHy|. % % \begin{macrocode} - \IfPackageLoadedTF{pageslts}{\relax}{% - \lastpage@fileswtest{\thepage}{\lastpage@lastpage}% - \IfPackageLoadedTF{hyperref}{\lastpage@fileswtestHy}{\relax}% - }% + \lastpage@fileswtest{\thepage}{\lastpage@lastpage}% + \IfPackageLoadedT{hyperref}{\lastpage@fileswtestHy}% \fi% } %</lastpagemodern> @@ -1750,45 +1761,45 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \end{description} % % \DescribeMacro{lastpage.sty} -% The |lastpage.sty| (i.\,e. each document using the \xpackage{lastpage} package) +% The |lastpage.sty| (i.\,e.\ each document using the \xpackage{lastpage} package) % requires: % \begin{description} % \item[-] \TeX, \url{https://www.CTAN.org} % -% \item[-] package \xpackage{lastpage}, 2024-07-07, v2.1c, +% \item[-] package \xpackage{lastpage}, 2024-11-24, v2.1d, % \url{https://ctan.org/pkg/lastpage} % \end{description} % % \DescribeMacro{lastpage209.sty} -% The |lastpage209.sty| for \LaTeX2.09{} (i.\,e. each document using +% The |lastpage209.sty| for \LaTeX2.09{} (i.\,e.\ each document using % the \xpackage{lastpage209} package) requires: % \begin{description} % \item[-] \TeX-format \LaTeX{}, v2.09 % -% \item[-] package \xpackage{lastpage209}, 2024-07-07, v2.1c, +% \item[-] package \xpackage{lastpage209}, 2024-11-24, v2.1d, % \url{https://ctan.org/pkg/lastpage} % \end{description} % and does not work with \xpackage{hyperref}, which needs \LaTeX2e{}.\smallskip % % \DescribeMacro{lastpage2e.sty} -% The |lastpage2e.sty| for \LaTeXe{} (i.\,e. each document using +% The |lastpage2e.sty| for \LaTeXe{} (i.\,e.\ each document using % the \xpackage{lastpage2e} package) requires: % \begin{description} % \item[-] \TeX-format \LaTeXe{} 1994/12/01 or newer, % \url{https://www.CTAN.org} % -% \item[-] package \xpackage{lastpage}, 2024-07-07, v2.1c, +% \item[-] package \xpackage{lastpage}, 2024-11-24, v2.1d, % \url{https://ctan.org/pkg/lastpage} % \end{description} % % \DescribeMacro{lastpageclassic.sty} -% The |lastpageclassic.sty| for \LaTeXe{} (i.\,e. each document using +% The |lastpageclassic.sty| for \LaTeXe{} (i.\,e.\ each document using % the \xpackage{lastpageclassic} package) requires: % \begin{description} -% \item[-] \TeX-format \LaTeXe{} between 1994/12/01 and 2023-05-31,\newline +% \item[-] \TeX-format \LaTeXe{} between 1994/12/01 and 2024-05-31,\newline % \url{https://www.CTAN.org} % -% \item[-] package \xpackage{lastpage}, 2024-07-07, v2.1c, +% \item[-] package \xpackage{lastpage}, 2024-11-24, v2.1d, % \url{https://ctan.org/pkg/lastpage} % \end{description} % and can use @@ -1799,19 +1810,19 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \end{description} % % \DescribeMacro{lastpagemodern.sty} -% The |lastpagemodern.sty| for \LaTeXe{} (i.\,e. each document using +% The |lastpagemodern.sty| for \LaTeXe{} (i.\,e.\ each document using % the \xpackage{lastpagemodern} package) requires: % \begin{description} -% \item[-] \TeX-format \LaTeXe{} 2023-06-01 or newer,\newline +% \item[-] \TeX-format \LaTeXe{} 2024-06-01 or newer,\newline % \url{https://www.CTAN.org} % -% \item[-] package \xpackage{lastpage}, 2024-07-07, v2.1c, +% \item[-] package \xpackage{lastpage}, 2024-11-24, v2.1d, % \url{https://ctan.org/pkg/lastpage} % \end{description} % and can use % \begin{description} -% \item[-] package \xpackage{hyperref}, 2023-11-07 and newer -% (tested with: 2024-05-23, v7.01i), +% \item[-] package \xpackage{hyperref}, probably 2023-11-07 and newer +% (tested with: 2024-10-30 v7.01k), % \url{https://ctan.org/pkg/hyperref} % \end{description} % \pagebreak @@ -1820,7 +1831,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % The |lastpage-example.tex| requires the same file as all % documents using the \xpackage{lastpage} package, i.\,e. % \begin{description} -% \item[-] package \xpackage{lastpage}, 2024-07-07, v2.1c, +% \item[-] package \xpackage{lastpage}, 2024-11-24, v2.1d, % \url{https://ctan.org/pkg/lastpage}\newline % (Well, it is the example file for this package, and because you are reading the % documentation for the \xpackage{lastpage} package, it can be assumed that you already @@ -1834,89 +1845,10 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \item[-] package \xpackage{showkeys}, 2024-05-23, v3.21, % \url{https://ctan.org/pkg/showkeys} % -% \item[-] package \xpackage{hyperref}, 2024-05-23, v7.01i, +% \item[-] package \xpackage{hyperref}, 2024-10-30, v7.01k, % \url{https://ctan.org/pkg/hyperref} % \end{description} % -% \DescribeMacro{endfloat} -% The \xpackage{endfloat} package is not required, but because -% the \xpackage{lastpage} package is incompatible with \textit{ancient} versions -% of the \xpackage{endfloat} package (see subsection~\ref{sec:endfloat}), -% here the recent one (at the time of writing this documentation) is listed: -% \begin{description} -% \item[-] package \xpackage{endfloat}, 2019/04/15, v2.7, -% \url{https://ctan.org/pkg/endfloat} -% \end{description} -% -% \DescribeMacro{fancyhdr} -% \DescribeMacro{nccfancyhdr} -% Neither the \xpackage{fancyhdr} nor the \xpackage{nccfancyhdr} package is required -% (older versions of the \xpackage{lastpage} package used its predecessor -% \xpackage{fancyheadings}), but because they were mentioned, also they are listed -% here: -% \begin{description} -% \item[-] package \xpackage{fancyhdr}, 2024/04/23, v4.2, -% \url{https://ctan.org/pkg/fancyhdr} -% -% \item[-] package \xpackage{nccfancyhdr}, 2004/12/07, v1.1, -% \url{https://ctan.org/pkg/nccfancyhdr} -% \end{description} -% -% \DescribeMacro{count1to} -% \DescribeMacro{nofm} -% \DescribeMacro{totpages} -% \DescribeMacro{lastpage} -% \DescribeMacro{totalcount} -% \DescribeMacro{zref} -% \DescribeMacro{memoir} -% As possible alternatives in section~\ref{sec:Alternatives}, Alternatives, -% there are listed (newer versions might be available): -% \begin{description} -% \item[-] package \xpackage{pageslts}, 2015/12/21, v1.2f, -% \url{https://ctan.org/pkg/pageslts} -% -% \item[-] package \xpackage{papermas}, 2023-04-12, v1.1a; the \xpackage{papermas} -% package can be considered as kind of add-on to the \xpackage{pageslts} package.\newline -% \url{https://ctan.org/pkg/papermas} -% -% \item[-] package \xpackage{count1to}, 2009/05/24, v2.1, -% \url{https://ctan.org/pkg/count1to} -% -% \item[-] package \xpackage{nofm}, 1991/02/25, -% \href{https://mirror.ctan.org/obsolete/macros/latex209/contrib/misc/nofm.sty}{% -% https://mirror.ctan.org/obsolete/macros/latex209/}% -% \href{https://mirror.ctan.org/obsolete/macros/latex209/contrib/misc/nofm.sty}{% -% contrib/misc/nofm.sty}, -% does not work with e.\,g. \xpackage{hyperref} -% -% \item[-] package \xpackage{totpages}, 2005/09/19, v2.00, -% \url{https://ctan.org/pkg/totpages} -% -% \item[-] package \xpackage{totalcount}, 2018/01/21, v1.0a, -% \url{https://ctan.org/pkg/totalcount} -% -% \item[-] package \xpackage{zref}, 2023-09-14, v2.35, -% \url{https://ctan.org/pkg/zref} -% -% \item[-] class \xpackage{memoir}, 2024-01-26, v3.8.2, -% \url{https://ctan.org/pkg/memoir}. -% \end{description} -% -% \DescribeMacro{Oberdiek} -% \DescribeMacro{holtxdoc} -% \DescribeMacro{zref} -% All packages of the `oberdiek' bundle -% (especially \xpackage{holtxdoc} and \xpackage{zref}) -% are also available in a TDS compliant ZIP archive:\newline -% \url{https://mirror.ctan.org/install/macros/latex/contrib/oberdiek.tds.zip}.\newline -% It is probably best to download and use this, because the packages in there -% are quite probably both recent and compatible among themselves.\par -% -% \DescribeMacro{hyperref} -% \noindent \xpackage{hyperref} is not included in that bundle and needs to be -% downloaded separately,\newline -% \url{https://mirror.ctan.org/install/macros/latex/contrib/hyperref.tds.zip}.\par -% % \DescribeMacro{Münch} % A hyperlinked list of my (other) packages can be found at\newline % \url{https://ctan.org/author/muench-hm}. @@ -1936,7 +1868,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % There is also a |lastpage.tds.zip| available: % \begin{description} % \item[\url{https://mirror.ctan.org/install/macros/latex/contrib/lastpage.tds.zip}]\hspace*{0.1cm} -% Everything in TDS compliant, compiled format +% Everything in TDS compliant, compiled format. % \end{description} % which additionally contains\\ % \begin{tabular}{ll} @@ -1956,7 +1888,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % % \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting % \docstrip{} archive. The files are extracted by running the -% \xext{.dtx} through \plainTeX{}: +% \xext{.dtx} through \plainTeX : % \begin{quote} % \verb|tex lastpage.dtx| % \end{quote} @@ -2041,7 +1973,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \end{quote} % If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's % TDS installing feature, then some files can already be in the right -% place, see the documentation of \docstrip{}. +% place, see the documentation of \docstrip. % % \subsection{Refresh file name databases} % If your \TeX~distribution (\TeX\,Live, \mikTeX, \dots) relies on @@ -2052,11 +1984,11 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \paragraph{Unpacking with \LaTeX.} % The \xfile{.dtx} chooses its action depending on the format: % \begin{description} -% \item[\plainTeX:] Run \docstrip{} and extract the files. +% \item[\plainTeX:] Run \docstrip\ and extract the files. % \item[\LaTeX:] Generate the documentation. % \end{description} -% If you insist on using \LaTeX{} for \docstrip{} (really, -% \docstrip{} does not need \LaTeX ), then inform the autodetect routine +% If you insist on using \LaTeX\ for \docstrip\ (really, +% \docstrip\ does not need \LaTeX ), then inform the autodetect routine % about your intention: % \begin{quote} % \verb|latex \let\install=y\input{lastpage.dtx}| @@ -2096,7 +2028,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \section{Acknowledgements} % % I (\textsc{H.-Martin Münch}) would like to thank -% \textsc{Jeffrey P. Goldberg} (jeffrey+news at goldmark dot org) for +% \textsc{Jeffrey P. Goldberg} \mbox{(jeffrey+}\allowbreak news at goldmark dot org) for % inventing the \xpackage{lastpage} package as well as for allowing me % to update it. Further I would like to thank \textsc{Heiko Oberdiek} % for providing a~lot~(!) of useful packages (from which I also learned everything @@ -2139,7 +2071,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \end{Version} % \begin{Version}{2010/02/18 v1.1} % \item Proposed |LastPages| label by \textsc{H.-Martin Münch} -% on \Newsgroup{comp.text.tex}, see e.\,g. +% on \Newsgroup{comp.text.tex}, see e.\,g.\ % % \url{https://groups.google.com/g/comp.text.tex/c/Ad8pO2Rw_HY/m/8EfHqT1JB0QJ}; % now available in the \xpackage{pageslts} package. % \end{Version} @@ -2179,7 +2111,8 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % checked for the |\hyperref| command, in case \xpackage{hyperref} was not % loaded at |\begin{document}| yet. (Bug reported by \textsc{Sebastian Bank}, % thanks!)\newline -% [\pkg{lastpagemodern.sty} just uses |\IfPackageLoadedTF{hyperref}|.] +% [\pkg{lastpagemodern.sty} just uses |\IfPackageLoadedT{hyperref}| and +% |\IfPackageLoadedTF{hyperref}|.] % \item Changed the |\unit| definition (got rid of an old |\rm|). [Removed in v2.0a.] % \item Changed |\lastpage@puthyperlabel| to |\lastpage@putlabelhyper| analogous to % |\pagesLTS@putlabelhyper| of the \xpackage{pageslts} package. @@ -2308,7 +2241,16 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \end{Version} % \begin{Version}{2024-07-07 v2.1c} % \item With help from \textsc{David Carlisle} |\lastpage@rmpage| no longer assumes -% |\@currentHpage| to begin with |page.|. +% |\@currentHpage| to begin with \mbox{\textquotedblleft |page.|\textquotedblright .} +% \end{Version} +% \begin{Version}{2024-11-24 v2.1d} +% \item The \xpackage{pageslts} package has been repaired, thus here the warnings are removed. +% \item Several small changes in documentation and |lastpagemodern.sty| because of the updates +% of \LaTeX-format (to 2024-06-01), \xpackage{hyperref} package (to 2024-10-30, v7.01k), +% and \xpackage{pageslts} package (to 2024-11-20, v2.0a). +% \item Added a warning message about missing |\DeclareTextCommand{...}{PD1}{...}| +% (cf.~\autoref{subsec:fnsymbol}: \nameref{subsec:fnsymbol}, page~\pageref{subsec:fnsymbol}). +% \item Documentation section about alternatives rewritten. % \end{Version} % \end{History} % \bigskip @@ -2316,8 +2258,6 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % When you find a mistake or have a suggestion for an improvement of this package, % please send an e-mail to the maintainer, thanks! (Please see BUG REPORTS in the README.) % \newpage -% % \PrintIndex -% % \Finale \endinput
\ No newline at end of file diff --git a/macros/latex/contrib/lastpage/lastpage.pdf b/macros/latex/contrib/lastpage/lastpage.pdf Binary files differindex 9d224e6772..2ebae720ea 100644 --- a/macros/latex/contrib/lastpage/lastpage.pdf +++ b/macros/latex/contrib/lastpage/lastpage.pdf diff --git a/macros/latex/contrib/srdp-mathematik/README.md b/macros/latex/contrib/srdp-mathematik/README.md index 33f315b9de..69385a19c0 100644 --- a/macros/latex/contrib/srdp-mathematik/README.md +++ b/macros/latex/contrib/srdp-mathematik/README.md @@ -1,4 +1,4 @@ -# srdp-mathematik.sty v1.13.0 +# srdp-mathematik.sty v1.13.1 This package provides basic commands for the defined formats of the Austrian sRDP in mathematics. Furthermore, it includes ways to implement answers in the tex file, which can be voluntarily displayed in the pdf file and diff --git a/macros/latex/contrib/srdp-mathematik/srdp-mathematik.pdf b/macros/latex/contrib/srdp-mathematik/srdp-mathematik.pdf Binary files differindex cc8c4308d5..02e027f7be 100644 --- a/macros/latex/contrib/srdp-mathematik/srdp-mathematik.pdf +++ b/macros/latex/contrib/srdp-mathematik/srdp-mathematik.pdf diff --git a/macros/latex/contrib/srdp-mathematik/srdp-mathematik.sty b/macros/latex/contrib/srdp-mathematik/srdp-mathematik.sty index 5612d145c3..d93e32b86b 100644 --- a/macros/latex/contrib/srdp-mathematik/srdp-mathematik.sty +++ b/macros/latex/contrib/srdp-mathematik/srdp-mathematik.sty @@ -10,8 +10,7 @@ % \NeedsTeXFormat{LaTeX2e}[1996/12/26] -\ProvidesPackage{srdp-mathematik}[2024/03/29 v1.13.0 Standard-Schularbeitsformate] - +\ProvidesPackage{srdp-mathematik}[2024/11/24 v1.13.1 Standard-Schularbeitsformate] \usepackage{color} \usepackage{xcolor} @@ -46,8 +45,6 @@ \usepackage{eso-pic} \usepackage{esvect} \usepackage{phaistos} -\usepackage{substitutefont} -\substitutefont{LPH}{\familydefault}{cmr} \renewcommand{\vec}[1]{\vv{#1}} \usepackage{graphicx} \usepackage{setspace} diff --git a/macros/latex/contrib/srdp-mathematik/srdp-mathematik.tex b/macros/latex/contrib/srdp-mathematik/srdp-mathematik.tex index 210b9b4ae2..9b3efa844b 100644 --- a/macros/latex/contrib/srdp-mathematik/srdp-mathematik.tex +++ b/macros/latex/contrib/srdp-mathematik/srdp-mathematik.tex @@ -55,7 +55,7 @@ hidelinks \vfill -\Huge The \textit{srdp-mathematik} package v1.13.0\\[1cm] +\Huge The \textit{srdp-mathematik} package v1.13.1\\[1cm] Documentation \\ [1cm] diff --git a/macros/latex/contrib/stocksize/stocksize-doc.pdf b/macros/latex/contrib/stocksize/stocksize-doc.pdf Binary files differindex 5f0e34cf40..a62b4e5b26 100644 --- a/macros/latex/contrib/stocksize/stocksize-doc.pdf +++ b/macros/latex/contrib/stocksize/stocksize-doc.pdf diff --git a/macros/latex/contrib/stocksize/stocksize-doc.tex b/macros/latex/contrib/stocksize/stocksize-doc.tex index 5dd3b53d85..85f25aebaa 100644 --- a/macros/latex/contrib/stocksize/stocksize-doc.tex +++ b/macros/latex/contrib/stocksize/stocksize-doc.tex @@ -111,12 +111,12 @@ To start a new page with a different page/stock size use the \verb!\newstocksize % new (15cm x 10cm) \newstocksize{layoutsize={15cm,10cm},margin=1.5cm} - \printpagesize[15cm, 10cm, margin=1cm] + \printpagesize[15cm, 10cm, margin=1.5cm] \kant[1-2] % new (20cm x 20cm) \newstocksize{layoutsize={20cm,20cm},margin=4.0cm} - \printpagesize[20cm, 20cm, margin=1cm] + \printpagesize[20cm, 20cm, margin=4cm] \kant[1-3] \restorestocksize diff --git a/macros/latex/contrib/stocksize/stocksize.sty b/macros/latex/contrib/stocksize/stocksize.sty index 36c6f18998..c3abb9fb63 100644 --- a/macros/latex/contrib/stocksize/stocksize.sty +++ b/macros/latex/contrib/stocksize/stocksize.sty @@ -12,8 +12,8 @@ %% and version 1.3c or later is part of all distributions of LaTeX %% version 2006/05/20 or later. %% -\def\fileversion{1.0.2} -\def\filedate {2024/11/13} +\def\fileversion{1.0.3} +\def\filedate {2024/11/23} \edef\filename {\@currname} \ProvidesPackage{stocksize}[% diff --git a/macros/latex/contrib/suftesi/suftesi.dtx b/macros/latex/contrib/suftesi/suftesi.dtx index a9a76bfce1..475437e291 100644 --- a/macros/latex/contrib/suftesi/suftesi.dtx +++ b/macros/latex/contrib/suftesi/suftesi.dtx @@ -56,7 +56,7 @@ This work has the LPPL maintenance status "author-maintained". %<class>\NeedsTeXFormat{LaTeX2e}[2005/12/01] %<class>\ProvidesClass{suftesi} %<*class> - [2023/09/07 v3.2.1 A class for typesetting theses, books and articles] + [2022/11/24 v3.2.2 A class for typesetting theses, books and articles] %</class> %<*driver> \documentclass[12pt]{ltxdoc} @@ -337,7 +337,7 @@ cochineal,mathpazo,bera,amsthm} %</driver> % \fi % -% \CheckSum{5685} +% \CheckSum{5697} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -355,6 +355,7 @@ cochineal,mathpazo,bera,amsthm} % Grave accent \` Left brace \{ Vertical bar \| % Right brace \} Tilde \~} % +% \changes{v3.2.2}{2024/11/24}{Temporarily fixed a conflict between \sty{amstext} and \sty{zref}.} % \changes{v3.2.1}{2023/09/07}{Removed \sty{substitutefont} package (obsolete) and replaced \cmd{substitutefont} with \cmd{DeclareFontFamilySubstitution} provided by the \LaTeX\ kernel. Definitions of \texttt{sufred} and \texttt{sufgray} color moved \cmd{AtBeginDocument}.} % \changes{v3.2.0}{2021/11/01}{Fixed a bug in \cmd{xfootnote} command. % Fixed a bug occurring when using the \cmd{geometry} command.} @@ -5457,6 +5458,19 @@ cochineal,mathpazo,bera,amsthm} \def\thefootnote{\@fnsymbol\c@footnote}% \fi % \end{macrocode} +% The \sty{zref} conflicts with \sty{amstext} (loaded by \sty{amsmath}), +% because \sty{amstext} changes stepcounter. This is a temporary fix +% by Frank Mittelbach on \url{https://github.com/ho-tex/zref/issues/11}: +% \begin{macrocode} +\AtBeginDocument{% +\let\ZREF@org@stepcounter\stepcounter +\def\stepcounter#1{% + \ifcsname @stepcounterhook@#1\endcsname + \csname @stepcounterhook@#1\endcsname + \fi + \ZREF@org@stepcounter{#1}% +}} +% \end{macrocode} % \paragraph{The \cmd{xfootnote} command} Prints a footnote with discretionary % symbol give in the first argument. Since version 1.3.4 \cmd{protected@xdef} % replaces \cmd{xdef}. diff --git a/macros/latex/contrib/suftesi/suftesi.pdf b/macros/latex/contrib/suftesi/suftesi.pdf Binary files differindex fc7ac9f929..0efa8b1aa1 100644 --- a/macros/latex/contrib/suftesi/suftesi.pdf +++ b/macros/latex/contrib/suftesi/suftesi.pdf diff --git a/macros/latex/contrib/tkz/tkz-elements/README.md b/macros/latex/contrib/tkz/tkz-elements/README.md index 66c11bf62f..3c53ea16eb 100644 --- a/macros/latex/contrib/tkz/tkz-elements/README.md +++ b/macros/latex/contrib/tkz/tkz-elements/README.md @@ -1,10 +1,10 @@ # tkz-elements — for euclidean geometry -Release 2.30c 2024/07/16 +Release 3.00c 2024/11/23 ## Description -`tkz-elements v.2.30c` is the new version of a library written in lua, allowing to make all the necessary calculations to define the objects of a Euclidean geometry figure. You need to compile with `LuaLaTeX`. With `tkz-elements`, the definitions and calculations are only done with `Lua`. +`tkz-elements v.3.00c` is the new version of a library written in lua, allowing to make all the necessary calculations to define the objects of a Euclidean geometry figure. You need to compile with `LuaLaTeX`. With `tkz-elements`, the definitions and calculations are only done with `Lua`. The main possibility of programmation proposed is oriented "object programming" with object classes like point, line, triangle, circle and ellipse. For the moment, once the calculations are done, it is `tkz-euclide` or `TikZ` which allows the drawings. You can use the option `mini` with `tkz-euclide` to load only the modules required for tracing. @@ -43,9 +43,9 @@ your LaTeX document: \usepackage[mini]{tkz-euclide} \usepackage{tkz-elements} \begin{document} -\begin{tkzelements} +\directlua{ your code -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes your code @@ -62,14 +62,17 @@ An important example `Golden Arbelos` using the package is on the site. All the are on the site. ## History - - - version 2.30c - - new version of the macro `\tkzGetNodes` written by Sanskar Singh. This version now fixes a bug that prevented a figure from being centred with `centering` or the `center` environment. - - adding methods `bevan_circle`, `symmedial_circle`. - - correction of the methods `function triangle: bevan_point ()` and `function triangle: mittenpunkt_point ()`. - - adding `function triangle: similar ()` - - adding `function line : perpendicular_bisector ()` which is similar to `function line : mediator ()` - - correction of documentation. + - version 3.00c + - It is now possible to use the `directlua` primitive to perform `lua` code. In this case, tables and scaling can be reset using the `init_elements` function. You can still use the `tkzelements` environment, but only if you load the `luacode` package. + - Examples have been added to the `transfers` section. + + - version 2.30c + - New version of the macro `\tkzGetNodes` written by Sanskar Singh. This version now fixes a bug that prevented a figure from being centred with `centering` or the `center` environment. + - Adding methods `bevan_circle`, `symmedial_circle`. + - Correction of the methods `function triangle: bevan_point ()` and `function triangle: mittenpunkt_point ()`. + - Adding `function triangle: similar ()` + - Adding `function line : perpendicular_bisector ()` which is similar to `function line : mediator ()` + - Correction of documentation. - version 2.25c - French documentation at my site: [http://altermundus.fr](http://altermundus.fr) @@ -77,7 +80,7 @@ are on the site. - Added `cevian`, `pedal`, `conway_circle`, `conway_points` new methods to the class `triangle`. - version 2.20c - - Package: + - Package: - Added class matrix; methods are mainly of order 2, sometimes of order 3. - Added function solve_quadratic. This function can be used to solve second-degree equations with real or complex numbers. - Added method print for the class point. Example z.A : print () diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-circle.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-circle.tex index 85e7359518..2d5665f879 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-circle.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-circle.tex @@ -38,7 +38,8 @@ Three attributes are used (south, west, radius). \begin{minipage}{0.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.a = point: new (1, 1) z.b = point: new (5, 4) @@ -48,7 +49,7 @@ Three attributes are used (south, west, radius). r = C.ab.radius z.c = C.ab.opp z.r,z.t = get_points (C.ab.ct : ortho_from (z.b)) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPoints(a,b,c,s,w) @@ -60,7 +61,8 @@ Three attributes are used (south, west, radius). \end{Verbatim} \end{minipage} \begin{minipage}{0.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.a = point: new (1, 1) z.b = point: new (5, 4) @@ -70,16 +72,16 @@ Three attributes are used (south, west, radius). r = C.ab.radius z.c = C.ab.opp z.r,z.t = get_points (C.ab.ct : ortho_from (z.b)) -\end{tkzelements} +} -\emph{\begin{tikzpicture} +\hfill\begin{tikzpicture} \tkzGetNodes \tkzDrawPoints(a,b,c,s,w) \tkzLabelPoints(a,b,c,s,w) \tkzDrawCircle(a,b) \tkzDrawSegments(a,b r,t b,c) \tkzLabelSegment[sloped](a,b){ab = \tkzUseLua{r}} -\end{tikzpicture}} +\end{tikzpicture} \end{minipage} % subsubsection example_circle_attributes (end) @@ -127,7 +129,7 @@ Three attributes are used (south, west, radius). \midrule \textbf{Miscellaneous} &&\\ \midrule -\Imeth{circle}{power (pt)} &| r = C.OA: power (z.M)| & [\ref{par:power_v1} ; \ref{par:power_v2} ; \ref{sub:apollonius_circle_v1_with_inversion} ] \\ +\Imeth{circle}{power (pt)} &| r = C.OA: power (z.M)| & [\ref{ssub:power_v1} ; \ref{ssub:power_v2} ; \ref{sub:apollonius_circle_v1_with_inversion} ] \\ \Imeth{circle}{in\_out (pt)} & |C.OA : in_out (z.M)| & [\ref{ssub:in_out_for_circle_and_disk}] \\ \Imeth{circle}{in\_out\_disk (pt)} & |C.OA : in_out_disk (z.M)| & [\ref{ssub:in_out_for_circle_and_disk}] \\ \Imeth{circle}{draw ()} & for further use &\\ @@ -145,11 +147,12 @@ A circle is defined by its centre and a point through which it passes. \vspace{6pt} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.O = point: new (0,0) z.A = point: new (2,1) C = circle: new (z.O , z.A) -\end{tkzelements} +} \begin{tikzpicture}[gridded] \tkzGetNodes \tkzDrawCircles(O,A) @@ -159,11 +162,12 @@ C = circle: new (z.O , z.A) \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.O = point: new (0,0) z.A = point: new (2,1) C = circle: new (z.O , z.A) -\end{tkzelements} +} \begin{center} \begin{tikzpicture}[gridded] \tkzGetNodes @@ -186,12 +190,13 @@ We define a circle with its centre and radius. \vspace{6pt} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.O = point: new (0,0) z.A = point: new (2,1) C = circle: radius (z.A , math.sqrt(5)) z.T = C.through -\end{tkzelements} +} \begin{tikzpicture}[gridded] \tkzGetNodes \tkzDrawCircles(A,T) @@ -201,12 +206,13 @@ z.T = C.through \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () z.O = point: new (0,0) z.A = point: new (2,1) C = circle: radius (z.A , math.sqrt(5)) z.T = C.through - \end{tkzelements} + } \begin{center} \begin{tikzpicture}[gridded] \tkzGetNodes @@ -226,13 +232,14 @@ A circle is defined by two points at the ends of one of its diameters. \vspace{6pt} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0,0) z.B = point: new (2,1) C = circle: diameter (z.A , z.B) z.O = C.center z.T = C.through -\end{tkzelements} +} \begin{tikzpicture}[gridded] \tkzGetNodes \tkzDrawCircles(O,T) @@ -242,13 +249,14 @@ z.T = C.through \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0,0) z.B = point: new (2,1) C = circle: diameter (z.A , z.B) z.O = C.center z.T = C.through -\end{tkzelements} +} \begin{center} \begin{tikzpicture}[gridded] \tkzGetNodes @@ -267,12 +275,13 @@ This method is used to define a point that is diametrically opposed to a point o \vspace{6pt} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0,0) z.O = point: new (2,1) C = circle: new (z.O , z.A) z.B = C : antipode (z.A) -\end{tkzelements} +} \begin{tikzpicture}[gridded] \tkzGetNodes \tkzDrawCircles(O,A) @@ -282,12 +291,13 @@ z.B = C : antipode (z.A) \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0,0) z.O = point: new (2,1) C = circle: new (z.O , z.A) z.B = C : antipode (z.A) -\end{tkzelements} +} \begin{center} \begin{tikzpicture}[gridded] \tkzGetNodes @@ -311,13 +321,14 @@ The definition I use here is more general: the defined point is simply the point \vspace{6pt} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0,0) z.O = point: new (2,1) C = circle: new (z.O , z.A) z.B = C : point (0.25) z.M = C : midarc (z.A,z.B) -\end{tkzelements} +} \begin{tikzpicture}[gridded] \tkzGetNodes \tkzDrawCircles(O,A) @@ -327,13 +338,14 @@ z.M = C : midarc (z.A,z.B) \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0,0) z.O = point: new (2,1) C = circle: new (z.O , z.A) z.B = C : point (0.25) z.M = C : midarc (z.A,z.B) -\end{tkzelements} +} \begin{center} \begin{tikzpicture}[gridded] \tkzGetNodes @@ -358,14 +370,15 @@ If $r=.5$ the defined point is diametrically opposed to $A$, the angle $\widehat \vspace{6pt} \begin{minipage}{.5\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () z.O = point: new (0,0) z.A = point: new (1,2) C.OA = circle: new (z.O,z.A) z.B = C.OA: point (1/6) z.C = C.OA: point (0.25) z.D = C.OA: point (0.5) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircle(O,A) @@ -375,14 +388,15 @@ If $r=.5$ the defined point is diametrically opposed to $A$, the angle $\widehat \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () z.O = point: new (0,0) z.A = point: new (1,2) C.OA = circle: new (z.O,z.A) z.B = C.OA: point (1/6) z.C = C.OA: point (0.25) z.D = C.OA: point (0.5) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} \tkzGetNodes @@ -409,14 +423,15 @@ The \code{inversion} method can be used on a point, a group of points, a line or \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.o = point: new (-1,2) z.a = point: new (2,1) C.oa = circle: new (z.o,z.a) z.c = point: new (3,4) z.d = C.oa: inversion (z.c) p = C.oa: power (z.c) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircle(o,a) @@ -429,7 +444,8 @@ The \code{inversion} method can be used on a point, a group of points, a line or \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale =.75 z.o = point: new (-1,2) z.a = point: new (2,1) @@ -437,7 +453,7 @@ The \code{inversion} method can be used on a point, a group of points, a line or z.c = point: new (3,4) z.d = C.oa: inversion (z.c) p = C.oa: power (z.c) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -460,7 +476,8 @@ The result is either a straight line or a circle. \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.o = point: new (-1,1) z.a = point: new (1,3) C.oa = circle: new (z.o,z.a) @@ -469,7 +486,7 @@ The result is either a straight line or a circle. L.cd = line: new (z.c,z.d) C.OH = C.oa: inversion (L.cd) z.O,z.H = get_points(C.OH) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(o,a O,H) @@ -480,7 +497,8 @@ The result is either a straight line or a circle. \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.o = point: new (-1,1) z.a = point: new (1,3) C.oa = circle: new (z.o,z.a) @@ -489,7 +507,7 @@ The result is either a straight line or a circle. L.cd = line: new (z.c,z.d) C.OH = C.oa: inversion (L.cd) z.O,z.H = get_points(C.OH) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -511,7 +529,8 @@ The result is either a straight line or a circle. \begin{minipage}{.55\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .7 z.o,z.a = point: new (-1,3),point: new (2,3) z.c = point: new (-2,1) @@ -528,7 +547,7 @@ if obj.type == "line" then z.p,z.q = get_points(obj) else z.f,z.b = get_points(obj) end color = "orange" -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles[black](o,a) @@ -541,7 +560,8 @@ color = "orange" \end{Verbatim} \end{minipage} \begin{minipage}{.45\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () scale = .7 z.o,z.a = point: new (-1,3),point: new (2,3) z.c = point: new (-2,1) @@ -558,7 +578,7 @@ color = "orange" then z.p,z.q = get_points(obj) else z.f,z.b = get_points(obj) end color = "orange" - \end{tkzelements} + } \begin{center} \begin{tikzpicture} @@ -582,8 +602,9 @@ Circles are geometrically similar to one another and mirror symmetric. Hence, a \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} - scale = 0.75 +\directlua{% +init_elements () + scale = 0.7 z.A = point : new ( 0 , 0 ) z.a = point : new ( 2 , 2 ) z.B = point : new ( 5 , 2 ) @@ -594,7 +615,7 @@ z.I = C.Aa : internal_similitude (C.Bb) L.TA1,L.TA2 = C.Aa : tangent_from (z.I) z.A1 = L.TA1.pb z.A2 = L.TA2.pb -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(A,a B,b) @@ -604,8 +625,9 @@ z.A2 = L.TA2.pb \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} - scale = .75 +\directlua{% +init_elements () + scale = .7 z.A = point : new ( 0 , 0 ) z.a = point : new ( 2 , 2 ) z.B = point : new ( 5 , 2 ) @@ -616,7 +638,7 @@ z.I = C.Aa : internal_similitude (C.Bb) L.TA1,L.TA2 = C.Aa : tangent_from (z.I) z.A1 = L.TA1.pb z.A2 = L.TA2.pb -\end{tkzelements} +} \begin{center} \begin{tikzpicture} \tkzGetNodes @@ -634,46 +656,48 @@ z.A2 = L.TA2.pb \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.a = point : new ( 2 , 2 ) z.B = point : new ( 3 , 2 ) -z.b = point : new ( 4 , 1 ) +z.b = point : new ( 3.5 , 1 ) C.Aa = circle : new (z.A,z.a) C.Bb = circle : new (z.B,z.b) z.I = C.Aa : external_similitude (C.Bb) L.TA1,L.TA2 = C.Aa : tangent_from (z.I) z.A1 = L.TA1.pb z.A2 = L.TA2.pb -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(A,a B,b) \tkzDrawPoints(A,a,B,b,I,A1,A2) -\tkzDrawLines[add = .5 and .2](A1,I A2,I) +\tkzDrawLines[add = .25 and .1](A1,I A2,I) \end{tikzpicture} \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = .75 z.A = point : new ( 0 , 0 ) -z.a = point : new ( 2 , 2 ) +z.a = point : new ( 2 , 2 ) z.B = point : new ( 3 , 2 ) -z.b = point : new ( 4 , 1 ) +z.b = point : new ( 3.5, 1 ) C.Aa = circle : new (z.A,z.a) C.Bb = circle : new (z.B,z.b) z.I = C.Aa : external_similitude (C.Bb) L.TA1,L.TA2 = C.Aa : tangent_from (z.I) z.A1 = L.TA1.pb z.A2 = L.TA2.pb -\end{tkzelements} +} \begin{center} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(A,a B,b) \tkzDrawPoints(A,a,B,b,I,A1,A2) -\tkzDrawLines[add = .5 and .2](A1,I A2,I) +\tkzDrawLines[add = .25 and .1](A1,I A2,I) \end{tikzpicture} \end{center} \end{minipage} @@ -691,7 +715,9 @@ Here I have also named \code{radical\_center} the point of intersection of the r \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () + scale = .8 z.O = point : new (0,0) z.x = point : new (1,0) z.y = point : new (4,0) @@ -705,12 +731,12 @@ Here I have also named \code{radical\_center} the point of intersection of the r z.bp,z.b = intersection (C.Opy,C.Pz) L.aap = line : new (z.a,z.ap) L.bbp = line : new (z.b,z.bp) - -- z.X = intersection (L.aap,L.bbp) + % z.X = intersection (L.aap,L.bbp) z.X = C.Ox : radical_center(C.Pz,C.Opy) - -- L.OOp = line : new (z.O,z.Op) - -- z.H = L.OOp : projection (z.X) + % L.OOp = line : new (z.O,z.Op) + % z.H = L.OOp : projection (z.X) z.H = C.Ox : radical_center(C.Opy) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(O,a O',b P,z) @@ -721,7 +747,9 @@ Here I have also named \code{radical\_center} the point of intersection of the r \end{Verbatim} \end{minipage} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{tkzelements} +\directlua{% +init_elements () +scale = .8 z.O = point : new (0,0) z.x = point : new (1,0) z.y = point : new (4,0) @@ -738,7 +766,7 @@ L.bbp = line : new (z.b,z.bp) z.X = intersection (L.aap,L.bbp) L.OOp = line : new (z.O,z.Op) z.H = L.OOp : projection (z.X) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -763,7 +791,8 @@ The radical line, also called the radical axis, is the locus of points of equal \label{par:radical_axis_v1} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .75 z.X = point : new (0,0) z.B = point : new (2,2) @@ -782,7 +811,7 @@ L.AB = line : new (z.A,z.B) L.ApBp = line : new (z.Ap,z.Bp) z.M = intersection (L.AB,L.ApBp) z.H = L.XY : projection (z.M) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(X,B Y,A') @@ -793,7 +822,8 @@ z.H = L.XY : projection (z.M) \end{tikzpicture} \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .75 z.X = point : new (0,0) z.B = point : new (2,2) @@ -812,7 +842,7 @@ L.AB = line : new (z.A,z.B) L.ApBp = line : new (z.Ap,z.Bp) z.M = intersection (L.AB,L.ApBp) z.H = L.XY : projection (z.M) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -830,7 +860,8 @@ z.H = L.XY : projection (z.M) \label{par:radical_axis_v2} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = 1.25 z.O = point : new (-1,0) z.Op = point : new (4,-1) @@ -847,12 +878,12 @@ _,z.Tp = get_points (L.MTp) L.MK,L.MKp = C.OpD : tangent_from (z.M) _,z.K = get_points (L.MK) _,z.Kp = get_points (L.MKp) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(O,B O',D) \tkzDrawLine(E,F) - \tkzDrawLine[add=.5 and .5](O,O') + \tkzDrawLine[add=.25 and .25](O,O') \tkzDrawLines[add = 0 and .5](M,T M,T' M,K M,K') \tkzDrawCircle(M,T) \tkzDrawPoints(O,O',T,M,T',K,K') @@ -860,7 +891,8 @@ _,z.Kp = get_points (L.MKp) \end{tikzpicture} \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale =1.25 z.O = point : new (-1,0) z.Op = point : new (4,-1) @@ -877,14 +909,14 @@ _,z.Tp = get_points (L.MTp) L.MK,L.MKp = C.OpD : tangent_from (z.M) _,z.K = get_points (L.MK) _,z.Kp = get_points (L.MKp) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(O,B O',D) \tkzDrawLine(E,F) - \tkzDrawLine[add=.5 and .5](O,O') + \tkzDrawLine[add=.25 and .25](O,O') \tkzDrawLines[add = 0 and .5](M,T M,T' M,K M,K') \tkzDrawCircle(M,T) \tkzDrawPoints(O,O',T,M,T',K,K') @@ -897,7 +929,8 @@ _,z.Kp = get_points (L.MKp) \label{par:radical_axis_v3} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () z.O = point : new (0,0) z.B = point : new (4,0) z.Op = point : new (6,0) @@ -910,7 +943,7 @@ _,z.Kp = get_points (L.MKp) _,z.T = get_points (L) L = C.OpB : tangent_from (z.M) _,z.Tp = get_points (L) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(O,B O',B) @@ -923,7 +956,8 @@ _,z.Kp = get_points (L.MKp) \end{tikzpicture} \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.O = point : new (0,0) z.B = point : new (4,0) z.Op = point : new (6,0) @@ -936,7 +970,7 @@ L = C.OB : tangent_from (z.M) _,z.T = get_points (L) L = C.OpB : tangent_from (z.M) _,z.Tp = get_points (L) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -956,7 +990,8 @@ _,z.Tp = get_points (L) \label{par:radical_axis_v4} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.O = point : new (0,0) z.B = point : new (5,0) z.Op = point : new (3,0) @@ -970,7 +1005,7 @@ _,z.Tp = get_points (L) _,z.T = get_points (L) _,L = C.OpB : tangent_from (z.M) _,z.Tp = get_points (L) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(O,B O',B) @@ -983,7 +1018,8 @@ _,z.Tp = get_points (L) \end{tikzpicture} \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.O = point : new (0,0) z.B = point : new (5,0) z.Op = point : new (3,0) @@ -997,7 +1033,7 @@ _,z.Tp = get_points (L) _,z.T = get_points (L) _,L = C.OpB : tangent_from (z.M) _,z.Tp = get_points (L) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -1021,7 +1057,8 @@ _,z.Tp = get_points (L) \begin{minipage}{.5\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () z.A = point: new (0,0) z.B = point: new (1,2) C.AB = circle: new (z.A,z.B) @@ -1031,7 +1068,7 @@ _,z.Tp = get_points (L) L.T1,L.T2 = C.AB : tangent_from (z.C) z.T1 = L.T1.pb z.T2 = L.T2.pb -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircle(A,B) @@ -1045,7 +1082,8 @@ _,z.Tp = get_points (L) \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () z.A = point: new (0,0) z.B = point: new (1,2) C.AB = circle: new (z.A,z.B) @@ -1055,7 +1093,7 @@ _,z.Tp = get_points (L) L.T1,L.T2 = C.AB : tangent_from (z.C) z.T1 = L.T1.pb z.T2 = L.T2.pb -\end{tkzelements} +} \begin{center} \begin{tikzpicture} \tkzGetNodes @@ -1078,7 +1116,8 @@ _,z.Tp = get_points (L) Let be a tangent common to both circles at $T$ and $T'$ (closest to $C$). Let a secant parallel to this tangent pass through $C$. Then the segment $[TT']$ is seen from the other common point $D$ at an angle equal to half the angle of the two circles. \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 5 , 2 ) L.AB = line : new ( z.A , z.B ) @@ -1094,7 +1133,7 @@ Let be a tangent common to both circles at $T$ and $T'$ (closest to $C$). Let a _,z.M = intersection (L.mm, C.AC) z.Mp = intersection (L.mm, C.BC) _,z.D = intersection (C.AC,C.BC) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(A,C B,C) @@ -1109,7 +1148,8 @@ Let be a tangent common to both circles at $T$ and $T'$ (closest to $C$). Let a \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 5 , 2 ) L.AB = line : new ( z.A , z.B ) @@ -1125,7 +1165,7 @@ L.mm = L.TTp : ll_from (z.C) _,z.M = intersection (L.mm, C.AC) z.Mp = intersection (L.mm, C.BC) _,z.D = intersection (C.AC,C.BC) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -1150,14 +1190,15 @@ In geometry, two circles are said to be orthogonal if their respective tangent l This method determines a circle with a given centre, orthogonal to a circle that is also given. \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .6 z.C_1 = point: new (0,0) z.C_2 = point: new (8,0) z.A = point: new (5,0) C = circle: new (z.C_1,z.A) z.S,z.T = get_points (C: orthogonal_from (z.C_2)) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(C_1,T C_2,T) @@ -1176,14 +1217,15 @@ This method determines a circle with a given centre, orthogonal to a circle that \end{tikzpicture} \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .6 z.C_1 = point: new (0,0) z.C_2 = point: new (8,0) z.A = point: new (5,0) C = circle: new (z.C_1,z.A) z.S,z.T = get_points (C: orthogonal_from (z.C_2)) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -1210,7 +1252,8 @@ z.S,z.T = get_points (C: orthogonal_from (z.C_2)) \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.O = point: new (0,1) z.A = point: new (1,0) z.z1 = point: new (-1.5,-1.5) @@ -1218,7 +1261,7 @@ z.S,z.T = get_points (C: orthogonal_from (z.C_2)) C.OA = circle: new (z.O,z.A) C = C.OA: orthogonal_through (z.z1,z.z2) z.c = C.center -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircle(O,A) @@ -1228,7 +1271,8 @@ z.S,z.T = get_points (C: orthogonal_from (z.C_2)) \end{tikzpicture} \end{Verbatim} \end{minipage} -\begin{minipage}{.5\textwidth}\begin{tkzelements} +\begin{minipage}{.5\textwidth}\directlua{% +init_elements () z.O = point: new (0,1) z.A = point: new (1,0) z.z1 = point: new (-1.5,-1.5) @@ -1236,7 +1280,7 @@ z.S,z.T = get_points (C: orthogonal_from (z.C_2)) C.OA = circle: new (z.O,z.A) C = C.OA: orthogonal_through (z.z1,z.z2) z.c = C.center -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -1274,7 +1318,8 @@ We can obtain the centers of similarity of these two circles by constructing $EH \begin{minipage}{.4\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .8 z.A = point : new ( 1 , 0 ) z.B = point : new ( 3 , 0 ) @@ -1290,11 +1335,12 @@ C.IT,C.JV = C.AO : midcircle (C.BP) z.I,z.T = get_points (C.IT) z.J,z.V = get_points (C.JV) z.X,z.Y = intersection (C.AO,C.BP) -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.6\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () scale = .8 z.A = point : new ( 1 , 0 ) z.B = point : new ( 3 , 0 ) @@ -1310,7 +1356,7 @@ z.X,z.Y = intersection (C.AO,C.BP) z.I,z.T = get_points (C.IT) z.J,z.V = get_points (C.JV) z.X,z.Y = intersection (C.AO,C.BP) - \end{tkzelements} + } \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles[teal,thick](A,O B,P) @@ -1337,7 +1383,8 @@ z.X,z.Y = intersection (C.AO,C.BP) \label{midcircle_diameter} \begin{minipage}{.6\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () scale =.75 z.A = point : new ( 3 , 0 ) z.B = point : new ( 5 , 0 ) @@ -1354,11 +1401,12 @@ z.X,z.Y = intersection (C.AO,C.BP) z.y = C.UR.center C.IT = C.AO : midcircle (C.BP) z.I,z.T = get_points (C.IT) -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.6\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () scale =.75 z.A = point : new ( 3 , 0 ) z.B = point : new ( 5 , 0 ) @@ -1375,7 +1423,7 @@ z.X,z.Y = intersection (C.AO,C.BP) z.y = C.UR.center C.IT = C.AO : midcircle (C.BP) z.I,z.T = get_points (C.IT) - \end{tkzelements} + } \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles[teal,thick](A,O B,P) @@ -1397,7 +1445,8 @@ $I$ is the center of external similarity of the two given circles. To obtain the \begin{minipage}{.4\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale=.75 local a,b,c,d z.A = point : new ( 0 , 0 ) @@ -1416,11 +1465,12 @@ L.TF = C.Bb : tangent_from (z.I) z.H = intersection (L.TF,C.IT) z.E = intersection (L.TF,C.Aa) z.F=L.TF.pb -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.6\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale=.75 local a,b,c,d z.A = point : new ( 0 , 0 ) @@ -1439,7 +1489,7 @@ L.TF = C.Bb : tangent_from (z.I) z.H = intersection (L.TF,C.IT) z.E = intersection (L.TF,C.Aa) z.F=L.TF.pb -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles[teal,thick](A,a B,b) @@ -1462,7 +1512,8 @@ z.F=L.TF.pb \begin{minipage}{.4\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale=.75 local a,b,c,d z.A = point : new ( 0 , 0 ) @@ -1481,11 +1532,12 @@ L.TF = C.Bb : tangent_from (z.I) z.H = intersection (L.TF,C.IT) z.E = intersection (L.TF,C.Aa) z.F=L.TF.pb -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.6\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale=.75 local a,b,c,d z.A = point : new ( 0 , 0 ) @@ -1504,7 +1556,7 @@ L.TF = C.Bb : tangent_from (z.I) z.H = intersection (L.TF,C.IT) z.E = intersection (L.TF,C.Aa) z.F=L.TF.pb -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles[teal,thick](A,a B,b) @@ -1524,7 +1576,8 @@ z.F=L.TF.pb \begin{minipage}{.4\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 2 , 0 ) z.B = point : new ( 4 , 0 ) z.a = point : new ( 1 , 0) @@ -1533,11 +1586,12 @@ C.Aa = circle : new (z.A,z.a) C.Bb = circle : new (z.B,z.b) C.IT = C.Aa : midcircle (C.Bb) z.I,z.T = get_points(C.IT) -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.6\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 2 , 0 ) z.B = point : new ( 4 , 0 ) z.a = point : new ( 1 , 0) @@ -1546,7 +1600,7 @@ C.Aa = circle : new (z.A,z.a) C.Bb = circle : new (z.B,z.b) C.IT = C.Aa : midcircle (C.Bb) z.I,z.T = get_points (C.IT) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -1569,7 +1623,8 @@ z.I,z.T = get_points (C.IT) \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.A = point: new (0,0) z.B = point: new (6,0) @@ -1583,7 +1638,7 @@ z.I,z.T = get_points (C.IT) z.I_c,z.Xc = get_points (C.exc) C.ortho = C.exa : radical_circle (C.exb,C.exc) z.w,z.a = get_points (C.ortho) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C) @@ -1595,7 +1650,8 @@ z.I,z.T = get_points (C.IT) \end{Verbatim} \end{minipage} -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.A = point: new (0,0) z.B = point: new (6,0) @@ -1609,7 +1665,7 @@ z.I,z.T = get_points (C.IT) z.I_c,z.Xc = get_points (C.exc) C.ortho = C.exa : radical_circle (C.exb,C.exc) z.w,z.a = get_points (C.ortho) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -1623,14 +1679,14 @@ z.I,z.T = get_points (C.IT) \end{center} % subsubsection radical_circle (end) -\subsubsection{Method \Imeth{circle}{power(C)}} % (fold) -\label{ssub:method_imeth_circle_power_c} +\subsubsection{Method \Imeth{circle}{power(C)} Power v1} % (fold) +\label{ssub:power_v1} -\paragraph{Power v1} % (fold) -\label{par:power_v1} -\begin{minipage}[t]{.5\textwidth}\vspace{0pt}% + +\begin{minipage}[t]{.45\textwidth}\vspace{0pt}% \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.O = point : new (0,0) z.A = point : new (2,-2) z.M = point : new (-6,0) @@ -1638,7 +1694,7 @@ z.I,z.T = get_points (C.IT) C.OA = circle : new (z.O,z.A) z.Ap = C.OA : antipode (z.A) z.B = intersection (L.AM, C.OA) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircle(O,A) @@ -1650,9 +1706,10 @@ z.I,z.T = get_points (C.IT) \end{tikzpicture} \end{Verbatim} \end{minipage} -\begin{minipage}[t]{.5\textwidth} -\begin{tkzelements} -scale = 1 +\begin{minipage}[t]{.55\textwidth}\vspace{0pt}% +\directlua{% +init_elements () +scale = .75 z.O = point : new (0,0) z.A = point : new (2,-2) z.M = point : new (-6,0) @@ -1660,11 +1717,8 @@ L.AM = line : new (z.A,z.M) C.OA = circle : new (z.O,z.A) z.Ap = C.OA : antipode (z.A) z.B = intersection (L.AM, C.OA) -\end{tkzelements} - - -\begin{center} - \begin{tikzpicture} +} +\begin{tikzpicture} \tkzGetNodes \tkzDrawCircle(O,A) \tkzMarkRightAngle[fill=gray!10](A',B,M) @@ -1673,16 +1727,18 @@ z.B = intersection (L.AM, C.OA) \tkzLabelPoints(O,A,A',M,B) \tkzDrawSegments[-Triangle](M,A M,A') \end{tikzpicture} -\end{center} - \end{minipage} -% paragraph power_v1 (end) +% subsubsection power_v1 (end) + +\subsubsection{Method \Imeth{circle}{power(C)} Power v2} % (fold) +\label{ssub:power_v2} +\vspace{6pt} + -\paragraph{Power v2} % (fold) -\label{par:power_v2} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.O = point : new (0,0) z.A = point : new (2,2) z.M = point : new (-1.5,0) @@ -1693,7 +1749,7 @@ z.B = intersection (L.AM, C.OA) z.m = z.M : north(1) L.mM = line : new (z.m,z.M) z.U,z.V = intersection (L.mM,C.OA) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircle(O,A) @@ -1707,8 +1763,9 @@ z.B = intersection (L.AM, C.OA) \end{Verbatim} \end{minipage} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{tkzelements} -scale = 1 +\directlua{% +init_elements () +scale = .8 z.O = point : new (0,0) z.A = point : new (2,2) z.M = point : new (-1.5,0) @@ -1719,7 +1776,7 @@ _,z.B = intersection (L.AM, C.OA) z.m = z.M : north(1) L.mM = line : new (z.m,z.M) z.U,z.V = intersection (L.mM,C.OA) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -1735,7 +1792,7 @@ z.U,z.V = intersection (L.mM,C.OA) \end{center} \end{minipage} -% paragraph power_v2 (end) +% subsubsection power_v2 (end) % subsubsection method_imeth_circle_power_c (end) @@ -1744,7 +1801,8 @@ z.U,z.V = intersection (L.mM,C.OA) \begin{minipage}{.5\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () z.O = point : new (0,0) z.A = point : new (1,2) C.OA = circle : new (z.O,z.A) @@ -1757,10 +1815,11 @@ z.U,z.V = intersection (L.mM,C.OA) BDn = C.OA : in_out_disk (z.N) BCp = C.OA : in_out (z.P) BDp = C.OA : in_out_disk (z.P) - \end{tkzelements} + } \end{Verbatim} \end{minipage} -\begin{minipage}{.5\textwidth}\begin{tkzelements} +\begin{minipage}{.5\textwidth}\directlua{% +init_elements () z.O = point : new (0,0) z.A = point : new (1,2) C.OA = circle : new (z.O,z.A) @@ -1773,7 +1832,7 @@ BCn = C.OA : in_out (z.N) BDn = C.OA : in_out_disk (z.N) BCp = C.OA : in_out (z.P) BDp = C.OA : in_out_disk (z.P) -\end{tkzelements} +} \def\tkzPosPoint#1#2#3#4{% \tkzLabelPoints(O,M,N,P) \ifthenelse{\equal{\tkzUseLua{#1}}{true}}{ @@ -1835,7 +1894,8 @@ This function returns a string indicating the position of the circle in relation \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.a = point : new ( 3 , 0 ) z.B = point : new ( 2 , 0 ) @@ -1846,7 +1906,7 @@ This function returns a string indicating the position of the circle in relation if position == "inside tangent" then color = "orange" else color = "blue" end -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -1856,7 +1916,8 @@ This function returns a string indicating the position of the circle in relation \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 1 , 0 ) z.a = point : new ( 3 , 0 ) z.B = point : new ( 2 , 0 ) @@ -1865,7 +1926,7 @@ C.Aa = circle: new (z.A,z.a) C.Bb = circle: new (z.B,z.b) position = C.Aa : circles_position (C.Bb) if position == "inside tangent" then color = "orange" else color = "blue" end -\end{tkzelements} +} \hspace{\fill} \begin{tikzpicture} \tkzGetNodes diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-ellipse.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-ellipse.tex index 016dd8025c..7b640220e6 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-ellipse.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-ellipse.tex @@ -34,9 +34,10 @@ The first attributes are the three points that define the ellipse: : the \Iattr \subsubsection{Atributes of an ellipse: example} % (fold) \label{ssub:attributes_of_an_ellipse} -\begin{minipage}{.5\textwidth} +\begin{minipage}{.45\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.C = point: new (3 , 2) z.A = point: new (5 , 1) L.CA = line : new (z.C,z.A) @@ -55,11 +56,12 @@ The first attributes are the three points that define the ellipse: : the \Iattr z.S = E.south z.Co = E.covertex z.Ve = E.vertex -\end{tkzelements} +} \end{Verbatim} \end{minipage} -\begin{minipage}{.5\textwidth} - \begin{tkzelements} +\begin{minipage}{.55\textwidth} + \directlua{% +init_elements () z.C = point: new (3 , 2) z.A = point: new (5 , 1) L.CA = line : new (z.C,z.A) @@ -78,7 +80,7 @@ The first attributes are the three points that define the ellipse: : the \Iattr z.S = E.south z.Co = E.covertex z.Ve = E.vertex - \end{tkzelements} + } \begin{tikzpicture} \pgfkeys{/pgf/number format/.cd,fixed,precision=2} \tkzGetNodes @@ -86,7 +88,7 @@ The first attributes are the three points that define the ellipse: : the \Iattr \tkzDrawEllipse[red](C,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{slope}) \tkzDrawPoints(C,A,B,b,W,S,F1,F2) \tkzLabelPoints(C,A,B) - \tkzDrawLine[add = .5 and .5](A,W) + \tkzDrawLine[add = .25 and .25](A,W) \tkzLabelSegment[pos=1.25,above,sloped](A,W){slope = \pgfmathprintnumber{\tkzUseLua{slope}}} \tkzLabelPoint[below](S){South} \tkzLabelPoint[below left](F1){Focus 1} @@ -105,7 +107,7 @@ The first attributes are the three points that define the ellipse: : the \Iattr \tkzUseLua{slope}) \tkzDrawPoints(C,A,B,b,W,S,F1,F2) \tkzLabelPoints(C,A,B) - \tkzDrawLine[add = .5 and .5](A,W) + \tkzDrawLine[add = .25 and .25](A,W) \tkzLabelSegment[pos=1.5,above,sloped](A,W){% slope = \pgfmathprintnumber{\tkzUseLua{slope}}} \tkzLabelPoint[below](S){South} @@ -157,7 +159,8 @@ For attributes [\ref{sec:class_ellipse}]. \begin{minipage}{0.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.C = point: new (3 , 2) z.A = point: new (5 , 1) z.B = z.C : homothety(0.5, @@ -166,7 +169,7 @@ For attributes [\ref{sec:class_ellipse}]. a = E.Rx b = E.Ry slope = math.deg(E.slope) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles[teal](C,A) @@ -178,7 +181,8 @@ For attributes [\ref{sec:class_ellipse}]. \end{Verbatim} \end{minipage} \begin{minipage}{0.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.C = point: new (3 , 2) z.A = point: new (5 , 1) z.B = z.C : homothety(0.5, @@ -187,7 +191,7 @@ E = ellipse: new (z.C,z.A,z.B) a = E.Rx b = E.Ry slope = math.deg(E.slope) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles[teal](C,A) @@ -197,7 +201,7 @@ slope = math.deg(E.slope) \end{tikzpicture} \end{minipage} -The function \Igfct{package}{tkzUseLua (variable)} is used to transfer values to \TIKZ\ or \pkg{tkz-euclide}. +The macro \tkzcname{tkzUseLua (variable)} is used to transfer values to \TIKZ\ or \pkg{tkz-euclide}. % subsubsection method_imeth_ellipse_new (end) @@ -208,7 +212,8 @@ The first two points are the foci of the ellipse, and the third one is the verte \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (5 , 1) L.AB = line : new (z.A,z.B) @@ -230,11 +235,12 @@ The first two points are the foci of the ellipse, and the third one is the verte z.R,z.S = intersection (L.XO,E) a,b = E.Rx,E.Ry ang = math.deg(E.slope) -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () scale =1 z.A = point: new (0 , 0) z.B = point: new (5 , 1) @@ -257,7 +263,7 @@ The first two points are the foci of the ellipse, and the third one is the verte z.R,z.S = intersection (L.XO,E) a,b = E.Rx,E.Ry ang = math.deg(E.slope) - \end{tkzelements} + } \begin{center} \begin{tikzpicture} @@ -302,14 +308,16 @@ The first two points are the foci of the ellipse, and the third one is the verte \label{ssub:ellipse_method_point} The method \Imeth{ellipse}{point} defines a point $M$ of the ellipse whose coordinates are $(a\times cos(phi), b\times sin(phi))$. |phi| angle between (center,vertex) and (center,M) - \emph{The environment \tkzNameEnv{tkzelements} uses as \tkzname{lua} the radian as unit for angles. } + \emph{With \code{lua}, the radian is used as unit for angles. } \begin{minipage}{0.6\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () + scale = .6 z.C = point: new (2 , 3) - z.A = point: new (6 , 5) + z.A = point: new (-1 , -2) a = value(4) b = value(3) ang = math.deg(-math.pi/4) @@ -325,14 +333,15 @@ The first two points are the foci of the ellipse, and the third one is the verte z.N = L.tb.pb L.K = E :tangent_at (z.K) z.ka,z.kb = get_points(L.K) -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{0.4\textwidth} -\begin{tkzelements} -scale = .75 +\directlua{% +init_elements () +scale = .6 z.C = point: new (2 , 3) -z.A = point: new (6 , 5) +z.A = point: new (-1 , -2) a = value(4) b = value(3) ang = math.deg(-math.pi/4) @@ -348,7 +357,7 @@ z.M = L.ta.pb z.N = L.tb.pb L.K = E :tangent_at (z.K) z.ka,z.kb = get_points(L.K) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawSegments(C,V C,CoV) diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-line.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-line.tex index f4acdafc8c..3d46a029b5 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-line.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-line.tex @@ -8,7 +8,8 @@ Writing |L.AB = line: new (z.A,z.B)| creates an object of the class \tkzname{line} (the notation is arbitrary for the moment). Geometrically, it represents both the line passing through the points $A$ and $B$ as the segment $[AB]$. Thus, we can use the midpoint of |L.AB|, which is, of course, the midpoint of the segment $[AB]$. This medium is obtained with |L.AB.mid|. Note that |L.AB.pa = z.A| and |L.AB.pb = z.B|. Finally, if a line $L$ is the result of a method, you can obtain the points with |z.A,z.B = get_points (L)| or with the previous remark. \begin{mybox} - Creation |L.AB = line : new ( z.A , z.B ) | + Creation \\ + |L.AB = line : new ( z.A , z.B ) | \end{mybox} @@ -43,7 +44,8 @@ The attributes are : \label{ssub:example_class_line} \vspace{5pt} -\begin{tkzelements} +\directlua{% +init_elements () z.a = point: new (1, 1) z.b = point: new (5, 4) L.ab = line : new (z.a,z.b) @@ -54,7 +56,7 @@ z.r = L.ab.north_pa z.s = L.ab.south_pb sl = L.ab.slope len = L.ab.length -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -74,7 +76,8 @@ len = L.ab.length \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.a = point: new (1, 1) z.b = point: new (5, 4) @@ -86,7 +89,7 @@ len = L.ab.length z.s = L.ab.south_pb sl = L.ab.slope len = L.ab.length -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -113,13 +116,14 @@ With | L.AB = line : new (z.A,z.B)|, a line is defined. \begin{minipage}{0.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new (1,1) z.B = point : new (3,2) L.AB = line : new (z.A,z.B) z.C = L.AB.north_pa z.D = L.AB.south_pa -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawLines(A,B C,D) @@ -131,14 +135,15 @@ With | L.AB = line : new (z.A,z.B)|, a line is defined. \end{Verbatim} \end{minipage} \begin{minipage}{0.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = 1 z.A = point : new (1,1) z.B = point : new (3,2) L.AB = line : new (z.A,z.B) z.C = L.AB.north_pa z.D = L.AB.south_pa -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawLines(A,B C,D) @@ -262,14 +267,15 @@ Here's the list of methods for the \tkzNameObj{line} object. The results can be \begin{minipage}{.5\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () z.A = point : new (1,-1) z.B = point : new (5,0) L.AB = line : new ( z.A , z.B ) z.M = point : new (2,3) z.N = L.AB : report (3,z.M) z.O = L.AB : report (3) - \end{tkzelements} + } \begin{tikzpicture} \tkzGetNodes \tkzDrawSegments(A,B M,N) @@ -279,14 +285,15 @@ Here's the list of methods for the \tkzNameObj{line} object. The results can be \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () z.A = point : new (1,-1) z.B = point : new (5,0) L.AB = line : new ( z.A , z.B ) z.M = point : new (2,3) z.N = L.AB : report (3,z.M) z.O = L.AB : report (3) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawSegments(A,B M,N) @@ -303,13 +310,14 @@ The angles are on either side of the given segment \begin{minipage}{.4\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 0 ) L.AB = line : new ( z.A , z.B ) T.ABC = L.AB : two_angles (math.pi/6,math.pi/2) z.C = T.ABC.pc -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygons(A,B,C) @@ -324,13 +332,14 @@ The angles are on either side of the given segment \end{Verbatim} \end{minipage} \begin{minipage}{.6\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 0 ) L.AB = line : new ( z.A , z.B ) T.ABC= L.AB : two_angles (math.pi/6,math.pi/2) z.C = T.ABC.pc - \end{tkzelements} + } \begin{center} \begin{tikzpicture} @@ -353,7 +362,8 @@ The angles are on either side of the given segment \label{ssub:method_imeth_line_isosceles} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = 2 z.a = point : new (1,2) z.b = point : new (5,1) @@ -365,7 +375,7 @@ The angles are on either side of the given segment z.Ka,z.Kb,z.Kc = get_points (T.SY) L.Kb = T.abc : symmedian_line (1) _,z.Kb = get_points(L.Kb) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygons(a,b,c Ka,Kb,Kc) @@ -377,7 +387,8 @@ The angles are on either side of the given segment \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = 2 z.a = point : new (1,2) z.b = point : new (5,1) @@ -390,7 +401,7 @@ The angles are on either side of the given segment z.Kc = get_points (T.SY) L.Kb = T.abc : symmedian_line (1) _,z.Kb = get_points(L.Kb) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygons(a,b,c Ka,Kb,Kc) @@ -411,7 +422,8 @@ In the following example, a small difficulty arises. The given lengths are not a \vspace{6pt} \begin{minipage}{.4\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 5 , 0 ) L.AB = line : new ( z.A , z.B ) @@ -421,7 +433,7 @@ In the following example, a small difficulty arises. The given lengths are not a z.C = T.ABC.pc z.D = T.ABD.pc z.E = T.ABE.pc -\end{tkzelements} +} \hspace{\fill} \begin{tikzpicture}[gridded] \tkzGetNodes @@ -433,7 +445,8 @@ In the following example, a small difficulty arises. The given lengths are not a \end{Verbatim} \end{minipage} \begin{minipage}{.6\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 5 , 0 ) L.AB = line : new ( z.A , z.B ) @@ -443,7 +456,7 @@ In the following example, a small difficulty arises. The given lengths are not a z.C = T.ABC.pc z.D = T.ABD.pc z.E = T.ABE.pc -\end{tkzelements} +} \begin{center} \begin{tikzpicture}[gridded] @@ -465,15 +478,16 @@ In some cases, two solutions are possible. \begin{minipage}{.4\textwidth} \begin{Verbatim} -\begin{tkzelements} - scale =1 - z.A = point : new ( 0 , 0 ) - z.B = point : new ( 5 , 0 ) - L.AB = line : new ( z.A , z.B ) +\directlua{% +init_elements () + scale = 1 + z.A = point : new ( 0 , 0 ) + z.B = point : new ( 5 , 0 ) + L.AB = line : new ( z.A , z.B ) T.ABC,T.ABD = L.AB : ssa (value(3),math.pi/6) - z.C = T.ABC.pc - z.D = T.ABD.pc -\end{tkzelements} + z.C = T.ABC.pc + z.D = T.ABD.pc +} \begin{tikzpicture}[gridded] \tkzGetNodes \tkzDrawPolygons(A,B,C A,B,D) @@ -487,7 +501,8 @@ In some cases, two solutions are possible. \end{Verbatim} \end{minipage} \begin{minipage}{.6\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () scale =1 z.A = point : new ( 0 , 0 ) z.B = point : new ( 5 , 0 ) @@ -495,7 +510,7 @@ In some cases, two solutions are possible. T.ABC,T.ABD = L.AB : ssa (value(3),math.pi/6) z.C = T.ABC.pc z.D = T.ABD.pc - \end{tkzelements} + } \begin{center} \begin{tikzpicture}[gridded] @@ -524,7 +539,7 @@ The side lengths are proportional to the lengths given in the table. They depend \textbf{Name} & \textbf{definition} \\ \midrule \Imeth{line}{gold (<swap>)} & Right triangle with $a=\varphi$, $b=1$ and $c=\sqrt{\varphi}$\\ -\Imeth{line}{golden (<swap>)} &Right triangle $b=\varphi$ $c=1$ ; half of gold rectangle \\ +\Imeth{line}{golden (<swap>)} & Right triangle $b=\varphi$, $c=1$ ; half of gold rectangle \\ \Imeth{line}{divine ()} & Isosceles $a=\varphi$, $b=c=1$ and $\beta = \gamma=\pi/5$ \\ \Imeth{line}{pythagoras ()} & $a=5$, $b=4$, $c=3$ and other names: isis or egyptian\\ \Imeth{line}{sublime ()} & Isosceles $a=1$, $b=c=\varphi$ and $\beta =\gamma=2\pi/5$ ; other name: euclid\\ @@ -534,7 +549,8 @@ The side lengths are proportional to the lengths given in the table. They depend \begin{minipage}{.4\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 0 ) L.AB = line : new ( z.A , z.B ) @@ -550,7 +566,7 @@ The side lengths are proportional to the lengths given in the table. They depend z.G = T.ABG.pc T.ABH = L.AB : pythagoras () z.H = T.ABH.pc -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygons(A,B,C A,B,D A,B,E A,B,F A,B,G A,B,H) @@ -560,7 +576,8 @@ The side lengths are proportional to the lengths given in the table. They depend \end{Verbatim} \end{minipage} \begin{minipage}{.6\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 0 ) L.AB = line : new ( z.A , z.B ) @@ -576,7 +593,7 @@ The side lengths are proportional to the lengths given in the table. They depend z.G = T.ABG.pc T.ABH = L.AB : pythagoras () z.H = T.ABH.pc -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygons(A,B,C A,B,D A,B,E A,B,F A,B,G A,B,H) @@ -598,14 +615,15 @@ This method exists for all objects except quadrilaterals. \begin{minipage}{.4\textwidth} \begin{Verbatim} -\begin{tkzelements} - z.A = point : new (-1,-1) - z.B = point : new (1,1) +\directlua{% +init_elements () + z.A = point : new (-1,-1) + z.B = point : new (1,1) L.AB = line : new (z.A,z.B) - z.I = L.AB : point (0.5) - z.J = L.AB : point (-0.5) - z.K = L.AB : point (2) -\end{tkzelements} + z.I = L.AB : point (0.5) + z.J = L.AB : point (-0.5) + z.K = L.AB : point (2) +} \begin{tikzpicture}[gridded] \tkzGetNodes \tkzDrawLine(J,K) @@ -615,14 +633,15 @@ This method exists for all objects except quadrilaterals. \end{Verbatim} \end{minipage} \begin{minipage}{.6\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () z.A = point : new (-1,-1) z.B = point : new (1,1) L.AB = line : new (z.A,z.B) z.I = L.AB : point (0.5) z.J = L.AB : point (-0.5) z.K = L.AB : point (2) -\end{tkzelements} +} \begin{center} \begin{tikzpicture}[gridded] \tkzGetNodes @@ -641,14 +660,15 @@ If the coefficient is missing then it defaults to $1$ and in the following examp \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (4 , 0) z.C = point: new (1 , 3) L.AB = line : new (z.A,z.B) z.D = L.AB : colinear_at (z.C,.5) z.E = L.AB : colinear_at (z.C) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawSegments(A,B C,E) @@ -658,14 +678,15 @@ If the coefficient is missing then it defaults to $1$ and in the following examp \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (4 , 0) z.C = point: new (1 , 3) L.AB = line : new (z.A,z.B) z.D = L.AB : colinear_at (z.C,.5) z.E = L.AB : colinear_at (z.C) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} \tkzGetNodes @@ -685,12 +706,13 @@ If the coefficient is missing then it defaults to $1$ and in the following examp \begin{minipage}{.4\textwidth} \begin{Verbatim} -\begin{tkzelements} - z.a = point: new (1, 1) - z.b = point: new (5, 4) +\directlua{% +init_elements () + z.a = point: new (1, 1) + z.b = point: new (5, 4) L.ab = line : new (z.a,z.b) - z.c = L.ab : normalize () -\end{tkzelements} + z.c = L.ab : normalize () +} \begin{tikzpicture}[gridded] \tkzGetNodes @@ -702,12 +724,13 @@ If the coefficient is missing then it defaults to $1$ and in the following examp \end{Verbatim} \end{minipage} \begin{minipage}{.6\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.a = point: new (1, 1) z.b = point: new (5, 4) L.ab = line : new (z.a,z.b) z.c = L.ab : normalize () -\end{tkzelements} +} \begin{center} \begin{tikzpicture}[gridded] @@ -728,12 +751,13 @@ If the coefficient is missing then it defaults to $1$ and in the following examp \begin{minipage}{.4\textwidth} \begin{Verbatim} -\begin{tkzelements} - z.A = point : new ( 0 , -1 ) - z.B = point : new ( 4 , 2 ) +\directlua{% +init_elements () + z.A = point : new ( 0 , -1 ) + z.B = point : new ( 4 , 2 ) L.AB = line : new ( z.A , z.B ) - z.G = L.AB : barycenter (1,2) -\end{tkzelements} + z.G = L.AB : barycenter (1,2) +} \begin{tikzpicture} \tkzGetNodes \tkzDrawLine(A,B) @@ -743,12 +767,13 @@ If the coefficient is missing then it defaults to $1$ and in the following examp \end{Verbatim} \end{minipage} \begin{minipage}{.6\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , -1 ) z.B = point : new ( 4 , 2 ) L.AB = line : new ( z.A , z.B ) z.G = L.AB : barycenter (1,2) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} \tkzGetNodes @@ -765,7 +790,8 @@ If the coefficient is missing then it defaults to $1$ and in the following examp \label{ssub:new_line_from_a_defined_line} \begin{minipage}{0.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = 1.25 z.A = point : new (1,1) z.B = point : new (3,2) @@ -773,9 +799,9 @@ If the coefficient is missing then it defaults to $1$ and in the following examp z.C = L.AB.north_pa z.D = L.AB.south_pa L.CD = line : new (z.C,z.D) - _,z.E = get_points ( L.CD: ll_from (z.B)) - -- z.E = L2.pb -\end{tkzelements} + _,z.E = get_points ( L.CD: ll_from (z.B)) + % z.E = L2.pb +} \begin{tikzpicture} \tkzGetNodes \tkzDrawLines(A,B C,D B,E) @@ -787,7 +813,8 @@ If the coefficient is missing then it defaults to $1$ and in the following examp \end{Verbatim} \end{minipage} \begin{minipage}{0.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = 1.25 z.A = point : new (1,1) z.B = point : new (3,2) @@ -796,8 +823,8 @@ z.C = L.AB.north_pa z.D = L.AB.south_pa L.CD = line : new (z.C,z.D) _,z.E = get_points ( L.CD: ll_from (z.B)) --- or z.E = L2.pb with |L2 = L.CD: ll_from (z.B)| -\end{tkzelements} +% or z.E = L2.pb with |L2 = L.CD: ll_from (z.B)| +} \begin{center} \begin{tikzpicture} @@ -819,14 +846,15 @@ _,z.E = get_points ( L.CD: ll_from (z.B)) \label{ssub:newline_ortho_from} \begin{minipage}{0.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new (1,1) z.B = point : new (3,2) L.AB = line : new (z.A,z.B) z.C = point : new (1,3) L.CD = L.AB : ortho_from(z.C) z.D = L.CD.pb -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawLines(A,B C,D) @@ -836,14 +864,15 @@ _,z.E = get_points ( L.CD: ll_from (z.B)) \end{Verbatim} \end{minipage} \begin{minipage}{0.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new (1,1) z.B = point : new (3,2) L.AB = line : new (z.A,z.B) z.C = point : new (1,3) L.CD = L.AB : ortho_from(z.C) z.D = L.CD.pb -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -866,14 +895,15 @@ In Mathworld, the mediator is the plane through the midpoint of a line segment a the perpendicular bisector of a line segment, is a line segment perpendicular to the segment and passing through the midpoint of this segment. \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new(0,0) z.B = point: new(5,0) L.AB = line: new (z.A,z.B) L.med = L.AB : mediator () z.M = L.AB.mid z.x,z.y= get_points(L.med) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawLine(A,B) @@ -886,14 +916,15 @@ the perpendicular bisector of a line segment, is a line segment perpendicular t \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new(0,0) z.B = point: new(5,0) L.AB = line: new (z.A,z.B) L.med = L.AB : mediator () z.M = L.AB.mid z.x,z.y= get_points(L.med) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} \tkzGetNodes @@ -905,7 +936,6 @@ the perpendicular bisector of a line segment, is a line segment perpendicular t \tkzMarkSegments(A,M M,B) \end{tikzpicture} \end{center} - \end{minipage} % subsubsection method_imeth_line_mediator (end) @@ -915,13 +945,14 @@ the perpendicular bisector of a line segment, is a line segment perpendicular t \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new(0,0) z.B = point: new(5,0) L.AB = line: new (z.A,z.B) T.ABC = L.AB : equilateral () z.C = T.ABC.pc -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawLine(A,B) @@ -933,13 +964,14 @@ the perpendicular bisector of a line segment, is a line segment perpendicular t \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new(0,0) z.B = point: new(5,0) L.AB = line: new (z.A,z.B) T.ABC = L.AB : equilateral () z.C = T.ABC.pc -\end{tkzelements} +} \begin{center} \begin{tikzpicture} \tkzGetNodes @@ -959,7 +991,8 @@ the perpendicular bisector of a line segment, is a line segment perpendicular t \label{ssub:example_projection_of_several_points} \begin{minipage}{0.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .8 z.a = point: new (0, 0) z.b = point: new (4, 1) @@ -967,7 +1000,7 @@ the perpendicular bisector of a line segment, is a line segment perpendicular t z.d = point: new (5, 2) L.ab = line: new (z.a,z.b) z.cp,z.dp = L.ab: projection(z.c,z.d) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawLines(a,b c,c' d,d') @@ -977,7 +1010,8 @@ the perpendicular bisector of a line segment, is a line segment perpendicular t \end{Verbatim} \end{minipage} \begin{minipage}{0.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = .8 z.a = point: new (0, 0) z.b = point: new (4, 1) @@ -985,7 +1019,7 @@ z.c = point: new (2, 5) z.d = point: new (5, 2) L.ab = line: new (z.a,z.b) z.cp,z.dp = L.ab : projection(z.c,z.d) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -1006,7 +1040,8 @@ z.cp,z.dp = L.ab : projection(z.c,z.d) \begin{minipage}{0.6\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (6 , 0) z.C = point: new (1 , 5) @@ -1017,8 +1052,8 @@ z.cp,z.dp = L.ab : projection(z.c,z.d) z.H = L.AB: projection (z.O) L.ab = C.OA: tangent_at (z.A) z.a,z.b = L.ab.pa,L.ab.pb - -- or z.a,z.b = get_points (L.ab) -\end{tkzelements} + % or z.a,z.b = get_points (L.ab) +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C) @@ -1037,7 +1072,8 @@ z.cp,z.dp = L.ab : projection(z.c,z.d) \end{Verbatim} \end{minipage} \begin{minipage}{0.4\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.A = point: new (0 , 0) z.B = point: new (6 , 0) @@ -1049,8 +1085,8 @@ C.OA = circle: new (z.O,z.A) z.H = L.AB : projection (z.O) L.ab = C.OA : tangent_at (z.A) z.a,z.b = L.ab.pa,L.ab.pb - -- or z.a,z.b = get_points (L.ab) -\end{tkzelements} + % or z.a,z.b = get_points (L.ab) +} \begin{center} \begin{tikzpicture} @@ -1080,14 +1116,15 @@ z.a,z.b = L.ab.pa,L.ab.pb \begin{minipage}{0.6\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0,0) z.B = point: new (1,2) z.C = point: new (-3,2) z.D = point: new (0,2) L.AB = line : new (z.A,z.B) z.E,z.F = L.AB : translation (z.C,z.D) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPoints(A,...,F) @@ -1097,14 +1134,15 @@ z.a,z.b = L.ab.pa,L.ab.pb \end{Verbatim} \end{minipage} \begin{minipage}{0.4\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0,0) z.B = point: new (1,2) z.C = point: new (-3,2) z.D = point: new (0,2) L.AB = line : new (z.A,z.B) z.E,z.F = L.AB : translation (z.C,z.D) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -1126,7 +1164,8 @@ z.a,z.b = L.ab.pa,L.ab.pb \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 1 ) z.E = point : new ( 0 , 2 ) @@ -1136,7 +1175,7 @@ z.a,z.b = L.ab.pa,L.ab.pb T.EFG = triangle : new (z.E,z.F,z.G) T.new = L.AB : reflection (T.EFG) z.Ep,z.Fp,z.Gp = get_points(T.new) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawLine(A,B) @@ -1147,7 +1186,8 @@ z.a,z.b = L.ab.pa,L.ab.pb \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 1 ) z.E = point : new ( 0 , 2 ) @@ -1157,7 +1197,7 @@ z.a,z.b = L.ab.pa,L.ab.pb T.EFG = triangle : new (z.E,z.F,z.G) T.new = L.AB : reflection (T.EFG) z.Ep,z.Fp,z.Gp = get_points(T.new) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -1177,14 +1217,15 @@ z.a,z.b = L.ab.pa,L.ab.pb \begin{minipage}{0.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new (0 , 0) - z.B = point : new (5 , -2) + z.B = point : new (4 , -2) z.C = point : new (3 , 3) L.AB = line : new (z.A,z.B) d = L.AB : distance (z.C) z.H = L.AB : projection (z.C) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawLines(A,B C,H) @@ -1196,14 +1237,15 @@ z.a,z.b = L.ab.pa,L.ab.pb \end{Verbatim} \end{minipage} \begin{minipage}{0.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new (0 , 0) - z.B = point : new (5 , -2) + z.B = point : new (4 , -2) z.C = point : new (3 , 3) L.AB = line : new (z.A,z.B) d = L.AB : distance (z.C) z.H = L.AB : projection (z.C) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -1226,7 +1268,8 @@ z.a,z.b = L.ab.pa,L.ab.pb \label{ssub:apollonius_circle_ma_mb_k} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 6 , 0 ) L.AB =line: new (z.A,z.B) @@ -1234,7 +1277,7 @@ z.a,z.b = L.ab.pa,L.ab.pb z.O,z.C = get_points ( C.apo ) z.D = C.apo : antipode (z.C) z.P = C.apo : point (0.30) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzFillCircle[blue!20,opacity=.2](O,C) @@ -1253,7 +1296,8 @@ z.a,z.b = L.ab.pa,L.ab.pb \end{tikzpicture} \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 6 , 0 ) L.AB =line: new (z.A,z.B) @@ -1261,7 +1305,7 @@ C.apo = L.AB : apollonius (2) z.O,z.C = get_points ( C.apo ) z.D = C.apo : antipode (z.C) z.P = C.apo : point (0.30) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-matrices.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-matrices.tex index d533511fbe..dfb17d2cc2 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-matrices.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-matrices.tex @@ -25,10 +25,11 @@ This \code{matrix} class has been created to avoid the need for an external libr \end{mybox} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () M = matrix: new {{a,b},{c,d}} tex.print('M = ') M : print () - \end{tkzelements} + } \end{minipage} @@ -47,9 +48,10 @@ This \code{matrix} class has been created to avoid the need for an external libr \end{mybox} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () V = matrix : vector (1,2,3) tex.print('V = ') V : print () - \end{tkzelements} + } \end{minipage} \item Homogeneous transformation matrix [\ref{ssub:method_htm}] @@ -62,10 +64,11 @@ This \code{matrix} class has been created to avoid the need for an external libr \end{mybox} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () H = matrix : htm (math.pi/3,1,2,2,1) tex.print('H = ') H: print () - \end{tkzelements} + } \end{minipage} \end{itemize} @@ -79,17 +82,19 @@ This method (Refer to \ref{ssub:method_print}) is necessary to control the resul \begin{minipage}{.5\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () M = matrix : new {{1,-1},{2,0}} M : print () - \end{tkzelements} + } \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () M = matrix : new {{1,-1},{2,0}} M : print () - \end{tkzelements} + } \end{minipage} @@ -132,21 +137,23 @@ The number of rows is accessed with |M.rows| and the number of columns with |M.c \vspace{.5em} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () M = matrix : new ({{1,2,3},{4,5,6}}) M : print () tex.print("Rows: "..M.rows) tex.print("Cols: "..M.cols) -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () M = matrix : new ({{1,2,3},{4,5,6}}) M : print () tex.print("Rows: "..M.rows) tex.print("Cols: "..M.cols) -\end{tkzelements} +} \end{minipage} % subsubsection attribute_set (end) @@ -157,21 +164,23 @@ The matrix must be square. This library was created for matrices of dimension 2 \vspace{.5em} \begin{minipage}{.6\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () M = matrix : square (3,1,1,0,2,-1,-2,1,-1,2) M : print () tex.print ('\\\\') tex.print ("Its determinant is: " .. M.det) - \end{tkzelements} + } \end{Verbatim} \end{minipage} \begin{minipage}{.4\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () M = matrix : square (3,1,1,0,2,-1,-2,1,-1,2) M : print () tex.print ('\\\\') tex.print ("Its determinant is: "..M.det) -\end{tkzelements} +} \end{minipage} % subsubsection determinant (end) @@ -180,25 +189,27 @@ tex.print ("Its determinant is: "..M.det) \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () a = point :new (1,-2) b = point :new (0,1) c = point :new (1,1) d = point :new (1,-1) A = matrix : new ({{a, b}, {c,d}}) tex.print(tostring(A.det)) -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () a = point :new (1,-2) b = point :new (0,1) c = point :new (1,1) d = point :new (1,-1) A = matrix : new ({{a, b}, {c,d}}) tex.print(tostring(A.det)) -\end{tkzelements} +} \end{minipage} % subsubsection determinant_with_complex_numbers (end) % subsection attibutes_of_a_matrix (end) @@ -238,7 +249,8 @@ To simplify the entries, I've used a few functions to simplify the displays. \vspace{.5em} \begin{minipage}{.6\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () A = matrix : new ({{1,2},{2,-1}}) B = matrix : new ({{-1,0},{1,3}}) S = A + B @@ -250,11 +262,12 @@ To simplify the entries, I've used a few functions to simplify the displays. dsp(S,'S') sym(" = ") dsp(A) sym(' + ') dsp(B) nl() nl() dsp(D,'D') sym(" = ") dsp(A) sym(' - ') dsp(B) -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.4\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () local function dsp (M,name) if name then tex.print(name..' = ')print_matrix(M) @@ -279,7 +292,7 @@ nl() nl() dsp(S,'S') sym(" = ") dsp(A) sym(' + ') dsp(B) nl() nl() dsp(D,'D') sym(" = ") dsp(A) sym(' - ') dsp(B) -\end{tkzelements} +} \end{minipage} % subsubsection addition_of_matrices (end) @@ -290,7 +303,8 @@ To simplify the entries, I've used a few functions. You can find their definitio \begin{minipage}{.5\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () A = matrix : new ({{1,2},{2,-1}}) B = matrix : new ({{-1,0},{1,3}}) P = A * B @@ -298,11 +312,12 @@ To simplify the entries, I've used a few functions. You can find their definitio C = A^3 K = 2 * A T = A^'T' - \end{tkzelements} + } \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () local function dsp (M,name) if name then tex.print(name..' = ')print_matrix(M) @@ -328,7 +343,7 @@ To simplify the entries, I've used a few functions. You can find their definitio nl() nl() dsp(A^('T'),"$A^{T}$") nl() nl() -\end{tkzelements} +} \end{minipage} \subsubsection{Metamethod \code{eq}} % (fold) @@ -378,7 +393,8 @@ This is the main method for creating a matrix. Here's an example of a 2x3 matrix \vspace{.5em} \begin{minipage}{.5\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () a = point : new (1,0) b = point : new (1,1) c = point : new (-1,1) @@ -387,11 +403,12 @@ This is the main method for creating a matrix. Here's an example of a 2x3 matrix f = point : new (0,-1) M = matrix : new ({{a,b,c},{d,e,f}}) M : print () - \end{tkzelements} + } \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () a = point : new (1,0) b = point : new (1,1) c = point : new (-1,1) @@ -400,7 +417,7 @@ e = point : new (1,-1) f = point : new (0,-1) M = matrix : new ({{a,b,c},{d,e,f}}) M : print () -\end{tkzelements} +} \end{minipage} % subsubsection method_new (end) @@ -413,17 +430,19 @@ The special case of a column matrix, frequently used to represent a vector, can \vspace{.5em} \begin{minipage}{.5\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () M = matrix : vector (1,2,3) M : print () - \end{tkzelements} + } \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () M = matrix : vector (1,2,3) M : print () - \end{tkzelements} + } \end{minipage} % subsubsection method_vector (end) @@ -442,7 +461,8 @@ which gives: \begin{minipage}{.5\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () pi = math.pi M = matrix : htm (pi/4 , 3 , 1) z.A = point : new (2,-1) @@ -450,11 +470,12 @@ which gives: z.A.mtx : print () tex.print ('then after homogenization: ') V : print () - \end{tkzelements} + } \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () pi = math.pi M = matrix : htm (pi/4 , 3 , 1) z.A = point : new (2,-1) @@ -462,7 +483,7 @@ which gives: z.A.mtx : print () tex.print ('then after homogenization: ') V : print () -\end{tkzelements} +} \end{minipage} % subsubsection method_homogenization (end) @@ -481,11 +502,12 @@ The main method is to create the matrix: A 3x3 matrix is created which combines a $\pi/4$ rotation and a $\overrightarrow{t}=(3,1)$ translation. -\begin{tkzelements} +\directlua{% +init_elements () pi = math.pi M = matrix : htm (pi/4 , 3 , 1) M : print () -\end{tkzelements} +} Now we can apply the matrix M. Let $A$ be the point defined here: \ref{ssub:method_homogenization}. By homogenization, we obtain the column matrix $V$. @@ -495,7 +517,8 @@ Now we can apply the matrix M. Let $A$ be the point defined here: \ref{ssub:meth W = A * V \end{mybox} -\begin{tkzelements} +\directlua{% +init_elements () pi = math.pi M = matrix : htm (pi/4 , 3 , 1) M :print () @@ -504,7 +527,7 @@ V = z.A.mtx : homogenization () V : print () tex.print('=') W = M * V W : print () -\end{tkzelements} +} All that remains is to extract the coordinates of the new point. % subsubsection method_htm (end) @@ -518,21 +541,23 @@ The method \code{get\_htm\_point} extracts a point from a vector obtained afte \begin{minipage}{.5\textwidth} \begin{verbatim} -\begin{tkzelements} +\directlua{% +init_elements () W : print () z.P = get_htm_point(W) tex.print("The affix of $P$ is: ") tex.print(display(z.P)) -\end{tkzelements} +} \end{verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () W : print () z.P = get_htm_point(W) tex.print("The affix of $P$ is: ") tex.print(display(z.P)) -\end{tkzelements} +} \end{minipage} % subsubsection method_code_get__htm__point (end) @@ -548,7 +573,8 @@ The above operations can be simplified by using the \code{htm\_apply} method dir Then the method \code{htm\_apply} transforms a point, a list of points or an object. - \begin{tkzelements} + \directlua{% +init_elements () pi = math.pi M = matrix : htm (pi/4 , 3 , 1 ) z.O = point : new (0,0) @@ -566,11 +592,12 @@ z.K = point : new (2,2) T = triangle : new ( z.I , z.J , z.K ) Tp = M : htm_apply (T) z.Kp = Tp.pc -\end{tkzelements} +} \begin{minipage}{.6\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () pi = math.pi M = matrix : htm (pi/4 , 3 , 1 ) z.O = point : new (0,0) @@ -588,7 +615,7 @@ z.Kp = Tp.pc T = triangle : new ( z.I , z.J , z.K ) Tp = M : htm_apply (T) z.Kp = Tp.pc -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.4\textwidth} @@ -609,7 +636,8 @@ New cartesian coordinates system: \vspace{.5 em} \begin{minipage}{.5\textwidth} \begin{verbatim} -\begin{tkzelements} +\directlua{% +init_elements () pi = math.pi tp = tex.print nl = '\\\\' @@ -625,11 +653,12 @@ New cartesian coordinates system: V : print () z.N = get_htm_point(V) tex.print(display(z.N)) -\end{tkzelements} +} \end{verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () pi = math.pi tp = tex.print nl = '\\\\' @@ -645,7 +674,7 @@ New cartesian coordinates system: V : print () z.N = get_htm_point(V) tex.print(display(z.N)) - \end{tkzelements} + } \end{minipage} % subsubsection method_code_htm__apply (end) @@ -659,18 +688,20 @@ We have already seen this method in the presentation of matrices. We first need \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () M = matrix : square (2,2,3,-5,4) M : print () -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () M = matrix : square (2,2,3,-5,4) M : print () tex.print(S) -\end{tkzelements} +} \end{minipage} % subsubsection method_square (end) @@ -682,17 +713,19 @@ With the \pkg{amsmath} package loaded, this method can be used. By default, the \vspace{.5em} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () M = matrix : new ({{math.sqrt(2),math.sqrt(3)},{math.sqrt(4),math.sqrt(5)}}) M : print ('pmatrix') -\end{tkzelements} +} \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () M = matrix : new ({{math.sqrt(2),math.sqrt(3)},{math.sqrt(4),math.sqrt(5)}}) tkz_dc = 3 M : print ('pmatrix') -\end{tkzelements} +} \vspace{.5em} @@ -703,17 +736,19 @@ In the case of a square matrix, it is possible to transmit a list of values whos \vspace{.5em} \begin{minipage}{.5\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () M = matrix : square (2,1,0,0,2) M : print () - \end{tkzelements} + } \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () M = matrix : square (2,1,0,0,2) M : print () - \end{tkzelements} + } \end{minipage} % subsubsection method_print (end) @@ -727,7 +762,8 @@ Below, $A$ is an array. It can be displayed as a simple array or as a matrix, bu \vspace{.5em} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () A = {{1,2},{1,-1}} tex.print ('A = ') print_array (A) tex.print (' or ') @@ -735,11 +771,12 @@ Below, $A$ is an array. It can be displayed as a simple array or as a matrix, bu M = matrix : new ({{1,1},{0,2}}) tex.print ('\\\\') tex.print ('M = ') M : print () -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () A = {{1,2},{1,-1}} tex.print ('A = ') print_array (A) tex.print (' or ') @@ -747,7 +784,7 @@ Below, $A$ is an array. It can be displayed as a simple array or as a matrix, bu M = matrix : new ({{1,1},{0,2}}) tex.print ('\\\\') tex.print ('M = ') M : print () -\end{tkzelements} +} \end{minipage} @@ -758,19 +795,21 @@ Below, $A$ is an array. It can be displayed as a simple array or as a matrix, bu \begin{minipage}{.5\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () M = matrix : new {{1,2},{2,-1}} S = M: get(1,1) + M: get(2,2) tex.print(S) - \end{tkzelements} + } \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () M = matrix : new {{1,2},{2,-1}} S = M: get(1,1) + M: get(2,2) tex.print(S) -\end{tkzelements} +} \end{minipage} @@ -781,21 +820,23 @@ tex.print(S) \begin{minipage}{.6\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () A = matrix : new ({{1,2},{2,-1}}) tex.print("Inverse of $A = $") B = A : inverse () B : print () -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.4\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () A = matrix : new ({{1,2},{2,-3}}) tex.print("Inverse of $A = $") B = A : inverse () B : print () -\end{tkzelements} +} \end{minipage} % subsubsection inverse_matrix (end) @@ -804,22 +845,24 @@ tex.print(S) \begin{minipage}{.6\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () M = matrix : new ({{1,0,1},{1,2, 1},{0,-1,2}}) tex.print("$M = $") print_matrix (M) tex.print('\\\\') tex.print("Inverse of $M = M^{-1} = $") print_matrix (M^-1) -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.4\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () M = matrix : new ({{1,0,1},{1,2,1},{0,-1,2}}) tex.print("$M = $") print_matrix (M) tex.print('\\\\') tex.print("Inverse of $M = M^{-1} = $") print_matrix (M^-1) -\end{tkzelements} +} \end{minipage} % subsubsection inverse_matrix_with_power_syntax (end) @@ -832,21 +875,23 @@ A transposed matrix can be accessed with |A: transpose ()| or with |A^{'T'}|. \vspace{.5em} \begin{minipage}{.6\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () A = matrix : new ({{1,2},{2,-1}}) AT = A : transpose () tex.print("$A^{'T'} = $") AT : print () - \end{tkzelements} + } \end{Verbatim} \end{minipage} \begin{minipage}{.4\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () A = matrix : new ({{1,2},{2,-1}}) AT = A : transpose () tex.print("$A^{'T'} = $") AT : print () - \end{tkzelements} + } \end{minipage} \vspace{.5em} @@ -860,7 +905,8 @@ Remark: |(A ^'T')^'T' = A| \begin{minipage}{.6\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () N = matrix : new {{1, 0, 3},{2, 1, 0},{-1, 2, 0}} tex.print('N = ') print_matrix(N) tex.print('\\\\') @@ -871,11 +917,12 @@ Remark: |(A ^'T')^'T' = A| tex.print('N $\\times$ adj(N) = ') print_matrix(N.i) tex.print('\\\\') tex.print('det(N) = ') tex.print(N.det) -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.4\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () N = matrix : new {{1, 0, 3},{2, 1, 0},{-1, 2, 0}} tex.print('N = ') print_matrix(N) N.a = N : adjugate () @@ -885,7 +932,7 @@ Remark: |(A ^'T')^'T' = A| tex.print('N $\\times$ adj(N) = ') print_matrix(N.i) tex.print('\\\\') tex.print('det(N) = ') tex.print(N.det) -\end{tkzelements} +} \end{minipage} % subsubsection method_adjugate (end) @@ -898,17 +945,19 @@ Creating the identity matrix order 3 \begin{minipage}{.5\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () Id_3 = matrix : identity (3) Id_3 : print () - \end{tkzelements} + } \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () Id_3 = matrix : identity (3) Id_3 : print () -\end{tkzelements} +} \end{minipage} % subsubsection methode_identity (end) @@ -922,7 +971,8 @@ For the moment, this method only concerns matrices of order 2. \begin{minipage}{.5\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () A = matrix : new {{5,-3}, {6,-4}} tex.print('A = ') A : print () D,P = A : diagonalize () @@ -936,11 +986,12 @@ For the moment, this method only concerns matrices of order 2. tex.print('Verification: $P^{-1}P = $ ') T = P^(-1)*P T : print () - \end{tkzelements} + } \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () A = matrix : new {{5,-3}, {6,-4}} tex.print('A = ') A : print () D,P = A : diagonalize () @@ -954,7 +1005,7 @@ For the moment, this method only concerns matrices of order 2. tex.print('Verification: $P^{-1}P = $ ') T = P^(-1)*P T : print () - \end{tkzelements} + } \end{minipage} % subsubsection diagonalization (end) @@ -964,7 +1015,8 @@ For the moment, this method only concerns matrices of order 2. The method returns \code{true} if the matrix is orthogonal and \code{false} otherwise. \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () local cos = math.cos local sin = math.sin local pi = math.pi @@ -983,10 +1035,11 @@ The method returns \code{true} if the matrix is orthogonal and \code{false} othe print_matrix(transposeMatrix (A)) tex.print('=') inv_matrix (A) : print () - \end{tkzelements} + } \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () local cos = math.cos local sin = math.sin local pi = math.pi @@ -1000,7 +1053,7 @@ tex.print('Test: $A^T = A^{-1} ?$') print_matrix(transposeMatrix (A)) tex.print('=') inv_matrix (A) : print () -\end{tkzelements} +} % subsubsection method_is_orthogonal (end) \subsubsection{Method \Imeth{matrix}{is\_diagonal}} % (fold) diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-misc.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-misc.tex index e80a292858..0266a2feb5 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-misc.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-misc.tex @@ -25,7 +25,6 @@ \Igfct{math}{bisector\_ext (z1,z2,z3)} & L.Aa = bisector_ext (z.A,z.B,z.C) from A \\ \Igfct{math}{altitude (z1,z2,z3)} & altitude from z1 \\ \Igfct{package}{set\_lua\_to\_tex (list)} & set\_lua\_to\_tex('a','n') defines |\a| and |\n| \\ -\Igfct{package}{tkzUseLua (variable)} & |\textbackslash\tkzUseLua{a}| prints the value of a\\ %parabola (a,b,c) & to get \\ \Igfct{math}{value (v) } & apply |scale * value | \\ \Igfct{math}{real (v) } & apply | value /scale | \\ @@ -46,13 +45,14 @@ \subsection{Harmonic division with tkzphi } % (fold) \label{sub:harmonic_division_with_tkzphi} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale =.5 z.a = point: new(0,0) z.b = point: new(8,0) L.ab = line: new (z.a,z.b) z.m,z.n = L.ab: harmonic_both (tkzphi) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawLine[add= .2 and .2](a,n) @@ -62,17 +62,18 @@ \end{Verbatim} -\begin{tkzelements} - scale =.5 +\directlua{% +init_elements () + scale =.25 z.a = point: new(0,0) z.b = point: new(8,0) L.ab = line: new (z.a,z.b) z.m,z.n = L.ab: harmonic_both (tkzphi) -\end{tkzelements} +} \hspace*{\fill} \begin{tikzpicture} \tkzGetNodes - \tkzDrawLine[add= .2 and .2](a,n) + \tkzDrawLine[add= .1 and .1](a,n) \tkzDrawPoints(a,b,n,m) \tkzLabelPoints(a,b,n,m) \end{tikzpicture} @@ -83,7 +84,8 @@ \label{sub:function_islinear} \begin{minipage}{0.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.a = point: new (1, 1) z.b = point: new (2, 2) z.c = point: new (4, 4) @@ -92,7 +94,7 @@ else z.d = point: new (-1, -1) end -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPoints(a,...,d) @@ -101,7 +103,8 @@ \end{Verbatim} \end{minipage} \begin{minipage}{0.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.a = point: new (1, 1) z.b = point: new (2, 2) z.c = point: new (4, 4) @@ -110,7 +113,7 @@ else z.d = point: new (-1, -1) end -\end{tkzelements} +} \hspace*{\fill} \begin{tikzpicture} \tkzGetNodes @@ -141,13 +144,14 @@ If |scale = 1.2| with a = 6 then real(a) = $6 / 1.2 = 5$ . \subsection{Transfer from lua to \TEX} % (fold) \label{sub:transfer_from_lua_to_tex} -It's possible to transfer variable from Lua to \TEX{} with -\Igfct{package}{\textbackslash{tkzUseLua}}. +It's possible to transfer variable from Lua to \TEX{} with the macro +\tkzcname{tkzUseLua}. \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new (0 , 0) z.B = point : new (3 , 2) z.C = point : new (2 , 5) @@ -155,7 +159,7 @@ It's possible to transfer variable from Lua to \TEX{} with d = L.AB : distance (z.C) l = L.AB.length z.H = L.AB : projection (z.C) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawLines(A,B C,H) @@ -167,7 +171,8 @@ It's possible to transfer variable from Lua to \TEX{} with \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new (0 , 0) z.B = point : new (3 , 2) z.C = point : new (2 , 5) @@ -175,7 +180,7 @@ It's possible to transfer variable from Lua to \TEX{} with d = L.AB : distance (z.C) l = L.AB.length z.H = L.AB : projection (z.C) -\end{tkzelements} +} \hspace*{\fill} \begin{tikzpicture} \tkzGetNodes @@ -191,7 +196,8 @@ It's possible to transfer variable from Lua to \TEX{} with \subsection{Normalized angles : Slope of lines (ab), (ac) and (ad)} % (fold) \label{sub:normalized_angles} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.a = point: new(0, 0) z.b = point: new(-3, -3) z.c = point: new(0, 3) @@ -205,7 +211,7 @@ It's possible to transfer variable from Lua to \TEX{} with angle = point.arg (z.d-z.a) tex.print('slope of (ad) : '..tostring(angle)..'\\\\') tex.print('slope normalized of (acd) : '..tostring(angle\_normalize(angle))..'\\\\') -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawLines[red](a,b a,c a,d) @@ -213,7 +219,8 @@ It's possible to transfer variable from Lua to \TEX{} with \tkzLabelPoints(a,b,c,d) \end{tikzpicture} \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .75 z.a = point: new(0, 0) z.b = point: new(-3, -3) @@ -228,7 +235,7 @@ tex.print('slope normalized of (ac) : '..tostring(angle_normalize(angle))..'\\\\ angle = point.arg (z.d-z.a) tex.print('slope of (ad) : '..tostring(angle)..'\\\\') tex.print('slope normalized of (ad) : '..tostring(angle_normalize(angle))..'\\\\') -\end{tkzelements} +} \hspace*{\fill} \begin{tikzpicture} @@ -248,13 +255,14 @@ The function |get_angle (a,b,c)| gives the angle normalized of $(\overrightarro \begin{minipage}{0.6\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.a = point: new(0, 0) z.b = point: new(-2, -2) z.c = point: new(0, 3) angcb = tkzround ( get_angle (z.a,z.c,z.b),3) angbc = tkzround ( get_angle (z.a,z.b,z.c),3) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -269,14 +277,15 @@ The function |get_angle (a,b,c)| gives the angle normalized of $(\overrightarro \end{Verbatim} \end{minipage} \begin{minipage}{0.4\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = 1.2 z.a = point: new(0, 0) z.b = point: new(-2, -2) z.c = point: new(0, 3) angcb = tkzround ( get_angle (z.a,z.c,z.b),3) angbc = tkzround ( get_angle (z.a,z.b,z.c),3) -\end{tkzelements} +} \hspace*{\fill} \begin{tikzpicture} @@ -298,7 +307,8 @@ The function |get_angle (a,b,c)| gives the angle normalized of $(\overrightarro \begin{minipage}{0.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new(0,0) z.B = point: new(5,0) z.C = point: new(0,3) @@ -307,7 +317,7 @@ The function |get_angle (a,b,c)| gives the angle normalized of $(\overrightarro z.B_1, z.C_1 = get_points (T.ABC: anti ()) x = dot_product (z.A,z.B,z.C) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C) @@ -319,7 +329,8 @@ The function |get_angle (a,b,c)| gives the angle normalized of $(\overrightarro \end{Verbatim} \end{minipage} \begin{minipage}{0.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = .6 z.A = point: new(0,0) z.B = point: new(5,0) @@ -329,7 +340,7 @@ The function |get_angle (a,b,c)| gives the angle normalized of $(\overrightarro z.B_1, z.C_1 = get_points (T.ABC: anti ()) x = dot_product (z.A,z.B,z.C) -\end{tkzelements} +} \hspace*{\fill} \begin{tikzpicture} \tkzGetNodes @@ -359,7 +370,8 @@ These functions are useful if you don't need to create a useful triangle object \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.a = point: new (0, 0) z.b = point: new (5, -2) z.c = point: new (2, 3) @@ -368,7 +380,7 @@ These functions are useful if you don't need to create a useful triangle object angic = tkzround ( get_angle (z.a,z.i,z.c),2) angci = tkzround ( get_angle (z.a,z.b,z.i),2) z.e = bisector_ext (z.a,z.b,z.c).pb -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -385,7 +397,8 @@ These functions are useful if you don't need to create a useful triangle object \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.a = point: new (0, 0) z.b = point: new (5, -2) z.c = point: new (2, 3) @@ -394,7 +407,7 @@ These functions are useful if you don't need to create a useful triangle object angic = tkzround ( get_angle (z.a,z.i,z.c),2) angci = tkzround ( get_angle (z.a,z.b,z.i),2) z.e = bisector_ext (z.a,z.b,z.c).pb -\end{tkzelements} +} \hspace{\fill} \begin{tikzpicture} \tkzGetNodes @@ -425,7 +438,8 @@ This function solves the equation $ax^2+bx+c= 0$ with real or complex numbers. \begin{minipage}{.6\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () tex.sprint('Solve : $x^2+1=0$ The solution set is ') r1,r2 = solve_quadratic(1,0,1) tex.print('\\{'..tostring(r1)..' , '..tostring(r2)..'\\}') @@ -440,11 +454,12 @@ This function solves the equation $ax^2+bx+c= 0$ with real or complex numbers. tex.sprint('Solve : $ix^2+(1+i)x+(-1+i)=0$ The solution set is ') r1,r2 = solve_quadratic(a,b,c) tex.print('\\{'..tostring(r1)..' , '..tostring(r2)..'\\}') -\end{tkzelements} +} \end{Verbatim} \end{minipage} -\begin{tkzelements} +\directlua{% +init_elements () tex.sprint('Solve : $x^2+1=0$ The solution set is ') r1,r2 = solve_quadratic(1,0,1) tex.print('\\{'..tostring(r1)..' , '..tostring(r2)..'\\}') @@ -459,7 +474,7 @@ This function solves the equation $ax^2+bx+c= 0$ with real or complex numbers. tex.sprint('Solve : $ix^2+(1+i)x+(-1+i)=0$ The solution set is ') r1,r2 = solve_quadratic(a,b,c) tex.print('\\{'..tostring(r1)..' , '..tostring(r2)..'\\}') -\end{tkzelements} +} % subsubsection function_solve__quadratic (end) % section math_functions (end) diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-parallelogram.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-parallelogram.tex index 6088f6cfb3..d6a1187ff3 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-parallelogram.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-parallelogram.tex @@ -39,7 +39,8 @@ Creation | P.new = parallelogram : new (z.A,z.B,z.C,z.D)| % subsubsection example_attributes (end) \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 1 ) z.C = point : new ( 7 , 5 ) @@ -49,7 +50,7 @@ z.B = P.new.pb z.C = P.new.pc z.D = P.new.pd z.I = P.new.center -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C,D) @@ -61,7 +62,8 @@ z.I = P.new.center \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 1 ) z.C = point : new ( 7 , 5 ) @@ -71,7 +73,7 @@ z.B = P.new.pb z.C = P.new.pc z.D = P.new.pd z.I = P.new.center -\end{tkzelements} +} \hspace{\fill} \begin{tikzpicture} \tkzGetNodes @@ -109,15 +111,16 @@ z.I = P.new.center % subsubsection parallelogram_with_fourth_method (end) \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .75 z.A = point : new ( 0 , 0 ) -z.B = point : new ( 4 , 1 ) -z.C = point : new ( 5 , 3 ) +z.B = point : new ( 3 , 1 ) +z.C = point : new ( 4 , 3 ) P.four = parallelogram : fourth (z.A,z.B,z.C) z.D = P.four.pd z.I = P.four.center -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C,D) @@ -129,14 +132,16 @@ z.I = P.four.center \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () + scale = .75 z.A = point : new ( 0 , 0 ) -z.B = point : new ( 4 , 1 ) -z.C = point : new ( 5 , 3 ) +z.B = point : new ( 3 , 1 ) +z.C = point : new ( 4 , 3 ) P.four = parallelogram : fourth (z.A,z.B,z.C) z.D = P.four.pd z.I = P.four.center -\end{tkzelements} +} \hspace{\fill} \begin{tikzpicture} @@ -147,5 +152,6 @@ z.I = P.four.center \tkzLabelPoints[above](C,D) \tkzDrawPoints[red](I) \end{tikzpicture} +\hspace{\fill} \end{minipage} % subsubsection parallelogram_with_side_method (end) diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-point.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-point.tex index 0da8f16b78..7dba1b8022 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-point.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-point.tex @@ -86,7 +86,8 @@ The creation of a point is done using the following method, but there are other % Method \Imeth{point}{new} \begin{mybox} - Creation |z.A = point: new (1,2) | + Creation \\ + |z.A = point: new (1,2) | \end{mybox} The point $A$ has coordinates $x=1$ and $y=2$. If you use the notation |z.A|, then $A$ will be referenced as a node in \TIKZ\ or in \pkg{tkz-euclide}. @@ -103,7 +104,7 @@ This is the creation of a fixed point with coordinates 1 and 2 and which is name \Iattr{point}{re} & |z.A.re = 1| & [\ref{ssub:methods}] \\ \Iattr{point}{im} & |z.A.im = 2| & [\ref{ssub:methods}] \\ \Iattr{point}{type} & |z.A.type = 'point'| & \\ - \Iattr{point}{argument} & |z.A.argument $\approx$ 0.78539816339745| & [\ref{ssub:example_point_attributes}] \\ + \Iattr{point}{argument} & |z.A.argument| $\approx$ |0.78539816339745| & [\ref{ssub:example_point_attributes}] \\ \Iattr{point}{modulus} & |z.A.modulus| $\approx$ |2.2360...| =$\sqrt{5}$ & [\ref{ssub:example_point_attributes}] \\ \bottomrule \end{tabular} @@ -114,16 +115,17 @@ This is the creation of a fixed point with coordinates 1 and 2 and which is name \subsubsection{Example: point attributes} % (fold) \label{ssub:example_point_attributes} -\begin{tkzelements} +\directlua{ +init_elements () z.M = point: new (1,2) -\end{tkzelements} +} \hspace*{\fill} \begin{Verbatim} -\begin{tkzelements} - z.M = point: new (1,2) -\end{tkzelements} +\directlua{ + init_elements () + z.M = point: new (1,2)} \end{Verbatim} \pgfkeys{/pgf/number format/.cd,std,precision=2} \let\pmpn\pgfmathprintnumber @@ -172,13 +174,16 @@ $|z_M| =\sqrt{5}\approx \pmpn{\tkzUseLua{z.M.modulus}}$ cm} \begin{scope}[every annotation/.style={fill=lightgray!15,anchor = east}] \node [annotation,font =\small,text width=6cm] at (current bounding box.west) { Attributes of \texttt{z.M} - \begin{itemize} - \item \texttt{z.M.re} = 1 - \item \texttt{z.M.im} = 2 - \item \texttt{z.M.type} = 'point' - \item \texttt{z.M.argument} = $\theta \approx \pmpn{\tkzUseLua{z.M.argument}}$ rad - \item \texttt{z.M.modulus} = $|z_M| =\sqrt{5}\approx \pmpn{\tkzUseLua{z.M.modulus}}$ cm - \end{itemize} + \begin{mybox}{} + \begin{itemize} + \item \texttt{z.M.re} = 1 + \item \texttt{z.M.im} = 2 + \item \texttt{z.M.type} = 'point' + \item \texttt{z.M.argument} = $\theta \approx \pmpn{\tkzUseLua{z.M.argument}}$ rad + \item \texttt{z.M.modulus} = $|z_M| =\sqrt{5}\approx \pmpn{\tkzUseLua{z.M.modulus}}$ cm + \end{itemize} + \end{mybox} + }; \end{scope} \end{tikzpicture} @@ -195,12 +200,13 @@ Attributes of \texttt{z.M} \normalsize \begin{minipage}{\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{ +init_elements () z.A = point : new ( 2 , 3 ) z.O = point : new ( 0 , 0 ) z.I = point : new ( 1 , 0 ) -\end{tkzelements} -\hspace{\fill}\begin{tikzpicture} +} +\begin{tikzpicture} \tkzGetNodes \tkzInit[xmin=-4,ymin=-4,xmax=4,ymax=4] \tkzDrawCircle[dashed,red](O,A) @@ -216,11 +222,12 @@ Attributes of \texttt{z.M} \end{minipage} \begin{minipage}{\textwidth} - \begin{tkzelements} +\directlua{ +init_elements () z.A = point : new ( 2 , 3 ) z.O = point : new ( 0 , 0 ) z.I = point : new ( 1 , 0 ) - \end{tkzelements} +} \begin{center} \begin{tikzpicture} \tkzGetNodes @@ -262,7 +269,7 @@ The methods described in the following table are standard and can be found in mo \midrule \textbf{Points} &&\\ \midrule -\Imeth{point}{north(r)} & |r| distance to the point (1 if empty) & [\ref{par:power_v2} ; \ref{ssub:methods}] \\ +\Imeth{point}{north(r)} & |r| distance to the point (1 if empty) & [\ref{ssub:power_v2} ; \ref{ssub:methods}] \\ \Imeth{point}{south(r)} & & \\ \Imeth{point}{east(r)} & & \\ \Imeth{point}{west(r)} & & \\ @@ -292,14 +299,15 @@ If |d| is absent then it is considered equal to 1. \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{ + init_elements () z.O = point : new ( 0, 0 ) z.A = z.O : east () z.Ap = z.O : east (2) : north (2) z.B = z.O : north () z.C = z.O : west () z.D = z.O : south () -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C,D) @@ -308,7 +316,8 @@ If |d| is absent then it is considered equal to 1. \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{ + init_elements () scale = 1.5 z.O = point : new ( 0, 0 ) z.A = z.O : east () @@ -316,7 +325,7 @@ If |d| is absent then it is considered equal to 1. z.B = z.O : north () z.C = z.O : west () z.D = z.O : south () -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -338,11 +347,12 @@ This involves defining a point using its modulus and argument. \begin{minipage}{0.6\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{ + init_elements () z.O = point: new (0, 0) z.A = point: new (3, 0) z.F = point: polar (3, math.pi/3) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircle(O,A) @@ -355,12 +365,13 @@ This involves defining a point using its modulus and argument. \end{Verbatim} \end{minipage} \begin{minipage}{0.4\textwidth} -\begin{tkzelements} +\directlua{ +init_elements () scale = .75 z.O = point: new (0, 0) z.A = point: new (3, 0) z.F = point: polar (3, math.pi/3) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -383,34 +394,27 @@ This involves defining a point using its modulus and argument. The result is a point located between the origin and the initial point at a distance of $1$ from the origin. -\begin{tkzelements} +\directlua{ +init_elements () scale = 1.5 z.O = point : new (0,0) z.A = point : new (2,1) z.B = z.A : normalize () z.I = point : new (1,0) -\end{tkzelements} +} + -\begin{center} - \begin{tikzpicture} - \tkzGetNodes - \tkzDrawSegment(O,A) - \tkzDrawCircle(O,B) - \tkzDrawPoints(O,A,B,I) - \tkzLabelPoints(O,A) - \tkzLabelPoints[above](B) - \tkzLabelPoint[below right](I){$1$} - \end{tikzpicture} -\end{center} +\begin{minipage}{0.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{ +init_elements () scale = 1.5 z.O = point : new (0,0) z.A = point : new (1,2) z.B = z.A : normalize () z.I = point : new (1,0) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawSegment(O,A) @@ -420,6 +424,20 @@ z.I = point : new (1,0) \tkzLabelPoint[below right](I){$1$} \end{tikzpicture} \end{Verbatim} +\end{minipage} +\begin{minipage}{0.5\textwidth} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawSegment(O,A) + \tkzDrawCircle(O,B) + \tkzDrawPoints(O,A,B,I) + \tkzLabelPoints(O,A) + \tkzLabelPoints[above](B) + \tkzLabelPoint[below right](I){$1$} + \end{tikzpicture} +\end{center} + \end{minipage} % subsubsection method_normalize (end) @@ -431,12 +449,13 @@ Let $O$ be the origin of the plane. The "orthogonal (d)" method is used to obtai \begin{minipage}{.6\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{ +init_elements () z.A = point : new ( 3 , 1 ) z.B = z.A : orthogonal (1) z.O = point : new ( 0,0 ) z.C = z.A : orthogonal () -\end{tkzelements} +} \begin{tikzpicture}[gridded] \tkzGetNodes \tkzDrawSegments(O,A O,C) @@ -446,12 +465,13 @@ Let $O$ be the origin of the plane. The "orthogonal (d)" method is used to obtai \end{Verbatim} \end{minipage} \begin{minipage}{.4\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 3 , 1 ) z.B = z.A : orthogonal (1) z.O = point : new ( 0,0 ) z.C = z.A : orthogonal () -\end{tkzelements} +} \begin{center} \begin{tikzpicture}[gridded] \tkzGetNodes @@ -471,43 +491,39 @@ This method is complementary to the previous one, so you may not wish to have $\ \begin{minipage}{.6\textwidth} \begin{Verbatim} -\begin{tkzelements} - z.A = point : new ( 3 , 1 ) - z.B = z.A : orthogonal (1) - z.O = point : new ( 0,0 ) - -- z.B = z.B : at (z.A) -- or - z.B = z.A : orthogonal (1) : at (z.A) - z.E = z.A : orthogonal (1) - z.C = z.A+z.B - z.D =(z.C-z.A):orthogonal(2) : at (z.C) -\end{tkzelements} -\begin{tikzpicture}[gridded] +\directlua{% +init_elements () +z.O = point : new ( 0,0 ) +z.A = point : new ( 3 , 2 ) +z.B = z.A : orthogonal (1) +z.C = z.A+z.B +z.D =(z.C-z.A):orthogonal(2) : at (z.C) +} + \begin{tikzpicture}[gridded] \tkzGetNodes \tkzLabelPoints[below right](O,A,C) - \tkzLabelPoints[above](B,D,E) - \tkzDrawSegments(O,A A,B A,C C,D O,E) - \tkzDrawPoints(O,A,B,C,D,E) -\end{tikzpicture} + \tkzLabelPoints[above](B,D) + \tkzDrawSegments(O,A A,B A,C C,D O,B) + \tkzDrawPoints(O,A,B,C,D) + \end{tikzpicture} \end{Verbatim} \end{minipage} \begin{minipage}{.4\textwidth} -\begin{tkzelements} -z.A = point : new ( 3 , 1 ) -z.B = z.A : orthogonal (1) +\directlua{% +init_elements () z.O = point : new ( 0,0 ) --- z.B = z.B : at (z.A) -- or -z.B = z.A : orthogonal (1) : at (z.A) -z.E = z.A : orthogonal (1) +z.A = point : new ( 3 , 2 ) +z.B = z.A : orthogonal (1) z.C = z.A+z.B z.D =(z.C-z.A):orthogonal(2) : at (z.C) -\end{tkzelements} +} \begin{center} \begin{tikzpicture}[gridded] \tkzGetNodes \tkzLabelPoints[below right](O,A,C) - \tkzLabelPoints[above](B,D,E) - \tkzDrawSegments(O,A A,B A,C C,D O,E) - \tkzDrawPoints(O,A,B,C,D,E) + \tkzLabelPoints[above](B,D) + \tkzDrawSegments(O,A A,B A,C C,D O,B) + \tkzDrawPoints(O,A,B,C,D) \end{tikzpicture} \end{center} \end{minipage} @@ -521,12 +537,13 @@ The arguments are the angle of rotation in radians, and here a list of points. \begin{minipage}{.6\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.a = point: new(0, -1) z.b = point: new(4, 0) z.o = point: new(6, -2) z.ap,z.bp = z.o : rotation (math.pi/2,z.a,z.b) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawLines(o,a o,a' o,b o,b') @@ -539,13 +556,14 @@ The arguments are the angle of rotation in radians, and here a list of points. \end{Verbatim} \end{minipage} \begin{minipage}{.4\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.a = point: new(0, -1) z.b = point: new(4, 0) z.o = point: new(6, -2) z.ap,z.bp = z.o : rotation (math.pi/2,z.a,z.b) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -567,7 +585,8 @@ Rotate a triangle by an angle of $\pi/6$ around $O$. \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .75 z.O = point : new ( -1 , -1 ) z.A = point : new ( 2 , 0 ) @@ -581,7 +600,7 @@ Rotate a triangle by an angle of $\pi/6$ around $O$. z.C = T.ABC.pc T.ApBpCp = z.O : rotation (math.pi/3,T.ABC) z.Ap,z.Bp,z.Cp = get_points ( T.ApBpCp) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygons(A,B,C A',B',C' A,B,E,F A',B',E',F') @@ -592,7 +611,8 @@ Rotate a triangle by an angle of $\pi/6$ around $O$. \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.O = point : new ( -1 , -1 ) z.A = point : new ( 2 , 0 ) z.B = point : new ( 5 , 0 ) @@ -605,7 +625,7 @@ _,_,z.Ep,z.Fp = get_points ( S.new ) z.C = T.ABC.pc T.ApBpCp = z.O : rotation (math.pi/3,T.ABC) z.Ap,z.Bp,z.Cp = get_points ( T.ApBpCp) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -630,14 +650,15 @@ Example of the symmetry of an object \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.a = point: new(0,-1) z.b = point: new(2, 0) L.ab = line : new (z.a,z.b) C.ab = circle : new (z.a,z.b) z.o = point: new(1,1) z.ap,z.bp = get_points (z.o: symmetry (C.ab)) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(a,b a',b') @@ -649,14 +670,15 @@ Example of the symmetry of an object \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.a = point: new(0, -1) z.b = point: new(2, 0) L.ab = line : new (z.a,z.b) C.ab = circle : new (z.a,z.b) z.o = point: new(1, 1) z.ap,z.bp = get_points (z.o: symmetry (C.ab)) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-quadrilateral.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-quadrilateral.tex index 30ee773eba..55484fa41a 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-quadrilateral.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-quadrilateral.tex @@ -42,15 +42,16 @@ Creation | Q.new = rectangle : new (z.A,z.B,z.C,z.D)| \label{ssub:quadrilateral_attributes} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 0 ) z.C = point : new ( 5 , 1 ) -z.D = point : new ( -1 , 4 ) +z.D = point : new ( 0 , 3 ) Q.ABCD = quadrilateral : new ( z.A , z.B , z.C , z.D ) z.I = Q.ABCD.i z.G = Q.ABCD.g -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -61,15 +62,16 @@ z.G = Q.ABCD.g \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 0 ) z.C = point : new ( 5 , 1 ) -z.D = point : new ( -1 , 4 ) +z.D = point : new ( 0 , 3 ) Q.ABCD = quadrilateral : new ( z.A , z.B , z.C , z.D ) z.I = Q.ABCD.i z.G = Q.ABCD.g -\end{tkzelements} +} \hspace{\fill}\begin{tikzpicture} \tkzGetNodes @@ -102,7 +104,8 @@ z.G = Q.ABCD.g \label{ssub:inscribed_quadrilateral} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 0 ) z.D = point : polar ( 4 , 2*math.pi/3 ) @@ -115,7 +118,7 @@ if bool == true then C.cir = triangle : new (z.A,z.B,z.C): circum_circle () z.O = C.cir.center end -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -129,7 +132,8 @@ end \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = .75 z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 0 ) @@ -143,7 +147,7 @@ if bool == true then C.cir = triangle : new (z.A,z.B,z.C): circum_circle () z.O = C.cir.center end -\end{tkzelements} +} \hspace{\fill} \begin{tikzpicture} \tkzGetNodes diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-rectangle.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-rectangle.tex index cd0ae2981c..0a9edc0d6d 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-rectangle.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-rectangle.tex @@ -41,14 +41,15 @@ Creation | R.ABCD = rectangle : new (z.A,z.B,z.C,z.D)| \label{ssub:example} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 0 ) z.C = point : new ( 4 , 4) z.D = point : new ( 0 , 4) R.new = rectangle : new (z.A,z.B,z.C,z.D) z.I = R.new.center -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -61,7 +62,8 @@ z.I = R.new.center \end{Verbatim} \end{minipage} \hspace{\fill}\begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () scale =1.5 z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 0 ) @@ -69,7 +71,7 @@ z.I = R.new.center z.D = point : new ( 0 , 2) R.new = rectangle : new (z.A,z.B,z.C,z.D) z.I = R.new.center - \end{tkzelements} + } \begin{tikzpicture} \tkzGetNodes @@ -118,7 +120,8 @@ z.I = R.new.center \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 0 ) @@ -127,7 +130,7 @@ P.ABCD = rectangle : angle ( z.I , z.A , math.pi/6) z.B = P.ABCD.pb z.C = P.ABCD.pc z.D = P.ABCD.pd -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -139,7 +142,8 @@ z.D = P.ABCD.pd \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 0 ) @@ -148,7 +152,7 @@ P.ABCD = rectangle : angle ( z.I , z.A , math.pi/6) z.B = P.ABCD.pb z.C = P.ABCD.pc z.D = P.ABCD.pd -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C,D) @@ -165,14 +169,15 @@ z.D = P.ABCD.pd \label{ssub:side_method} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 3 ) R.side = rectangle : side (z.A,z.B,3) z.C = R.side.pc z.D = R.side.pd z.I = R.side.center -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C,D) @@ -184,14 +189,15 @@ z.I = R.side.center \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 3 ) R.side = rectangle : side (z.A,z.B,3) z.C = R.side.pc z.D = R.side.pd z.I = R.side.center -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C,D) @@ -208,14 +214,15 @@ z.I = R.side.center \label{ssub:diagonal_method} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.C = point : new ( 4 , 3 ) R.diag = rectangle : diagonal (z.A,z.C) z.B = R.diag.pb z.D = R.diag.pd z.I = R.diag.center -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -229,14 +236,15 @@ z.I = R.diag.center \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.C = point : new ( 4 , 3 ) R.diag = rectangle : diagonal (z.A,z.C) z.B = R.diag.pb z.D = R.diag.pd z.I = R.diag.center -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -254,14 +262,15 @@ z.I = R.diag.center \label{ssub:gold_method} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.X = point : new ( 0 , 0 ) z.Y = point : new ( 4 , 2 ) R.gold = rectangle : gold (z.X,z.Y) z.Z = R.gold.pc z.W = R.gold.pd z.I = R.gold.center -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -275,14 +284,15 @@ z.I = R.gold.center \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.X = point : new ( 0 , 0 ) z.Y = point : new ( 4 , 2 ) R.gold = rectangle : gold (z.X,z.Y) z.Z = R.gold.pc z.W = R.gold.pd z.I = R.gold.center -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-regular.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-regular.tex index 98b6ac3610..b4034f9245 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-regular.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-regular.tex @@ -33,7 +33,9 @@ Creation | RP.IA = regular_polygon : new (z.I,z.A,6)| \label{ssub:pentagon} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () +scale = .75 z.O = point: new (0,0) z.I = point: new (1,3) z.A = point: new (2,0) @@ -41,7 +43,7 @@ RP.five = regular_polygon : new (z.I,z.A,5) RP.five : name ("P_") C.ins = circle: radius (z.I,RP.five.inradius) z.H = RP.five.proj -\end{tkzelements} +} \begin{tikzpicture} \def\nb{\tkzUseLua{RP.five.nb}} \tkzGetNodes @@ -53,7 +55,9 @@ z.H = RP.five.proj \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () +scale = .75 z.O = point: new (0,0) z.I = point: new (1,3) z.A = point: new (2,0) @@ -61,7 +65,7 @@ z.H = RP.five.proj RP.five : name ("P_") C.ins = circle : radius ( z.I , RP.five.inradius ) z.H = RP.five.proj - \end{tkzelements} + } \hspace{\fill} \begin{tikzpicture} \def\nb{\tkzUseLua{RP.five.nb}} @@ -71,6 +75,7 @@ z.H = RP.five.proj \tkzDrawPoints[red](P_1,P_...,P_\nb,H,I) \tkzLabelPoints[red](I,A,H) \end{tikzpicture} + \hspace{\fill} \end{minipage} % subsubsection pentagon (end) % subsection regular_polygon_attributes (end) diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-square.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-square.tex index 17e26d105f..1a5b69bba5 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-square.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-square.tex @@ -41,7 +41,8 @@ Creation | S.AB = square : new (z.A,z.B,z.C,z.D)| \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 0 ) z.C = point : new ( 4 , 4) @@ -49,7 +50,7 @@ z.D = point : new ( 0 , 4) S.new = square : new ( z.A , z.B ,z.C,z.D) z.I = S.new.center z.H = S.new.proj -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles[orange](I,A I,H) @@ -65,7 +66,8 @@ z.H = S.new.proj \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 0 ) z.C = point : new ( 4 , 4) @@ -73,7 +75,7 @@ z.H = S.new.proj S.new = square : new ( z.A , z.B ,z.C,z.D) z.I = S.new.center z.H = S.new.proj - \end{tkzelements} + } \hspace{\fill} \begin{tikzpicture} \tkzGetNodes @@ -115,7 +117,8 @@ z.H = S.new.proj % \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = 2 z.A = point : new ( 0 , 0 ) z.B = point : new ( 2 , 1 ) @@ -124,7 +127,7 @@ z.H = S.new.proj z.C = S.side.pc z.D = S.side.pd z.I = S.side.center -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -137,7 +140,8 @@ z.H = S.new.proj \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () scale = 2 z.A = point : new ( 0 , 0 ) z.B = point : new ( 2 , 1 ) @@ -146,7 +150,7 @@ z.B = S.side.pb z.C = S.side.pc z.D = S.side.pd z.I = S.side.center -\end{tkzelements} +} \hspace{\fill} \begin{tikzpicture} \tkzGetNodes diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-triangle.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-triangle.tex index b144ed3e01..af4dac7c7b 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-triangle.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-triangle.tex @@ -46,12 +46,13 @@ The triangle object is created using the \Imeth{triangle}{new} method, for examp \begin{minipage}{.6\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new(0,0) z.B = point: new(5,0) z.C = point: new(2,3) T.ABC = triangle: new (z.A,z.B,z.C) -\end{tkzelements} +} \def\wangle#1{\tkzDN[2]{% \tkzUseLua{math.deg(T.ABC.#1)}}} \begin{tikzpicture} @@ -64,12 +65,13 @@ The triangle object is created using the \Imeth{triangle}{new} method, for examp \end{Verbatim} \end{minipage} \begin{minipage}{.4\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new(0,0) z.B = point: new(5,0) z.C = point: new(2,3) T.ABC = triangle: new (z.A,z.B,z.C) -\end{tkzelements} +} \def\wangle#1{\tkzDN[2]{\tkzUseLua{math.deg(T.ABC.#1)}}} \begin{tikzpicture} \tkzGetNodes @@ -85,7 +87,8 @@ The triangle object is created using the \Imeth{triangle}{new} method, for examp \label{ssub:example_triangle_attributes} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (4 , 0) z.C = point: new (0 , 3) @@ -100,7 +103,7 @@ The triangle object is created using the \Imeth{triangle}{new} method, for examp alpha = T.ABC.alpha beta = T.ABC.beta gamma = T.ABC.gamma -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C) @@ -114,7 +117,8 @@ The triangle object is created using the \Imeth{triangle}{new} method, for examp \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (4 , 0) z.C = point: new (1 , 3) @@ -129,7 +133,7 @@ The triangle object is created using the \Imeth{triangle}{new} method, for examp alpha = T.ABC.alpha beta = T.ABC.beta gamma = T.ABC.gamma -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -207,7 +211,7 @@ The triangle object is created using the \Imeth{triangle}{new} method, for examp \Imeth{triangle}{bisector (n) } & |L.Bb = T.ABC : bisector (1) | n = 1 line from $B$ \footnote{|_,z.b = get_points(L.Bb)| recovers the common point of the opposite side and bisector. If you don't need to use the triangle object several times, you can obtain a bisector with the function |bisector (z.A,z.B,z.C)| [\ref{misc}]}& [\ref{ssub:method_imeth_triangle_bisector}]\\ -\Imeth{triangle}{bisector\_ext(n) } & n=2 line from the third vertex.& [\ref{sub:harmonic_division_and_bisector}]\\ +\Imeth{triangle}{bisector\_ext(n) } & n=2 line from the third vertex.& [\ref{ssub:harmonic_division_and_bisector}]\\ \Imeth{triangle}{symmedian\_line (n)} & Cevian with respect to Lemoine point.& [\ref{ssub:method_imeth_triangle_symmedial} ; \ref{ssub:method_imeth_line_isosceles}]\\ @@ -299,7 +303,7 @@ The triangle object is created using the \Imeth{triangle}{new} method, for examp \Imeth{triangle}{steiner\_circumellipse ()} & [ex. \ref{ssub:steiner_inellipse_and_circumellipse}] \\ -\Imeth{triangle}{euler\_ellipse ()} & [ex. (\ref{sub:euler_ellipse}]\\ +\Imeth{triangle}{euler\_ellipse ()} & [ex. (\ref{ssub:euler_ellipse}]\\ \midrule \textbf{Miscellaneous} &\\ \midrule @@ -322,7 +326,8 @@ The points of contact of the inscribed circle (incircle) with the triangle in qu \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.a = point: new(1,0) z.b = point: new(6,2) z.c = point: new(2,5) @@ -330,7 +335,7 @@ T = triangle : new (z.a,z.b,z.c) z.g = T : gergonne_point () z.i = T.incenter z.ta,z.tb,z.tc = get_points (T : intouch ()) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygons(a,b,c) @@ -344,7 +349,8 @@ z.ta,z.tb,z.tc = get_points (T : intouch ()) \end{Verbatim} \end{minipage} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{tkzelements} +\directlua{% +init_elements () z.a = point: new(1,0) z.b = point: new(6,2) z.c = point: new(2,5) @@ -352,7 +358,7 @@ T = triangle : new (z.a,z.b,z.c) z.g = T : gergonne_point () z.i = T.incenter z.ta,z.tb,z.tc = get_points (T : intouch ()) -\end{tkzelements} +} \begin{center} @@ -378,7 +384,8 @@ Let $E_a$ be the point at which the $J_a$-excircle meets the side $(BC)$ of a tr \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .7 z.A = point : new (0,0) z.B = point : new (3.6,0) @@ -389,7 +396,7 @@ Let $E_a$ be the point at which the $J_a$-excircle meets the side $(BC)$ of a tr z.J_c = get_points (T.ABC : excentral ()) z.E_a,z.E_b, z.E_c = get_points (T.ABC : extouch ()) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPoints(A,B,C) @@ -407,7 +414,8 @@ Let $E_a$ be the point at which the $J_a$-excircle meets the side $(BC)$ of a tr \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = .7 z.A = point : new (0,0) z.B = point : new (3.6,0) @@ -418,7 +426,7 @@ Let $E_a$ be the point at which the $J_a$-excircle meets the side $(BC)$ of a tr z.J_c = get_points (T.ABC : excentral ()) z.E_a,z.E_b, z.E_c = get_points (T.ABC : extouch ()) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -450,7 +458,8 @@ The Mittenpunkt is the symmedian point of the excentral triangle. The mittenpunk \vspace{6pt} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = 1 z.A = point : new ( 0 , 0 ) z.B = point : new ( 6 , 0 ) @@ -463,11 +472,12 @@ The Mittenpunkt is the symmedian point of the excentral triangle. The mittenpunk z.Mi = T : mittenpunkt_point () T.int = T : extouch () z.Ta,z.Tb,z.Tc = get_points(T.int) -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = 1 z.A = point : new ( 0 , 0 ) z.B = point : new ( 6 , 0 ) @@ -480,7 +490,7 @@ The Mittenpunkt is the symmedian point of the excentral triangle. The mittenpunk z.Mi = T : mittenpunkt_point () T.int = T : extouch () z.Ta,z.Tb,z.Tc = get_points(T.int) -\end{tkzelements} +} \begin{center} \begin{tikzpicture}[scale=.5] \tkzGetNodes @@ -530,7 +540,8 @@ This involves obtaining the projections of a point onto the sides of a triangle. \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (5 , 0) z.C = point: new (-.4 , 4) @@ -539,11 +550,12 @@ z.J,_ = get_points(T.ABC: ex_circle (2)) z.X , z.Y, z.Z = T.ABC : projection (z.J) -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (5 , 0) z.C = point: new (-.4 , 4) @@ -552,7 +564,7 @@ z.J,_ = get_points(T.ABC: ex_circle (2)) z.X , z.Y, z.Z = T.ABC : projection (z.J) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} \tkzGetNodes @@ -597,7 +609,8 @@ Given a reference triangle $ABC$, the trilinear coordinates of a point $P$ with \vspace{6pt} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 0 ) z.C = point : new ( 4 , 3 ) @@ -607,7 +620,7 @@ b = T.ABC.b c = T.ABC.c z.Gp = T.ABC : trilinear (b*c,a*c,a*b) z.G = T.ABC : barycentric (1,1,1) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C) @@ -618,7 +631,8 @@ z.G = T.ABC : barycentric (1,1,1) \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 0 ) z.C = point : new ( 4 , 3 ) @@ -628,7 +642,7 @@ b = T.ABC.b c = T.ABC.c z.Gp = T.ABC : trilinear (b*c,a*c,a*b) z.G = T.ABC : barycentric (1,1,1) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} \tkzGetNodes @@ -651,14 +665,15 @@ This method produces a triplet of coordinates which are the barycentric coordina \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (1,1) z.B = point: new (8,0) z.C = point: new (2,5) T = triangle: new(z.A,z.B,z.C) z.G = T.centroid ca,cb,cc = T : barycentric_coordinates (z.G) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygons(A,B,C) @@ -669,7 +684,8 @@ This method produces a triplet of coordinates which are the barycentric coordina \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () scale = .75 z.A = point: new (1,1) z.B = point: new (8,0) @@ -677,7 +693,7 @@ This method produces a triplet of coordinates which are the barycentric coordina T = triangle: new(z.A,z.B,z.C) z.G = T.centroid ca,cb,cc = T : barycentric_coordinates (z.G) - \end{tkzelements} + } \begin{center} \begin{tikzpicture} \tkzGetNodes @@ -699,7 +715,8 @@ In the next example, the point $D$ is defined by $\overrightarrow{AD} = 1\cdot \ \vspace{6pt} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .75 z.A = point: new (1,1) z.B = point: new (8,0) @@ -708,7 +725,7 @@ In the next example, the point $D$ is defined by $\overrightarrow{AD} = 1\cdot \ T = triangle: new(z.A,z.B,z.C) z.D = T : base (1,1) z.E = T : base (.5,1) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygons(A,B,D,C A,B,E,C) @@ -719,7 +736,8 @@ In the next example, the point $D$ is defined by $\overrightarrow{AD} = 1\cdot \ \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () scale = .75 z.A = point: new (1,1) z.B = point: new (8,0) @@ -728,7 +746,7 @@ In the next example, the point $D$ is defined by $\overrightarrow{AD} = 1\cdot \ T = triangle: new(z.A,z.B,z.C) z.D = T : base (1,1) z.E = T : base (.5,1) - \end{tkzelements} + } \begin{center} \begin{tikzpicture} \tkzGetNodes @@ -751,7 +769,8 @@ The points $a$, $b$ and $c$ are the Euler points. They are the midpoints of the \begin{minipage}{.5\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () scale = 1.25 z.A = point: new (0,0) z.B = point: new (5,0) @@ -766,7 +785,7 @@ The points $a$, $b$ and $c$ are the Euler points. They are the midpoints of the z.Ha, z.Hb, z.Hc = get_points (T.orthic) - \end{tkzelements} + } \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygons[red](A,B,C) @@ -780,7 +799,8 @@ The points $a$, $b$ and $c$ are the Euler points. They are the midpoints of the \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () scale = 1.25 z.A = point: new (0,0) z.B = point: new (5,0) @@ -795,7 +815,7 @@ The points $a$, $b$ and $c$ are the Euler points. They are the midpoints of the z.Ha, z.Hb, z.Hc = get_points (T.orthic) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -821,7 +841,8 @@ In the next example, we look for the centre of gravity in two different ways: th \vspace{6pt} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = 1.5 z.A = point: new (0,0) z.B = point: new (5,0) @@ -837,11 +858,12 @@ In the next example, we look for the centre of gravity in two different ways: th z.e7, z.e8, z.e9 = T : nine_points () -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = 1.5 z.A = point: new (0,0) z.B = point: new (5,0) @@ -857,7 +879,7 @@ In the next example, we look for the centre of gravity in two different ways: th z.e7, z.e8, z.e9 = T : nine_points () -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygons[red](A,B,C) @@ -889,7 +911,8 @@ There are several methods to obtain one or more altitudes of a triangle. One pos \vspace{6pt} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0,0) z.B = point: new (5,0) z.C = point: new (2,4) @@ -900,7 +923,7 @@ There are several methods to obtain one or more altitudes of a triangle. One pos z.Hc = L.HC.pb z.Ha = L.HA.pb z.a,z.b,z.c = get_points (T : orthic ()) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C) @@ -915,7 +938,8 @@ There are several methods to obtain one or more altitudes of a triangle. One pos \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0,0) z.B = point: new (5,0) z.C = point: new (2,4) @@ -926,7 +950,7 @@ There are several methods to obtain one or more altitudes of a triangle. One pos z.Hc = L.HC.pb z.Ha = L.HA.pb z.a,z.b,z.c = get_points (T : orthic ()) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} \tkzGetNodes @@ -953,7 +977,8 @@ There are several methods to obtain one or more bisectors of a triangle. One pos \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new (0 , 0) z.B = point : new (3 , 2) z.C = point : new (2 , 5) @@ -962,7 +987,7 @@ There are several methods to obtain one or more bisectors of a triangle. One pos z.E = L.AE.pb z.F = T.ABC : bisector (1).pb z.a,z.b,z.c = get_points (T.ABC : incentral ()) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C) @@ -977,7 +1002,8 @@ There are several methods to obtain one or more bisectors of a triangle. One pos \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new (0 , 0) z.B = point : new (3 , 2) z.C = point : new (2 , 5) @@ -986,7 +1012,7 @@ There are several methods to obtain one or more bisectors of a triangle. One pos z.E = L.AE.pb z.F = T.ABC : bisector (1).pb z.a,z.b,z.c = get_points (T.ABC : incentral ()) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} \tkzGetNodes @@ -1019,14 +1045,15 @@ There are several ways of obtaining the Euler circle. The first would be to use \vspace{6pt} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0,0) z.B = point: new (5,0) z.C = point: new (1,4) T = triangle: new(z.A,z.B,z.C) C.euler = T : euler_circle () z.N,z.K = get_points (C.euler) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygons[red](A,B,C) @@ -1038,14 +1065,15 @@ There are several ways of obtaining the Euler circle. The first would be to use \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0,0) z.B = point: new (5,0) z.C = point: new (1,4) T = triangle: new(z.A,z.B,z.C) C.euler = T : euler_circle () z.N,z.K = get_points (C.euler) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} \tkzGetNodes @@ -1068,14 +1096,15 @@ To obtain the circumscribed circle, simply use the \code{T.circumcenter} attribu \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0,0) z.B = point: new (5,0) z.C = point: new (1,4) T = triangle: new(z.A,z.B,z.C) C.circum = T : circum_circle () z.O,z.K = get_points (C.circum) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygons[red](A,B,C) @@ -1087,14 +1116,15 @@ To obtain the circumscribed circle, simply use the \code{T.circumcenter} attribu \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0,0) z.B = point: new (5,0) z.C = point: new (1,4) T = triangle: new(z.A,z.B,z.C) C.circum = T : circum_circle () z.O,z.K = get_points (C.circum) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -1122,7 +1152,8 @@ The incenter is the point of concurrence of the triangle's angle bisectors. In a \vspace{6pt} -\begin{tkzelements} +\directlua{% +init_elements () scale = 2 z.A = point : new (0 , 0) z.B = point : new (5 , 0) @@ -1133,7 +1164,7 @@ The incenter is the point of concurrence of the triangle's angle bisectors. In a z.G = T.ABC : bisector (2).pb C.IH = T.ABC : in_circle () z.I,z.H = get_points (C.IH) -\end{tkzelements} +} \begin{tikzpicture}% [ new/.style ={ color = orange }, one/.style = { new,/tkzmkangle/size=.5 }, @@ -1166,7 +1197,8 @@ The incenter is the point of concurrence of the triangle's angle bisectors. In a \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new (0 , 0) z.B = point : new (5 , 0) z.C = point : new (1 , 3) @@ -1176,7 +1208,7 @@ The incenter is the point of concurrence of the triangle's angle bisectors. In a z.G = T.ABC : bisector (2).pb C.IH = T.ABC : in_circle () z.I,z.H = get_points (C.IH) -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} @@ -1222,7 +1254,8 @@ Given a triangle, extend two sides in the direction opposite their common vertex \vspace{6pt} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (5 , 0) z.C = point: new (-.4 , 4) @@ -1239,11 +1272,12 @@ z.Zi = T.ABC : projection (z.I) z.Xj , z.Yj, z.Zj = T.ABC : projection (z.J) -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.A = point: new (0 , 0) z.B = point: new (5 , 0) @@ -1261,7 +1295,7 @@ z.Zi = T.ABC : projection (z.I) z.Xj , z.Yj, z.Zj = T.ABC : projection (z.J) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} \tkzGetNodes @@ -1305,7 +1339,8 @@ z.Zj = T.ABC : projection (z.J) In geometry, the incircle of the medial triangle of a triangle is the Spieker circle. Its center is the Spieker center. \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = 1.5 z.A = point: new (1,1) z.B = point: new (5,1) @@ -1318,7 +1353,7 @@ In geometry, the incircle of the medial triangle of a triangle is the Spieker ci z.Qa = midpoint(z.A,z.N) z.Qb = midpoint(z.B,z.N) z.Qc = midpoint(z.C,z.N) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} \tkzGetNodes @@ -1335,7 +1370,8 @@ In geometry, the incircle of the medial triangle of a triangle is the Spieker ci \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (1,1) z.B = point: new (5,1) z.C = point: new (2.2,4) @@ -1347,7 +1383,7 @@ In geometry, the incircle of the medial triangle of a triangle is the Spieker ci z.Qa = midpoint(z.A,z.N) z.Qb = midpoint(z.B,z.N) z.Qc = midpoint(z.C,z.N) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygons(A,B,C Qa,Qb,Qc) @@ -1374,7 +1410,8 @@ Picking a Cevian point $P$ in the interior of a triangle $ABC$ and drawing Cevia \vspace{6pt} -\begin{tkzelements} +\directlua{% +init_elements () scale = 1.25 z.A = point: new (0,0) z.B = point: new (4,0) @@ -1388,7 +1425,7 @@ Picking a Cevian point $P$ in the interior of a triangle $ABC$ and drawing Cevia z.Pa,z.Pb,z.Pc = get_points (T.cevian) C.cev = T.ABC : cevian_circle (z.P) z.w = C.cev.center -\end{tkzelements} +} \begin{center} \begin{tikzpicture} \tkzGetNodes @@ -1408,7 +1445,8 @@ Picking a Cevian point $P$ in the interior of a triangle $ABC$ and drawing Cevia \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0,0) z.B = point: new (4,0) z.C = point: new (1.8,3) @@ -1421,7 +1459,7 @@ Picking a Cevian point $P$ in the interior of a triangle $ABC$ and drawing Cevia z.Pa,z.Pb,z.Pc = get_points (T.cevian) C.cev = T.ABC : cevian_circle (z.P) z.w = C.cev.center -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygons[cyan](A,B,C) @@ -1449,7 +1487,8 @@ Given a point $P$, the pedal triangle of $P$ is the triangle whose polygon verti \vspace{6pt} \begin{minipage}{.5\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () z.A = point: new(0,0) z.B = point: new(5,0) z.C = point: new(1.5,3) @@ -1460,7 +1499,7 @@ Given a point $P$, the pedal triangle of $P$ is the triangle whose polygon verti C.pedal = T.ABC : pedal_circle (z.O) z.w = C.pedal.center z.T = C.pedal.through - \end{tkzelements} + } \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C) @@ -1474,7 +1513,8 @@ Given a point $P$, the pedal triangle of $P$ is the triangle whose polygon verti \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () z.A = point: new(0,0) z.B = point: new(5,0) z.C = point: new(1.5,3) @@ -1485,7 +1525,7 @@ Given a point $P$, the pedal triangle of $P$ is the triangle whose polygon verti C.pedal = T.ABC : pedal_circle (z.O) z.w = C.pedal.center z.T = C.pedal.through - \end{tkzelements} + } \begin{center} \begin{tikzpicture} \tkzGetNodes @@ -1510,7 +1550,8 @@ In plane geometry, Conway's circle theorem states that when the sides meeting at \vspace{6pt} \begin{minipage}{.5\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () z.A = point:new (0,0) z.C = point:new (5,0) z.B = point:new (1,3) @@ -1519,7 +1560,7 @@ In plane geometry, Conway's circle theorem states that when the sides meeting at z.w,z.t = get_points(C.conway) z.t1,z.t2,z.t3,z.t4, z.t5,z.t6= T.ABC : conway_points () - \end{tkzelements} + } \hspace*{5cm} \begin{tikzpicture} \tkzGetNodes @@ -1536,7 +1577,8 @@ In plane geometry, Conway's circle theorem states that when the sides meeting at \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () scale = .5 z.A = point:new (0,0) z.C = point:new (5,0) @@ -1546,7 +1588,7 @@ In plane geometry, Conway's circle theorem states that when the sides meeting at z.w,z.t = get_points(C.conway) z.t1,z.t2,z.t3, z.t4,z.t5,z.t6= T.ABC : conway_points () - \end{tkzelements} + } \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C) @@ -1568,7 +1610,8 @@ In plane geometry, Conway's circle theorem states that when the sides meeting at \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.A = point: new (1,1) z.B = point: new (6,0) @@ -1576,8 +1619,8 @@ In plane geometry, Conway's circle theorem states that when the sides meeting at T = triangle: new(z.A,z.B,z.C) C.bevan = T : bevan_circle () z.c,z.t = get_points (C.bevan) - -- or z.c = T : bevan_point () -\end{tkzelements} + % or z.c = T : bevan_point () +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygons(A,B,C) @@ -1589,7 +1632,8 @@ In plane geometry, Conway's circle theorem states that when the sides meeting at \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () scale =.5 z.A = point: new (1,1) z.B = point: new (6,0) @@ -1597,8 +1641,7 @@ In plane geometry, Conway's circle theorem states that when the sides meeting at T = triangle: new(z.A,z.B,z.C) C.bevan = T : bevan_circle () z.c,z.t = get_points (C.bevan) - -- or z.c = T : bevan_point () - \end{tkzelements} + } \begin{center} \begin{tikzpicture} \tkzGetNodes @@ -1631,7 +1674,8 @@ The exinscribed circles of a triangle are tangent to the circle of the nine poin \vspace{6pt} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .8 z.A = point: new (0,0) z.B = point: new (6,0) @@ -1643,7 +1687,7 @@ The exinscribed circles of a triangle are tangent to the circle of the nine poin z.Ja,z.Jb,z.Jc = get_points ( T.ABC : excentral () ) z.I = T.ABC.incenter z.Ia,z.Ib,z.Ic = get_points (T.ABC : intouch ()) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPoints(Ja,Jb,Jc) @@ -1660,7 +1704,8 @@ The exinscribed circles of a triangle are tangent to the circle of the nine poin \end{minipage} -\begin{tkzelements} +\directlua{% +init_elements () scale = .7 z.A = point: new (0,0) z.B = point: new (6,0) @@ -1672,7 +1717,7 @@ The exinscribed circles of a triangle are tangent to the circle of the nine poin z.Ja,z.Jb,z.Jc = get_points ( T.ABC : excentral () ) z.I = T.ABC.incenter z.Ia,z.Ib,z.Ic = get_points (T.ABC : intouch ()) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} \tkzGetNodes @@ -1698,7 +1743,8 @@ The \code{similar} method creates a new triangle whose sides are parallel to the \begin{minipage}{.5\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () scale =.5 z.A = point: new (0 , 0) z.B = point: new (6 , 0) @@ -1707,7 +1753,7 @@ The \code{similar} method creates a new triangle whose sides are parallel to the z.X,z.Y,z.Z = get_points ( T.ABC : similar ()) z.H_a,z.H_b, z.H_c = get_points (T.ABC : orthic ()) - \end{tkzelements} + } \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygons(A,B,C X,Y,Z) @@ -1719,7 +1765,8 @@ The \code{similar} method creates a new triangle whose sides are parallel to the \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () scale =.5 z.A = point: new (0 , 0) z.B = point: new (6 , 0) @@ -1728,7 +1775,7 @@ The \code{similar} method creates a new triangle whose sides are parallel to the z.X,z.Y,z.Z = get_points ( T.ABC : similar ()) z.H_a,z.H_b, z.H_c = get_points (T.ABC : orthic ()) - \end{tkzelements} + } \hspace*{\fill} \begin{tikzpicture} \tkzGetNodes @@ -1752,7 +1799,8 @@ The triangle $MaMbMc$ formed by joining the midpoints of the sides of a triangle \vspace{6pt} \begin{minipage}{.5\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () scale = 1.25 z.A = point: new (0,1) z.B = point: new (6,0) @@ -1762,7 +1810,7 @@ The triangle $MaMbMc$ formed by joining the midpoints of the sides of a triangle z.Ma,z.Mb,z.Mc= get_points (T.med) z.G = T.centroid z.O = T.circumcenter - \end{tkzelements} + } \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygons(A,B,C) @@ -1780,7 +1828,8 @@ The triangle $MaMbMc$ formed by joining the midpoints of the sides of a triangle \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () scale = 1.25 z.A = point: new (0,1) z.B = point: new (6,0) @@ -1790,7 +1839,7 @@ The triangle $MaMbMc$ formed by joining the midpoints of the sides of a triangle z.Ma,z.Mb,z.Mc= get_points (T.med) z.G = T.centroid z.O = T.circumcenter - \end{tkzelements} + } \begin{center} \begin{tikzpicture} \tkzGetNodes @@ -1822,7 +1871,8 @@ The incentral triangle $IaIbIc$ is the Cevian triangle of a triangle $ABC$ with \vspace{6pt} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (6 , 0) z.C = point: new (1 , 4) @@ -1832,7 +1882,7 @@ The incentral triangle $IaIbIc$ is the Cevian triangle of a triangle $ABC$ with z.Ic = get_points (T.ABC : incentral ()) z.Ta,z.Tb, z.Tc = get_points (T.ABC : intouch ()) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C) @@ -1847,7 +1897,8 @@ The incentral triangle $IaIbIc$ is the Cevian triangle of a triangle $ABC$ with \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (6 , 0) z.C = point: new (1 , 4) @@ -1857,7 +1908,7 @@ The incentral triangle $IaIbIc$ is the Cevian triangle of a triangle $ABC$ with z.Ic = get_points (T.ABC : incentral ()) z.Ta,z.Tb, z.Tc = get_points (T.ABC : intouch ()) - \end{tkzelements} + } \begin{center} \begin{tikzpicture} \tkzGetNodes @@ -1888,7 +1939,8 @@ The sides of an orthic triangle are parallel to the tangents to the circumcircle \vspace{6pt} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .75 z.A = point: new (0,0) z.B = point: new (5,0) @@ -1904,7 +1956,7 @@ The sides of an orthic triangle are parallel to the tangents to the circumcircle z.Ta, z.Tb, z.Tc = get_points (T : tangential ()) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygons[red](A,B,C Ta,Tb,Tc) @@ -1922,7 +1974,8 @@ The sides of an orthic triangle are parallel to the tangents to the circumcircle \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = .75 z.A = point: new (0,0) z.B = point: new (5,0) @@ -1938,7 +1991,7 @@ The sides of an orthic triangle are parallel to the tangents to the circumcircle z.Ta, z.Tb, z.Tc = get_points (T : tangential ()) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -1981,7 +2034,8 @@ In the next example, $L$ is the \code{Lemoine point} or the \code{Symmedian poin \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = 2 z.A = point : new (0,0) z.B = point : new (7,0) @@ -1996,9 +2050,9 @@ In the next example, $L$ is the \code{Lemoine point} or the \code{Symmedian poin _,z.Kb = get_points(L.Kb) z.G = T.ABC.centroid z.Ia,z.Ib,z.Ic = get_points ( T.ABC : incentral ()) - -- z.T = T.ABC : trilinear (0,1,1) + % z.T = T.ABC : trilinear (0,1,1) z.I = T.ABC.incenter -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygons(A,B,C) @@ -2014,7 +2068,8 @@ In the next example, $L$ is the \code{Lemoine point} or the \code{Symmedian poin \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = 2 z.A = point : new (0,0) z.B = point : new (7,0) @@ -2029,9 +2084,8 @@ In the next example, $L$ is the \code{Lemoine point} or the \code{Symmedian poin _,z.Kb = get_points(L.Kb) z.G = T.ABC.centroid z.Ia,z.Ib,z.Ic = get_points ( T.ABC : incentral ()) - -- z.T = T.ABC : trilinear (0,1,1) z.I = T.ABC.incenter -\end{tkzelements} +} \begin{center} \begin{tikzpicture} \tkzGetNodes @@ -2059,7 +2113,8 @@ The anticomplementary triangle is the triangle $TaTbTc$ which has a given triang \vspace{6pt} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .6 z.A = point: new (0,0) z.B = point: new (5,0) @@ -2069,7 +2124,7 @@ The anticomplementary triangle is the triangle $TaTbTc$ which has a given triang z.Ta, z.Tb, z.Tc = get_points (T.similar) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygons[red](A,B,C) @@ -2081,7 +2136,8 @@ The anticomplementary triangle is the triangle $TaTbTc$ which has a given triang \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = .6 z.A = point: new (0,0) z.B = point: new (5,0) @@ -2091,7 +2147,7 @@ The anticomplementary triangle is the triangle $TaTbTc$ which has a given triang z.Ta, z.Tb, z.Tc = get_points (T.similar) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} \tkzGetNodes @@ -2116,7 +2172,8 @@ The line on which the orthocenter $H$, triangle centroid $G$, circumcenter $O$, \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (6 , 0) z.C = point: new (1.5 , 3.5) @@ -2127,7 +2184,7 @@ The line on which the orthocenter $H$, triangle centroid $G$, circumcenter $O$, z.H = T.ABC.orthocenter z.P,z.Q,z.R = get_points (T.ABC: orthic()) z.K,z.I,z.J = get_points (T.ABC: medial ()) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawLines[blue](O,H) @@ -2143,7 +2200,8 @@ The line on which the orthocenter $H$, triangle centroid $G$, circumcenter $O$, \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (6 , 0) z.C = point: new (1.5 , 3.5) @@ -2154,7 +2212,7 @@ The line on which the orthocenter $H$, triangle centroid $G$, circumcenter $O$, z.H = T.ABC. orthocenter z.P,z.Q,z.R = get_points (T.ABC: orthic()) z.K,z.I,z.J = get_points (T.ABC: medial ()) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} \tkzGetNodes @@ -2174,13 +2232,14 @@ The line on which the orthocenter $H$, triangle centroid $G$, circumcenter $O$, \end{minipage} % subsubsection euler_line (end) -\subsection{Euler ellipse} % (fold) -\label{sub:euler_ellipse} +\subsubsection{Euler ellipse} % (fold) +\label{ssub:euler_ellipse} The Euler ellipse is a conic, tangent to the three sides of a triangle, with the orthocentre and the centre of the circumscribed circle as foci. Example of obtaining the Euler circle as well as the Euler ellipse. \vspace{6pt} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (2,3.8) z.B = point: new (0 ,0) z.C = point: new (6.2 ,0) @@ -2194,11 +2253,12 @@ ang = math.deg(E.euler.slope) z.O = T.ABC.circumcenter z.G = T.ABC.centroid z.H = T.ABC.orthocenter -\end{tkzelements} +} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (2,3.8) z.B = point: new (0 ,0) z.C = point: new (6.2 ,0) @@ -2212,7 +2272,7 @@ ang = math.deg(E.euler.slope) z.O = T.ABC.circumcenter z.G = T.ABC.centroid z.H = T.ABC.orthocenter -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} @@ -2242,7 +2302,7 @@ z.H = T.ABC.orthocenter \tkzLabelPoints[above](A) \end{tikzpicture} \end{Verbatim} -% subsection euler_ellipse (end) +% subsubsection euler_ellipse (end) \subsubsection{Steiner inellipse and circumellipse} % (fold) \label{ssub:steiner_inellipse_and_circumellipse} @@ -2251,7 +2311,8 @@ In this example, the inner and outer Steiner ellipses, referred to as the "inell \vspace{6pt} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.A = point: new (1 , 4) z.B = point: new (11 , 1) @@ -2270,10 +2331,11 @@ In this example, the inner and outer Steiner ellipses, referred to as the "inell L.T1,L.T2= E : tangent_from (z.M) z.T1 = L.T1.pb z.T2 = L.T2.pb -\end{tkzelements} +} \end{Verbatim} \end{minipage} -\begin{minipage}{.5\textwidth}\begin{tkzelements} +\begin{minipage}{.5\textwidth}\directlua{% +init_elements () scale = .5 z.A = point: new (1 , 4) z.B = point: new (11 , 1) @@ -2292,7 +2354,7 @@ z.M = C : point (0) L.T1,L.T2= E : tangent_from (z.M) z.T1 = L.T1.pb z.T2 = L.T2.pb -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -2329,8 +2391,8 @@ z.T2 = L.T2.pb % subsubsection steiner_inellipse_and_circumellipse (end) -\subsection{Harmonic division and bisector} % (fold) -\label{sub:harmonic_division_and_bisector} +\subsubsection{Harmonic division and bisector} % (fold) +\label{ssub:harmonic_division_and_bisector} Let four points $A$, $C$, $B$ and $D$, in this order, lying on the straight line $(d)$ and $M$ un point pris hors de $(d)$. Then, if two of the following three propositions are true, then the third is also true: \begin{enumerate} @@ -2342,7 +2404,8 @@ Let four points $A$, $C$, $B$ and $D$, in this order, lying on the straight line \vspace{6pt} \begin{minipage}{.4\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .4 z.A = point: new (0 , 0) z.B = point: new (6 , 0) @@ -2361,11 +2424,12 @@ Let four points $A$, $C$, $B$ and $D$, in this order, lying on the straight line L.MD = line: new (z.M,z.D) z.E = intersection (L.LL,L.MC) z.F = intersection (L.LL,L.MD) -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.6\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale =.4 z.A = point: new (0 , 0) z.B = point: new (6 , 0) @@ -2384,7 +2448,7 @@ Let four points $A$, $C$, $B$ and $D$, in this order, lying on the straight line L.MD = line: new (z.M,z.D) z.E = intersection (L.LL,L.MC) z.F = intersection (L.LL,L.MD) -\end{tkzelements} +} \hspace{\fill} \begin{tikzpicture} \tkzGetNodes @@ -2418,7 +2482,7 @@ Let four points $A$, $C$, $B$ and $D$, in this order, lying on the straight line \tkzMarkSegments(B,E B,M B,F) \end{tikzpicture} \end{Verbatim} -% subsection harmonic_division_and_bisector (end) +% subsubsection harmonic_division_and_bisector (end) % diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-vectors.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-vectors.tex index ed1ea77183..f5e1e3a430 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-vectors.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-vectors.tex @@ -25,8 +25,8 @@ z.C = ... z.D = ... V.AB = vector : new (z.A,z.B) V.CD = vector : new (z.C,z.D) -V.AE = V.AB + V.CD -- possible V.AB : add (V.CD) -z.E = V.AE.head -- we recover the final point (head) +V.AE = V.AB + V.CD % possible V.AB : add (V.CD) +z.E = V.AE.head % we recover the final point (head) \end{Verbatim} \subsection{Attributes of a vector} % (fold) @@ -56,7 +56,8 @@ z.E = V.AE.head -- we recover the final point (head) \begin{minipage}{.6\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.O = point: new (0,0) z.A = point: new (0,1) z.B = point: new (3,4) @@ -67,7 +68,7 @@ z.E = V.AE.head -- we recover the final point (head) v = vector : new (z.C,z.D) w =u+v z.E = w.head -\end{tkzelements} +} \begin{tikzpicture}[gridded] \tkzGetNodes \tkzLabelPoints(A,B,C,D,O,E) @@ -81,7 +82,8 @@ $\tkzDN{\tkzUseLua{math.deg(w.slope)}}^\circ$ \end{Verbatim} \end{minipage} \begin{minipage}{.4\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.O = point: new (0,0) z.A = point: new (0,1) z.B = point: new (3,4) @@ -92,7 +94,7 @@ $\tkzDN{\tkzUseLua{math.deg(w.slope)}}^\circ$ v = vector : new (z.C,z.D) w = u+v z.E = w.head -\end{tkzelements} +} \begin{tikzpicture}[gridded] \tkzGetNodes \tkzLabelPoints(A,B,C,D,O,E) @@ -139,7 +141,9 @@ $\tkzDN{\tkzUseLua{math.deg(w.slope)}}^\circ$ \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () +scale = .75 z.O = point: new (0,0) z.A = point: new (0,1) z.B = point: new (3,4) @@ -156,7 +160,7 @@ $\tkzDN{\tkzUseLua{math.deg(w.slope)}}^\circ$ z.X = V.AX.head V.OY = V.AX : at (z.O) z.Y = V.OY.head -\end{tkzelements} +} \begin{tikzpicture}[gridded] \tkzGetNodes \tkzDrawSegments[>=stealth,->,red](A,B A,C A,D A,N A,R A,X O,Y) @@ -165,7 +169,9 @@ $\tkzDN{\tkzUseLua{math.deg(w.slope)}}^\circ$ \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () +scale = .75 z.O = point: new (0,0) z.A = point: new (0,1) z.B = point: new (3,4) @@ -182,7 +188,7 @@ $\tkzDN{\tkzUseLua{math.deg(w.slope)}}^\circ$ z.X = V.AX.head V.OY = V.AX : at (z.O) z.Y = V.OY.head -\end{tkzelements} +} \begin{tikzpicture}[gridded] \tkzGetNodes \tkzDrawSegments[>=stealth,->,red](A,B A,C A,D A,N A,R A,X O,Y) diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes.tex index 1228c60e08..3b7e1db188 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes.tex @@ -41,20 +41,22 @@ A method is an operation (function or procedure) associated (linked) with an obj Example: The point object is used to vertically determine a new point object located at a certain distance from it (here 2). Then it is possible to rotate objects around it. \begin{Verbatim} - \begin{tkzelements} +\directlua{ + init_elements () z.A = point (1,0) z.B = z.A : north (2) z.C = z.A : rotation (math.pi/3,z.B) tex.print(tostring(z.C)) - \end{tkzelements} +} \end{Verbatim} -\begin{tkzelements} +\directlua{ + init_elements () z.A = point (1,0) z.B = z.A : north (2) z.C = z.A : rotation (math.pi/3,z.B) tex.print(tostring("The coordinates of $C$ are: " .. z.C.re .." and "..z.C.im)) -\end{tkzelements} +} % subsubsection methods (end) diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-convention.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-convention.tex index 70b61fb902..49afe50798 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-convention.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-convention.tex @@ -14,7 +14,7 @@ |if bool == ... then ... else ... end| \end{mybox} - and outside the environment \tkzNameEnv{tkzelements} you can use the macro + and you can use the macro \begin{mybox} |\ifthenelse{\equal{\tkzUseLua{bool}}{true}}{ ... }{ ... }| \end{mybox} @@ -34,7 +34,7 @@ At present, the only obligation is to store the points in the table |z| \footnote{To place the point M in the table, simply write |z.M| = \ldots or |z["M"]|= \ldots} if you intend to use them in \TIKZ\ or \pkg{tkz-euclide}. f a point will not be used, you can designate it as you wish while adhering to Lua conventions. - Points within the \tkzNameEnv{tkzelements} environment must follow a convention in the form |z.name|, where |name| represents the name of the corresponding \tkzname{node}. + Points in the lua code must follow a convention in the form |z.name|, where |name| represents the name of the corresponding \tkzname{node}. As for the conventions for designating |name| you must adhere to Lua conventions in particular cases. \begin{enumerate} diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-examples.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-examples.tex index 284ecca8eb..bb5d40e372 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-examples.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-examples.tex @@ -10,7 +10,8 @@ Use of |north and east| functions linked to points, to transfer lengths, Refer t \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .75 z.A = point : new ( 0 , 0 ) z.B = point : new ( 3 , 0 ) @@ -21,7 +22,7 @@ Use of |north and east| functions linked to points, to transfer lengths, Refer t z.E = z.B: east (L.AB.length) z.M = L.AB.mid z.F = z.E : north (length(z.C,z.M)) -\end{tkzelements} +} \begin{tikzpicture}[gridded] \tkzGetNodes \tkzDrawPolygons(A,B,C) @@ -33,7 +34,8 @@ Use of |north and east| functions linked to points, to transfer lengths, Refer t \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = .75 z.A = point : new ( 0 , 0 ) z.B = point : new ( 3 , 0 ) @@ -44,7 +46,7 @@ Use of |north and east| functions linked to points, to transfer lengths, Refer t z.E = z.B: east (L.AB.length) z.M = L.AB.mid z.F = z.E : north (length(z.C,z.M)) -\end{tkzelements} +} \begin{center} \begin{tikzpicture}[gridded] @@ -66,7 +68,8 @@ Use of |north and east| functions linked to points, to transfer lengths, Refer t \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new (0,0) z.a = point : new (4,0) z.B = point : new (7,-1) @@ -82,7 +85,7 @@ Use of |north and east| functions linked to points, to transfer lengths, Refer t z.Ip = C.Aa : internal_similitude (C.Bb) z.Jp = C.Aa : internal_similitude (C.Cc) z.Kp = C.Cc : internal_similitude (C.Bb) -\end{tkzelements} +} \begin{tikzpicture}[rotate=-60] \tkzGetNodes \tkzDrawCircles(A,a B,b C,c) @@ -94,7 +97,8 @@ Use of |north and east| functions linked to points, to transfer lengths, Refer t \end{Verbatim} \end{minipage} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.A = point : new (0,0) z.a = point : new (4,0) @@ -111,7 +115,7 @@ z.K = C.Cc : external_similitude (C.Bb) z.Ip = C.Aa : internal_similitude (C.Bb) z.Jp = C.Aa : internal_similitude (C.Cc) z.Kp = C.Cc : internal_similitude (C.Bb) -\end{tkzelements} +} \begin{center} \begin{tikzpicture}[rotate=30] @@ -132,7 +136,8 @@ z.Kp = C.Cc : internal_similitude (C.Bb) \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .75 z.A = point : new (0,0) z.a = point : new (5,0) @@ -146,7 +151,7 @@ z.Kp = C.Cc : internal_similitude (C.Bb) z.i,z.j = get_points (C.Aa : radical_axis (C.Bb)) z.k,z.l = get_points (C.Aa : radical_axis (C.Cc)) z.m,z.n = get_points (C.Bb : radical_axis (C.Cc)) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(A,a B,b C,c) @@ -155,7 +160,8 @@ z.Kp = C.Cc : internal_similitude (C.Bb) \end{Verbatim} \end{minipage} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.A = point : new (0,0) z.a = point : new (5,0) @@ -169,7 +175,7 @@ z.Kp = C.Cc : internal_similitude (C.Bb) z.i,z.j = get_points (C.Aa : radical_axis (C.Bb)) z.k,z.l = get_points (C.Aa : radical_axis (C.Cc)) z.m,z.n = get_points (C.Bb : radical_axis (C.Cc)) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -187,7 +193,8 @@ z.Kp = C.Cc : internal_similitude (C.Bb) \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.P = point : new (0,0) z.Q = point : new (5,0) z.I = point : new (3,2) @@ -202,7 +209,7 @@ z.Kp = C.Cc : internal_similitude (C.Bb) L.AF = line : new (z.A,z.F) L.CQ = line : new (z.C,z.Q) z.D = intersection (L.AF,L.CQ) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(P,E Q,E) @@ -215,7 +222,8 @@ z.Kp = C.Cc : internal_similitude (C.Bb) \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () scale =.5 z.P = point : new (0,0) z.Q = point : new (5,0) @@ -231,7 +239,7 @@ z.Kp = C.Cc : internal_similitude (C.Bb) L.AF = line : new (z.A,z.F) L.CQ = line : new (z.C,z.Q) z.D = intersection (L.AF,L.CQ) - \end{tkzelements} + } \begin{center} \begin{tikzpicture} \tkzGetNodes @@ -251,7 +259,8 @@ z.Kp = C.Cc : internal_similitude (C.Bb) \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = 1.25 z.A = point: new (1,0) z.B = point: new (5,2) @@ -265,7 +274,7 @@ z.Kp = C.Cc : internal_similitude (C.Bb) z.P = intersection (L.tA,T.bc) z.Q = intersection (L.tB,T.ca) z.R = intersection (L.tC,T.ab) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon[teal](A,B,C) @@ -280,7 +289,8 @@ z.Kp = C.Cc : internal_similitude (C.Bb) \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = .75 z.A = point: new (1,0) z.B = point: new (5,2) @@ -294,7 +304,7 @@ L.tC = C.OA: tangent_at (z.C) z.R = intersection (L.tC,T.ab) z.P = intersection (L.tA,T.bc) z.Q = intersection (L.tB,T.ca) -\end{tkzelements} +} \begin{center} \begin{tikzpicture}[rotate=90] @@ -318,7 +328,8 @@ z.Q = intersection (L.tB,T.ca) \label{sub:alternate} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (6 , 0) z.C = point: new (1 , 5) @@ -328,7 +339,7 @@ z.Q = intersection (L.tB,T.ca) z.D = intersection (L.AI,T.bc) L.LLC = T.ab: ll_from (z.C) z.E = intersection (L.AI,L.LLC) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C) @@ -345,7 +356,8 @@ z.Q = intersection (L.tB,T.ca) \end{minipage} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (6 , 0) z.C = point: new (1 , 5) @@ -355,7 +367,7 @@ L.AI = line: new (z.A,z.I) z.D = intersection (L.AI,T.bc) L.LLC = T.ab: ll_from (z.C) z.E = intersection (L.AI,L.LLC) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} \tkzGetNodes @@ -379,7 +391,8 @@ z.E = intersection (L.AI,L.LLC) For two circles to be orthogonal, it is necessary and sufficient for a secant passing through one of their common points to be seen from the other common point at a right angle. \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 2 ) L.AB = line : new ( z.A , z.B ) @@ -396,7 +409,7 @@ For two circles to be orthogonal, it is necessary and sufficient for a secant L.mm = L.TTp : ll_from (z.C) _,z.M = intersection (L.mm, C.AC) z.Mp = intersection (L.mm, C.BC) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -410,7 +423,8 @@ For two circles to be orthogonal, it is necessary and sufficient for a secant \end{tikzpicture} \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 2 ) L.AB = line : new ( z.A , z.B ) @@ -427,7 +441,7 @@ z.Mp = intersection (L.MC, C.BC) L.mm = L.TTp : ll_from (z.C) _,z.M = intersection (L.mm, C.AC) z.Mp = intersection (L.mm, C.BC) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -447,7 +461,8 @@ z.Mp = intersection (L.mm, C.BC) \subsection{Apollonius circle} % (fold) \label{sub:apollonius_circle} -\begin{tkzelements} +\directlua{% +init_elements () scale=.75 z.A = point: new (0 , 0) z.B = point: new (6 , 0) @@ -461,11 +476,12 @@ scale=.75 z.O = L.CD.mid L.AM = T.MAB.ab z.E = z.M : symmetry (z.A) -\end{tkzelements} +} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale=.75 z.A = point: new (0 , 0) z.B = point: new (6 , 0) @@ -479,7 +495,7 @@ scale=.75 z.O = L.CD.mid L.AM = T.MAB.ab z.E = z.M : symmetry (z.A) -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} @@ -536,7 +552,8 @@ Remark : The circle can be obtained with: \label{sub:apollonius_and_circle_circumscribed} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale =.75 z.A = point: new (0 , 0) z.B = point: new (6 , 0) @@ -554,7 +571,7 @@ Remark : The circle can be obtained with: C.GA = circle: new (z.G,z.A) C.OC = circle: new (z.O,z.C) _,z.N = intersection (C.GA , C.OC) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,M) @@ -570,7 +587,8 @@ Remark : The circle can be obtained with: \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale =.75 z.A = point: new (0 , 0) z.B = point: new (6 , 0) @@ -588,7 +606,7 @@ Remark : The circle can be obtained with: C.GA = circle: new (z.G,z.A) C.OC = circle: new (z.O,z.C) _,z.N = intersection (C.GA , C.OC) -\end{tkzelements} +} \begin{center} @@ -614,7 +632,8 @@ Remark : The circle can be obtained with: \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (6 , 0) z.C = point: new (4.5 , 1) @@ -642,7 +661,7 @@ Remark : The circle can be obtained with: z.T = intersection (L.Bz,T.ABC.ca) L.Bpt = line: new (z.Bp,z.T) z.O3 = L.Bpt.mid -\end{tkzelements} +} \end{Verbatim} \begin{Verbatim} \begin{tikzpicture} @@ -658,7 +677,8 @@ Remark : The circle can be obtained with: \end{tikzpicture} \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (6 , 0) z.C = point: new (4.5 , 1) @@ -686,7 +706,7 @@ L.Bz = line: new (z.B,z.z) z.T = intersection (L.Bz,T.ABC.ca) L.Bpt = line: new (z.Bp,z.T) z.O3 = L.Bpt.mid -\end{tkzelements} +} \begin{center} @@ -708,7 +728,8 @@ z.O3 = L.Bpt.mid Same result using the function |T.ABC.ab : apollonius (k) | \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () scale = .75 z.A = point: new (0 , 0) z.B = point: new (6 , 0) @@ -721,7 +742,7 @@ Same result using the function |T.ABC.ab : apollonius (k) | z.w2,z.t2 = get_points ( C.AC ) C.BC = T.ABC.bc : apollonius (length(z.A,z.B)/length(z.A,z.C)) z.w3,z.t3 = get_points ( C.BC ) - \end{tkzelements} + } \end{Verbatim} % subsection apollonius_circles (end) @@ -731,7 +752,8 @@ Same result using the function |T.ABC.ab : apollonius (k) | \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.O_1 = point: new (0, 0) z.O_2 = point: new (0, 1) z.A = point: new (0, 3) @@ -744,7 +766,7 @@ Same result using the function |T.ABC.ab : apollonius (k) | L = line: new (z.x,z.O_2) C = circle: new (z.O_2,z.A) z.C,z.D = intersection (L ,C) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(O_1,A O_2,A) @@ -756,7 +778,8 @@ Same result using the function |T.ABC.ab : apollonius (k) | \end{Verbatim} \end{minipage} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{tkzelements} +\directlua{% +init_elements () z.O_1 = point: new (0, 0) z.O_2 = point: new (0, 1) z.A = point: new (0, 3) @@ -769,7 +792,7 @@ Same result using the function |T.ABC.ab : apollonius (k) | L = line: new (z.x,z.O_2) C = circle: new (z.O_2,z.A) z.C,z.D = intersection (L ,C) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -788,7 +811,8 @@ Same result using the function |T.ABC.ab : apollonius (k) | \subsection{Bankoff circle} % (fold) \label{sub:bankoff_circle} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (10 , 0) L.AB = line : new (z.A,z.B) @@ -826,7 +850,7 @@ Same result using the function |T.ABC.ab : apollonius (k) | z.O_4 = T.P0P1P2.circumcenter T.CP1P2 = triangle : new (z.C,z.P_1,z.P_2) z.O_5 = T.CP1P2.circumcenter -\end{tkzelements} +} \end{Verbatim} \begin{Verbatim} @@ -854,7 +878,8 @@ Same result using the function |T.ABC.ab : apollonius (k) | \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = 1.25 z.A = point: new (0 , 0) z.B = point: new (10 , 0) @@ -893,7 +918,7 @@ Same result using the function |T.ABC.ab : apollonius (k) | z.O_4 = T.P0P1P2.circumcenter T.CP1P2 = triangle : new (z.C,z.P_1,z.P_2) z.O_5 = T.CP1P2.circumcenter -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -929,7 +954,8 @@ $L$ is the symmedian point or lemoine point. $\dfrac{CL}{CLc} = \dfrac{a^2+b^2}{ \vspace{6pt} \begin{minipage}{.5\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () scale = 1.5 z.A = point : new (1,2) z.B = point : new (5,1) @@ -942,7 +968,7 @@ $L$ is the symmedian point or lemoine point. $\dfrac{CL}{CLc} = \dfrac{a^2+b^2}{ T.ABC.b*T.ABC.b+T.ABC.c*T.ABC.c) L.SY = line : new (z.C,z.Lc) z.L = L.SY : point (k) - \end{tkzelements} + } \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygons(A,B,C) @@ -959,7 +985,8 @@ $L$ is the symmedian point or lemoine point. $\dfrac{CL}{CLc} = \dfrac{a^2+b^2}{ \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () scale = 1.5 z.A = point : new (1,2) z.B = point : new (5,1) @@ -972,7 +999,7 @@ $L$ is the symmedian point or lemoine point. $\dfrac{CL}{CLc} = \dfrac{a^2+b^2}{ T.ABC.b*T.ABC.b+T.ABC.c*T.ABC.c) L.SY = line : new (z.C,z.Lc) z.L = L.SY : point (k) - \end{tkzelements} + } \begin{center} \begin{tikzpicture} \tkzGetNodes @@ -997,7 +1024,8 @@ $L$ is the symmedian point or lemoine point. $\dfrac{CL}{CLc} = \dfrac{a^2+b^2}{ \label{sub:example_cevian_with_orthocenter} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = 1.5 z.a = point: new (1,2) z.b = point: new (5,1) @@ -1008,7 +1036,7 @@ $L$ is the symmedian point or lemoine point. $\dfrac{CL}{CLc} = \dfrac{a^2+b^2}{ z.ta,z.tb,z.tc = get_points (T.cevian) C.cev = T : cevian_circle (z.i) z.w = C.cev.center -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygons(a,b,c ta,tb,tc) @@ -1020,7 +1048,8 @@ $L$ is the symmedian point or lemoine point. $\dfrac{CL}{CLc} = \dfrac{a^2+b^2}{ \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = 1.5 z.a = point: new (1,2) z.b = point: new (5,1) @@ -1031,7 +1060,7 @@ T.cevian = T : cevian (z.i) z.ta,z.tb,z.tc = get_points (T.cevian) C.cev = T : cevian_circle (z.i) z.w = C.cev.center -\end{tkzelements} +} \begin{center} \begin{tikzpicture} \tkzGetNodes @@ -1050,7 +1079,8 @@ z.w = C.cev.center \label{sub:excircles} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = 0.7 z.A = point: new (0,0) z.B = point: new (6,0) @@ -1062,7 +1092,7 @@ z.w = C.cev.center la = line: new ( z.A, z.T_a) lb = line: new ( z.B, z.T_b) z.G = intersection (la,lb) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPoints[new](J_a,J_b,J_c) @@ -1085,7 +1115,8 @@ z.w = C.cev.center \end{tikzpicture} \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale=0.7 z.A = point: new (0,0) z.B = point: new (6,0) @@ -1097,7 +1128,7 @@ z.w = C.cev.center la = line: new ( z.A, z.T_a) lb = line: new ( z.B, z.T_b) z.G = intersection (la,lb) -\end{tkzelements} +} \begin{center} @@ -1131,7 +1162,8 @@ z.w = C.cev.center \label{sub:divine_ratio} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (8 , 0) L.AB = line: new (z.A,z.B) @@ -1155,7 +1187,7 @@ C1 = circle: new (z.O_1,z.C) _,z.T = intersection (L.AR,C1) L.BG = line: new (z.B,z.G) z.L = intersection (L.AR,L.BG) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygons(A,C,E,F A,B,G,H) @@ -1166,7 +1198,8 @@ z.L = intersection (L.AR,L.BG) \end{tikzpicture} \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (8 , 0) L.AB = line: new (z.A,z.B) @@ -1190,7 +1223,7 @@ C1 = circle: new (z.O_1,z.C) _,z.T = intersection (L.AR,C1) L.BG = line: new (z.B,z.G) z.L = intersection (L.AR,L.BG) -\end{tkzelements} +} \begin{center} @@ -1212,7 +1245,8 @@ z.L = intersection (L.AR,L.BG) % modif C: point (0.25) instead of 2 \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.O = point: new (0 , 0) z.F1 = point: new (4 , 0) @@ -1228,7 +1262,7 @@ z.L = intersection (L.AR,L.BG) L.J,L.K = E: tangent_from (z.L) z.J = L.J.pb z.K = L.K.pb -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPoints(F1,F2,O) @@ -1244,7 +1278,8 @@ z.L = intersection (L.AR,L.BG) \end{Verbatim} \end{minipage} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.O = point: new (0 , 0) z.F1 = point: new (4 , 0) @@ -1260,7 +1295,7 @@ z.L = C: point (0.25) L.J,L.K = E: tangent_from (z.L) z.J = L.J.pb z.K = L.K.pb -\end{tkzelements} +} \begin{center} @@ -1286,7 +1321,8 @@ z.K = L.K.pb \label{sub:gold_division} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0,0) z.B = point: new (2.5,0) L.AB = line: new (z.A,z.B) @@ -1302,7 +1338,7 @@ z.G = intersection (L.mediator,C.BA) L.EG = line:new (z.E,z.G) z.C = intersection (L.EG,L.AB) z.O = C.AB: antipode (z.B) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawArc[delta=5](O,B)(G) @@ -1315,7 +1351,8 @@ z.O = C.AB: antipode (z.B) \end{tikzpicture} \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0,0) z.B = point: new (2.5,0) L.AB = line: new (z.A,z.B) @@ -1331,7 +1368,7 @@ z.G = intersection (L.mediator,C.BA) L.EG = line:new (z.E,z.G) z.C = intersection (L.EG,L.AB) z.O = C.AB: antipode (z.B) -\end{tkzelements} +} \begin{center} @@ -1354,7 +1391,8 @@ z.O = C.AB: antipode (z.B) \label{sub:ellipse} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.C = point: new (3 , 2) z.A = point: new (5 , 1) L.CA = line : new (z.C,z.A) @@ -1365,7 +1403,7 @@ z.O = C.AB: antipode (z.B) a = E.Rx b = E.Ry slope = math.deg(E.slope) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles[teal](C,A) @@ -1376,7 +1414,8 @@ z.O = C.AB: antipode (z.B) \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.C = point: new (3 , 2) z.A = point: new (5 , 1) L.CA = line : new (z.C,z.A) @@ -1387,7 +1426,7 @@ E = ellipse: new (z.C,z.A,z.B) a = E.Rx b = E.Ry slope = math.deg(E.slope) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -1407,7 +1446,8 @@ slope = math.deg(E.slope) \label{sub:ellipse_with_radii} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale=.5 z.C = point: new (0 , 4) b = value(math.sqrt(8)) @@ -1416,7 +1456,7 @@ ang = math.deg(math.pi/4) E = ellipse: radii (z.C,a,b,math.pi/4) z.V = E : point (0) z.CoV = E : point (math.pi/2) -\end{tkzelements} +} \begin{tikzpicture}[gridded] \tkzGetNodes \tkzDrawEllipse[blue](C,\tkzUseLua{a}, @@ -1426,7 +1466,8 @@ z.CoV = E : point (math.pi/2) \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale=.5 z.C = point: new (0 , 4) b = value(math.sqrt(8)) @@ -1435,7 +1476,7 @@ ang = math.deg(math.pi/4) E = ellipse: radii (z.C,a,b,math.pi/4) z.V = E : point (0) z.CoV = E : point (math.pi/2) -\end{tkzelements} +} \begin{center} @@ -1453,7 +1494,8 @@ z.CoV = E : point (math.pi/2) \label{sub:ellipse_with_foci} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () local e e = .8 z.A = point: new (2 , 3) @@ -1471,7 +1513,7 @@ z.CoV = E : point (math.pi/2) L.ta,L.tb = E: tangent_from (z.K) z.F = L.ta.pb z.G = L.tb.pb -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPoints(A,B,C,K,F,G,V,cV) @@ -1482,7 +1524,8 @@ z.CoV = E : point (math.pi/2) \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () local e e = .8 z.A = point: new (2 , 3) @@ -1500,7 +1543,7 @@ ang = math.deg(E.slope) L.ta,L.tb = E: tangent_from (z.K) z.F = L.ta.pb z.G = L.tb.pb -\end{tkzelements} +} \begin{center} @@ -1521,7 +1564,8 @@ z.G = L.tb.pb \label{sub:euler_relation} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .75 z.A = point: new (0 , 0) z.B = point: new (5 , 0) @@ -1536,7 +1580,7 @@ z.G = L.tb.pb z.w = T.IBA.circumcenter L.Ow = line : new (z.O,z.w) _,z.E = intersection (L.Ow, C.OA) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawArc(J,X)(Y) @@ -1551,7 +1595,8 @@ z.G = L.tb.pb \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (5 , 0) z.C = point: new (-.4 , 4) @@ -1565,7 +1610,7 @@ T.IBA = triangle: new (z.I,z.B,z.A) z.w = T.IBA.circumcenter L.Ow = line : new (z.O,z.w) _,z.E = intersection (L.Ow, C.OA) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -1589,7 +1634,8 @@ _,z.E = intersection (L.Ow, C.OA) \label{sub:external_angle} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .75 z.A = point: new (0 , 0) z.B = point: new (5 , 0) @@ -1599,7 +1645,7 @@ _,z.E = intersection (L.Ow, C.OA) z.O = T.ABC.circumcenter z.D = intersection (T.ext.ab,T.ABC.ab) z.E = z.C: symmetry (z.B) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C) @@ -1615,7 +1661,8 @@ _,z.E = intersection (L.Ow, C.OA) \end{Verbatim} \end{minipage} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{tkzelements} +\directlua{% +init_elements () scale = .75 z.A = point: new (0 , 0) z.B = point: new (5 , 0) @@ -1625,7 +1672,7 @@ T.ext = T.ABC: excentral () z.O = T.ABC.circumcenter z.D = intersection (T.ext.ab,T.ABC.ab) z.E = z.C: symmetry (z.B) -\end{tkzelements} +} \begin{center} @@ -1651,7 +1698,8 @@ z.E = z.C: symmetry (z.B) \label{sub:internal_angle} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .8 z.A = point: new (0 , 0) z.B = point: new (6 , 0) @@ -1663,7 +1711,7 @@ z.E = z.C: symmetry (z.B) L.LL = T.ab: ll_from (z.C) L.AD = line: new (z.A,z.D) z.E = intersection (L.LL,L.AD) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C) @@ -1679,7 +1727,8 @@ z.E = z.C: symmetry (z.B) \end{Verbatim} \end{minipage} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{tkzelements} +\directlua{% +init_elements () scale =.8 z.A = point: new (0 , 0) z.B = point: new (6 , 0) @@ -1691,7 +1740,7 @@ z.D = intersection (L.AI, T.bc) L.LL = T.ab: ll_from (z.C) L.AD = line: new (z.A,z.D) z.E = intersection (L.LL,L.AD) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -1715,7 +1764,8 @@ z.E = intersection (L.LL,L.AD) \label{sub:nine_points} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = 1.5 z.A = point: new (0 , 0) z.B = point: new (5 , -.5) @@ -1740,8 +1790,8 @@ z.E = intersection (L.LL,L.AD) z.P = L.CU: projection (z.A) z.Q = L.CU: projection (z.B) L.LH = line: new (z.L,z.H) - z.F = intersection (L.LH,C.IH) -- feuerbach -\end{tkzelements} + z.F = intersection (L.LH,C.IH) % feuerbach +} \begin{tikzpicture} \tkzGetNodes @@ -1757,7 +1807,8 @@ z.E = intersection (L.LL,L.AD) \end{Verbatim} \end{minipage} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{tkzelements} +\directlua{% +init_elements () scale = 1 z.A = point: new (0 , 0) z.B = point: new (5 , -.5) @@ -1780,8 +1831,8 @@ L.ML = line: new (z.M,z.L) z.P = L.CU: projection (z.A) z.Q = L.CU: projection (z.B) L.LH = line: new (z.L,z.H) -z.F = intersection (L.LH,C.IH) -- feuerbach -\end{tkzelements} +z.F = intersection (L.LH,C.IH) % feuerbach +} \begin{center} \begin{tikzpicture}[rotate=90] @@ -1804,7 +1855,8 @@ z.F = intersection (L.LH,C.IH) -- feuerbach \label{sub:gold_ratio_with_segment} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (8 , 0) L.AB = line: new (z.A,z.B) @@ -1815,7 +1867,7 @@ z.F = intersection (L.LH,C.IH) -- feuerbach _,z.K = intersection (L.BX,C.MA) L.AK = line: new (z.Y,z.K) z.C = intersection (L.AK,L.AB) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawLines(A,B X,K) @@ -1827,7 +1879,8 @@ z.F = intersection (L.LH,C.IH) -- feuerbach \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.A = point: new (0 , 0) z.B = point: new (8 , 0) @@ -1839,7 +1892,7 @@ C.MA = circle: new (z.M,z.A) _,z.K = intersection (L.BX,C.MA) L.AK = line: new (z.Y,z.K) z.C = intersection (L.AK,L.AB) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -1859,7 +1912,8 @@ z.C = intersection (L.AK,L.AB) \label{sub:gold_arbelos} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .6 z.A = point: new (0 , 0) z.C = point: new (6 , 0) @@ -1872,7 +1926,7 @@ z.C = intersection (L.AK,L.AB) z.O_2 = L.CB.mid L.AB = line: new (z.A,z.B) z.O_0 = L.AB.mid -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(O_1,C O_2,B O_0,B) @@ -1882,7 +1936,8 @@ z.C = intersection (L.AK,L.AB) \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = .4 z.A = point: new (0 , 0) z.C = point: new (6 , 0) @@ -1895,7 +1950,7 @@ L.CB = line: new (z.C,z.B) z.O_2 = L.CB.mid L.AB = line: new (z.A,z.B) z.O_0 = L.AB.mid -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -1913,7 +1968,8 @@ z.O_0 = L.AB.mid \label{sub:harmonic_division_v1} \begin{minipage}[t]{.4\textwidth}\vspace{0pt}% \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale=.75 z.A = point: new (0 , 0) z.B = point: new (4 , 0) @@ -1926,7 +1982,7 @@ z.O_0 = L.AB.mid z.F = z.B : symmetry (z.E) L.GF = line :new (z.G,z.F) z.C = intersection (L.GF,L.AB) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawLines(A,B A,G A,D A,G F,E G,F G,D) @@ -1937,7 +1993,8 @@ z.O_0 = L.AB.mid \end{Verbatim} \end{minipage} \begin{minipage}[t]{.6\textwidth}\vspace{0pt}% -\begin{tkzelements} +\directlua{% +init_elements () scale=.75 z.A = point: new (0 , 0) z.B = point: new (4 , 0) @@ -1950,7 +2007,7 @@ z.O_0 = L.AB.mid z.F = z.B : symmetry (z.E) L.GF = line :new (z.G,z.F) z.C = intersection (L.GF,L.AB) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -1968,7 +2025,8 @@ z.O_0 = L.AB.mid \label{sub:harmonic_division_v2} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.A = point: new (0 , 0) z.B = point: new (6 , 0) @@ -1985,7 +2043,7 @@ L.BF = line: new (z.B,z.F) z.G = intersection (L.AE,L.BF) L.GX = line: new (z.G,z.X) z.C = intersection (L.GX,L.AB) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawLines(A,D A,E B,F D,F X,A X,B X,C) @@ -1995,7 +2053,8 @@ z.C = intersection (L.GX,L.AB) \end{Verbatim} \end{minipage} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.A = point: new (0 , 0) z.B = point: new (6 , 0) @@ -2012,7 +2071,7 @@ L.BF = line: new (z.B,z.F) z.G = intersection (L.AE,L.BF) L.GX = line: new (z.G,z.X) z.C = intersection (L.GX,L.AB) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -2030,7 +2089,8 @@ z.C = intersection (L.GX,L.AB) \label{sub:menelaus} \begin{minipage}{.4\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (6 , 0) z.C = point: new (5 , 4) @@ -2041,7 +2101,7 @@ z.C = intersection (L.GX,L.AB) L.BC = line: new (z.B,z.C) z.Q = intersection (L.AC,L.PX) z.R = intersection (L.BC,L.PX) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C) @@ -2053,7 +2113,8 @@ z.C = intersection (L.GX,L.AB) \end{Verbatim} \end{minipage} \begin{minipage}{.6\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (6 , 0) z.C = point: new (5 , 4) @@ -2064,7 +2125,7 @@ L.PX = line: new (z.P,z.X) L.BC = line: new (z.B,z.C) z.Q = intersection (L.AC,L.PX) z.R = intersection (L.BC,L.PX) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -2084,7 +2145,8 @@ z.R = intersection (L.BC,L.PX) \subsection{Euler ellipse} % (fold) \label{sub:hexagram} -\begin{tkzelements} +\directlua{% +init_elements () scale =1.3 z.A = point: new (0 , 0) z.B = point: new (5 , 1) @@ -2120,11 +2182,12 @@ z.x = intersection (L.BC,L.XO) z.U = intersection (L.XO,E) _,z.V = intersection (L.YO,E) _,z.W = intersection (L.ZO,E) -\end{tkzelements} +} \begin{minipage}{.4\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = 1.3 z.A = point: new (0 , 0) z.B = point: new (5 , 1) @@ -2163,7 +2226,7 @@ _,z.W = intersection (L.ZO,E) z.U = intersection (L.XO,E) _,z.V = intersection (L.YO,E) _,z.W = intersection (L.ZO,E) -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.6\textwidth} @@ -2207,7 +2270,8 @@ _,z.W = intersection (L.ZO,E) \subsection{Gold Arbelos properties} % (fold) \label{sub:gold_arbelos_properties} -\begin{tkzelements} +\directlua{% +init_elements () scale = .7 z.A = point : new(0,0) z.B = point : new(10,0) @@ -2244,11 +2308,12 @@ z.R ,z.S = L.UV : projection (z.O_2,z.O_3) L.O1D = line : new (z.O_1,z.D) z.W = intersection (L.UV,L.O1D) z.O = C.DC : inversion (z.W) -\end{tkzelements} +} \begin{minipage}{.4\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new(0,0) z.B = point : new(10,0) z.C = gold_segment_ (z.A,z.B) @@ -2284,7 +2349,7 @@ z.O = C.DC : inversion (z.W) L.O1D = line : new (z.O_1,z.D) z.W = intersection (L.UV,L.O1D) z.O = C.DC : inversion (z.W) -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.6\textwidth} @@ -2358,7 +2423,8 @@ z.O = C.DC : inversion (z.W) \subsection{Apollonius circle v1 with inversion} % (fold) \label{sub:apollonius_circle_v1_with_inversion} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .7 z.A = point: new (0,0) z.B = point: new (6,0) @@ -2375,7 +2441,7 @@ z.O = C.DC : inversion (z.W) C.apo = C.ortho : inversion (C.euler) z.O = C.apo.center z.xa,z.xb,z.xc = C.ortho : inversion (z.Ea,z.Eb,z.Ec) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles[red](O,xa N,Ea) @@ -2395,7 +2461,8 @@ z.O = C.DC : inversion (z.W) \end{tikzpicture} \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.A = point: new (0,0) z.B = point: new (6,0) @@ -2412,7 +2479,7 @@ z.O = C.DC : inversion (z.W) C.apo = C.ortho : inversion (C.euler) z.O = C.apo.center z.xa,z.xb,z.xc = C.ortho : inversion (z.Ea,z.Eb,z.Ec) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -2440,7 +2507,8 @@ z.O = C.DC : inversion (z.W) \subsection{Apollonius circle v2} % (fold) \label{sub:apollonius_circle_v2} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.A = point: new (0,0) z.B = point: new (6,0) @@ -2466,7 +2534,7 @@ z.O = C.DC : inversion (z.W) L.ox = L.NMa: ll_from (z.o) L.MaS = line: new (z.Ma,z.S) z.t = intersection (L.ox,L.MaS) -- through -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -2481,7 +2549,8 @@ z.O = C.DC : inversion (z.W) \end{tikzpicture} \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale =.5 z.A = point: new (0,0) z.B = point: new (6,0) @@ -2507,7 +2576,7 @@ L.NMa = line: new (z.N,z.Ma) L.ox = L.NMa: ll_from (z.o) L.MaS = line: new (z.Ma,z.S) z.t = intersection (L.ox,L.MaS) -- through -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -2530,7 +2599,8 @@ z.t = intersection (L.ox,L.MaS) -- through \label{sub:orthogonal_circles_v2} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .75 z.O = point: new (2,2) z.Op = point: new (-4,1) @@ -2545,7 +2615,7 @@ z.T = L.T.pb z.Tp = L.Tp.pb L.OOp = line : new (z.O,z.Op) z.M = L.OOp.mid -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircle[red](O,P) @@ -2564,7 +2634,8 @@ z.M = L.OOp.mid \end{tikzpicture} \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .75 z.O = point: new (2,2) z.Op = point: new (-4,1) @@ -2579,7 +2650,7 @@ z.T = L.T.pb z.Tp = L.Tp.pb L.OOp = line : new (z.O,z.Op) z.M = L.OOp.mid -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -2607,7 +2678,8 @@ z.M = L.OOp.mid \label{sub:orthogonal_circle_to_two_circles} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.O = point : new (-1,0) z.B = point : new (0,2) z.Op = point : new (4,-1) @@ -2623,7 +2695,7 @@ z.M = L.OOp.mid z.K = L.K.pb z.Tp = L.Tp.pb z.Kp = L.Kp.pb -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(O,B O',D) @@ -2636,7 +2708,8 @@ z.M = L.OOp.mid \end{tikzpicture} \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = 1.25 z.O = point : new (-1,0) z.B = point : new (0,2) @@ -2653,7 +2726,7 @@ z.T = L.T.pb z.K = L.K.pb z.Tp = L.Tp.pb z.Kp = L.Kp.pb -\end{tkzelements} +} \begin{center} @@ -2675,7 +2748,8 @@ z.Kp = L.Kp.pb \subsection{Midcircles} % (fold) \label{sub:midcircles} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (10 , 0) L.AB = line : new (z.A,z.B) @@ -2720,7 +2794,7 @@ _,z.G = intersection (L.AP0,C.O4P0) z.H = intersection (L.BP0,C.O4P0) z.Ap = z.M_1: symmetry (z.A) z.H_4,z.F,z.E,z.H_0 = L.AB : projection (z.O_4,z.G,z.H,z.P_0) -\end{tkzelements} +} \begin{center} @@ -2757,7 +2831,8 @@ z.H_4,z.F,z.E,z.H_0 = L.AB : projection (z.O_4,z.G,z.H,z.P_0) \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (10 , 0) L.AB = line : new (z.A,z.B) @@ -2802,7 +2877,7 @@ z.H_4,z.F,z.E,z.H_0 = L.AB : projection (z.O_4,z.G,z.H,z.P_0) z.H = intersection (L.BP0,C.O4P0) z.Ap = z.M_1: symmetry (z.A) z.H_4,z.F,z.E,z.H_0 = L.AB : projection (z.O_4,z.G,z.H,z.P_0) -\end{tkzelements} +} \end{Verbatim} \begin{Verbatim} @@ -2842,7 +2917,8 @@ z.H_4,z.F,z.E,z.H_0 = L.AB : projection (z.O_4,z.G,z.H,z.P_0) \subsection{Pencil v1} % (fold) \label{sub:pencil_v1} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .75 z.A = point : new (0,2) z.B = point : new (0,-2) @@ -2857,7 +2933,7 @@ z.H_4,z.F,z.E,z.H_0 = L.AB : projection (z.O_4,z.G,z.H,z.P_0) z.x,z.y = get_points (C.C0A : orthogonal_from (z.M_0)) z.xp,z.yp = get_points (C.C0A : orthogonal_from (z.M_1)) z.O = L.BA.mid -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(C_0,A C_1,A C_3,A C_5,A) @@ -2870,7 +2946,8 @@ z.H_4,z.F,z.E,z.H_0 = L.AB : projection (z.O_4,z.G,z.H,z.P_0) \end{tikzpicture} \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale=.75 z.A = point : new (0,2) z.B = point : new (0,-2) @@ -2885,7 +2962,7 @@ C.C0A = circle : new (z.C_0,z.A) z.x,z.y = get_points (C.C0A : orthogonal_from (z.M_0)) z.xp,z.yp = get_points (C.C0A : orthogonal_from (z.M_1)) z.O = L.BA.mid -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -2906,7 +2983,8 @@ z.O = L.BA.mid \subsection{Pencil v2} % (fold) \label{sub:pencil_v2} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale=.75 z.A = point : new (0,0) z.B = point : new (1,0) @@ -2924,7 +3002,7 @@ z.O = L.BA.mid z.u = C.orth0.through z.v = C.orth1.through z.t = C.orth2.through -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(C_0,A C_1,B) @@ -2936,7 +3014,8 @@ z.O = L.BA.mid \end{tikzpicture} \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale=.75 z.A = point : new (0,0) z.B = point : new (1,0) @@ -2954,7 +3033,7 @@ z.O = L.BA.mid z.u = C.orth0.through z.v = C.orth1.through z.t = C.orth2.through -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -2974,7 +3053,8 @@ z.O = L.BA.mid \subsection{Reim v1} % (fold) \label{sub:reim_v1} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0,0) z.E = point: new (-2,2) C.AE = circle : new (z.A,z.E) @@ -2989,7 +3069,7 @@ z.O = L.BA.mid L.FD = line: new (z.F,z.D) z.G = intersection (L.FD,C.BD) z.O = intersection (L.EC,L.FD) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(A,E B,H) @@ -3006,7 +3086,8 @@ z.O = L.BA.mid \end{tikzpicture} \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0,0) z.E = point: new (-2,2) C.AE = circle : new (z.A,z.E) @@ -3021,7 +3102,7 @@ z.O = L.BA.mid L.FD = line: new (z.F,z.D) z.G = intersection (L.FD,C.BD) z.O = intersection (L.EC,L.FD) -\end{tkzelements} +} \begin{center} @@ -3047,7 +3128,8 @@ z.O = L.BA.mid \subsection{Reim v2} % (fold) \label{sub:reim_v2} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .6 z.A = point: new (0,0) z.B = point: new (10,0) @@ -3060,7 +3142,7 @@ z.O = L.BA.mid z.N = intersection (L.MC,C.BC) z.m,z.mp = get_points (C.AC: tangent_at (z.M)) z.n,z.np = get_points (C.BC: tangent_at (z.N)) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(A,C B,C) @@ -3074,7 +3156,8 @@ z.O = L.BA.mid \end{tikzpicture} \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .4 z.A = point: new (0,0) z.B = point: new (10,0) @@ -3087,7 +3170,7 @@ C.BC = circle: new (z.B,z.C) z.N = intersection (L.MC,C.BC) z.m,z.mp = get_points (C.AC: tangent_at (z.M)) z.n,z.np = get_points (C.BC: tangent_at (z.N)) -\end{tkzelements} +} \begin{center} @@ -3110,7 +3193,8 @@ z.n,z.np = get_points (C.BC: tangent_at (z.N)) \subsection{Reim v3} % (fold) \label{sub:reim_v3} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0,0) z.B = point: new (8,0) z.C = point: new (2,6) @@ -3132,7 +3216,7 @@ z.n,z.np = get_points (C.BC: tangent_at (z.N)) C.zO = circle: new (z.z,z.O) L.KO = line: new (z.K,z.O) z.D = intersection (L.KO,C.zO) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -3149,7 +3233,8 @@ z.n,z.np = get_points (C.BC: tangent_at (z.N)) \end{tikzpicture} \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .75 z.A = point: new (0,0) z.B = point: new (8,0) @@ -3172,7 +3257,7 @@ z.n,z.np = get_points (C.BC: tangent_at (z.N)) C.zO = circle: new (z.z,z.O) L.KO = line: new (z.K,z.O) z.D = intersection (L.KO,C.zO) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -3197,7 +3282,9 @@ z.n,z.np = get_points (C.BC: tangent_at (z.N)) \label{sub:tangent_and_circle} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () +scale = .75 z.A = point: new (1,0) z.B = point: new (2,2) z.E = point: new (5,-4) @@ -3209,7 +3296,7 @@ z.n,z.np = get_points (C.BC: tangent_at (z.N)) z.i = L.Ti.pb z.j = L.Tj.pb z.k,z.l = get_points (C.AB: tangent_at (z.B)) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(A,B M,A) @@ -3220,7 +3307,9 @@ z.n,z.np = get_points (C.BC: tangent_at (z.N)) \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () +scale = .75 z.A = point: new (1,0) z.B = point: new (2,2) z.E = point: new (5,-4) @@ -3232,7 +3321,7 @@ L.Ti,L.Tj = C.AB: tangent_from (z.E) z.i = L.Ti.pb z.j = L.Tj.pb z.k,z.l = get_points (C.AB: tangent_at (z.B)) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -3251,12 +3340,14 @@ z.k,z.l = get_points (C.AB: tangent_at (z.B)) \label{sub:homothety} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () +scale = .5 z.A = point: new (0,0) z.B = point: new (1,2) z.E = point: new (-3,2) z.C,z.D = z.E : homothety(2,z.A,z.B) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPoints(A,B,C,E,D) @@ -3267,13 +3358,14 @@ z.k,z.l = get_points (C.AB: tangent_at (z.B)) \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} -scale = .6 +\directlua{% +init_elements () +scale = .5 z.A = point: new (0,0) z.B = point: new (1,2) z.E = point: new (-3,2) z.C,z.D = z.E : homothety(2,z.A,z.B) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} \tkzGetNodes @@ -3291,7 +3383,8 @@ z.C,z.D = z.E : homothety(2,z.A,z.B) \label{sub:tangent_and_chord} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .8 z.A = point: new (0 , 0) z.B = point: new (6 , 0) @@ -3305,7 +3398,7 @@ z.C,z.D = z.E : homothety(2,z.A,z.B) L.AO = line: new (z.A,z.O) z.b1,z.b2 = get_points (C.OA: tangent_at (z.B)) z.H = L.AB: projection (z.O) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircle(O,A) @@ -3320,7 +3413,8 @@ z.C,z.D = z.E : homothety(2,z.A,z.B) \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = 0.75 z.A = point: new (0 , 0) z.B = point: new (6 , 0) @@ -3334,7 +3428,7 @@ z.D = C.OA: point (4.5) L.AO = line: new (z.A,z.O) z.b1,z.b2 = get_points (C.OA: tangent_at (z.B)) z.H = L.AB: projection (z.O) -\end{tkzelements} +} \begin{center} @@ -3359,7 +3453,8 @@ z.H = L.AB: projection (z.O) \label{sub:three_chords} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.O = point: new (0 , 0) z.B = point: new (0 , 2) z.P = point: new (1 , -.5) @@ -3387,11 +3482,12 @@ C.xD = circle : new (z.x,z.D) z.Ap = intersection (L.GB,C.xB) z.Ep,_ = intersection (L.GE,C.xF) z.Cp,_ = intersection (L.GD,C.xD) -\end{tkzelements} +} \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.O = point: new (0 , 0) z.B = point: new (0 , 2) z.P = point: new (1 , -.5) @@ -3419,7 +3515,7 @@ C.xD = circle : new (z.x,z.D) z.Ap = intersection (L.GB,C.xB) z.Ep,_ = intersection (L.GE,C.xF) z.Cp,_ = intersection (L.GD,C.xD) -\end{tkzelements} +} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% \begin{Verbatim} @@ -3472,7 +3568,8 @@ z.Cp,_ = intersection (L.GD,C.xD) \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (-1 , 0) z.C = point: new (4 , -1.5) z.E = point: new (1 , -1) @@ -3489,7 +3586,7 @@ z.Cp,_ = intersection (L.GD,C.xD) L.TA = C.wE : tangent_at (z.A) L.TC = C.xE : tangent_at (z.C) z.I = intersection (L.TA,L.TC) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(w,E) @@ -3504,7 +3601,8 @@ z.Cp,_ = intersection (L.GD,C.xD) \end{Verbatim} \end{minipage} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{tkzelements} +\directlua{% +init_elements () scale = .75 z.A = point: new (-1 , 0) z.C = point: new (4 , -1.5) @@ -3522,7 +3620,7 @@ z.G = intersection (L.Aw,L.Cx) L.TA = C.wE : tangent_at (z.A) L.TC = C.xE : tangent_at (z.C) z.I = intersection (L.TA,L.TC) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -3544,13 +3642,14 @@ z.I = intersection (L.TA,L.TC) \label{sub:midarc} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (-1,0) z.B = point: new (2,4) C.AB = circle: new (z.A,z.B) z.C = z.A: rotation (math.pi/3,z.B) z.D = C.AB: midarc (z.B,z.C) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPoints(A,B,C) @@ -3561,14 +3660,15 @@ z.I = intersection (L.TA,L.TC) \end{Verbatim} \end{minipage} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.A = point: new (-1,0) z.B = point: new (2,4) C.AB = circle: new (z.A,z.B) z.C = z.A: rotation (math.pi/3,z.B) z.D = C.AB: midarc (z.B,z.C) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -3587,7 +3687,8 @@ z.D = C.AB: midarc (z.B,z.C) \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = 1.6 z.A = point: new (1,0) z.B = point: new (5,2) @@ -3607,7 +3708,7 @@ z.D = C.AB: midarc (z.B,z.C) z.P = intersection (L.tA,L.BC) z.Q = intersection (L.tB,L.AC) z.R = intersection (L.tC,L.AB) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon[teal](A,B,C) @@ -3621,7 +3722,8 @@ z.D = C.AB: midarc (z.B,z.C) \end{Verbatim} \end{minipage} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{tkzelements} +\directlua{% +init_elements () scale = 0.75 z.A = point: new (1,0) z.B = point: new (5,2) @@ -3641,7 +3743,7 @@ L.tC = line: new (z.Cr,z.Cl) z.P = intersection (L.tA,L.BC) z.Q = intersection (L.tB,L.AC) z.R = intersection (L.tC,L.AB) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -3667,7 +3769,8 @@ Draw lines through the symmedian point $L$ and parallel to the sides of the tria [\href{https://mathworld.wolfram.com/FirstLemoineCircle.html}{Weisstein, Eric W. "First Lemoine Circle." From MathWorld--A Wolfram Web Resource.}] \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (1,1) z.B = point: new (5,1) z.C = point: new (2.2,4) @@ -3679,7 +3782,7 @@ Draw lines through the symmedian point $L$ and parallel to the sides of the tria z.y5,z.y6 = intersection (T.bc,C.first_lemoine) z.y3,z.y4 = intersection (T.ca,C.first_lemoine) z.L = T : lemoine_point () -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -3695,7 +3798,8 @@ Draw lines through the symmedian point $L$ and parallel to the sides of the tria \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (1,1) z.B = point: new (5,1) z.C = point: new (2.2,4) @@ -3707,7 +3811,7 @@ Draw lines through the symmedian point $L$ and parallel to the sides of the tria z.y5,z.y6 = intersection (T.bc,C.first_lemoine) z.y3,z.y4 = intersection (T.ca,C.first_lemoine) z.L = T : lemoine_point () -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygons(A,B,C) @@ -3730,7 +3834,8 @@ Draw antiparallels through the symmedian point $L$. The points where these lines \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = 2 z.a = point: new (0,0) z.b = point: new (5,0) @@ -3753,7 +3858,7 @@ Draw antiparallels through the symmedian point $L$. The points where these lines L.y1y6 = line : new (z.y1,z.y6) L.y4y5 = line : new (z.y4,z.y5) L.y2y3 = line : new (z.y2,z.y3) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygons(a,b,c y1,y2,y3,y4,y5,y6) @@ -3767,7 +3872,8 @@ Draw antiparallels through the symmedian point $L$. The points where these lines \end{tikzpicture} \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = 2 z.a = point: new (0,0) z.b = point: new (5,0) @@ -3790,7 +3896,7 @@ z.x5,z.x6 = intersection (L.ca,C.second_lemoine) L.y1y6 = line : new (z.y1,z.y6) L.y4y5 = line : new (z.y4,z.y5) L.y2y3 = line : new (z.y2,z.y3) -\end{tkzelements} +} \begin{center} @@ -3813,7 +3919,8 @@ L.y2y3 = line : new (z.y2,z.y3) \subsection{Inversion} % (fold) \label{sub:inversion} -\begin{tkzelements} +\directlua{% +init_elements () scale = .75 z.A = point: new (-1,0) z.B = point: new (2,2) @@ -3828,12 +3935,13 @@ z.H = L.AE : projection (z.t1) z.Bp, z.Ep, z.Cp = C.AC: inversion ( z.B, z.E, z.C ) -\end{tkzelements} +} \begin{minipage}{.5\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () z.A = point: new (-1,0) z.B = point: new (2,2) z.C = point: new (2,4) @@ -3848,7 +3956,7 @@ z.Cp = C.AC: inversion ( z.B, z.E, z.C ) z.Bp, z.Ep, z.Cp = C.AC: inversion ( z.B, z.E, z.C ) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -3881,7 +3989,8 @@ z.Cp = C.AC: inversion ( z.B, z.E, z.C ) \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.a = point: new (0,0) z.b = point: new (5,0) z.c = point: new (1,4) @@ -3893,7 +4002,7 @@ z.Cp = C.AC: inversion ( z.B, z.E, z.C ) z.y_0,z.y_1 = get_points (L.anti) L.anti = T : antiparallel (z.L,2) z.z_0,z.z_1 = get_points (L.anti) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -3907,7 +4016,8 @@ z.Cp = C.AC: inversion ( z.B, z.E, z.C ) \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.a = point: new (0,0) z.b = point: new (5,0) z.c = point: new (1,4) @@ -3919,7 +4029,7 @@ L.anti = T : antiparallel (z.L,1) z.y_0,z.y_1 = get_points (L.anti) L.anti = T : antiparallel (z.L,2) z.z_0,z.z_1 = get_points (L.anti) -\end{tkzelements} +} \begin{center} \begin{tikzpicture} @@ -3940,7 +4050,8 @@ z.z_0,z.z_1 = get_points (L.anti) \label{sub:soddy} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 5 , 0 ) z.C = point : new ( 0.5 , 4 ) @@ -3972,7 +4083,7 @@ C.soddy_ext = C.ins : inversion (C.soddy_int) z.w = C.soddy_ext.center z.s = C.soddy_ext.through z.Xip,z.Yip,z.Zip = C.ins : inversion (z.Xi,z.Yi,z.Zi) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -3986,7 +4097,8 @@ z.Xip,z.Yip,z.Zip = C.ins : inversion (z.Xi,z.Yi,z.Zi) \end{tikzpicture} \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 5 , 0 ) z.C = point : new ( 0.5 , 4 ) @@ -4018,7 +4130,7 @@ C.soddy_ext = C.ins : inversion (C.soddy_int) z.w = C.soddy_ext.center z.s = C.soddy_ext.through z.Xip,z.Yip,z.Zip = C.ins : inversion (z.Xi,z.Yi,z.Zi) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -4035,7 +4147,8 @@ z.Xip,z.Yip,z.Zip = C.ins : inversion (z.Xi,z.Yi,z.Zi) \subsection{Soddy circle with function} % (fold) \label{sub:soddy_circle_with_function} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 5 , 0 ) z.C = point : new (4 , 4 ) @@ -4051,11 +4164,12 @@ C.soddy_ext = C.ins : inversion (C.soddy_int) z.w = C.soddy_ext.center z.t = C.soddy_ext.through z.Xip,z.Yip,z.Zip = C.ins : inversion (z.xi,z.yi,z.zi) -\end{tkzelements} +} \begin{minipage}{.5\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 5 , 0 ) z.C = point : new (4 , 4 ) @@ -4073,7 +4187,7 @@ z.Xip,z.Yip,z.Zip = C.ins : inversion (z.xi,z.yi,z.zi) z.t = C.soddy_ext.through z.Xip,z.Yip, z.Zip = C.ins : inversion (z.xi,z.yi,z.zi) - \end{tkzelements} + } \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} @@ -4106,7 +4220,8 @@ z.Xip,z.Yip,z.Zip = C.ins : inversion (z.xi,z.yi,z.zi) \subsection{Pappus chain} % (fold) \label{sub:pappus_chain} -\begin{tkzelements} +\directlua{% +init_elements () scale =.75 xC,nc = 10,16 xB = xC/tkzphi @@ -4133,10 +4248,11 @@ z.Xip,z.Yip,z.Zip = C.ins : inversion (z.xi,z.yi,z.zi) L.SpTp = line:new ( z["S"..i.."p"], z["T"..i.."p"]) z["I"..i] = L.SpTp.mid end -\end{tkzelements} +} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () xC,nc = 10,16 xB = xC/tkzphi xD = (xC*xC)/xB @@ -4162,7 +4278,7 @@ z.Xip,z.Yip,z.Zip = C.ins : inversion (z.xi,z.yi,z.zi) L.SpTp = line:new ( z["S"..i.."p"], z["T"..i.."p"]) z["I"..i] = L.SpTp.mid end -\end{tkzelements} +} \end{Verbatim} \begin{minipage}{.5\textwidth} @@ -4196,7 +4312,8 @@ z.Xip,z.Yip,z.Zip = C.ins : inversion (z.xi,z.yi,z.zi) \subsection{Three Circles} % (fold) \label{sub:three_circles} -\begin{tkzelements} +\directlua{% +init_elements () function threecircles(c1,r1,c2,r2,c3,h1,h3,h2) local xk = math.sqrt (r1*r2) local cx = (2*r1*math.sqrt(r2))/(math.sqrt(r1)+math.sqrt(r2)) @@ -4210,11 +4327,12 @@ function threecircles(c1,r1,c2,r2,c3,h1,h3,h2) z[h3] = L.h1h2: projection (z[c3]) end threecircles("A",4,"B",3,"C","E","G","F") -\end{tkzelements} +} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () function threecircles(c1,r1,c2,r2,c3,h1,h3,h2) local xk = math.sqrt (r1*r2) local cx = (2*r1*math.sqrt(r2))/(math.sqrt(r1)+math.sqrt(r2)) @@ -4228,7 +4346,7 @@ function threecircles(c1,r1,c2,r2,c3,h1,h3,h2) z[h3] = L.h1h2: projection (z[c3]) end threecircles("A",4,"B",3,"C","E","G","F") -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -4254,7 +4372,8 @@ end Pentagons in a golden arbelos} % (fold) \label{sub:golden_arbelos} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (10 , 0) L.AB = line: new ( z.A, z.B) @@ -4289,11 +4408,12 @@ k = 1/tkzphi^2 kk = tkzphi z.D_1,z.E_1,z.F_1,z.G_1 = z.B : homothety (k, z.D,z.E,z.F,z.G) z.D_2,z.E_2,z.F_2,z.G_2 = z.M_0 : homothety (kk,z.D_1,z.E_1,z.F_1,z.G_1) -\end{tkzelements} +} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (10 , 0) L.AB = line: new ( z.A, z.B) @@ -4328,7 +4448,7 @@ z.D_2,z.E_2,z.F_2,z.G_2 = z.M_0 : homothety (kk,z.D_1,z.E_1,z.F_1,z.G_1) kk = tkzphi z.D_1,z.E_1,z.F_1,z.G_1 = z.B : homothety (k, z.D,z.E,z.F,z.G) z.D_2,z.E_2,z.F_2,z.G_2 = z.M_0 : homothety (kk,z.D_1,z.E_1,z.F_1,z.G_1) -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-indepthstudy.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-indepthstudy.tex index 140063f928..e49c7892af 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-indepthstudy.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-indepthstudy.tex @@ -247,13 +247,14 @@ Then |z.B = z.A * za| describes a rotation of point A by an angle |a|. \begin{minipage}{.6\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () z.O = point : new (0,0) z.A = point : new (1,2) a = math.pi/6 za = point(math.cos(a),math.sin(a)) z.B = z.A * za - \end{tkzelements} + } \begin{tikzpicture} \tkzGetNodes \tkzDrawPoints(O,A,B) @@ -264,14 +265,15 @@ Then |z.B = z.A * za| describes a rotation of point A by an angle |a|. \end{Verbatim} \end{minipage} \begin{minipage}{.6\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale=2 z.O = point : new (0,0) z.A = point : new (1,2) a = math.pi/6 za = point(math.cos(a),math.sin(a)) z.B = z.A * za -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPoints(O,A,B) @@ -287,7 +289,8 @@ Then |z.B = z.A * za| describes a rotation of point A by an angle |a|. \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.o = point: new(0,0) z.a = point: new(1,-1) z.b = point: new(2,1) @@ -300,7 +303,7 @@ Then |z.B = z.A * za| describes a rotation of point A by an angle |a|. -- = z.a : conj () z.g = z.b* point(math.cos(math.pi/2), math.sin(math.pi/2)) -\end{tkzelements} +} \hspace*{\fill} \begin{tikzpicture} @@ -315,7 +318,8 @@ Then |z.B = z.A * za| describes a rotation of point A by an angle |a|. \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () z.o = point: new(0,0) z.a = point: new(1,-1) z.b = point: new(2,1) @@ -327,7 +331,7 @@ Then |z.B = z.A * za| describes a rotation of point A by an angle |a|. z.ap = point.conj (z.a) -- = z.a : conj () z.g = z.b* point(math.cos(math.pi/2),math.sin(math.pi/2)) -\end{tkzelements} +} \hspace*{\fill} \begin{tikzpicture} @@ -374,12 +378,13 @@ Then |z.B = z.A * za| describes a rotation of point A by an angle |a|. \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (1,0) z.B = point: new (5,-1) z.C = point: new (2,5) z.G = barycenter ({z.A,3},{z.B,1},{z.C,1}) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -388,12 +393,13 @@ Then |z.B = z.A * za| describes a rotation of point A by an angle |a|. \end{tikzpicture} \end{Verbatim} \end{minipage} -\begin{minipage}{.5\textwidth}\begin{tkzelements} +\begin{minipage}{.5\textwidth}\directlua{% +init_elements () z.A = point: new (1,0) z.B = point: new (5,-1) z.C = point: new (2,5) z.G = barycenter ({z.A,3},{z.B,1},{z.C,1}) -\end{tkzelements} +} \hspace{\fill} \begin{tikzpicture} \tkzGetNodes @@ -427,7 +433,8 @@ The problem encountered in this example stems from the notation of the point nam \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () local r = 3 z.O = point : new (0,0) max = 100 @@ -436,11 +443,12 @@ The problem encountered in this example stems from the notation of the point nam z["A_"..i] = point : polar(r,2*i*math.pi/max) end a = math.deg(get_angle (z.O,z.A_1,z.A_2)) -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () local r = 3 z.O = point : new (0,0) max = 100 @@ -449,7 +457,7 @@ The problem encountered in this example stems from the notation of the point nam z["A_"..i] = point : polar(r,2*i*math.pi/max) end a = math.deg(get_angle (z.O,z.A_1,z.A_2)) -\end{tkzelements} +} \hspace{\fill} \begin{tikzpicture} \pgfkeys{/pgf/number format/.cd,use comma} @@ -501,7 +509,8 @@ The \tkzNamePack{ifthen} package is required for the code below. \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0,0) z.B = point: new (1,2) z.X = point: new (2,4.000) @@ -514,7 +523,7 @@ if L.AB : in_out (z.X) inline = false end inline_bis = L.AB : in_out (z.Y) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -531,7 +540,8 @@ if L.AB : in_out (z.X) \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () z.A = point: new (0,0) z.B = point: new (1,2) z.X = point: new (2,4.000) @@ -544,7 +554,7 @@ if L.AB : in_out (z.X) inline = false end inline_bis = L.AB : in_out (z.Y) -\end{tkzelements} +} \hspace{\fill} \begin{tikzpicture} \tkzGetNodes @@ -664,7 +674,8 @@ You obtain a point on the object by entering a real number between 0 and 1. \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 2 ) z.C = point : new ( 1 , 3 ) @@ -674,7 +685,7 @@ You obtain a point on the object by entering a real number between 0 and 1. z.I = L.AB : point (0.5) z.J = C.AB : point (0.5) z.K = T.ABC : point (0.5) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawLine(A,B) @@ -686,7 +697,8 @@ You obtain a point on the object by entering a real number between 0 and 1. \end{minipage} \hspace{\fill} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale =.75 z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 2 ) @@ -697,7 +709,7 @@ You obtain a point on the object by entering a real number between 0 and 1. z.I = L.AB : point (0.5) z.J = C.AB : point (0.5) z.K = T.ABC : point (0.5) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawLine(A,B) diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-intersection.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-intersection.tex index 1ba8fd0981..53eff14d51 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-intersection.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-intersection.tex @@ -12,7 +12,8 @@ The result is of the form: |point| or |false|. \begin{minipage}{0.6\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new (1,-1) z.B = point : new (4,1) z.C = point : new (2,1) @@ -26,7 +27,7 @@ The result is of the form: |point| or |false|. else z.I = x end -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -37,7 +38,8 @@ The result is of the form: |point| or |false|. \end{Verbatim} \end{minipage} \begin{minipage}{0.4\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new (1,-1) z.B = point : new (4,1) z.C = point : new (2,1) @@ -51,7 +53,7 @@ tex.print('error') else z.I = x end -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -71,7 +73,8 @@ The result is of the form : |point,point| or |false,false|. If the line is tange \begin{minipage}{0.6\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new (1,-1) z.B = point : new (1,2) L.AB = line : new (z.A,z.B) @@ -82,7 +85,7 @@ The result is of the form : |point,point| or |false,false|. If the line is tange C.OD = circle : new (z.O,z.D) z.I,_ = intersection (L.AB,C.OD) _,z.K = intersection (C.OD,L.AE) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -94,7 +97,8 @@ The result is of the form : |point,point| or |false,false|. If the line is tange \end{Verbatim} \end{minipage} \begin{minipage}{0.4\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = 2 z.A = point : new (1,-1) z.B = point : new (1,2) @@ -106,15 +110,16 @@ L.AE = line : new (z.A,z.E) C.OD = circle : new (z.O,z.D) z.I,_ = intersection (L.AB,C.OD) _,z.K = intersection (C.OD,L.AE) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes -\tkzDrawLines(A,B A,E) +\tkzDrawLines[add=.1 and .1](A,B A,E) \tkzDrawCircle(O,D) \tkzDrawPoints(A,B,O,D,I,K) \tkzLabelPoints[left](A,B,O,D,I,K) \end{tikzpicture} +\hfill \end{minipage} Other examples: \ref{sub:altshiller} @@ -128,7 +133,8 @@ The result is of the form : |point,point| or |false,false|. If the circles are \begin{minipage}{0.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new (1,1) z.B = point : new (2,2) z.C = point : new (3,3) @@ -138,7 +144,7 @@ The result is of the form : |point,point| or |false,false|. If the circles are z.I,_ = intersection (C.AB,C.CB) C.DC = circle : new (z.D,z.C) z.J,z.K = intersection (C.DC,C.CB) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(A,B C,B D,C) @@ -148,7 +154,8 @@ The result is of the form : |point,point| or |false,false|. If the circles are \end{Verbatim} \end{minipage} \begin{minipage}{0.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new (1,1) z.B = point : new (2,2) z.C = point : new (3,3) @@ -158,7 +165,7 @@ C.CB = circle : new (z.C,z.B) z.I,_ = intersection (C.AB,C.CB) C.DC = circle : new (z.D,z.C) z.J,z.K = intersection (C.DC,C.CB) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -180,7 +187,8 @@ The designation of intersection points is a little more complicated than the pre \begin{minipage}{0.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.a = point: new (5 , 2) z.b = point: new (-4 , 0) @@ -196,7 +204,7 @@ The designation of intersection points is a little more complicated than the pre a = E.Rx b = E.Ry ang = math.deg(E.slope) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawLines[red](a,b u,v) % p,s p,t @@ -210,23 +218,24 @@ The designation of intersection points is a little more complicated than the pre \end{Verbatim} \end{minipage} \begin{minipage}{0.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale =.5 z.a = point: new (5 , 2) z.b = point: new (-4 , 0) z.m = point: new (2 , 4) z.n = point: new (4 , 4) - L.ab = line : new (z.a,z.b) - L.mn = line : new (z.m,z.n) + L.ab = line : new (z.a,z.b) + L.mn = line : new (z.m,z.n) z.c = L.ab. mid z.e = L.ab: point (-.2) E = ellipse: foci (z.a,z.b,z.e) z.u,z.v = intersection (E,L.mn) - -- transfer to tex + % transfer to tex a = E.Rx b = E.Ry ang = math.deg(E.slope) -\end{tkzelements} +} \hspace*{\fill} \begin{tikzpicture} \tkzGetNodes diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-main.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-main.tex index 10998bb7f5..427dfe3c2d 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-main.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-main.tex @@ -1,6 +1,6 @@ % !TEX TS-program = lualatex % encoding : utf8 -% Documentation of tkz-elements v2.30c +% Documentation of tkz-elements v3.00c % Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -21,10 +21,10 @@ headings = small ]{tkz-doc} \gdef\tkznameofpack{tkz-elements} -\gdef\tkzversionofpack{2.30c} +\gdef\tkzversionofpack{3.00c} \gdef\tkzdateofpack{\today} \gdef\tkznameofdoc{tkz-elements.pdf} -\gdef\tkzversionofdoc{2.30c} +\gdef\tkzversionofdoc{3.00c} \gdef\tkzdateofdoc{\today} \gdef\tkzauthorofpack{Alain Matthes} \gdef\tkzadressofauthor{} @@ -139,6 +139,8 @@ sharp corners \newcommand*{\Immeth}[2]{\texttt{#2}\index{#1_3@\texttt{#1: metamethod}!\_\_\texttt{#2}}} \newcommand*{\Igfct}[2]{\texttt{#2}\index{#1_3@\texttt{#1: function}!\texttt{#2}}} \newcommand*{\Iclass}[1]{\texttt{#1}\index{Class !#1@\texttt{#1}}} +\newcommand*{\Iengine}[1]{\texttt{#1}\index{Engine !#1@\texttt{#1}}} +\newcommand*{\Iprimitive}[1]{\textbackslash\texttt{#1}\index{Lua\TeX\ primitive !#1@\texttt{\textbackslash#1}}} \newcommand*{\tkzNameObj}[1]{\tkzname{#1}\Iobj{#1}} \newcommand*{\Iobj}[1]{\index{Object_1@\texttt{Object}!\texttt{#1}}} \newcommand*{\tkzRBomb}{\textcolor{red}{\bomb}} @@ -171,7 +173,6 @@ sharp corners \AtBeginDocument{\MakeShortVerb{\|}} % link to shortvrb \begin{document} -%\LuaCodeDebugOn \parindent=0pt \tkzTitleFrame{tkz-elements \tkzversionofpack\\Euclidean Geometry} @@ -212,6 +213,7 @@ Project Public License Distributed from \href{http://www.ctan.org/}{CTAN}\ arch \clearpage \newpage +\input{TKZdoc-elements-news.tex} \input{TKZdoc-elements-structure.tex} \input{TKZdoc-elements-why.tex} \input{TKZdoc-elements-presentation.tex} diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-news.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-news.tex new file mode 100644 index 0000000000..9eb6544054 --- /dev/null +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-news.tex @@ -0,0 +1,13 @@ +\section{News} % (fold) +\label{sec:news} + +The documentation you are reading corresponds to the latest version 3.0 of \tkzNamePack{tkz-elements}. This version introduces an important new feature: the code \code{Lua} part of the code can now be processed using the \Iprimitive{directlua} primitive of \Iengine{Lua\LaTeX}. See the examples given in the Transfers section. + +This introduces a slight complication whatever the method used to execute the \code{Lua} code. If you want to use the \tkzNameEnv{tkzelements} environment, then you need to load the \pkg{luacode} package. If you prefer to use the |\directlua| primitive, you'll need to delete and reset the tables and \Igfct{tkz-elements}{scale} with the \Igfct{tkz-elements}{init\_elements} function. + +Some complex examples require the use of the \Iprimitive{directlua} primitive. + + +% section news (end) +\endinput + diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-organization.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-organization.tex index 1778a7c8fb..22025d1146 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-organization.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-organization.tex @@ -9,9 +9,7 @@ You can load \tkzname{tkz-euclide} in three different ways. The simplest is |\us The package \pkg{ifthen} is useful if you need to use some Boolean. -The macro \tkzcname{LuaCodeDebugOn} allows you to try and find errors in Lua code. - -While it's possible to leave the Lua code in the \tkzNameEnv{tkzelements} environment, externalizing this code has its advantages. +While it's possible to leave the Lua code in the macro |directlua|, externalizing this code has its advantages. The first advantage is that, if you use a good editor, you have a better presentation of the code. Styles differ between \code{Lua} and \LATEX{}, making the code clearer. This is how I proceeded, then reintegrated the code into the main code. @@ -29,12 +27,11 @@ A third advantage is that the code can be reused. \usepackage[mini]{tkz-euclide} \usepackage{tkz-elements,ifthen} -\begin{document} -\LuaCodeDebugOn -\begin{tkzelements} +\begin{document} +\directlua{ scale = 1.25 dofile ("sangaku.lua") -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -63,10 +60,11 @@ L.Cc = line : new (z.C,z.c) z.I = intersection (L.Cc,L.BF) \end{Verbatim} -\begin{tkzelements} +\directlua{ + init_elements () scale = 1.25 dofile ("sangaku.lua") -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -82,15 +80,24 @@ z.I = intersection (L.Cc,L.BF) If necessary, it's better to perform scaling in the \code{Lua} section. This approach tends to be more accurate. However, there is a caveat to be aware of. I've made it a point to avoid using numerical values in my codes whenever possible. Generally, these values only appear in the definition of fixed points. If the \code{scale} option is used, scaling is applied when points are created. Let's imagine you want to organize your code as follows: -|scale = 1.5|\\ -|xB = 8|\\ -|z.B = point : new ( xB,0 )| +\begin{mybox}{} + \begin{verbatim} + scale = 1.5 + xB = 8 + z.B = point : new ( xB,0 ) + \end{verbatim} +\end{mybox} + Scaling would then be ineffective, as the numerical values are not modified, only the point coordinates. To account for scaling, use the function \Igfct{math}{value (v) }. -|scale = 1.5|\\ -|xB = value (8)|\\ -|z.B = point : new ( xB,0 )| +\begin{mybox}{} +\begin{verbatim} + scale = 1.5 + xB = value (8) + z.B = point : new ( xB,0 ) +\end{verbatim} +\end{mybox} \subsection{Code presentation} % (fold) \label{sub:code_presentation} diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-presentation.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-presentation.tex index f0689fcc74..195a691064 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-presentation.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-presentation.tex @@ -4,8 +4,7 @@ \subsection{With Lua} % (fold) \label{sub:with_lua} -The primary function of tkz-elements is to calculate dimensions and define points, which is achieved using Lua. You can view tkz-elements as a kernel that is utilized either by tkz-euclide or by TikZ, -Definitions and calculations take place within the environment \tkzNameEnv{tkzelements}, which is based on \tkzNameEnv{luacode}. +The primary function of tkz-elements is to calculate dimensions and define points, which is achieved using Lua. You can view tkz-elements as a kernel that is utilized either by tkz-euclide or by TikZ. The lua code can be implemented immediately using the \tkzcname{directlua} primitive, or it can take place within a \tkzNameEnv{tkzelements} environment which is based on \tkzNameEnv{luacode}. In the latter case, you need to load the \pkg{luacode} package. In the first case, if you create a complex document, you'll be able to reset the tables and scale with the \Igfct{package}{init\_elements} function. \begin{minipage}[t]{.52\textwidth}\vspace{0pt}% The key points are: @@ -13,12 +12,12 @@ Definitions and calculations take place within the environment \tkzNameEnv{tkze \item The source file must be \tkzEHand\ {\color{red}\uline{ \color{black}UTF8}} encoded. \item Compilation is done with \tkzEHand\ {\color{red}\uline{ \color{black}Lua\LATEX{}}}. \item You need to load \tkzimp{\TIKZ}{} or \tkzimp{tkz-euclide} and \tkzimp{tkz-elements}. - \item Definitions and calculations are performed in an (orthonormal) Cartesian coordinate system, using Luawithin the \tkzimp{tkzelements} environment. + \item Definitions and calculations are performed in an (orthonormal) Cartesian coordinate system, using Lua with the macro \tkzcname{directlua} or within the \tkzimp{tkzelements} environment. \end{itemize} On the right, you can see the minimum template. -The code is divided into two parts, represented by two environments \tkzNameEnv{tkzelements} and \tkzNameEnv{tikzpicture}. In the first environment, you place your Lua code, while in the second, you use tkz-euclide commands. +The code is divided into two parts, represented by lua code, argument to the primitive |\directlua| and the environment \tkzNameEnv{tikzpicture}. In the first part, you place your Lua code, while in the second, you use tkz-euclide commands. \vspace*{4.1 cm}% \end{minipage}\hspace*{\fill} @@ -33,14 +32,14 @@ The code is divided into two parts, represented by two environments \tkzNameEnv \usepackage{tkz-elements} begin{document} -\begin{tkzelements} +\directlua{ scale = 1 % definition of some points z.A = point : new ( , ) z.B = point : new ( , ) ...code... -\end{tkzelements} +} \begin{tikzpicture} % point transfer to Nodes @@ -77,7 +76,7 @@ After obtaining all the necessary points for the drawing, they must be transform \subsubsection{The figure} -\begin{tkzelements} +\directlua{ scale = 1.2 z.A = point: new (0 , 0) z.B = point: new (10 , 0) @@ -102,7 +101,7 @@ After obtaining all the necessary points for the drawing, they must be transform z.P_1 = intersection (C.PC,C.AC) _,z.P_2 = intersection (C.QA,C.CB) z.O_3 = triangle: new ( z.P_0, z.P_1, z.P_2).circumcenter -\end{tkzelements} +} \hspace*{\fill} \begin{tikzpicture} \tkzGetNodes @@ -128,29 +127,29 @@ After obtaining all the necessary points for the drawing, they must be transform \usepackage{tkz-elements} \begin{document} -\begin{tkzelements} +\directlua{ z.A = point: new (0 , 0) -z.B = point: new (10 , 0) -- creation of two fixed points $A$ and $B$ +z.B = point: new (10 , 0) % creation of two fixed points $A$ and $B$ L.AB = line: new ( z.A, z.B) -z.C = L.AB: gold_ratio () -- use of a method linked to “line” -z.O_0 = line: new ( z.A, z.B).mid -- midpoint of segment with an attribute of “line” -z.O_1 = line: new ( z.A, z.C).mid -- objects are not stored and cannot be reused. +z.C = L.AB: gold_ratio () % use of a method linked to “line” +z.O_0 = line: new ( z.A, z.B).mid % midpoint of segment with an attribute of “line” +z.O_1 = line: new ( z.A, z.C).mid % objects are not stored and cannot be reused. z.O_2 = line: new ( z.C, z.B).mid -C.AB = circle: new ( z.O_0, z.B) -- new object “circle” stored and reused +C.AB = circle: new ( z.O_0, z.B) % new object “circle” stored and reused C.AC = circle: new ( z.O_1, z.C) C.CB = circle: new ( z.O_2, z.B) -z.P = C.CB.north -- “north” atrributes of a circle +z.P = C.CB.north % “north” atrributes of a circle z.Q = C.AC.north z.O = C.AB.south -z.c = z.C : north (2) -- “north” method of a point (needs a parameter) -C.PC = circle: new ( z.P, z.C) -C.QA = circle: new ( z.Q, z.A) -z.P_0 = intersection (C.PC,C.AB) -- search for intersections of two circles. -z.P_1 = intersection (C.PC,C.AC) -- idem -_,z.P_2 = intersection (C.QA,C.CB) -- idem -z.O_3 = triangle: new ( z.P_0, z.P_1, z.P_2).circumcenter - -- circumcenter attribute of “triangle” -\end{tkzelements} +z.c = z.C : north (2) % “north” method of a point (needs a parameter) +C.PC = circle: new ( z.P, z.C) +C.QA = circle: new ( z.Q, z.A) +z.P_0 = intersection (C.PC,C.AB) % search for intersections of two circles. +z.P_1 = intersection (C.PC,C.AC) % idem +_,z.P_2 = intersection (C.QA,C.CB) % idem +z.O_3 = triangle: new ( z.P_0, z.P_1, z.P_2).circumcenter + % circumcenter attribute of “triangle” +} \end{Verbatim} \begin{Verbatim} @@ -179,24 +178,25 @@ Here's another example with comments \documentclass{standalone} \usepackage{tkz-euclide,tkz-elements} \begin{document} -\begin{tkzelements} - z.A = point: new (2 , 4) -- we create environment tkzelements - z.B = point: new (0 , 0) -- three fixed points are used +\directlua{ + z.A = point: new (2 , 4) + z.B = point: new (0 , 0) % three fixed points are used z.C = point: new (8 , 0) - T.ABC = triangle: new (z.A,z.B,z.C) -- we create a new triangle object - C.ins = T.ABC: in_circle () -- we get the incircle of this triangle - z.I = C.ins.center -- center is an attribute of the circle - z.T = C.ins.through -- through is also an attribute - -- z.I,z.T = get_points (C.ins) -- get_points is a shortcut - C.cir = T.ABC : circum_circle () -- we get the circumscribed circle - z.W = C.cir.center -- we get the center of this circle - z.O = C.cir.south -- now we get the south pole of this circle - L.AO = line: new (z.A,z.O) -- we create an object "line" - L.BC = T.ABC.bc -- we get the line (BC) - z.I_A = intersection (L.AO,L.BC) -- we search the intersection of the last lines -\end{tkzelements} + T.ABC = triangle: new (z.A,z.B,z.C) % we create a new triangle object + C.ins = T.ABC: in_circle () % we get the incircle of this triangle + z.I = C.ins.center % center is an attribute of the circle + z.T = C.ins.through % through is also an attribute + -- z.I,z.T = get_points (C.ins) % get_points is a shortcut + C.cir = T.ABC : circum_circle () % we get the circumscribed circle + z.W = C.cir.center % we get the center of this circle + z.O = C.cir.south % now we get the south pole of this circle + L.AO = line: new (z.A,z.O) % we create an object "line" + L.BC = T.ABC.bc % we get the line (BC) + z.I_A = intersection (L.AO,L.BC) % we search the intersection of the last lines +} \end{Verbatim} -\begin{tkzelements} +\directlua{ + init_elements () scale = 1.2 z.A = point: new (2 , 4) z.B = point: new (0 , 0) @@ -205,14 +205,13 @@ Here's another example with comments C.ins = T.ABC: in_circle () z.I = C.ins.center z.T = C.ins.through --- z.I,z.T = get_points (C.ins) C.cir = T.ABC : circum_circle () z.W = C.cir.center z.O = C.cir.south L.AO = line: new (z.A,z.O) L.BC = T.ABC.bc z.I_A = intersection (L.AO,L.BC) -\end{tkzelements} +} \hspace*{\fill} \begin{tikzpicture} @@ -229,7 +228,7 @@ Here's another example with comments \tkzLabelPoints[above](A) \end{tikzpicture} \hspace*{\fill} - +% Here's the tikzpicture environment to obtain the drawing: \begin{Verbatim} \begin{tikzpicture} diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-structure.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-structure.tex index d1958d4763..510b43df37 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-structure.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-structure.tex @@ -1,12 +1,10 @@ \section{Structure} % (fold) \label{sec:structure} -\tkzNamePack{tkz-elements} loads the \tkzNamePack{luacode} package to create the \tkzNameEnv{tkzelements} environment, which is based on the \tkzNameEnv{luacode} environment. - -Within the \tkzNameEnv{tkzelements} environment, the scale is initialized to 1, and then all values in various tables are cleared. +After loading the package, the scale is initialized to 1, and then all values in various tables are cleared. The package defines two macros |\tkzGetNodes| and |\tkzUseLua|. -Additionally, the package loads the file |tkz_elements_main.lua|. This file initializes all the tables that will be used by the modules in which the classes are defined. +Additionally, the package loads the file |tkz_elements_main.lua|. This file initializes all the tables that will be used by the modules in which the classes are defined. In this file, a function is defined to reset all tables and the scale. This is the function \Igfct{tkz-elements}{init\_elements}. \begin{tikzpicture}[scale=.75] \begin{scope} @@ -22,9 +20,7 @@ Additionally, the package loads the file |tkz_elements_main.lua|. This file ini L2/.style={level distance=65mm,minimum size=2cm}] node[concept,circular drop shadow] {|tkz-elements.sty|} [clockwise from=10] - child[concept color=MidnightBlue!40,minimum size=16mm] { - node[concept,circular drop shadow] {|luacode|} -} + child[concept color= MidnightBlue!80,minimum size=4cm,text width=38mm, clockwise from=27] { node[concept,circular drop shadow] {|tkz\_elements\_main|} @@ -45,13 +41,11 @@ clockwise from=27] { \end{scope} \end{tikzpicture} -The current classes are (some are still inactive): -\begin{itemize} - \item active : \Iclass{point} (z) ; \Iclass{line} (L) ; \Iclass{circle} (C) ; \Iclass{triangle} (T) ; \Iclass{ellipse} (E) ; \Iclass{quadrilateral} (Q) ; \Iclass{square} (S) ; \Iclass{rectangle} (R) ; \Iclass{parallelogram} (P) ; \Iclass{regular\_polygon} (RP); \Iclass{vector} (V). +The current classes are : + + \Iclass{point} (z) ; \Iclass{line} (L) ; \Iclass{circle} (C) ; \Iclass{triangle} (T) ; \Iclass{ellipse} (E) ; \Iclass{quadrilateral} (Q) ; \Iclass{square} (S) ; \Iclass{rectangle} (R) ; \Iclass{parallelogram} (P) ; \Iclass{regular\_polygon} (RP); \Iclass{vector} (V) and \Iclass{matrix} (M). - \item inactive : matrix (M) ; vector (V). -\end{itemize} If |name| is name of a class, you can find its definition in the file |tkz_elements_name.lua|. diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-transfers.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-transfers.tex index 264097e9b8..1b65e4dabe 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-transfers.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-transfers.tex @@ -5,11 +5,11 @@ \subsection{From Lua to tkz-euclide or TikZ} % (fold) \label{sub:fom_lua_to_tkz_euclide_or_tikz} -In this section, we'll explore how to transfer points, Booleans, and numerical values. +In this section, we'll explore how to transfer points, booleans, and numerical values. \subsubsection{Points transfer} % (fold) \label{ssub:points_transfer} -We utilize an environment \tkzname{tkzelements} outside an \tkzname{tikzpicture} environment which allows us to perform all the necessary calculations. Then, we execute the macro \Imacro{tkzGetNodes} which transforms the affixes of the table |z| into \tkzname{Nodes}. Finally, we proceed with the drawing. +The necessary definitions and calculations are performed with the primitive \tkzcname{directlua} or inside the environment \tkzNameEnv{tkzelements}. Then, we execute the macro \Imacro{tkzGetNodes} which transforms the affixes of the table |z| into \tkzname{Nodes}. Finally, we proceed with the drawing. At present, the drawing program is either \TIKZ\ or \pkg{tkz-euclide}. However, you have the option to use another package for plotting. To do so, you'll need to create a macro similar to \tkzcname{tkzGetNodes}. Of course, this package must be capable of storing points like \TIKZ\ or \pkg{tkz-euclide}. @@ -34,18 +34,20 @@ end} \end{mybox} See the section In-depth Study \ref{sec:in_depth_study} for an explanation of the previous code. -The environment \tkzNameEnv{tkzelements} allows to use the underscore |_| and the macro \tkzcname{tkzGetNodes} allows to obtain names of nodes containing \tkzname{prime} or \tkzname{double prime}. (Refer to the next example) +Point names can contain the underscore |_| and the macro \tkzcname{tkzGetNodes} allows to obtain names of nodes containing \tkzname{prime} or \tkzname{double prime}. (Refer to the next example) +\vspace{6pt} \begin{minipage}{0.5\textwidth} \begin{Verbatim} -\begin{tkzelements} - scale = 1.2 +\directlua{ + init_elements () + scale = 1.5 z.o = point: new (0,0) z.a_1 = point: new (2,1) z.a_2 = point: new (1,2) z.ap = z.a_1 + z.a_2 z.app = z.a_1 - z.a_2 -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawSegments(o,a_1 o,a_2 o,a' o,a'') @@ -57,14 +59,15 @@ The environment \tkzNameEnv{tkzelements} allows to use the underscore |_| and th \end{Verbatim} \end{minipage} \begin{minipage}{0.5\textwidth} -\begin{tkzelements} - scale = 1.2 +\directlua{ + init_elements () + scale = 1.5 z.o = point: new (0,0) z.a_1 = point: new (2,1) z.a_2 = point: new (1,2) z.ap = z.a_1 + z.a_2 z.app = z.a_1 - z.a_2 -\end{tkzelements} +} \hspace{\fill} \begin{tikzpicture} \tkzGetNodes @@ -78,15 +81,42 @@ The environment \tkzNameEnv{tkzelements} allows to use the underscore |_| and th \end{minipage}% \newpage +% subsubsection points_transfer (end) % subsection fom_lua_to_tkz_euclide_or_tikz (end) + \subsubsection{Other transfers} % (fold) \label{ssub:other_transfers} Sometimes it's useful to transfer angle, length measurements or boolean. For this purpose, I have created the macro (refer to \ref{sub:transfer_from_lua_to_tex}) \IEmacro{tkzUseLua(value)} +\begin{mybox} + \begin{Verbatim} + \def\tkzUseLua#1{\directlua{tex.print(tostring(#1))}} +\end{Verbatim} +\end{mybox} +\directlua{ +init_elements () +z.b = point: new (1,1) +z.a = point: new (4,2) +z.c = point: new (2,2) +z.d = point: new (5,1) +L.ab = line : new (z.a,z.b) +L.cd = line : new (z.c,z.d) +det = (z.b-z.a)^(z.d-z.c) +if det == 0 then bool = true + else bool = false +end +x = intersection (L.ab,L.cd) +} + +The intersection of the two lines lies at +a point whose affix is: \tkzUseLua{x} + +\begin{minipage}{0.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{ + init_elements () z.b = point: new (1,1) z.a = point: new (4,2) z.c = point: new (2,2) @@ -98,14 +128,12 @@ Sometimes it's useful to transfer angle, length measurements or boolean. For thi else bool = false end x = intersection (L.ab,L.cd) -\end{tkzelements} - +} The intersection of the two lines lies at a point whose affix is:\tkzUseLua{x} - \begin{tikzpicture} \tkzGetNodes - \tkzInit[xmin =-1,ymin=-1,xmax=6,ymax=3] + \tkzInit[xmin =0,ymin=0,xmax=5,ymax=3] \tkzGrid\tkzAxeX\tkzAxeY \tkzDrawPoints(a,...,d) \ifthenelse{\equal{\tkzUseLua{bool}}{true}}{ @@ -114,29 +142,12 @@ The intersection of the two lines lies at \tkzLabelPoints(a,...,d) \end{tikzpicture} \end{Verbatim} - -\begin{tkzelements} -z.b = point: new (1,1) -z.a = point: new (4,2) -z.c = point: new (2,2) -z.d = point: new (5,1) -L.ab = line : new (z.a,z.b) -L.cd = line : new (z.c,z.d) -det = (z.b-z.a)^(z.d-z.c) -if det == 0 then bool = true - else bool = false -end -x = intersection (L.ab,L.cd) -\end{tkzelements} - -The intersection of the two lines lies at -a point whose affix is: \tkzUseLua{x} - -\vspace{1em} +\end{minipage} +\begin{minipage}{0.5\textwidth} \hspace{\fill} \begin{tikzpicture} \tkzGetNodes - \tkzInit[xmin =-1,ymin=-1,xmax=6,ymax=3] + \tkzInit[xmin =0,ymin=0,xmax=5,ymax=3] \tkzGrid\tkzAxeX\tkzAxeY \tkzDrawPoints(a,...,d) \ifthenelse{\equal{\tkzUseLua{bool}}{true}}{ @@ -144,9 +155,306 @@ a point whose affix is: \tkzUseLua{x} \tkzDrawSegments[blue](a,b c,d)} \tkzLabelPoints(a,...,d) \end{tikzpicture} - \hspace{\fill} + \hspace{\fill} + \end{minipage} + % subsubsection other_transfers (end) -% subsubsection points_transfer (end) +\subsubsection{Example 1} % (fold) +\label{ssub:example_1} + +In this example, it's necessary to transfer the function to the Lua part, then retrieve the curve point coordinates from \TeX. + +The main tools used are a table and its methods (\Imeth{table}{insert},\Imeth{table}{concat}) and the \Igfct{lua}{load} function. + +\begin{Verbatim} +\makeatletter\let\percentchar\@percentchar\makeatother +\directlua{ + function list (f,min,max,nb) + local tbl = {} + for x = min, max, (max - min) / nb do + table.insert (tbl, ('(\percentchar f,\percentchar f)'):format (x, f (x))) + end + return table.concat (tbl) + end +} +\def\plotcoords#1#2#3#4{% +\directlua{% + f = load (([[ + return function (x) + return (\percentchar s) + end + ]]):format ([[#1]]), nil, 't', math) () +tex.print(list(f,#2,#3,#4))} +} +\begin{tikzpicture} +\tkzInit[xmin=1,xmax=3,ymin=0,ymax=2] +\tkzGrid +\tkzDrawX[right=3pt,label={$x$}] +\tkzDrawY[above=3pt,label={$f(x) = \dfrac{1-\mathrm{e}^{-x^2}}{1+\mathrm{e}^{-x^2}}$}] +\draw[cyan,thick] plot coordinates {\plotcoords{(1-exp(-x^2))/(exp(-x^2)+1)}{-3}{3}{100}}; +\end{tikzpicture} +\end{Verbatim} + + +\makeatletter\let\percentchar\@percentchar\makeatother +\directlua{ + function list (f,min,max,nb) + local tbl = {} + for x = min, max, (max - min) / nb do + table.insert (tbl, ('(\percentchar f,\percentchar f)'):format (x, f (x))) + end + return table.concat (tbl) + end +} + +\def\plotcoords#1#2#3#4{% +\directlua{% + f = load (([[ + return function (x) + return (\percentchar s) + end + ]]):format ([[#1]]), nil, 't', math) () +tex.print(list(f,#2,#3,#4))} +} + +\begin{tikzpicture} +\tkzInit[xmin=1,xmax=3,ymin=0,ymax=2] +\tkzGrid +\tkzDrawX[right=3pt,label={$x$}] +\tkzDrawY[above=3pt,label={$f(x) = \dfrac{1-\mathrm{e}^{-x^2}}{1+\mathrm{e}^{-x^2}}$}] +\draw[cyan,thick] plot coordinates {\plotcoords{(1-exp(-x^2))/(exp(-x^2)+1)}{-3}{3}{100}}; + +\end{tikzpicture} + +% subsubsection example_1 (end) + +\subsubsection{Example 2} % (fold) +\label{ssub:example_2} + +This consists in passing a number (the number of sides) from \TeX\ to \code{Lua}. This is made easier by using the \Iprimitive{directlua} primitive. This example is based on a answer from egreg [\href{https://tex.stackexchange.com/questions/729009/how-can-these-regular-polygons-be-arranged-within-a-page/731503#731503}{egreg--tex.stackexchange.com}] + +\begin{Verbatim} +\directlua{ + z.I = point: new (0,0) + z.A = point: new (2,0) +} +\def\drawPolygon#1{ +\directlua{ + RP.six = regular_polygon : new (z.I,z.A,#1) + RP.six : name ("P_") + } +\begin{tikzpicture}[scale=.5] + \def\nb{\tkzUseLua{RP.six.nb}} + \tkzGetNodes + \tkzDrawCircles(I,A) + \tkzDrawPolygon(P_1,P_...,P_\nb) + \tkzDrawPoints[red](P_1,P_...,P_\nb) +\end{tikzpicture} +} +\foreach [count=\i] \n in {3, 4, ..., 10} { + \makebox[0.2\textwidth]{% + \begin{tabular}[t]{@{}c@{}} + $n=\n$ \\[1ex] + \drawPolygon{\n} + \end{tabular}% + }\ifnum\i=4 \\[2ex]\fi +} +\end{Verbatim} + +\directlua{ + z.I = point: new (0,0) + z.A = point: new (2,0) +} +\def\drawPolygon#1{ +\directlua{ + RP.six = regular_polygon : new (z.I,z.A,#1) + RP.six : name ("P_") + } +\begin{tikzpicture}[scale=.5] + \def\nb{\tkzUseLua{RP.six.nb}} + \tkzGetNodes + \tkzDrawCircles(I,A) + \tkzDrawPolygon(P_1,P_...,P_\nb) + \tkzDrawPoints[red](P_1,P_...,P_\nb) +\end{tikzpicture} +} +\foreach [count=\i] \n in {3, 4, ..., 10} { + \makebox[0.2\textwidth]{% + \begin{tabular}[t]{@{}c@{}} + $n=\n$ \\[1ex] + \drawPolygon{\n} + \end{tabular}% + }\ifnum\i=4 \\[2ex]\fi +} + +% subsubsection example_2 (end) + +\subsubsection{Example 3} % (fold) +\label{ssub:example_3} + +This time, the transfer will be carried out using an external file. The following example is based on this one, but using a table. + +\directlua{ + z.a = point: new (1,0) + z.b = point: new (3,2) + z.c = point: new (0,2) + A,B,C = parabola (z.a,z.b,z.c) + + function f(t0, t1, n) + local out=assert(io.open("tmp.table","w")) + local y + for t = t0,t1,(t1-t0)/n do + y = A*t^2+B*t +C + out:write(t, " ", y, " i\string\n") + end + out:close() + end + } + +\begin{minipage}{0.5\textwidth} +\begin{Verbatim} +\directlua{ + z.a = point: new (1,0) + z.b = point: new (3,2) + z.c = point: new (0,2) + A,B,C = parabola (z.a,z.b,z.c) + + function f(t0, t1, n) + local out=assert(io.open("tmp.table","w")) + local y + for t = t0,t1,(t1-t0)/n do + y = A*t^2+B*t +C + out:write(t, " ", y, " i\string\n") + end + out:close() + end + } +\begin{tikzpicture} + \tkzGetNodes + \tkzInit[xmin=-1,xmax=5,ymin=0,ymax=6] + \tkzDrawX\tkzDrawY + \tkzDrawPoints[red,size=2](a,b,c) + \directlua{f(-1,3,100)}% + \draw[domain=-1:3] plot[smooth] file {tmp.table}; +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{0.5\textwidth} +\begin{tikzpicture} + \tkzGetNodes + \tkzInit[xmin=-1,xmax=5,ymin=0,ymax=6] + \tkzDrawX\tkzDrawY + \tkzDrawPoints[red,size=2](a,b,c) + \directlua{f(-1,3,100)}% + \draw[domain=-1:3] plot[smooth] file {tmp.table}; +\end{tikzpicture} +\end{minipage} +% subsubsection example_3 (end) + +\subsubsection{Example 4} % (fold) +\label{ssub:example_4} + +The result is identical to the previous one. +\begin{Verbatim} +\directlua{ + z.a = point: new (1,0) + z.b = point: new (3,2) + z.c = point: new (0,2) + A,B,C = parabola (z.a,z.b,z.c) + + function f(t0, t1, n) + local tbl = {} + for t = t0,t1,(t1-t0)/n do + y = A*t^2+B*t +C + table.insert (tbl, "("..t..","..y..")") + end + return table.concat (tbl) +end +} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawX\tkzDrawY + \tkzDrawPoints[red,size=2pt](a,b,c) + \draw[domain=-2:3,smooth] plot coordinates {\directlua{tex.print(f(-2,3,100))}}; +\end{tikzpicture} +\end{Verbatim} +% subsubsection example_4 (end) + +\subsubsection{Example 5} % (fold) +\label{ssub:example_5} + +\begin{Verbatim} +\makeatletter\let\percentchar\@percentchar\makeatother +\directlua{ +function cellx (start,step,n) +return start+step*(n-1) +end +} +\def\calcval#1#2{% +\directlua{ + f = load (([[ + return function (x) + return (\percentchar s) + end + ]]):format ([[#1]]), nil, 't', math) () +x = #2 +tex.print(string.format("\percentchar.2f",f(x)))} +} +\def\fvalues(#1,#2,#3,#4) {% +\def\firstline{$x$} + \foreach \i in {1,2,...,#4}{% + \xdef\firstline{\firstline & \tkzUseLua{cellx(#2,#3,\i)}}} +\def\secondline{$f(x)=#1$} + \foreach \i in {1,2,...,#4}{% + \xdef\secondline{\secondline & + \calcval{#1}{\tkzUseLua{cellx(#2,#3,\i)}}}} +\begin{tabular}{l*{#4}c} + \toprule + \firstline \\ + \secondline \\ + \bottomrule + \end{tabular} +} +\fvalues(x^2-3*x+1,-2,.25,8) +\vspace{12pt} + +\end{Verbatim} + +\makeatletter\let\percentchar\@percentchar\makeatother +\directlua{ +function cellx (start,step,n) +return start+step*(n-1) +end +} +\def\calcval#1#2{% +\directlua{ + f = load (([[ + return function (x) + return (\percentchar s) + end + ]]):format ([[#1]]), nil, 't', math) () +x = #2 +tex.print(string.format("\percentchar.2f",f(x)))} +} +\def\fvalues(#1,#2,#3,#4) {% +\def\firstline{$x$} + \foreach \i in {1,2,...,#4}{% + \xdef\firstline{\firstline & \tkzUseLua{cellx(#2,#3,\i)}}} +\def\secondline{$f(x)=#1$} + \foreach \i in {1,2,...,#4}{% + \xdef\secondline{\secondline & + \calcval{#1}{\tkzUseLua{cellx(#2,#3,\i)}}}} +\begin{tabular}{l*{#4}c} + \toprule + \firstline \\ + \secondline \\ + \bottomrule + \end{tabular} +} +\fvalues(x^2-3*x+1,-2,.25,8) +\vspace{12pt} + +% subsubsection example_5 (end) % section transfers (end) \endinput
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-why.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-why.tex index 6ab030ee2f..4b28826391 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-why.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-why.tex @@ -76,7 +76,7 @@ This version utilizes the simplest construction method made possible by Lua. \begin{mybox} \begin{Verbatim} -\begin{tkzelements} +\directlua{ scale = .4 z.A = point: new (0,0) z.B = point: new (6,0) @@ -95,7 +95,7 @@ This version utilizes the simplest construction method made possible by Lua. C.apo = C.ortho : inversion (C.euler) z.O = C.apo.center z.xa,z.xb,z.xc = C.ortho : inversion (z.Ea,z.Eb,z.Ec) -\end{tkzelements} +} \end{Verbatim} \end{mybox} @@ -160,7 +160,7 @@ The subsequent section exclusively deals with drawings, and is managed by \pkg{t \end{Verbatim} \vspace{1em} -\begin{tkzelements} +\directlua{ scale = .4 z.A = point: new (0,0) z.B = point: new (6,0) @@ -179,7 +179,7 @@ The subsequent section exclusively deals with drawings, and is managed by \pkg{t C.apo = C.ortho : inversion (C.euler) z.O = C.apo.center z.xa,z.xb,z.xc = C.ortho : inversion (z.Ea,z.Eb,z.Ec) -\end{tkzelements} +} \begin{minipage}{\textwidth} \hspace*{\fill} \begin{tikzpicture} diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/tmp.table b/macros/latex/contrib/tkz/tkz-elements/doc/latex/tmp.table new file mode 100644 index 0000000000..2d2b1e66d4 --- /dev/null +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/tmp.table @@ -0,0 +1,100 @@ +-1 6 i +-0.96 5.8016 i +-0.92 5.6064 i +-0.88 5.4144 i +-0.84 5.2256 i +-0.8 5.04 i +-0.76 4.8576 i +-0.72 4.6784 i +-0.68 4.5024 i +-0.64 4.3296 i +-0.6 4.16 i +-0.56 3.9936 i +-0.52 3.8304 i +-0.48 3.6704 i +-0.44 3.5136 i +-0.4 3.36 i +-0.36 3.2096 i +-0.32 3.0624 i +-0.28 2.9184 i +-0.24 2.7776 i +-0.2 2.64 i +-0.16 2.5056 i +-0.12 2.3744 i +-0.08 2.2464 i +-0.04 2.1216 i +3.4694469519536e-16 2 i +0.04 1.8816 i +0.08 1.7664 i +0.12 1.6544 i +0.16 1.5456 i +0.2 1.44 i +0.24 1.3376 i +0.28 1.2384 i +0.32 1.1424 i +0.36 1.0496 i +0.4 0.96 i +0.44 0.8736 i +0.48 0.7904 i +0.52 0.7104 i +0.56 0.6336 i +0.6 0.56 i +0.64 0.4896 i +0.68 0.4224 i +0.72 0.3584 i +0.76 0.2976 i +0.8 0.24 i +0.84 0.1856 i +0.88 0.1344 i +0.92 0.086399999999999 i +0.96 0.041599999999999 i +1 -4.4408920985006e-16 i +1.04 -0.0384 i +1.08 -0.0736 i +1.12 -0.1056 i +1.16 -0.1344 i +1.2 -0.16 i +1.24 -0.1824 i +1.28 -0.2016 i +1.32 -0.2176 i +1.36 -0.2304 i +1.4 -0.24 i +1.44 -0.2464 i +1.48 -0.2496 i +1.52 -0.2496 i +1.56 -0.2464 i +1.6 -0.24 i +1.64 -0.2304 i +1.68 -0.2176 i +1.72 -0.2016 i +1.76 -0.1824 i +1.8 -0.16 i +1.84 -0.1344 i +1.88 -0.1056 i +1.92 -0.073599999999999 i +1.96 -0.038399999999998 i +2 1.7763568394003e-15 i +2.04 0.041600000000001 i +2.08 0.086400000000002 i +2.12 0.1344 i +2.16 0.1856 i +2.2 0.24 i +2.24 0.2976 i +2.28 0.3584 i +2.32 0.4224 i +2.36 0.4896 i +2.4 0.56 i +2.44 0.6336 i +2.48 0.7104 i +2.52 0.7904 i +2.56 0.8736 i +2.6 0.96 i +2.64 1.0496 i +2.68 1.1424 i +2.72 1.2384 i +2.76 1.3376 i +2.8 1.44 i +2.84 1.5456 i +2.88 1.6544 i +2.92 1.7664 i +2.96 1.8816 i diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/tkz-elements.pdf b/macros/latex/contrib/tkz/tkz-elements/doc/tkz-elements.pdf Binary files differindex edb5864f4f..f7ba1922c0 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/tkz-elements.pdf +++ b/macros/latex/contrib/tkz/tkz-elements/doc/tkz-elements.pdf diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz-elements.sty b/macros/latex/contrib/tkz/tkz-elements/latex/tkz-elements.sty index 597a050850..821fe56225 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz-elements.sty +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz-elements.sty @@ -1,5 +1,5 @@ % encoding : utf8 -% tkz-elements.sty v2.30c +% tkz-elements.sty v3.0c % Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -11,29 +11,33 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\ProvidesPackage{tkz-elements}[2024/07/16 version 2.30c Graphic Object Library] -\RequirePackage{luacode} -\directlua{require "tkz_elements_main"} +\ProvidesPackage{tkz-elements}[2024/07/16 version 3.00 Graphic Object Library] +%\RequirePackage{luacode} + \directlua{ + require "tkz_elements_main" + tkz_epsilon=1e-8 + tkz_dc=2 + indirect = true + init_elements()}% + \newenvironment{tkzelements} { \directlua{scale=1} - \directlua{tkz_epsilon=1e-8} - \directlua{tkz_dc=2} - \directlua{indirect = true} - \directlua{z={} - C={} - E={} - L={} - M={} - P={} - Q={} - R={} - RP={} - S={} - T={} - V={}} + \directlua{z = {} + C = {} + E = {} + L = {} + M = {} + P = {} + Q = {} + R = {} + RP= {} + S = {} + T = {} + V = {}} \luacode} - {\endluacode} + {\endluacode}% + % new version of the next macro proposed by Sanskar Singh \def\tkzGetNodes{\directlua{% for K,V in pairs(z) do diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_circle.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_circle.lua index e17ccb2ebb..6bb0c7c4f0 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_circle.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_circle.lua @@ -1,6 +1,6 @@ -- tkz_elements-circles.lua -- date 2024/07/16 --- version 2.30c +-- version 3.00 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_class.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_class.lua index 3ded691d53..6d5fae53ec 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_class.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_class.lua @@ -1,6 +1,6 @@ -- tkz_elements_class.lua -- date 2024/07/16 --- version 2.30c +-- version 3.00 -- from class.lua (Simple Lua Classes from Lua-users wiki) -- Compatible with Lua 5.1 (not 5.0). -- http://lua-users.org/wiki/SimpleLuaClasses DavidManura diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_ellipse.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_ellipse.lua index 7581c19d7a..cbc3a3969c 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_ellipse.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_ellipse.lua @@ -1,6 +1,6 @@ -- tkz_elements-ellipses.lua -- date 2024/07/16 --- version 2.30c +-- version 3.00 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_circles.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_circles.lua index 88f9040b7f..3208f7a5d3 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_circles.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_circles.lua @@ -1,6 +1,6 @@ -- tkz_elements_functions_circles.lua -- date 2024/07/16 --- version 2.30c +-- version 3.00 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_intersections.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_intersections.lua index fe253e9aa2..750bafe078 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_intersections.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_intersections.lua @@ -1,6 +1,6 @@ -- tkz_elements_intersections.lua -- date 2024/07/16 --- version 2.30c +-- version 3.00 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_lines.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_lines.lua index a5504593c0..31c735df6f 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_lines.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_lines.lua @@ -1,6 +1,6 @@ -- tkz_elements_functions_lines.lua -- date 2024/07/16 --- version 2.30c +-- version 3.00 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_maths.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_maths.lua index c3f7e54ffd..d3efe9b290 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_maths.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_maths.lua @@ -1,6 +1,6 @@ -- tkz_elements_functions_maths.lua -- date 2024/07/16 --- version 2.30c +-- version 3.00 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_matrices.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_matrices.lua index c80420090f..3ced42be40 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_matrices.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_matrices.lua @@ -1,6 +1,6 @@ -- tkz_elements_functions_matrices.lua -- date 2024/07/16 --- version 2.30c +-- version 3.00 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_points.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_points.lua index e2366e25e3..59454e78f0 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_points.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_points.lua @@ -1,6 +1,6 @@ -- tkz_elements_functions_points.lua -- date 2024/07/16 --- version 2.30c +-- version 3.00 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_regular.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_regular.lua index 0f74d28fe9..0dfed425ae 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_regular.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_regular.lua @@ -1,6 +1,6 @@ -- tkz_elements_functions_regular.lua -- date 2024/07/16 --- version 2.30c +-- version 3.00 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_triangles.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_triangles.lua index 02d3058a16..5a81a993e1 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_triangles.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_triangles.lua @@ -1,6 +1,6 @@ -- tkz_elements_functions_triangles.lua -- date 2024/07/16 --- version 2.30c +-- version 3.00 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_line.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_line.lua index 797365f33f..4d24d9d229 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_line.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_line.lua @@ -1,6 +1,6 @@ -- tkz_elements_lines.lua -- date 2024/07/16 --- version 2.30c +-- version 3.00 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 @@ -437,6 +437,14 @@ function line: sas (a,phi) pt = rotation_ (self.pa,phi,x) return triangle : new (self.pa,self.pb,pt) end + +function line: asa (alpha,beta) + local pta,ptb,pt + pta = rotation_ (self.pa,alpha,self.pb) + ptb = rotation_ (self.pb,-beta,self.pa) + pt = intersection_ll_ (self.pa,pta,self.pb,ptb) + return triangle : new (self.pa,self.pb,pt) +end ---- sacred triangles ---- function line: gold (swap) diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_main.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_main.lua index 142f00c8ed..e4f5c7623e 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_main.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_main.lua @@ -1,6 +1,6 @@ -- tkz_elements-main.lua -- date 2024/07/16 --- version 2.30c +-- version 3.00 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 @@ -12,20 +12,7 @@ -- This work has the LPPL maintenance status “maintained”. -- The Current Maintainer of this work is Alain Matthes. - z = {} - C = {} - E = {} - L = {} - P = {} - M = {} - Q = {} - R = {} - RP = {} - S = {} - T = {} - V = {} - - -- loads module +-- loads module require "tkz_elements_point.lua" require "tkz_elements_line.lua" require "tkz_elements_circle.lua" @@ -48,4 +35,20 @@ require "tkz_elements_functions_circles.lua" require "tkz_elements_functions_triangles.lua" require "tkz_elements_functions_regular.lua" require "tkz_elements_functions_matrices.lua" -require "tkz_elements_matrices.lua"
\ No newline at end of file +require "tkz_elements_matrices.lua" + +function init_elements () + scale=1 + z={} + C={} + E={} + L={} + M={} + P={} + Q={} + R={} + RP={} + S={} + T={} + V={} +end
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_matrices.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_matrices.lua index 035e8a0a33..f0bd69b95e 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_matrices.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_matrices.lua @@ -1,6 +1,6 @@ -- tkz_elements_matrices.lua -- date 2024/07/16 --- version 2.30c +-- version 3.00 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_misc.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_misc.lua index daa3e21872..7fcac90d86 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_misc.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_misc.lua @@ -1,6 +1,6 @@ -- tkz_elements_functions_maths.lua -- date 2024/07/16 --- version 2.30c +-- version 3.00 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_parallelogram.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_parallelogram.lua index d471976d06..a6dc3360f9 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_parallelogram.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_parallelogram.lua @@ -1,6 +1,6 @@ -- tkz_elements_parallelogram.lua -- date 2024/07/16 --- version 2.30c +-- version 3.00 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_point.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_point.lua index e29779ef79..3ec0262051 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_point.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_point.lua @@ -1,6 +1,6 @@ -- tkz_elements_point.lua -- date 2024/07/16 --- version 2.30c +-- version 3.00 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_quadrilateral.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_quadrilateral.lua index 6625b9d789..fc3e95b28f 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_quadrilateral.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_quadrilateral.lua @@ -1,6 +1,6 @@ -- tkz_elements_quadrilateral.lua -- date 2024/07/16 --- version 2.30c +-- version 3.00 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_rectangle.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_rectangle.lua index fdc3084501..a531722020 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_rectangle.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_rectangle.lua @@ -1,6 +1,6 @@ -- tkz_elements-rectangle.lua -- date 2024/07/16 --- version 2.30c +-- version 3.00 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_regular.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_regular.lua index a4527c779b..bf49fca814 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_regular.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_regular.lua @@ -1,6 +1,6 @@ -- tkz_elements_regular.lua -- date 2024/07/16 --- version 2.30c +-- version 3.00 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 @@ -15,7 +15,7 @@ regular_polygon = {} function regular_polygon: new (za, zb ,nb) local type = 'regular_polygon' - local table = regular_ (za , zb , nb) + local table = regular_ (za , zb , nb) local center = za local through = zb local angle = 2 * math.pi/nb @@ -52,7 +52,7 @@ end ----------------------- function regular_polygon : incircle () local next,first - next = self.table[2] + next = self.table[2] first = self.table[1] return circle : new ( self.center , projection_ (first,next,self.center) ) end diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_square.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_square.lua index 93860b825c..68bfa8dec0 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_square.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_square.lua @@ -1,6 +1,6 @@ -- tkz_elements-square.lua -- date 2024/07/16 --- version 2.30c +-- version 3.00 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_triangle.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_triangle.lua index 84b10273da..6318a7d8d1 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_triangle.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_triangle.lua @@ -1,6 +1,6 @@ -- tkz_elements_triangles.lua -- date 2024/07/16 --- version 2.30c +-- version 3.00 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_vector.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_vector.lua index 0dcbbfde61..fcd63c783a 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_vector.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_vector.lua @@ -1,6 +1,6 @@ -- tkz_elements_vectors.lua -- date 2024/07/16 --- version 2.30c +-- version 3.00 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 diff --git a/macros/luatex/generic/luamplib/NEWS b/macros/luatex/generic/luamplib/NEWS index f53e2b3602..5ac7214c40 100644 --- a/macros/luatex/generic/luamplib/NEWS +++ b/macros/luatex/generic/luamplib/NEWS @@ -1,5 +1,11 @@ History of the luamplib package +2024/11/25 2.35.1 + * cope with 'TEX(char13)': remove everything from char13 to the end of + input string (https://tug.org/pipermail/metapost/2024-November/003572.html) + + * (WIP) avoid internal command names of tagpdf/kernel code (#151) + 2024/11/12 2.35.0 * even under \mplibtextextlabel{true}, the original 'infont' operator will be used when the character slot of the text argument is less than 32, or is diff --git a/macros/luatex/generic/luamplib/luamplib.dtx b/macros/luatex/generic/luamplib/luamplib.dtx index 0510b15120..87566e4630 100644 --- a/macros/luatex/generic/luamplib/luamplib.dtx +++ b/macros/luatex/generic/luamplib/luamplib.dtx @@ -85,7 +85,7 @@ See source file '\inFileName' for licencing and contact information. %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{luamplib.drv}% - [2024/11/12 v2.35.0 Interface for using the mplib library]% + [2024/11/25 v2.35.1 Interface for using the mplib library]% \documentclass{ltxdoc} \usepackage{metalogo,multicol,xspace} \usepackage[x11names]{xcolor} @@ -155,7 +155,7 @@ See source file '\inFileName' for licencing and contact information. % \author{Hans Hagen, Taco Hoekwater, Elie Roux, Philipp Gesang and Kim Dohyun\\ % Current Maintainer: Kim Dohyun\\ % Support: \url{https://github.com/lualatex/luamplib}} -% \date{2024/11/12 v2.35.0} +% \date{2024/11/25 v2.35.1} % % \maketitle % @@ -243,21 +243,25 @@ See source file '\inFileName' for licencing and contact information. % and outlinetext is supported by our own alternative |mpliboutlinetext| % (see \hyperlink{mpliboutlinetext}{below \S\,1.2}). % -% \leavevmode\llap{\textcolor{red}{☞}\kern1.2\parindent}\relax -% Among these, transparency (|texdoc metafun| \S\,8.2) is so simple that you can apply it to an object, -% with \emph{plain} format as well, +% \begin{description} +% \item[transparency] +% (|texdoc metafun| \S\,8.2) Transparency is so simple that you can apply it to an object, +% with \emph{plain} format as well as \emph{metafun}, % just by appending |withprescript| |"tr_transparency=|\hskip0pt\relax|<number>"| to the sentence. % ($0 \le \hbox{\emph{<number>}} \le 1$) % -% One thing worth mentioning about shading (|texdoc metafun| \S\,8.3) is: +% \item[shading] +% (|texdoc metafun| \S\,8.3) One thing worth mentioning about shading is: % when a color expression is given in string type, % it is regarded by luamplib as % a color expression of \TeX\ side. % For instance, when |withshadecolors("orange", 2/3red)| is given, the first color |"orange"| will be % interpreted as a \pkg{color}, \pkg{xcolor} or \pkg{l3color}'s expression. % +% \item[transparency group] % \hypertarget{metafunformat}{}\relax -% As for transparency group, the current \emph{metafun} document \S\,8.8 is not correct. +% (|texdoc metafun| \S\,8.8) +% As for transparency group, the current \emph{metafun} document is not correct. % The true syntax is: %\begin{verbatim} % draw <picture>|<path> asgroup <string> @@ -267,6 +271,7 @@ See source file '\inFileName' for licencing and contact information. % cannot properly render the isolated or knockout effect. % Transparency group is available with \emph{plain} format as well, with extended functionality. % See \hyperlink{transparencygroup}{below \S\,1.2}. +% \end{description} % % \paragraph{\cs{mplibnumbersystem\{scaled\textbar double\textbar decimal\}}} % Users can choose |numbersystem| option. @@ -552,7 +557,7 @@ See source file '\inFileName' for licencing and contact information. % \item[|alt=...|] sets an alternative text of the figure as given. % This key is needed for ordinary \metapost figures. % You can give alternative text within \metapost code as well: -% |verbatimtex| |\mplibalttext{...}| |etex;| +% |VerbatimTeX| |("\mplibalttext{...}");| % \item[|artifact|] starts an |artifact| MC (marked content). % BBox info will not be added. % This key is intended for decorative figures which have no semantic quality. @@ -561,7 +566,7 @@ See source file '\inFileName' for licencing and contact information. % This key is intended for figures which can be represented by a character or % a small sequence of characters. % You can give actual text within \metapost code as well: -% |verbatimtex| |\mplibactualtext{...}| |etex;| +% |VerbatimTeX| |("\mplibactualtext{...}");| % \item[|text|] starts an |artifact| MC and enables tagging on textext % (the same as |btex| |...| |etex|) boxes. % Horizontal mode is forced by \cs{noindent} command. BBox info will not be added. @@ -1092,8 +1097,8 @@ See source file '\inFileName' for licencing and contact information. luatexbase.provides_module { name = "luamplib", - version = "2.35.0", - date = "2024/11/12", + version = "2.35.1", + date = "2024/11/25", description = "Lua package to typeset Metapost with LuaTeX's MPLib.", } @@ -1572,8 +1577,9 @@ local factor = 65536*(7227/7200) local textext_fmt = 'image(addto currentpicture doublepath unitsquare \z xscaled %f yscaled %f shifted (0,-%f) \z withprescript "mplibtexboxid=%i:%f:%f")' -local function process_tex_text (str) +local function process_tex_text (str, maketext) if str then + if not maketext then str = str:gsub("\r.-$","") end local global = (has_instancename or luamplib.globaltextext or luamplib.codeinherit) and "\\global" or "" local tex_box_id @@ -1798,6 +1804,7 @@ local function protecttexcontents (str) :gsub("%%.-\n", "") :gsub("%%.-$", "") :gsub("%zPerCent%z", "\\%%") + :gsub("\r.-$", "") :gsub("%s+", " ") end luamplib.legacyverbatimtex = true @@ -1820,7 +1827,7 @@ function luamplib.maketext (str, what) end end else - return process_tex_text(str) + return process_tex_text(str, true) -- bool is for 'char13' end end return "" @@ -3732,18 +3739,16 @@ function luamplib.registergroup (boxid, name, opts) local trgroup = pdfetcs.tr_group trgroup.shifts[name] = { get_macro'MPllx', get_macro'MPlly' } local whd - local tagpdf = is_defined'picture@tag@bbox@attribute' + local urx, ury = wd/factor, (ht+dp)/factor if pdfmode then attr = tableconcat(attr) :gsub(decimals,rmzeros) local index = tex.saveboxresource(boxid, attr, res, true, grtype) token.set_macro("luamplib.group."..name, tableconcat{ - "\\prependtomplibbox\\hbox\\bgroup", - tagpdf and "\\luamplibtaggingbegin\\setbox\\mplibscratchbox\\hbox\\bgroup" or "", + "\\mplibstarttoPDF{0}{0}{",urx,"}{",ury,"}", "\\useboxresource ", index, - tagpdf and "\\egroup\\luamplibtaggingBBox\\unhbox\\mplibscratchbox\\luamplibtaggingend" or "", - "\\egroup", + "\\mplibstoptoPDF", }, "global") - whd = format("%.3f %.3f 0", wd/factor, (ht+dp)/factor) :gsub(decimals,rmzeros) + whd = format("%.3f %.3f 0", urx, ury) :gsub(decimals,rmzeros) else trgroup.cnt = (trgroup.cnt or 0) + 1 local objname = format("@mplibtrgr%s", trgroup.cnt) @@ -3759,18 +3764,15 @@ function luamplib.registergroup (boxid, name, opts) "\\special{pdf:econtent}}", } token.set_macro("luamplib.group."..name, tableconcat{ - "\\prependtomplibbox\\hbox\\bgroup", - tagpdf and "\\luamplibtaggingbegin" or "", + "\\mplibstarttoPDF{0}{0}{",urx,"}{",ury,"}", "\\setbox\\mplibscratchbox\\hbox{\\special{pdf:uxobj ", objname, "}}", "\\wd\\mplibscratchbox ", wd, "sp", "\\ht\\mplibscratchbox ", ht, "sp", "\\dp\\mplibscratchbox ", dp, "sp", - tagpdf and "\\luamplibtaggingBBox" or "", "\\box\\mplibscratchbox", - tagpdf and "\\luamplibtaggingend" or "", - "\\egroup", + "\\mplibstoptoPDF", }, "global") - whd = format("%.3f %.3f %.3f", wd/factor, ht/factor, dp/factor) :gsub(decimals,rmzeros) + whd = format("%.3f %.3f %.3f", urx, ht/factor, dp/factor) :gsub(decimals,rmzeros) end info("w/h/d of group '%s': %s", name, whd) end @@ -4199,7 +4201,7 @@ end % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{luamplib} - [2024/11/12 v2.35.0 mplib package for LuaTeX] + [2024/11/25 v2.35.1 mplib package for LuaTeX] \fi \ifdefined\newluafunction\else \input ltluatex @@ -4712,7 +4714,7 @@ end \def\luamplibtagtextbegin#1{} \let\luamplibtagtextend\relax \ifcsname SuspendTagging\endcsname\else\endinput\fi -\ifcsname picture@tag@bbox@attribute\endcsname \else +\ifcsname ver@tagpdf.sty\endcsname \else \ExplSyntaxOn \keys_define:nn{luamplib/notag} { @@ -4741,24 +4743,33 @@ end \let\mplibstoptoPDForiginal\mplibstoptoPDF \let\mplibputtextboxoriginal\mplibputtextbox \ExplSyntaxOn -\tl_new:N \l__tag_luamplib_alt_tl -\tl_new:N \l__tag_luamplib_alt_dflt_tl -\tl_set:Nn\l__tag_luamplib_alt_dflt_tl {metapost~figure} -\tl_new:N \l__tag_luamplib_actual_tl -\tl_new:N \l__tag_luamplib_struct_tl -\tl_set:Nn\l__tag_luamplib_struct_tl {Figure} -\bool_new:N \l__tag_luamplib_usetext_bool -\bool_set_false:N \l__tag_luamplib_usetext_bool +\tl_new:N \l__luamplib_tag_alt_tl +\tl_new:N \l__luamplib_tag_alt_dflt_tl +\tl_set:Nn\l__luamplib_tag_alt_dflt_tl {metapost~figure} +\tl_new:N \l__luamplib_tag_actual_tl +\tl_new:N \l__luamplib_tag_struct_tl +\tl_set:Nn\l__luamplib_tag_struct_tl {Figure} +\bool_new:N \l__luamplib_tag_usetext_bool +\bool_new:N \l__luamplib_tag_BBox_bool +\bool_set_true:N \l__luamplib_tag_BBox_bool +\seq_new:N\l__luamplib_tag_bboxcorr_seq +\bool_new:N\l__luamplib_tag_bboxcorr_bool +\bool_new:N \l__luamplib_tag_debug_bool +\tl_new:N \l__luamplib_BBox_label_tl +\tl_new:N \l__luamplib_BBox_llx_tl +\tl_new:N \l__luamplib_BBox_lly_tl +\tl_new:N \l__luamplib_BBox_urx_tl +\tl_new:N \l__luamplib_BBox_ury_tl \cs_set_nopar:Npn \luamplibtagtextbegin #1 { - \bool_if:NTF \l__tag_luamplib_usetext_bool + \bool_if:NTF \l__luamplib_tag_usetext_bool { \tag_mc_end_push: - \tag_struct_begin:n{tag=NonStruct,stash} - \tag_if_active:T { - \expandafter\xdef\csname luamplib.tagbox.#1\endcsname{\tag_get:n{struct_num}} - } \tag_mc_begin:n{} + \tag_struct_begin:n{tag=NonStruct,stash} + \def\myboxnum{#1} + \edef\mystructnum{\tag_get:n{struct_num}} + \edef\statebeforebox{\inteval{\tag_get:n{struct_counter}+\tag_get:n{mc_counter}}} } { \tag_if_active:TF @@ -4769,10 +4780,19 @@ end } \cs_set_nopar:Npn \luamplibtagtextend { - \bool_if:NTF \l__tag_luamplib_usetext_bool + \bool_if:NTF \l__luamplib_tag_usetext_bool { - \tag_mc_end: + \edef\stateafterbox{\inteval{\tag_get:n{struct_counter}+\tag_get:n{mc_counter}}} + \tag_if_active:T { + \int_compare:nNnTF + {\stateafterbox} + = + {\statebeforebox} + { \cs_gset_nopar:cpe {luamplib.notagbox.\myboxnum} {\mystructnum} } + { \cs_gset_nopar:cpe {luamplib.tagbox.\myboxnum} {\mystructnum} } + } \tag_struct_end: + \tag_mc_end: \tag_mc_begin_pop:n{} } { @@ -4789,21 +4809,24 @@ end \cs_set_nopar:Npn \mplibputtextbox #1 { \vbox to 0pt{\vss\hbox to 0pt{% - \bool_if:NTF \l__tag_luamplib_usetext_bool + \bool_if:NTF \l__luamplib_tag_usetext_bool { \ResumeTagging{luamplib.puttextbox} \tag_mc_end: \cs_if_exist:cTF {luamplib.tagbox.#1} { \tag_struct_use_num:n {\csname luamplib.tagbox.#1\endcsname} - \raise\dp#1\copy#1\hss + \raise\dp#1\copy#1 } { - \msg_warning:nnn{luamplib}{figure-text-reuse}{#1} + \cs_if_exist:cF {luamplib.notagbox.#1} + { + \msg_warning:nnn{luamplib}{figure-text-reuse}{#1} + } \tag_mc_begin:n{} \chardef\mplibtmpnum=#1\relax \tag_mc_reset_box:N \mplibtmpnum - \raise\dp#1\copy#1\hss + \raise\dp#1\copy#1 \tag_mc_end: } \tag_mc_begin:n{artifact} @@ -4811,24 +4834,24 @@ end { \chardef\mplibtmpnum=#1\relax \tag_mc_reset_box:N \mplibtmpnum - \raise\dp#1\copy#1\hss + \raise\dp#1\copy#1 } - }} + \hss}} } \cs_new_nopar:Npn \__luamplib_tagging_begin_figure: { \tag_if_active:T { \tag_mc_end_push: - \tl_if_empty:NT\l__tag_luamplib_alt_tl + \tl_if_empty:NT\l__luamplib_tag_alt_tl { - \msg_warning:nne{luamplib}{alt-text-missing}{\l__tag_luamplib_alt_dflt_tl} - \tl_set:Ne\l__tag_luamplib_alt_tl {\l__tag_luamplib_alt_dflt_tl} + \msg_warning:nne{luamplib}{alt-text-missing}{\l__luamplib_tag_alt_dflt_tl} + \tl_set:Ne\l__luamplib_tag_alt_tl {\l__luamplib_tag_alt_dflt_tl} } \tag_struct_begin:n { - tag=\l__tag_luamplib_struct_tl, - alt=\l__tag_luamplib_alt_tl, + tag=\l__luamplib_tag_struct_tl, + alt=\l__luamplib_tag_alt_tl, } \tag_mc_begin:n{} } @@ -4850,7 +4873,7 @@ end \tag_struct_begin:n { tag=Span, - actualtext=\l__tag_luamplib_actual_tl, + actualtext=\l__luamplib_tag_actual_tl, } \tag_mc_begin:n{} } @@ -4878,54 +4901,49 @@ end { ,alt .code:n = { - \bool_set_true:N \l__tag_graphic_BBox_bool - \bool_set_false:N \l__tag_luamplib_usetext_bool - \tl_set:Ne\l__tag_luamplib_alt_tl{\text_purify:n{#1}} + \bool_set_true:N \l__luamplib_tag_BBox_bool + \bool_set_false:N \l__luamplib_tag_usetext_bool + \tl_set:Ne\l__luamplib_tag_alt_tl{\text_purify:n{#1}} } ,actualtext .code:n = { - \bool_set_false:N \l__tag_graphic_BBox_bool - \bool_set_false:N \l__tag_luamplib_usetext_bool - \tl_set:Ne\l__tag_luamplib_actual_tl{\text_purify:n{#1}} + \bool_set_false:N \l__luamplib_tag_BBox_bool + \bool_set_false:N \l__luamplib_tag_usetext_bool + \tl_set:Ne\l__luamplib_tag_actual_tl{\text_purify:n{#1}} \cs_set_eq:NN \luamplibtaggingbegin \__luamplib_tagging_begin_actualtext: \cs_set_eq:NN \luamplibtaggingend \__luamplib_tagging_end_actualtext: \tag_if_active:T {\noindent} } ,artifact .code:n = { - \bool_set_false:N \l__tag_graphic_BBox_bool - \bool_set_false:N \l__tag_luamplib_usetext_bool + \bool_set_false:N \l__luamplib_tag_BBox_bool + \bool_set_false:N \l__luamplib_tag_usetext_bool \cs_set_eq:NN \luamplibtaggingbegin \__luamplib_tagging_begin_artifact: \cs_set_eq:NN \luamplibtaggingend \__luamplib_tagging_end_artifact: } ,text .code:n = { - \bool_set_false:N \l__tag_graphic_BBox_bool - \bool_set_true:N \l__tag_luamplib_usetext_bool + \bool_set_false:N \l__luamplib_tag_BBox_bool + \bool_set_true:N \l__luamplib_tag_usetext_bool \cs_set_eq:NN \luamplibtaggingbegin \__luamplib_tagging_begin_artifact: \cs_set_eq:NN \luamplibtaggingend \__luamplib_tagging_end_artifact: \tag_if_active:T {\noindent} } - ,correct-BBox .code:n = - { - \bool_set_true:N \l__tag_graphic_bboxcorr_bool - \seq_set_split:Nnn\l__tag_graphic_bboxcorr_seq{~}{#1~0pt~0pt~0pt~0pt} - } ,tag .code:n = { \str_case:nnF {#1} { {artifact} { - \bool_set_false:N \l__tag_graphic_BBox_bool - \bool_set_false:N \l__tag_luamplib_usetext_bool + \bool_set_false:N \l__luamplib_tag_BBox_bool + \bool_set_false:N \l__luamplib_tag_usetext_bool \cs_set_eq:NN \luamplibtaggingbegin \__luamplib_tagging_begin_artifact: \cs_set_eq:NN \luamplibtaggingend \__luamplib_tagging_end_artifact: } {text} { - \bool_set_false:N \l__tag_graphic_BBox_bool - \bool_set_true:N \l__tag_luamplib_usetext_bool + \bool_set_false:N \l__luamplib_tag_BBox_bool + \bool_set_true:N \l__luamplib_tag_usetext_bool \cs_set_eq:NN \luamplibtaggingbegin \__luamplib_tagging_begin_artifact: \cs_set_eq:NN \luamplibtaggingend \__luamplib_tagging_end_artifact: \tag_if_active:T {\noindent} @@ -4936,11 +4954,16 @@ end } } { - \tl_set:Nn\l__tag_luamplib_struct_tl{#1} + \tl_set:Nn\l__luamplib_tag_struct_tl{#1} } } + ,correct-BBox .code:n = + { + \bool_set_true:N \l__luamplib_tag_bboxcorr_bool + \seq_set_split:Nnn \l__luamplib_tag_bboxcorr_seq{~}{#1~0pt~0pt~0pt~0pt} + } ,debug .code:n = - { \bool_set_true:N \l__tag_graphic_debug_bool } + { \bool_set_true:N \l__luamplib_tag_debug_bool } ,instance .code:n = { \tl_gset:Nn \currentmpinstancename {#1} } ,instancename .meta:n = { instance = {#1} } @@ -4949,7 +4972,115 @@ end } \cs_new_nopar:Npn \luamplibtaggingBBox { - \let\@picbox\mplibscratchbox \picture@tag@bbox@attribute + \bool_lazy_and:nnT + {\tag_if_active_p:} + {\l__luamplib_tag_BBox_bool} + { + \tl_set:Ne \l__luamplib_BBox_label_tl {luamplib.BBox.\tag_get:n{struct_num}} + \tex_savepos:D + \property_record:ee{\l__luamplib_BBox_label_tl}{xpos,ypos,abspage} + \tl_set:Ne \l__luamplib_BBox_llx_tl + { + \dim_to_decimal_in_bp:n + { \property_ref:een {\l__luamplib_BBox_label_tl}{xpos}{0}sp } + } + \tl_set:Ne \l__luamplib_BBox_lly_tl + { + \dim_to_decimal_in_bp:n + { \property_ref:een {\l__luamplib_BBox_label_tl}{ypos}{0}sp - \dp\mplibscratchbox } + } + \tl_set:Ne \l__luamplib_BBox_urx_tl + { + \dim_to_decimal_in_bp:n + { \l__luamplib_BBox_llx_tl bp + \wd\mplibscratchbox } + } + \tl_set:Ne \l__luamplib_BBox_ury_tl + { + \dim_to_decimal_in_bp:n + { \l__luamplib_BBox_lly_tl bp + \ht\mplibscratchbox + \dp\mplibscratchbox } + } + \bool_if:NT \l__luamplib_tag_bboxcorr_bool + { + \tl_set:Ne \l__luamplib_BBox_llx_tl + { + \fp_eval:n + { + \l__luamplib_BBox_llx_tl + + + \dim_to_decimal_in_bp:n {\seq_item:Nn \l__luamplib_tag_bboxcorr_seq {1} } + } + } + \tl_set:Ne \l__luamplib_BBox_lly_tl + { + \fp_eval:n + { + \l__luamplib_BBox_lly_tl + + + \dim_to_decimal_in_bp:n {\seq_item:Nn \l__luamplib_tag_bboxcorr_seq {2} } + } + } + \tl_set:Ne \l__luamplib_BBox_urx_tl + { + \fp_eval:n + { + \l__luamplib_BBox_urx_tl + + + \dim_to_decimal_in_bp:n {\seq_item:Nn \l__luamplib_tag_bboxcorr_seq {3} } + } + } + \tl_set:Ne \l__luamplib_BBox_ury_tl + { + \fp_eval:n + { + \l__luamplib_BBox_ury_tl + + + \dim_to_decimal_in_bp:n {\seq_item:Nn \l__luamplib_tag_bboxcorr_seq {4} } + } + } + } + \prop_gput:cne + { g__tag_struct_\tag_get:n{struct_num}_prop } + {A} + { + << /O /Layout /BBox [ + \l__luamplib_BBox_llx_tl\c_space_tl + \l__luamplib_BBox_lly_tl\c_space_tl + \l__luamplib_BBox_urx_tl\c_space_tl + \l__luamplib_BBox_ury_tl + ] >> + } + \bool_if:NT \l__luamplib_tag_debug_bool + { + \iow_log:e + { + luamplib/tag/debug:~BBox~of~structure~\tag_get:n{struct_num}~is~ + \l__luamplib_BBox_llx_tl\c_space_tl + \l__luamplib_BBox_lly_tl\c_space_tl + \l__luamplib_BBox_urx_tl\c_space_tl + \l__luamplib_BBox_ury_tl + } + \use:e + { + \exp_not:N\AddToHookNext{shipout/foreground} + { + \exp_not:N\int_compare:nNnT + {\exp_not:N\g_shipout_readonly_int} + = + {\property_ref:een{\l__luamplib_BBox_label_tl}{abspage}{0}} + { + \exp_not:N\put + (\l__luamplib_BBox_llx_tl bp, \dim_eval:n{\l__luamplib_BBox_lly_tl bp -\paperheight}) + { + \exp_not:N\opacity_select:n{0.5} \exp_not:N\color_select:n{red} + \exp_not:N\rule + {\dim_eval:n {\l__luamplib_BBox_urx_tl bp - \l__luamplib_BBox_llx_tl bp}} + {\dim_eval:n {\l__luamplib_BBox_ury_tl bp - \l__luamplib_BBox_lly_tl bp}} + } + } + } + } + } + } } \cs_set_nopar:Npn \mplibstarttoPDF #1 #2 #3 #4 { @@ -5000,7 +5131,7 @@ end \tl_gset_eq:NN \currentmpinstancename \c_empty_tl \keys_set:nn{luamplib/tag}{#1} \tl_if_empty:NF \currentmpinstancename - { \tl_set:Nn\l__tag_luamplib_alt_dflt_tl {metapost~figure~\currentmpinstancename} } + { \tl_set:Nn\l__luamplib_tag_alt_dflt_tl {metapost~figure~\currentmpinstancename} } \mplibtmptoks{}\ltxdomplibcode } \RenewDocumentCommand\mpfig{s O{}} @@ -5016,7 +5147,7 @@ end } \keys_set:nn{luamplib/tag}{#2} \tl_if_empty:NF \mpfiginstancename - { \tl_set:Nn\l__tag_luamplib_alt_dflt_tl {metapost~figure~\mpfiginstancename} } + { \tl_set:Nn\l__luamplib_tag_alt_dflt_tl {metapost~figure~\mpfiginstancename} } \mplibmainmpfig } } @@ -5029,17 +5160,17 @@ end Using~the~default~value~'##1'~instead. } \keys_set:nn{luamplib/tag}{#1} - \tl_set:Nn\l__tag_luamplib_alt_dflt_tl {metapost~figure~#2} + \tl_set:Nn\l__luamplib_tag_alt_dflt_tl {metapost~figure~#2} \csname luamplib.group.#2\endcsname \endgroup } \cs_new_nopar:Npn \mplibalttext #1 { - \tl_set:Ne \l__tag_luamplib_alt_tl {\text_purify:n{#1}} + \tl_set:Ne \l__luamplib_tag_alt_tl {\text_purify:n{#1}} } \cs_new_nopar:Npn \mplibactualtext #1 { - \tl_set:Ne \l__tag_luamplib_actual_tl {\text_purify:n{#1}} + \tl_set:Ne \l__luamplib_tag_actual_tl {\text_purify:n{#1}} } \ExplSyntaxOff % \end{macrocode} diff --git a/macros/luatex/generic/luamplib/luamplib.pdf b/macros/luatex/generic/luamplib/luamplib.pdf Binary files differindex a6f7e5c362..05e9600400 100644 --- a/macros/luatex/generic/luamplib/luamplib.pdf +++ b/macros/luatex/generic/luamplib/luamplib.pdf diff --git a/macros/xetex/latex/hduthesis/README.md b/macros/xetex/latex/hduthesis/README.md index 3a6d6c11c3..ed26215292 100644 --- a/macros/xetex/latex/hduthesis/README.md +++ b/macros/xetex/latex/hduthesis/README.md @@ -13,6 +13,8 @@ - `pg.config`: 硕士论文格式配置 +- `stationery.config`: 学校信纸生成 + - `hdu.l3doc`: 模板 `l3doc` 用户手册配置 --- @@ -33,6 +35,8 @@ Modules of `hduThesiS` provide the following supports: - `pg.config`: Configuration for postgraduate thesis' format +- `stationery.config`: Creation of HDU's stationery + - `hdu.l3doc`: Configuration for class's `l3doc` manual **Welcome to pull requests [here](https://github.com/xiamyphys/hduthesis).** diff --git a/macros/xetex/latex/hduthesis/doc/hduthesis.pdf b/macros/xetex/latex/hduthesis/doc/hduthesis.pdf Binary files differindex 545384987d..acfdd8e07c 100644 --- a/macros/xetex/latex/hduthesis/doc/hduthesis.pdf +++ b/macros/xetex/latex/hduthesis/doc/hduthesis.pdf diff --git a/macros/xetex/latex/hduthesis/doc/hduthesis.tex b/macros/xetex/latex/hduthesis/doc/hduthesis.tex index 101f8e7120..ee4c074375 100644 --- a/macros/xetex/latex/hduthesis/doc/hduthesis.tex +++ b/macros/xetex/latex/hduthesis/doc/hduthesis.tex @@ -2,10 +2,11 @@ \DocInfo { - title = The \hologo{hduthesis} Class\\ - \hologo{LaTeX} Thesis Template for Hangzhou Dianzi University, - author = Mingyu Xia \mailto{xiamyphys@hdu.edu.cn} - \footnote{Physics Department, Graduate in 06/2025 (expected)}, + title = The \hologo{hduthesis} Class\\ + \hologo{LaTeX} Thesis Template for + Hangzhou Dianzi University, + author = Mingyu Xia \mailto{xiamyphys@hdu.edu.cn} + \footnote{Physics Department, Graduate in 06/2025}, CJKmain-font = {[AutoFakeSlant]{Songti SC}}, CJKsans-font = {[BoldFont = Hei, AutoFakeSlant]{Heiti SC}}, CJKmono-font = {[AutoFakeSlant]{LXGW WenKai Mono}} @@ -192,17 +193,59 @@ \begin{center} \fbox - { \parbox[c][1.5em]{16em}{\centering\file{hduthesis-bc.config-module}} } - \quad\fbox - { - \parbox[c][1.5em]{16em}{\centering\file{hduthesis-pg.config-module}} - }\\[2ex] - \quad\fbox - { \parbox[c][1.5em]{14em}{\centering\file{hduthesis-typeset-module}} } - \qquad\fbox - { \parbox[c][1.5em]{16em}{\centering\file{hduthesis-layout-module}} } + { \parbox[c][1.5em]{34ex}{\centering\file{hduthesis-pg.config-module}} } + \fbox { \parbox[c][1.5em]{32ex}{\centering\file{hduthesis-typeset-module}} } + \fbox { \parbox[c][1.5em]{15ex}{\centering\file{hdulogo.pdf}} }\\[2ex] + \fbox { \parbox[c][1.5em]{33ex}{\centering\file{hduthesis-bc.config-module}} } + \qquad \fbox { \parbox[c][1.5em]{16ex}{\centering\file{hdubadge.pdf}} } \qquad + \fbox { \parbox[c][1.5em]{16ex}{\centering\file{hdumotto.pdf}} }\\[2ex] + \fbox { \parbox[c][1.5em]{30ex}{\centering\file{hduthesis-layout-module}} }~ + \fbox { \parbox[c][1.5em]{16ex}{\centering\file{hdutitle.pdf}} } + \fbox + { \parbox[c][1.5em]{34ex}{\centering\file{hduthesis-stationery-module}} }~ \end{center} \hrule +\section{杭州电子科技大学信纸} + +加载全局选项 \pkg{stationery},并进行文档信息设置,即可生成信纸. 可用于推荐信撰写. +此模块无需 \pkg{agreed} 选项. + +\begin{framed} + \begin{verbatim} + \documentclass [ stationery ] { hduthesis } + \end{verbatim} +\end{framed} + +与学士 / 硕士学位论文文档信息设置类型,使用 \cs{DocInfo} 命令,对信件标题、发件人、机构、日期、电话和邮件信息进行设置. 此时 \cs{DocInfo} 命令接受键 +\keys{\cmdmac~title} \keys{\cmdmac~author} \keys{\cmdmac~affliction} +\keys{\cmdmac~date} \keys{\cmdmac~tel} \keys{\cmdmac~mail}. 下页为生成信纸的样例. + +\begin{framed} + \begin{verbatim} + \DocInfo + { + title = Recommendation Letter for SAN Chi Nan, + author = YIP Tsz Ching, + affliction = {Physics Department, Hangzhou Dianzi University}, + date = {25\textsuperscript{th} November, 2024}, + tel = (852) 3141-5926, + mail = xiamyphys@gmail.com + } + \end{verbatim} +\end{framed} + +\section{For Developers} + +本手册为 \cls{hduthesis} 加载选项 \pkg{l3doc} 后生成,基于 \cls{l3doc} 文档类. + +\begin{framed} + \begin{verbatim} + \documentclass [ l3doc ] { hduthesis } + \end{verbatim} +\end{framed} + +\includepdf{/Users/xiamyphys/Desktop/LaTeXer/hduthesis/examples/hduthesis-stationery} + \end{document} diff --git a/macros/xetex/latex/hduthesis/examples/hduthesis-stationery.pdf b/macros/xetex/latex/hduthesis/examples/hduthesis-stationery.pdf Binary files differnew file mode 100644 index 0000000000..18c98062ca --- /dev/null +++ b/macros/xetex/latex/hduthesis/examples/hduthesis-stationery.pdf diff --git a/macros/xetex/latex/hduthesis/examples/hduthesis-stationery.tex b/macros/xetex/latex/hduthesis/examples/hduthesis-stationery.tex new file mode 100644 index 0000000000..71e7bd7cd8 --- /dev/null +++ b/macros/xetex/latex/hduthesis/examples/hduthesis-stationery.tex @@ -0,0 +1,31 @@ +\documentclass[stationery]{hduthesis} + +\usepackage{lipsum} +\RequirePackage [ mono = false ] {libertine} + +\DocInfo + { + title = Recommendation Letter for SAN Chi Nan, + author = YIP Tsz Ching, + affliction = {Physics Department, Hangzhou Dianzi University}, + date = {25\textsuperscript{th} November, 2024}, + tel = (852) 3141-5926, + mail = xiamyphys@gmail.com + } + +\begin{document} + +\maketitle + +To whom it may concern: + +\lipsum[1-2] + +\vspace{\baselineskip} \raggedleft + +Sincerely yours ,\\[2ex] +\includegraphics[ height = 2em ]{hdutitle}\\[2ex] +Professor of Department of Physics\\ +Room \meta{int}, Building \meta{int}, Hangzhou Dianzi University + +\end{document}
\ No newline at end of file diff --git a/macros/xetex/latex/hduthesis/tex/hduthesis-hdu.stationery-module.code.tex b/macros/xetex/latex/hduthesis/tex/hduthesis-hdu.stationery-module.code.tex new file mode 100644 index 0000000000..1c13c626b3 --- /dev/null +++ b/macros/xetex/latex/hduthesis/tex/hduthesis-hdu.stationery-module.code.tex @@ -0,0 +1,89 @@ +\hduthesis_provide_module:n {hdu.stationery} + +\keys_define:nn { hdu.stationery / docinfo } + { + title .tl_set:N = \l__docinfo_title_tl, + author .tl_set:N = \l__docinfo_author_tl, + affliction .tl_set:N = \l__docinfo_affliction_tl, + date .tl_set:N = \l__docinfo_date_tl, + tel .tl_set:N = \l__docinfo_tel_tl, + mail .tl_set:N = \l__docinfo_mail_tl, + } + +\RequirePackage{ hyperref, geometry, tikz, twemojis, fancyhdr } +\NewDocumentCommand \DocInfo { m } + { + \keys_set:nn { hdu.stationery / docinfo } {#1} + \hypersetup { hidelinks, pdfauthor = \l__docinfo_author_tl } + } +\geometry + { hmargin = .8in, bottom = 1.05in, top = 2.1in, + headheight = 1.2in, headsep = .3in, footskip = .3in } +\linespread{1.25} +\RequirePackage [ skip = \baselineskip ] { parskip } +\renewcommand* \familydefault { \sfdefault } +\tikzset{ every~node/.append~style = { opacity = .8 } } +\definecolor{hdu}{HTML}{214395} + +\renewcommand* \headrulewidth {1pt} +\renewcommand* \footrulewidth {1pt} +\hook_gput_code:nnn { cmd/headrule/before } { . } { \color{hdu!80} } +\hook_gput_code:nnn { cmd/footrule/before } { . } { \color{hdu!80} } +\lhead + { + {}~ + \minipage{.64\linewidth} + \tikz [ baseline = -.6in ] + { \node { \includegraphics [ height = .75in ] { hdubadge } } } + \endminipage \hfill + \minipage{.32\linewidth} + \vbox + { + \raggedright \small + Date:~ + \tl_if_empty:NTF \l__docinfo_date_tl + { \today \par } + { \l__docinfo_date_tl \par } + \tl_if_empty:NF \l__docinfo_author_tl + { Name:~ \l__docinfo_author_tl \par } + \tl_if_empty:NF \l__docinfo_tel_tl + { Phone:~ \l__docinfo_tel_tl \par } + \tl_if_empty:NF \l__docinfo_mail_tl + { + Email:~ \href { mailto:\l__docinfo_mail_tl } + { \ttfamily \l__docinfo_mail_tl } + } + }\medskip + \endminipage + } +\cfoot + { \small \texttwemoji{1f4cd}~ + 1158~No.2~Street,~ Qiantang~District,~ + Hangzhou,~ Zhejiang~Province,~ 310018,~ China \qquad + \texttwemoji{1f310}~ www.hdu.edu.cn + } +\pagestyle{fancy} + +\renewcommand* \maketitle + { + \l__docinfo_author_tl\\ + \l__docinfo_affliction_tl\\ + \textbf{\l__docinfo_title_tl} \par \vspace{.5\baselineskip} + } + +\AtBeginDocument { \color_select:n {black!80} } + +\newcommand \meta[1] + { + \ensuremath \langle + \ifmmode \expandafter \nfss@text \fi + { + \itshape\ttfamily \edef \meta@hyphen@restore + { \hyphenchar \the \font \the \hyphenchar \font } + \hyphenchar \font \m@ne \language + \l@nohyphenation #1\/\meta@hyphen@restore + } + \ensuremath \rangle + } + +\endinput diff --git a/macros/xetex/latex/hduthesis/tex/hduthesis.cls b/macros/xetex/latex/hduthesis/tex/hduthesis.cls index 7979b35d01..048f8afc6d 100644 --- a/macros/xetex/latex/hduthesis/tex/hduthesis.cls +++ b/macros/xetex/latex/hduthesis/tex/hduthesis.cls @@ -1,28 +1,29 @@ -%% *********************************************************************** -%% Copyright 2024 by M.Y. XIA <xiamyphys@gmail.com> * -%% * -%% This work may be distributed and/or modified under the conditions * -%% of the LaTeX Project Public License * -%% * -%% http://www.latex-project.org/lppl.txt * -%% * -%% either version 1.3c of this license or any later version. * -%% * -%% This work has the LPPL maintenance status `maintained'. * -%% * -%% The Current Maintainers of this work is M.Y. XIA * -%% * -%% This work consists of the files hduthesis.cls, * -%% hduthesis-typeset-module.code, * -%% hduthesis-layout-module.code, * -%% hduthesis-bc.config-module.code, * -%% hduthesis-pg.config-module.code, * -%% hduthesis-hdu.l3doc-module.code, * -%% and README.md. * -%% available at https://github.com/xiamyphys/hduthesis * -%% *********************************************************************** -\def\hduthesis@date{2024/11/23} -\def\hduthesis@version{0.3.4} +%% ***************************************************************************** +%% Copyright 2024 by M.Y. XIA <xiamyphys@gmail.com> * +%% * +%% This work may be distributed and/or modified under the conditions of the * +%% LaTeX Project Public License * +%% * +%% http://www.latex-project.org/lppl.txt * +%% * +%% either version 1.3c of this license or any later version. * +%% * +%% This work has the LPPL maintenance status `maintained'. * +%% * +%% The Current Maintainers of this work is M.Y. XIA * +%% * +%% This work consists of the files hduthesis.cls, * +%% hduthesis-typeset-module.code, * +%% hduthesis-layout-module.code, * +%% hduthesis-bc.config-module.code, * +%% hduthesis-pg.config-module.code, * +%% hduthesis-hdu.l3doc-module.code, * +%% hduthesis-hdu.stationery-module.code, * +%% and README.md. * +%% available at https://github.com/xiamyphys/hduthesis * +%% ***************************************************************************** +\def\hduthesis@date{2024/11/25} +\def\hduthesis@version{0.4.0} \RequirePackage{etoolbox} \ProvidesExplClass{hduthesis} {\hduthesis@date} {\hduthesis@version} @@ -73,6 +74,9 @@ l3doc .bool_set:N = \g__hduthesis_doc_bool, l3doc .initial:n = false, l3doc .default:n = true, + stationery .bool_set:N = \g__hduthesis_stationery_bool, + stationery .initial:n = false, + stationery .default:n = true, math-font .tl_set:N = \g__hduthesis_math_font, CJKmain-font .tl_set:N = \g__hduthesis_main_CJK_font, CJKsans-font .tl_set:N = \g__hduthesis_sans_CJK_font, @@ -100,6 +104,14 @@ \endinput } +\bool_if:NT \g__hduthesis_stationery_bool + { + \PassOptionsToClass{ 12pt } { letter } + \exp_args:NNV \LoadClass [ \g__hdu_base_class_options_clist ] { letter } + \hduthesis_load_module:n { hdu.stationery } + \endinput + } + \PassOptionsToClass { a4paper, zihao = -4 } { ctexrep } \PassOptionsToPackage { quiet, no-math } { xeCJK } \exp_args:NNV \LoadClass [ \g__hdu_base_class_options_clist ] { ctexrep } |