diff options
author | Norbert Preining <norbert@preining.info> | 2023-08-17 03:01:02 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2023-08-17 03:01:02 +0000 |
commit | 5248edc6ec87b3acdb196687a1af5b6292c8510a (patch) | |
tree | e92a27a946d440a1df987f433ed3ec7490423d42 /macros/latex | |
parent | d10719e48fc5cd329e6333041ef31d868fafbdcc (diff) |
CTAN sync 202308170300
Diffstat (limited to 'macros/latex')
23 files changed, 2231 insertions, 101 deletions
diff --git a/macros/latex/contrib/expex-glossonly/README.md b/macros/latex/contrib/expex-glossonly/README.md new file mode 100644 index 0000000000..1029552acf --- /dev/null +++ b/macros/latex/contrib/expex-glossonly/README.md @@ -0,0 +1,25 @@ +# The `expex-glossonly` package + +`expex-glossonly` is a package which allows `gb4e` and `linguex` users to use the glossing macros +of the ExPex package, while still using the standard example and subexample numbering macros of +those respective packages. + +Copyright 2016-2023 by Alan Munn + +This package may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.3 +of this license or any later version. +The latest version of this license is in + http://www.latex-project.org/lppl.txt +and version 1.3 or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +This package has the LPPL maintenance status `maintained'. + +The Current Maintainer of this package is Alan Munn. + +This package consists of the file `expex-glossonly.sty` and documentation files +`expex-glossonly.tex` and `expex-glossonly.pdf` plus two test files: `gb4e-expex.tex` and `linguex-expex.tex` + +This package is currently experimental. Use at your own risk. + diff --git a/macros/latex/contrib/expex-glossonly/expex-glossonly.pdf b/macros/latex/contrib/expex-glossonly/expex-glossonly.pdf Binary files differnew file mode 100644 index 0000000000..df43f4d18f --- /dev/null +++ b/macros/latex/contrib/expex-glossonly/expex-glossonly.pdf diff --git a/macros/latex/contrib/expex-glossonly/expex-glossonly.sty b/macros/latex/contrib/expex-glossonly/expex-glossonly.sty new file mode 100644 index 0000000000..b33b6b41c0 --- /dev/null +++ b/macros/latex/contrib/expex-glossonly/expex-glossonly.sty @@ -0,0 +1,97 @@ +\def\EPGL@version{0.6} +\def\EPGL@date{2023/08/15} +% expex-glossonly is a package which allows gb4e and linguex users to use the glossing macros +% of the ExPex package, while still using the standard example and subexample numbering macros of +% those respective packages. +% +% Copyright 2016 by Alan Munn +% +% This package may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This package has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this package is Alan Munn. +% +% This package consists of the file expex-glossonly.sty and documentation files +% expex-glossonly.tex and expex-glossonly.pdf plus two test files: gb4e-expex.tex and linguex-expex.tex +% +% This package is currently experimental. Use at your own risk. +% +\ProvidesPackage{expex-glossonly}[\EPGL@date\ Compatibility package for using ExPex glosses with gb4e and linguex v. \EPGL@version ] +\DeclareOption*{\PackageWarning{expex-glossonly}{Unknown option `\CurrentOption`}} +\ProcessOptions +\RequirePackage{calc} +\RequirePackage{expex} +% First define a command to patch the ExPex main gloss command +% Need to find out if other gloss commands need to be patched. +\def\EPGL@patchexpexgloss{% + \let\xe\relax + \let\pex\relax +\def\gl@wrap@below@begin@a{% + \bgroup + \parindent0pt + \ep@setglstrut + \ifdim\ling@glwidth=0pt + \ifling@glbreaking + \bgroup + \else + \vtop\bgroup + \advance\hsize by -\leftskip + \advance\hsize by -\rightskip + %\leftskip=0pt + \EPGL@setglossmargin % this is the changed line + \fi + \else + \vtop\bgroup + \hsize=\ling@glwidth + \leftskip=0pt + \fi + \leavevmode + \bgroup + \parindent=0pt + \@glpreamblefalse + \@glftfalse + \let\mainlist=\empty + \let\itemtypelist=\empty + \let\aboveskiplist=\empty + \let\strutlist=\empty + \let\everylist=\empty + \let\colorlist=\empty +}} +% First check to see whether we are loaded first +% Since there is some overlap in commands, gb4e and linguex must be loaded second +\@ifpackageloaded{linguex}{\PackageError{expex-glossonly}{Please load expex-glossonly BEFORE linguex}{Please load expex-glossonly BEFORE linguex}}{} +\@ifpackageloaded{gb4e}{\PackageError{expex-glossonly}{Please load expex-glossonly BEFORE gb4e}{Please load expex-glossonly BEFORE gb4e}}{} +% Now only patch the command if the packages have been loaded +% This means that the package will do no harm if loaded by itself +\AtBeginDocument{% +\@ifpackageloaded{linguex}{ + \def\EPGL@setglossmargin{% + \ifnum\theExDepth=1% + \setlength{\leftskip}{\Exindent+\Exlabelsep+\Exlabelwidth+.5em} + \else + \setlength{\leftskip}{\Exindent+\Exlabelsep+\Exlabelwidth+\SubExleftmargin+.5em} + \fi} + \EPGL@patchexpexgloss + \PackageInfo{expex-glossonly}{Patching ExPex for use with linguex} + \typeout{Patching ExPex for use with linguex} +} +{\@ifpackageloaded{gb4e}{ + \def\EPGL@setglossmargin{% + \ifnum\@xnumdepth=1% + \setlength{\leftskip}{\leftmargin+\widthof{\@exwidth}+1em} + \else + \setlength{\leftskip}{\leftmargin+\labelwidth+\labelsep+1.5em} + \fi} + \EPGL@patchexpexgloss + \PackageInfo{expex-glossonly}{Patching ExPex for use with gb4e} + \typeout{Patching ExPex for use with gb4e} +}{}} +} +\endinput
\ No newline at end of file diff --git a/macros/latex/contrib/expex-glossonly/expex-glossonly.tex b/macros/latex/contrib/expex-glossonly/expex-glossonly.tex new file mode 100644 index 0000000000..5fc2a2e9d7 --- /dev/null +++ b/macros/latex/contrib/expex-glossonly/expex-glossonly.tex @@ -0,0 +1,100 @@ +% !TEX TS-program = pdflatexmk +\def\EPGLversion{0.6} +\def\EPGLdate{August 15, 2023} +\documentclass[11pt]{article} +\title{\textbf{The \textsf{expex-glossonly} package}} +\author{\textbf{Alan Munn}\\Department of Linguistics and Languages\\Michigan State University\\\texttt{\href{mailto:amunn@msu.edu}{amunn@msu.edu}}} +\date{Version \EPGLversion\\\EPGLdate} +\usepackage[T1]{fontenc} +\usepackage[margin=1in,includefoot]{geometry} +\usepackage{titling} +\usepackage[utf8]{inputenc} +\usepackage{array, booktabs, multicol, fancyhdr, xspace,tabularx} +\usepackage{enumitem} +\usepackage{fancyvrb,listings,url} +\usepackage[sf,compact]{titlesec} +\usepackage[]{he-she} +\usepackage{gb4e} +\usepackage[colorlinks=true]{hyperref} +\noautomath + + +\DefineShortVerb{\|} +\newcommand*\bs{\textbackslash} + +\IfFileExists{luximono.sty}% +{% + \usepackage[scaled]{luximono}% +} +{% + \IfFileExists{beramono.sty}% + {% + \usepackage[scaled]{beramono}% + }{} +} + + +\lstset{% + basicstyle=\ttfamily\small, + commentstyle=\itshape\ttfamily\small, + showspaces=false, + showstringspaces=false, + breaklines=true, + breakautoindent=true, + breakindent=1em, + xrightmargin=2.5em, + captionpos=t, + language=TeX, +} + +\newcommand*{\pkg}[1]{\texttt{#1}\xspace} +\setitemize[1]{label={}} +\setitemize[2]{label={}} +\setdescription{font={\normalfont}} +\setlength{\droptitle}{-1in} + +\lhead{} +\chead{} +\rhead{} +\lfoot{\emph{}} +\cfoot{\thepage} +\rfoot{} +\renewcommand{\headrulewidth}{0pt} +\renewcommand{\footrulewidth}{0pt} +\pagestyle{fancy} + + +\begin{document} +\maketitle +\thispagestyle{empty} +\renewcommand{\abstractname}{\sffamily Abstract} +\abstract{\noindent\begin{quote}This is an experimental package which is designed to let \pkg{gb4e} and \pkg{linguex} package users use the advanced glossing capabilities of the very powerful ExPex package.\end{quote}} +\section{Introduction} +The ExPex package by John Frampton provides very fine-grained control over glossing and example formatting, including unlimited gloss lines and various ways of formatting multiline glosses. By contrast the \pkg{cgloss4e} glossing macros provided with both \pkg{gb4e} and \pkg{linguex}, although very capable at basic glossing, lack the degree of customization that is sometimes needed for more complex glossing. + +On the other hand, for those users who have heavily invested in using either \pkg{gb4e} or \pkg{linguex}, shifting to ExPex can be quite daunting and burdensome, especially since the basic syntax of the examples is quite different. + +This package is an attempt to have the best of both worlds: it allows \pkg{gb4e} and \pkg{linguex} users to keep using those packages for basic example numbering and formatting, but also allows them to use the glossing macros that ExPex provides. + +\section{Package usage} +Usage of the package is simple: simply load it, and then load your favourite example numbering package. The \pkg{expex-glossonly} package must be loaded first. + +\begin{multicols}{2} +\begin{lstlisting} +\usepackage{expex-glossonly} +\usepackage{gb4e} +\end{lstlisting} +\begin{lstlisting} +\usepackage{expex-glossonly} +\usepackage{linguex} +\end{lstlisting} +\end{multicols} + + + +The package checks for which example numbering package you have loaded (either \pkg{gb4e} or \pkg{linguex}) and then patches the main glossing macro in ExPex to adjust to the horizontal spacing parameters of the particular example package you loaded. + +It does nothing explicitly to disable incompatible commands from ExPex (specifically any commands that would introduce a numbered or lettered example, such as |\ex|, |\pex|, |\a|, etc.) so you should not use them. Some, such as |\ex| are redefined by \pkg{gb4e} and therefore the ExPex version of it will fail to work. For this reason, you need to make sure to load the \pkg{expex-glossonly} package \emph{before} you load \pkg{gb4e} or \pkg{linguex} +\section{Bugs} +This is \emph{experimental} and has not been extensively tested. Use at your own risk. You're welcome to contact me with problems as they arise, however. +\end{document}
\ No newline at end of file diff --git a/macros/latex/contrib/expex-glossonly/testfiles/gb4e-expex.pdf b/macros/latex/contrib/expex-glossonly/testfiles/gb4e-expex.pdf Binary files differnew file mode 100644 index 0000000000..40b160303e --- /dev/null +++ b/macros/latex/contrib/expex-glossonly/testfiles/gb4e-expex.pdf diff --git a/macros/latex/contrib/expex-glossonly/testfiles/gb4e-expex.tex b/macros/latex/contrib/expex-glossonly/testfiles/gb4e-expex.tex new file mode 100644 index 0000000000..8cdeed2f5d --- /dev/null +++ b/macros/latex/contrib/expex-glossonly/testfiles/gb4e-expex.tex @@ -0,0 +1,48 @@ +\documentclass[12pt,letterpaper]{article} + +\usepackage{expex-glossonly} +\usepackage{amssymb} +\usepackage{gb4e} +%\usepackage{cgloss} + + +\lingset{everygla={\leftmargin=2in}, belowglpreambleskip=-0.5ex, aboveglftskip=-0.5ex} % gloss formatting + + +\begin{document} + +\begin{exe} +\ex[*]{ This is a regular example.} +\ex[*]{\label{foo} + \begingl + \glpreamble This is a preamble sentence.// + \gla\rightcomment{\small\checkmark X}J\'anos h\'aza// + \glb\rightcomment{\small\checkmark X}John house.his// + \glft `John's house'// + \endgl +} +\ex This is another example. +\end{exe} +\begin{exe} +\ex\label{bar} +\begin{xlist} +\ex \begingl + \gla\rightcomment{\small\checkmark X}J\'anos h\'aza// + \glb\rightcomment{\small\checkmark X}John house.his// + \glft `John's house'// + \endgl +\ex \begingl + \gla\rightcomment{\small\checkmark X}J\'anos h\'aza// + \glb\rightcomment{\small\checkmark X}John house.his// + \glft `John's house'// + \endgl +\end{xlist} +\ex +\begin{xlist} +\ex An example\setcounter{xnumi}{0} +\ex Another example. +\end{xlist} +\end{exe} + + +\end{document}
\ No newline at end of file diff --git a/macros/latex/contrib/expex-glossonly/testfiles/linguex-expex.pdf b/macros/latex/contrib/expex-glossonly/testfiles/linguex-expex.pdf Binary files differnew file mode 100644 index 0000000000..b52da13d57 --- /dev/null +++ b/macros/latex/contrib/expex-glossonly/testfiles/linguex-expex.pdf diff --git a/macros/latex/contrib/expex-glossonly/testfiles/linguex-expex.tex b/macros/latex/contrib/expex-glossonly/testfiles/linguex-expex.tex new file mode 100644 index 0000000000..368a35f8f1 --- /dev/null +++ b/macros/latex/contrib/expex-glossonly/testfiles/linguex-expex.tex @@ -0,0 +1,33 @@ +\documentclass[12pt,letterpaper]{article} + +\usepackage{expex-glossonly} +\usepackage{amssymb} +\usepackage{linguex} +\usepackage{cgloss} + +\lingset{everygla={\leftmargin=2in}, belowglpreambleskip=-0.5ex, aboveglftskip=-0.5ex} % gloss formatting +\makeatletter + +\begin{document} + +\ex. \ag. The boy didn't kiss the girl \\ +D boy AUX.NEG kiss D girl \\ \hfill {\small\checkmark X} +\trans `The boy did not kiss the girl'. \hfill {\small\checkmark X} + +\ex. +\a. + \begingl + \gla\rightcomment{\small\checkmark X}J\'anos h\'aza// + \glb\rightcomment{\small\checkmark X}John house.his// + \glft `John's house'// + \endgl +\b. This is another example. + +\ex.\begingl + \gla\rightcomment{\small\checkmark X}J\'anos h\'aza// + \glb\rightcomment{\small\checkmark X}John house.his// + \glft `John's house'// + \endgl + + +\end{document}
\ No newline at end of file diff --git a/macros/latex/contrib/floatbytocbasic/LICENSE.md b/macros/latex/contrib/floatbytocbasic/LICENSE.md new file mode 100644 index 0000000000..99a6973749 --- /dev/null +++ b/macros/latex/contrib/floatbytocbasic/LICENSE.md @@ -0,0 +1,19 @@ +---------------------------------------------------------------------------- + +This work may be distributed and/or modified under the conditions of the +LaTeX Project Public License, version 1.3c of the license. The latest +version of this license is in http://www.latex-project.org/lppl.txt and +version 1.3c or later is part of all distributions of LaTeX 2005/12/01 +or later. This work has the LPPL maintenance status “maintained”. +The current maintainer and author of this work is Markus Kohm. + +---------------------------------------------------------------------------- + +Dieses Werk darf nach den Bedingungen der LaTeX Project Public Lizenz +in der Version 1.3c, verteilt und/oder verändert werden. Die aktuelle +Version dieser Lizenz ist http://www.latex-project.org/lppl.txt und +Version 1.3c oder später ist Teil aller Verteilungen von LaTeX 2005/12/01 +oder später. Dieses Werk hat den LPPL-Verwaltungs-Status „maintained” +Der aktuelle Verwalter und Autor dieses Werks ist Markus Kohm. + +---------------------------------------------------------------------------- diff --git a/macros/latex/contrib/floatbytocbasic/README.md b/macros/latex/contrib/floatbytocbasic/README.md new file mode 100644 index 0000000000..c112b05c12 --- /dev/null +++ b/macros/latex/contrib/floatbytocbasic/README.md @@ -0,0 +1,152 @@ +# Package `floatbytocbasic` + +Copyright © 2008–2023 Markus Kohm + +Release: 2023-08-16 v1.0 + +License: LPPL 1.3c + +KOMA presents the `floatbytocbasic` package to extend the functionality of +package [`float`](https://ctan.org/pkg/float). The `floatbytocbasic` +package is part of the *third-party enhancements* project. + +---------------------------------------------------------------------------- + +This work may be distributed and/or modified under the conditions of +the LaTeX Project Public License, version 1.3c of the license. +The latest version of this license is in + http://www.latex-project.org/lppl.txt +and version 1.3c or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +The Current Maintainer and author of this work is Markus Kohm. + +---------------------------------------------------------------------------- + +# Abstract + +For several years +[KOMA-Script](https://www.sourceforge.net/project/koma-script) provided a +package `scrhack`, that has been made not only to improve the compatibility of +third-party packages with KOMA-Script classes, but also to generally improve +third-party packages. The package consisted not only in the package file +`scrhack.sty` but also in several so called hacks as separate files with +extension `.hak`. In the course of splitting off former KOMA-Script packages +from the KOMA-Script collection, it was decided to create independent packages +from the individual hacks. These new independent packages then serve as +replacements for the original packages they were intended to improve. Package +`floatbytocbasic` is such an enhancement package. It provides additional +features of using package [`tocbasic`](https://ctan.org/pkg/tocbasic) by +patching package [`float`](https://ctan.org/pkg/float). + +# Installation for Users + +If you are a user, you should wait until the package has been added to your +preferred TeX distribution. Then you can use the package manager of your TeX +distribution to install the package. + +# Unpacking for Distributors + +Distributors should download [the distribution from +CTAN](https://www.ctan.org/pkg/floatbytocbasic). This consists in: + +* `floatbytocbasic.dtx` +* `README.md` +* `LICENSE.md` +* `floatbytocbasic.pdf` + +If distributors also want to distribute `floatbytocbasic.sty`, they can +unpack it using + + tex floatbytocbasic.dtx + +Note, that you have to use `tex` not `latex`, `pdflatex`, `xelatex` or +`lualatex`! + +Note also, that a legal distribution consists at least in: + +* `floatbytocbasic.dtx` +* `README.md` + +The following files are optionally, but must not be distributed without the +previous ones: + +* `LICENSE.md` +* `floatbytocbasic.sty` +* `floatbytocbasic.pdf` + +# Unpacking and Installation for Developers + +Developers who want the current developer version of the code to be installed +for testing, should clone [the `third-party-enhancements` +repository](https://github.com/komascript/third-party-enhancements), e.g., +using + + git clone https://github.com/komascript/third-party-enhancements.git + +You can than either unpack and install all the third-party enhancements using: + + l3build install --full + +from within the main directory of the cloned respository. For installation of +`floatbytocbasic` only run the same command from within the +`floatbytocbasic` subdirectory. For installation without the manual omit +option `--full`, but this is not recommended for developers. + +# How to get the Manual + +After installation you should get the user manual using: + + texdoc floatbytocbasic + +See the manual of your TeX distribution for more information. + +Developers or distributors can also build the manual from the source using: + + l3build doc + +# How to Contribute + +To become a contributor, e.g., do heavy testing. If you find an issue, please +report it using [the issue +tracker](https://github.com/komascript/third-party-enhancements/issues). You +can also become a developer and, e.g., make new test files to the +packages. See the [`l3build`](https://ctan.org/pkg/l3build) manual for more +information about tests. If you've created a new test and think that it would +be useful. Please either do a pull request or [add a new +issue](https://github.com/komascript/third-party-enhancements/issues/new/choose) +and include your test file. + +Another kind of contribution would be to contact an author of one of the +third-party packages and convince her or him to integrate the code of the +corresponding enhancement package from this project into her or his package. + +# How to Report Issues + +If you think you have found a bug (or another kind of issue) using +`floatbytocbasic` you should use [the issue +tracker](https://github.com/komascript/third-party-enhancements/issues). Please +first search for similar issues already reported and maybe also already fixed +and closed. Maybe the replies to such a similar report would help you too. + +If your issue is new, you should report it also using [the issue +tracker](https://github.com/komascript/third-party-enhancements/issues). Please +be kind, not only when writing the report but also when reading replies and +commenting or answering. And please always add a minimal working example and +usually the relevant parts of the `log`-file to your report. Please use the +[markdown for +code](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks) +to add such files into the text of your report. The correct language +identifier for LaTeX code would be `latex`. For `log`-files you won't need any +language identifier. Usually you should not use attachments for code or +`log`-files unless you've been asked to do so. And please note, reports should +always be self-containing. External links often break and so the report become +useles. + +# How to Say Thank You for my Work + +Hey, I'm doing this as a hobby. So no need to say thank you. But I'm a vain +fop, so I'm certainly up for a quick thank you by email. On komascript.de you +can find an [explanation of my wishes](https://komascript.de/wunschliste) if +you want to give more. If you don't understand German, just click to links at +that page. diff --git a/macros/latex/contrib/floatbytocbasic/floatbytocbasic.dtx b/macros/latex/contrib/floatbytocbasic/floatbytocbasic.dtx new file mode 100644 index 0000000000..dbce9ae8b2 --- /dev/null +++ b/macros/latex/contrib/floatbytocbasic/floatbytocbasic.dtx @@ -0,0 +1,542 @@ +% \iffalse meta-comment +% ====================================================================== +% floatbytocbasic.dtx +% Copyright © 2008–2023 Markus Kohm +% +% This work is a KOMA-Script spin-off. For the original sources of +% KOMA-Script's `float.hak' see file `scrhack.dtx' in the KOMA-Script +% sources at <https://sourceforge.net/p/koma-script/code/>. +% +% Development is taking place as part of `scrhack' at +% <https://github.com/komascript/third-party-enhancements>. New issues +% should be reported there as well as known issues can be found. +% +% This work may be distributed and/or modified under the conditions of +% the LaTeX Project Public License, version 1.3c of the license. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.<3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later and of this work. +% +% The Current Maintainer and author of this work is Markus Kohm. +% +% This work consists of the file `floatbytocbasic.dtx' and `README.md'. +% +% The recommended way to install `floatbytocbasic' is to use +% the package manager of your TeX distribution. +% ====================================================================== +% +%<*dtx> +\ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi +\ProvidesFile{floatbytocbasic.dtx} +%</dtx> +%<*dtx|package> +%<package>\ProvidesPackage{floatbytocbasic} + [2023-08-16 v1.0 +%<dtx> sources and unpack driver of + improved float package using tocbasic] +%</dtx|package> +%<*dtx> +\ifx\documentclass\undefined + \input docstrip.tex + \generate{% + \file{floatbytocbasic.sty}{% + \from{floatbytocbasic.dtx}{package}% + }% + }% +\else + \let\endbatchfile\relax +\fi +\endbatchfile +\documentclass[ngerman,USenglish]{koma-script-source-doc} +\usepackage{babel} +\usepackage{csquotes} +\usepackage[style=alphabetic]{biblatex} +\begin{filecontents}[force]{\jobname.bib} +@online{pkg:float, + author={Anselm Lingnau}, + title={\pkg*{float} --- Improved interface for floating objects}, + version={1.3d}, + date={2001-11-08}, + url={https://ctan.org/pkg/float}, + urldate={2023-07-14}, + note={Improves the interface for defining floating objects such as figures + and tables. Introduces the boxed float, the ruled float and the + plaintop float. You can define your own floats and improve the + behaviour of the old ones.}, +} +@manual{pkg:float:manual, + author={Anselm Lingnau}, + date={2001-11-08}, + title={An Improved Environment for Floats}, + url={http://mirrors.ctan.org/macros/latex/contrib/float/float.pdf}, + urldate={2023-07-14}, + abstract={This style option improves the interface for defining floating + objects such as figures and tables in \LaTeX. It adds the notion + of a ‘float style’ that governs appearance of floats. New kinds of + floats may be defined using \cs{newfloat} command analogous to + \cs{newtheorem}. This style option also incorporates the + functionality of David Carlisle’s style option \pkg{here}, giving + floating environments a \texttt{[H]} option which means ‘PUT IT + HERE’ (as opposed to the standard \texttt{[h]} option which means + ‘You may put it here if you like’).}, +} +@online{pkg:xpatch, + author = {Enrico Gregorio}, + version = {0.3}, + date = {2020-03-25}, + title = {\pkg*{xpatch} – Extending \pkg{etoolbox} patching commands}, + url = {https://ctan.org/pkg/xpatch}, + urldate = {2023-07-19}, + note = {The package generalises the macro patching commands provided + by Philipp Lehmann's \pkg{etoolbox}.}, +} +@manual{pkg:xpatch:manual, + author = {Enrico Gregorio}, + version = {0.3}, + date = {2020-03-25}, + title = {The \pkg*{xpatch} package + extending \pkg{etoolbox} patching commands}, + url = {http://mirrors.ctan.org/macros/latex/contrib/xpatch/xpatch.pdf}, + urldate = {2023-07-19}, + abstract = {}, +} +@online{pkg:scrlfile, + author = {Markus Kohm}, + version = {3.41}, + date = {2023-07-07}, + title = {\pkg*{scrlfile} – Installation control (not only) for + \KOMAScript{} packages}, + url = {https://ctan.org/pkg/scrlfile}, + urldate = {2023-07-19}, + note = {The package provides hooks for the execution of commands before + or after loading files, classes or packages independent from the + \LaTeX{} kernel version.}, +} +@online{pkg:koma-script, + author={Markus Kohm}, + version={3.41}, + date={2023-07-07}, + title={{\KOMAScript} --- A bundle of versatile classes and packages}, + url={https://ctan.org/pkg/koma-script}, + urldate={2023-07-14}, + note={The \KOMAScript{} bundle provides replacements for the \pkg*{article}, + \pkg*{report}, and \pkg*{book} classes with emphasis on typography and + versatility. There is also a letter class.}, +} +@online{pkg:tocbasic, + author={Markus Kohm}, + version={3.41}, + date={2023-07-07}, + title={\pkg*{tocbasic} --- Management of tables/lists of contents (and the + like)}, + url={https://ctan.org/pkg/tocbasic}, + urldate={2023-07-14}, + note={The package provides means to create specialised ``table of + contents''-like lists of features of a document.}, +} +@manual{pkg:koma-script:manual:de, + author={Markus Kohm}, + date={2023-06-16}, + title={{\KOMAScript}}, + subtitle={Die Anleitung}, + url={http://mirrors.ctan.org/macros/latex/contrib/koma-script/scrguide-de.pdf}, + urldate={2023-07-04}, +} +@manual{pkg:koma-script:manual:en, + author={Markus Kohm}, + date={2023-06-16}, + title={{\KOMAScript}}, + subtitle={The Guide}, + url={http://mirrors.ctan.org/macros/latex/contrib/koma-script/scrguide-en.pdf}, + urldate={2023-07-14}, +} +\end{filecontents} +\addbibresource{\jobname.bib} +\setcounter{StandardModuleDepth}{2} +\begin{document} + \nocite{pkg:float,pkg:koma-script,pkg:tocbasic} + \DocInput{floatbytocbasic.dtx} +\end{document} +%</dtx> +%\fi +% +% \changes{v0.1}{2023/06/01}{start of \KOMAScript{} spin-off} +% \changes{v1.0}{2023/08/19}{first package release} +% +% \GetFileInfo{floatbytocbasic.dtx} +% \title{Improving Package \pkg{float} Using +% \href{https://komascript.de/}{\KOMAScript} Package \pkg{tocbasic}} +% \author{\href{mailto:komascript@gmx.info}{Markus Kohm}} +% \date{Version \filedate{} \fileversion} +% \maketitle +% \begin{abstract} +% Package \pkg*{floatbytocbasic} has started as hack module of the +% \KOMAScript{} package \pkg*{scrhack} years ago to fix an issue when using +% package \pkg{float} with \KOMAScript~3. This became necessary because +% package \pkg{float} still depends on an interface once proposed by the +% \KOMAScript{} author, but which has long since failed to meet +% requirements. Unfortunately, this problem could not be solved in dialog +% with the author of \pkg{float}. Although \pkg*{floatbytocbasic} still +% loads the \pkg{float} package, it then changes some internal commands to +% use and optimally support the \KOMAScript{} package \pkg{tocbasic}. On the +% one hand, the user interface of \pkg{float} remains usable unchanged, but +% at the same time the package benefits from many possibilities of +% \pkg{tocbasic}. +% \end{abstract} +% +% \tableofcontents +% +%\iffalse +%<*doc> +%\fi +\section{Why should I use this package instead of + \texorpdfstring{\pkg{float}}{float} only if I use a \KOMAScript{} class or + \KOMAScript{} package \texorpdfstring{\pkg{tocbasic}}{tocbasic}?} +\label{sec:whywithkomascript} + +The main symptom of using a deprecated interface to \KOMAScript{} by package +\pkg{float}, namely the use of \cs{float@listhead} and +\cs{float@addtolists}, are corresponding warnings when using one of the +\KOMAScript{} classes at the same time, for example: +\begin{verbatim} + Class scrbook Warning: \float@addtolists detected! + (scrbook) Implementation of \float@addtolist became + (scrbook) deprecated in KOMA-Script v3.01 2008/11/14 and + (scrbook) has been replaced by several more flexible + (scrbook) features of package `tocbasic`. + (scrbook) Since Version 3.12 support for deprecated + (scrbook) \float@addtolist interface has been + (scrbook) restricted to only some of the KOMA-Script + (scrbook) features and been removed from others. + (scrbook) Loading of package `scrhack' may help to + (scrbook) avoid this warning, if you are using a + (scrbook) a package that still implements the + (scrbook) deprecated \float@addtolist interface. +\end{verbatim} +or +\begin{verbatim} + Class scrbook Warning: \float@listhead detected! + (scrbook) Implementation of \float@listhead became + (scrbook) deprecated in KOMA-Script v3.01 2008/11/14 and + (scrbook) has been replaced by several more flexible + (scrbook) features of package `tocbasic`. + (scrbook) Maybe implementation of \float@listhead will + (scrbook) removed from KOMA-Script soon. + (scrbook) Loading of package `scrhack' may help to + (scrbook) avoid this warning, if you are using a + (scrbook) a package that still implements the + (scrbook) deprecated \float@listhead interface. +\end{verbatim} + +If you know, that the issue is because of loading package \pkg{float} you can +avoid it using \pkg{floatbytocbasic} as explained in \autoref{sec:howtouse}. + +\section{Why should I use this package instead of + \texorpdfstring{\pkg{float}}{float} only if I don't use a \KOMAScript{} + class or package?} +\label{sec:whywithoutkomascript} + +Package \pkg{float} does not check if a file extension or environment already +has been defined when using \cs{newfloat}. So several definitions of float +environments either with the same name or the same file extension could happen +by accident. Package \pkg*{floatbytocbasic} adds test to avoid such +issues. Alternatively you can force the definition or do the definition only +if needed. See description of \cs{deffloat}, \cs{renewfloat} and +\cs{providefloat} in \autoref{sec:howtouse} for more information. + +Package \pkg{tocbasic} provides several additional features, e.g.: +\begin{itemize} +\item automatic handling of language switching using \pkg{babel}, +\item optional numbered heading for a list/table of contents, +\item optional adding an entry to the table of contents for a list/table of + contents even if the heading is not numbered, +\item easy configuration of entries to a list/table of contents. +\end{itemize} +Several more features can be added by the class or other packages. See section +about \pkg*{tocbasic} in the \KOMAScript{} manual, either +\autocite{pkg:koma-script:manual:en} or \autocite{pkg:koma-script:manual:de}. + +\section{How to use \texorpdfstring{\pkg*{floatbytocbasic}}{floatbytocbasic}} +\label{sec:howtouse} + +In the document preamble of your document you just can replace +\begin{verbatim} + \usepackage{float} +\end{verbatim} +by +\begin{verbatim} + \usepackage{floatbytocbasic} +\end{verbatim} +to load package \pkg*{floatbytocbasic}. This does still also load package +\pkg{float} but additionally patches several commands of \pkg{float} to avoid +the issues shown in \autoref{sec:whywithkomascript}. + +If you want you can alternatively also load both packages explicitly, either +\pkg{float} before \pkg{floatbytocbasic} or---if you +want---\pkg{floatbytocbasic} before \pkg{float}. This is also useful, if you +use a package, that uses \pkg*{float} itself. In this case, you always should +load \pkg{floatbytocbasic} \emph{before} the package, that uses +\pkg{float}. Otherwise it is very likely that for some new float environments +the enhancements of \pkg*{floatbytocbasic} will not be used. Only if +\pkg*{floatbytocbasic} is loaded before the first use of \cs{newfloat} can it +be ensured that the definition of the new sliding environments is really done +with the help of \pkg{tocbasic} and thus its extended user interface is used. + +When using a class that uses \pkg{float}, the correct operation can be ensured +with +\begin{verbatim} + \AddToHook{package/float/after}{\RequirePackage{floatbytocbasic}} +\end{verbatim} +even before \cs{documentclass}. This requires at least \LaTeX{} +2020/10/01. For older versions of \LaTeX{} you can use +\begin{verbatim} + \RequirePackage{scrlfile} + \AfterPackage{float}{\RequirePackage{floatbytocbasic}} +\end{verbatim} +also before \cs{documentclass}. This would require the \KOMAScript{} package +\pkg{scrlfile}\nocite{pkg:scrlfile}. + +\begin{description} + \item[Note:] You \emph{should not} load \pkg*{float} after loading package + \pkg*{floatrow}. However, if you do, \pkg{floatrowbytocbasic} will be + loaded automatically. +\end{description} + +The user interface of \pkg*{floatbytocbasic} is the same as of \pkg{float}, +see \autocite{pkg:float:manual}. Following we document only the differences. + +\DescribeCommand{\newfloat} +\DescribeCommand{\providefloat} +\DescribeCommand{\renewfloat} +\DescribeCommand{\deffloat} +See \autocite[section~2]{pkg:float:manual} for the basic usage of \cs{newfloat}. +The command takes three mandatory arguments and an optional one; it is of +the form: +\begin{quote} + \cs{newfloat}\marg{type}\marg{placement}\marg{ext}\oarg{within} +\end{quote} +\pkg{floatbytocbasic} adds the registration of the file extension \meta{ext}, +which is the third argument. The main problem here is to decide what to do, if +\meta{ext} already has been registered. Package \pkg{float} simply does not +care for this case. It does neither report an error nor a warning, but just +redefine the float \meta{type} and reuses the auxiliary file extension +\meta{ext}. Because of the ``\texttt{new}'' in the name of the command, we +have decided to do it a little bit different. If the owner of the \meta{ext} +is \texttt{float}, it is assumed, that using the same auxiliary file is +intended and only an info is written to the \file{log}-file. Otherwise an +error is reported. But we also decided to define three new commands: +\begin{quote}\raggedright + \cs{deffloat}\marg{type}\marg{placement}\marg{ext}\oarg{within}\\ + \cs{providefloat}\marg{type}\marg{placement}\marg{ext}\oarg{within}\\ + \cs{renewfloat}\marg{type}\marg{placement}\marg{ext}\oarg{within} +\end{quote} +\cs{deffloat} also does not care for already existing \meta{type} environment +or already registered \meta{ext}. \cs{providefloat} does not overwrite +existing \meta{type} environment or already registered \meta{ext} for other +owners but \texttt{float}. \cs{renewfloat} does overwrite only already +existing \meta{type} environment with registered \meta{ext}. There are also +cases like defined \cs{\meta{type}} but not \cs{end\meta{type}} or not defined +environment \meta{type} but registered \meta{ext}. But there are no special +commands to handle these. If users need to take care for these cases, they can +test for definition using the \LaTeX{} kernel macro \cs{@ifundefined} and the +\pkg{tocbasic} command \cs{Ifattoclist}, described in the \KOMAScript{} user +manuals \autocite{pkg:koma-script:manual:en} +resp. \autocite{pkg:koma-script:manual:de}. +% +% \iffalse +%</doc> +% \fi +% +% \MaybeStop{\printbibliography[heading=bibintoc]\PrintIndex} +% +% \iffalse +%<*package> +% \fi +% \section{Implementation} +% +% \pkg{floatbytocbasic} depend on \KOMAScript{} package \pkg{tocbasic}. So we +% load it already before everything else. We use this package also to require +% at least \KOMAScript{} 3.41, which is one version before the intended +% spin-off. +% \begin{macrocode} +\@ifpackageloaded{floatrow}{% + \PackageWarning{floatbytocbasic}{% + package incompatible with package floatrow.\MessageBreak + Automatically using floatrowbytocbasic% + }% + \RequirePackage{floatrowbytocbasic}% + \endinput +}{} +\RequirePackage{tocbasic}[2023/07/07] +% \end{macrocode} +% +% We also load package \pkg{float}, because we reuse most of the code: +% \begin{macrocode} +\RequirePackage{float} +% \end{macrocode} +% +% As often as possible, we do not redefine macors of \pkg{float}, but patch +% them using \pkg{xpatch}\nocite{pkg:xpatch}: +% \begin{macrocode} +\RequirePackage{xpatch} +% \end{macrocode} +% +% We also use the new document command interface. So if the \LaTeX{} kernel is +% too old, we require \pkg{xparse}: +% \begin{macrocode} +\@ifundefined{NewDocumentCommand}{% + \RequirePackage{xparse}% +}{} +% \end{macrocode} +% +% \begin{command}{\deffloat} +% Basicly \cs{deffloat} is \cs{newfloat} of \pkg{float}: +% \begin{macrocode} +\@ifundefined{NewCommandCopy}{\let\deffloat\newfloat}{% + \NewCommandCopy\deffloat\newfloat +} +% \end{macrocode} +% But we also have to take care, that a not yet registered \meta{ext} has to +% be registered. +% \begin{description} +% \item[Note:] We do not need to setup feature \texttt{chapteratlist}, because +% classes like the \KOMAScript{} classes should use +%\begin{verbatim} +% \AtAddToTocList[float]{\setuptoc{\@currext}{chapteratlist}} +%\end{verbatim} +% to implement such features. +% \end{description} +% \begin{macrocode} +\xpretocmd\deffloat{% + \Ifattoclist{#3}{% + \let\reserved@a\relax + \owneroftoc[\def\reserved@a]{#3}\relax + \@ifundefined{reserved@a}{}{% + \Ifstr{\reserved@a}{float}{% + \PackageInfo{floatbytocbasic}{% + reusing file extension `#3' for\MessageBreak + float type `#1'% + }% + }{% + \PackageWarning{floatbytocbasic}{% + reusing file extension `#3' of owner\MessageBreak + `\reserved@a' for float `#1'\MessageBreak + not recommended% + }% + }% + }% + }{\addtotoclist[float]{#3}}% +}{}{% + \PackageError{floatbytocbasic}{incompatible definition of + \string\newfloat}{% + Package `floatbytocbasic' depends on the original definition of package + `float'.\MessageBreak + Some changes to that definition are tolerated.\MessageBreak + \@ifundefined{deffloat}% + {But it seems the definition is completely missing!}% + {But the current definition is incompatible!}% + \MessageBreak + Make sure, you have installed the original package `float' as referred + by\Messagebreak + section ``References'' of the manual.% + }% +} +% \end{macrocode} +% \end{command} +% +% \begin{command}{\newfloat,\providefloat,\renewfloat} +% \cs{newfloat} and \cs{renewfloat} similar to \cs{newcommand} and +% \cs{renewcommand} do some tests and maybe report an error, before +% (nevertheless) defining the float. +% \begin{macrocode} +\RenewDocumentCommand{\newfloat}{mmmo}{% + \@tempswatrue + \Ifattoclist{#3}{% + \let\reserved@a\relax + \owneroftoc[\def\reserved@a]{#3}\relax + \@ifundefined{reserved@a}{}{% + \Ifstr{\reserved@a}{float}{}{% + \PackageError{floatbytocbasic}{% + reusing `#3' of owner `\reserved@a' not allowed% + }{% + Each file extension should be used only once.\MessageBreak + Reusing is only allowed with the same owner/category.\MessageBreak + You, the class, or another package already uses `#3'.\MessageBreak + \@eha + }% + \@tempswafalse + }% + }% + }{}% + \if@tempswa + \expandafter\@ifdefinable\csname #1\endcsname{% + \IfValueTF{#4}{% + \deffloat{#1}{#2}{#3}[#4]% + }{% + \deffloat{#1}{#2}{#3}% + }% + }% + \fi +} +\NewDocumentCommand{\providefloat}{mmmo}{% + \@ifundefined{#1}{% + \newfloat{#1}{#2}{#3}[#4]% + }{}% +} +\NewDocumentCommand{\renewfloat}{mmmo}{% + \@ifundefined{#1}{% + \@latex@error{Environment #1 undefined}\@ehc + \removefromtoclist{#3}% + }{% + \Ifattoclist{#3}{% + \removefromtoclist{#3}% + }{% + \PackageError{floatbytocbasic}{extension `#3' not yet registered}{% + I can only renew floats with already registered + extensions.\MessageBreak + \@ehc + }% + }% + }% + \expandafter\let\csname #1\endcsname\relax + \expandafter\let\csname end#1\endcsname\relax + \newfloat{#1}{#2}{#3}[#4]% +} +% \end{macrocode} +% \end{command} +% +% \begin{command}{\listof} +% This command is redefined using a complete new definition using +% \pkg{tocbasic}'s \cs{listoftoc}. +% \begin{macrocode} +\renewcommand*\listof[2]{% + \@ifundefined{ext@#1}{% + \PackageError{floatbytocbasic}{unknown float type `#1'}\@eha + }{% + \@ifundefined{l@#1}{\expandafter\let\csname l@#1\endcsname\l@figure + \@ifundefined{l@#1}{% + \DeclareTOCStyleEntry[level=1,numwidth=2.3em,indent=1.5em] + {default}{#1}% + }{}% + }{}% + \listoftoc[{#2}]{\csname ext@#1\endcsname}% + }% +}% +% \end{macrocode} +% \end{command} +% +% \iffalse +%</package> +% \fi +% +% \Finale +% \PrintChanges +% +% \endinput +% Local Variables: +% mode: doctex +% ispell-local-dictionary: "en_US" +% eval: (flyspell-mode 1) +% TeX-master: t +% End: diff --git a/macros/latex/contrib/floatbytocbasic/floatbytocbasic.pdf b/macros/latex/contrib/floatbytocbasic/floatbytocbasic.pdf Binary files differnew file mode 100644 index 0000000000..e872073200 --- /dev/null +++ b/macros/latex/contrib/floatbytocbasic/floatbytocbasic.pdf diff --git a/macros/latex/contrib/floatrowbytocbasic/LICENSE.md b/macros/latex/contrib/floatrowbytocbasic/LICENSE.md new file mode 100644 index 0000000000..99a6973749 --- /dev/null +++ b/macros/latex/contrib/floatrowbytocbasic/LICENSE.md @@ -0,0 +1,19 @@ +---------------------------------------------------------------------------- + +This work may be distributed and/or modified under the conditions of the +LaTeX Project Public License, version 1.3c of the license. The latest +version of this license is in http://www.latex-project.org/lppl.txt and +version 1.3c or later is part of all distributions of LaTeX 2005/12/01 +or later. This work has the LPPL maintenance status “maintained”. +The current maintainer and author of this work is Markus Kohm. + +---------------------------------------------------------------------------- + +Dieses Werk darf nach den Bedingungen der LaTeX Project Public Lizenz +in der Version 1.3c, verteilt und/oder verändert werden. Die aktuelle +Version dieser Lizenz ist http://www.latex-project.org/lppl.txt und +Version 1.3c oder später ist Teil aller Verteilungen von LaTeX 2005/12/01 +oder später. Dieses Werk hat den LPPL-Verwaltungs-Status „maintained” +Der aktuelle Verwalter und Autor dieses Werks ist Markus Kohm. + +---------------------------------------------------------------------------- diff --git a/macros/latex/contrib/floatrowbytocbasic/README.md b/macros/latex/contrib/floatrowbytocbasic/README.md new file mode 100644 index 0000000000..396d0cc83b --- /dev/null +++ b/macros/latex/contrib/floatrowbytocbasic/README.md @@ -0,0 +1,153 @@ +# Package `floatrowbytocbasic` + +Copyright © 2008–2023 Markus Kohm + +Release: 2023-08-16 v1.0 + +License: LPPL 1.3c + +KOMA presents the `floatrowbytocbasic` package to extend the functionality +of package [`floatrow`](https://ctan.org/pkg/floatrow). The +`floatrowbytocbasic` package is part of the *third-party enhancements* +project. + +---------------------------------------------------------------------------- + +This work may be distributed and/or modified under the conditions of +the LaTeX Project Public License, version 1.3c of the license. +The latest version of this license is in + http://www.latex-project.org/lppl.txt +and version 1.3c or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +The Current Maintainer and author of this work is Markus Kohm. + +---------------------------------------------------------------------------- + +# Abstract + +For several years +[KOMA-Script](https://www.sourceforge.net/project/koma-script) provided a +package `scrhack`, that has been made not only to improve the compatibility of +third-party packages with KOMA-Script classes, but also to generally improve +third-party packages. The package consisted not only in the package file +`scrhack.sty` but also in several so called hacks as separate files with +extension `.hak`. In the course of splitting off former KOMA-Script packages +from the KOMA-Script collection, it was decided to create independent packages +from the individual hacks. These new independent packages then serve as +replacements for the original packages they were intended to improve. Package +`floatrowbytocbasic` is such an enhancement package. It provides additional +features of using package [`tocbasic`](https://ctan.org/pkg/tocbasic) by +patching package [`floatrow`](https://ctan.org/pkg/floatrow). + +# Installation for Users + +If you are a user, you should wait until the package has been added to your +preferred TeX distribution. Then you can use the package manager of your TeX +distribution to install the package. + +# Unpacking for Distributors + +Distributors should download [the distribution from +CTAN](https://www.ctan.org/pkg/floatrowbytocbasic). This consists in: + +* `floatrowbytocbasic.dtx` +* `README.md` +* `LICENSE.md` +* `floatrowbytocbasic.pdf` + +If distributors also want to distribute `floatrowbytocbasic.sty`, they can +unpack it using + + tex floatrowbytocbasic.dtx + +Note, that you have to use `tex` not `latex`, `pdflatex`, `xelatex` or +`lualatex`! + +Note also, that a legal distribution consists at least in: + +* `floatrowbytocbasic.dtx` +* `README.md` + +The following files are optionally, but must not be distributed without the +previous ones: + +* `LICENSE.md` +* `floatrowbytocbasic.sty` +* `floatrowbytocbasic.pdf` + +# Unpacking and Installation for Developers + +Developers who want the current developer version of the code to be installed +for testing, should clone [the `third-party-enhancements` +repository](https://github.com/komascript/third-party-enhancements), e.g., +using + + git clone https://github.com/komascript/third-party-enhancements.git + +You can than either unpack and install all the third-party enhancements using: + + l3build install --full + +from within the main directory of the cloned respository. For installation of +`floatrowbytocbasic` only run the same command from within the +`floatrowbytocbasic` subdirectory. For installation without the manual omit +option `--full`, but this is not recommended for developers. + +# How to get the Manual + +After installation you should get the user manual using: + + texdoc floatrowbytocbasic + +See the manual of your TeX distribution for more information. + +Developers or distributors can also build the manual from the source using: + + l3build doc + +# How to Contribute + +To become a contributor, e.g., do heavy testing. If you find an issue, please +report it using [the issue +tracker](https://github.com/komascript/third-party-enhancements/issues). You +can also become a developer and, e.g., make new test files to the +packages. See the [`l3build`](https://ctan.org/pkg/l3build) manual for more +information about tests. If you've created a new test and think that it would +be useful. Please either do a pull request or [add a new +issue](https://github.com/komascript/third-party-enhancements/issues/new/choose) +and include your test file. + +Another kind of contribution would be to contact an author of one of the +third-party packages and convince her or him to integrate the code of the +corresponding enhancement package from this project into her or his package. + +# How to Report Issues + +If you think you have found a bug (or another kind of issue) using +`floatrowbytocbasic` you should use [the issue +tracker](https://github.com/komascript/third-party-enhancements/issues). Please +first search for similar issues already reported and maybe also already fixed +and closed. Maybe the replies to such a similar report would help you too. + +If your issue is new, you should report it also using [the issue +tracker](https://github.com/komascript/third-party-enhancements/issues). Please +be kind, not only when writing the report but also when reading replies and +commenting or answering. And please always add a minimal working example and +usually the relevant parts of the `log`-file to your report. Please use the +[markdown for +code](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks) +to add such files into the text of your report. The correct language +identifier for LaTeX code would be `latex`. For `log`-files you won't need any +language identifier. Usually you should not use attachments for code or +`log`-files unless you've been asked to do so. And please note, reports should +always be self-containing. External links often break and so the report become +useles. + +# How to Say Thank You for my Work + +Hey, I'm doing this as a hobby. So no need to say thank you. But I'm a vain +fop, so I'm certainly up for a quick thank you by email. On komascript.de you +can find an [explanation of my wishes](https://komascript.de/wunschliste) if +you want to give more. If you don't understand German, just click to links at +that page. diff --git a/macros/latex/contrib/floatrowbytocbasic/floatrowbytocbasic.dtx b/macros/latex/contrib/floatrowbytocbasic/floatrowbytocbasic.dtx new file mode 100644 index 0000000000..1a14c9aeaa --- /dev/null +++ b/macros/latex/contrib/floatrowbytocbasic/floatrowbytocbasic.dtx @@ -0,0 +1,650 @@ +% \iffalse meta-comment +% ====================================================================== +% floatrowbytocbasic.dtx +% Copyright © 2008–2023 Markus Kohm +% +% This work is a KOMA-Script spin-off. For the original sources of +% KOMA-Script's `floatrow.hak' see file `scrhack.dtx' in the KOMA-Script +% sources at <https://sourceforge.net/p/koma-script/code/>. +% +% Development is taking place as part of `third-party-hacks' at +% <https://github.com/komascript/third-party-hacks>. New issues should +% be reported there as well as known issues can be found. +% +% This work may be distributed and/or modified under the conditions of +% the LaTeX Project Public License, version 1.3c of the license. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.<3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later and of this work. +% +% The Current Maintainer and author of this work is Markus Kohm. +% +% This work consists of the file `floatrowbytocbasic.dtx' and +% `README.md'. +% +% The recommended way to install `floatrowbytocbasic' is to use +% the package manager of your TeX distribution. +% ====================================================================== +% +%<*dtx> +\ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi +\ProvidesFile{floatrowbytocbasic.dtx} +%</dtx> +%<*dtx|package> +%<package>\ProvidesPackage{floatrowbytocbasic} + [2023-08-16 v1.0 +%<dtx> sources and unpack driver of + improved floatrow package using tocbasic] +%</dtx|package> +%<*dtx> +\ifx\documentclass\undefined + \input docstrip.tex + \generate{% + \file{floatrowbytocbasic.sty}{% + \from{floatrowbytocbasic.dtx}{package}% + }% + }% +\else + \let\endbatchfile\relax +\fi +\endbatchfile +\documentclass[ngerman,USenglish]{koma-script-source-doc} +\usepackage{babel} +\usepackage{csquotes} +\usepackage[style=alphabetic]{biblatex} +\begin{filecontents}[force]{\jobname.bib} +@online{pkg:floatrow, + author={Olga Lapko}, + title={\pkg*{floatrow} --- Modifying the layout of floats}, + version={0.3b}, + date={2008-08-02}, + url={https://ctan.org/pkg/floatrow}, + urldate={2023-07-18}, + note={The \pkg*{floatrow} package provides many ways to customize layouts of + floating environments and has code to cooperate with the \pkg{caption} + 3.x package. The package offers mechanisms to put floats side by side, + and to put the caption beside its float. The \pkg*{floatrow} settings + could be expanded to the floats created by packages \pkg{rotating}, + \pkg{wrapfig}, \pkg{subfig} (in the case of rows of subfloats), and + \pkg{longtable}.}, +} +@manual{pkg:floatrow:manual, + author={Olga Lapko}, + date={2009-08-02}, + title={The \pkg*{floatrow} package}, + url={http://mirrors.ctan.org/macros/latex/contrib/floatrow/floatrow.pdf}, + urldate={2023-07-18}, + abstract={This package was created as extension of the \pkg{float} package. + The \pkg*{floatrow} package borrows core code from the \pkg{float} + and \pkg{rotfloat} packages, so you must not load these packages.}, +} +@online{pkg:xpatch, + author = {Enrico Gregorio}, + version = {0.3}, + date = {2020-03-25}, + title = {\pkg*{xpatch} – Extending \pkg{etoolbox} patching commands}, + url = {https://ctan.org/pkg/xpatch}, + urldate = {2023-07-19}, + note = {The package generalises the macro patching commands provided + by Philipp Lehmann's \pkg{etoolbox}.}, +} +@manual{pkg:xpatch:manual, + author = {Enrico Gregorio}, + version = {0.3}, + date = {2020-03-25}, + title = {The \pkg*{xpatch} package + extending \pkg{etoolbox} patching commands}, + url = {http://mirrors.ctan.org/macros/latex/contrib/xpatch/xpatch.pdf}, + urldate = {2023-07-19}, + abstract = {}, +} +@online{pkg:scrlfile, + author = {Markus Kohm}, + version = {3.41}, + date = {2023-07-07}, + title = {\pkg*{scrlfile} – Installation control (not only) for + \KOMAScript{} packages}, + url = {https://ctan.org/pkg/scrlfile}, + urldate = {2023-07-19}, + note = {The package provides hooks for the execution of commands before + or after loading files, classes or packages independent from the + \LaTeX{} kernel version.}, +} +@online{pkg:koma-script, + author={Markus Kohm}, + version={3.41}, + date={2023-07-07}, + title={{\KOMAScript} --- A bundle of versatile classes and packages}, + url={https://ctan.org/pkg/koma-script}, + urldate={2023-07-14}, + note={The \KOMAScript{} bundle provides replacements for the \pkg*{article}, + \pkg*{report}, and \pkg*{book} classes with emphasis on typography and + versatility. There is also a letter class.}, +} +@online{pkg:tocbasic, + author={Markus Kohm}, + version={3.41}, + date={2023-07-07}, + title={\pkg*{tocbasic} --- Management of tables/lists of contents (and the + like)}, + url={https://ctan.org/pkg/tocbasic}, + urldate={2023-07-14}, + note={The package provides means to create specialised ``table of + contents''-like lists of features of a document.}, +} +@manual{pkg:koma-script:manual:de, + author={Markus Kohm}, + date={2023-06-16}, + title={{\KOMAScript}}, + subtitle={Die Anleitung}, + url={http://mirrors.ctan.org/macros/latex/contrib/koma-script/scrguide-de.pdf}, + urldate={2023-07-04}, +} +@manual{pkg:koma-script:manual:en, + author={Markus Kohm}, + date={2023-06-16}, + title={{\KOMAScript}}, + subtitle={The Guide}, + url={http://mirrors.ctan.org/macros/latex/contrib/koma-script/scrguide-en.pdf}, + urldate={2023-07-14}, +} +\end{filecontents} +\addbibresource{\jobname.bib} +\setcounter{StandardModuleDepth}{2} +\begin{document} + \nocite{pkg:floatrow,pkg:koma-script,pkg:tocbasic} + \DocInput{floatrowbytocbasic.dtx} +\end{document} +%</dtx> +%\fi +% +% \changes{v0.1}{2023/06/01}{start of \KOMAScript{} spin-off} +% \changes{v1.0}{2023/08/19}{first package release} +% +% \GetFileInfo{floatrowbytocbasic.dtx} +% \title{Improving Package \pkg{floatrow} Using +% \href{https://komascript.de/}{\KOMAScript} Package \pkg{tocbasic}} +% \author{\href{mailto:komascript@gmx.info}{Markus Kohm}} +% \date{Version \filedate{} \fileversion} +% \maketitle +% \begin{abstract} +% Package \pkg*{floatrowbytocbasic} has started as hack module of the +% \KOMAScript{} package \pkg*{scrhack} years ago to fix an issue when using +% package \pkg{floatrow} with \KOMAScript~3. This became necessary because +% package \pkg{floatrow} still depends on an interface once proposed by the +% \KOMAScript{} author, but which has long since failed to meet +% requirements. Unfortunately, this problem could not be solved in dialog +% with the author of \pkg{floatrow}. Although \pkg*{floatrowbytocbasic} still +% loads the \pkg{floatrow} package, it then changes some internal commands to +% use and optimally support the \KOMAScript{} package \pkg{tocbasic}. On the +% one hand, the user interface of \pkg{floatrow} remains usable unchanged, +% but at the same time the package benefits from many possibilities of +% \pkg{tocbasic}. +% \end{abstract} +% +% \tableofcontents +% +%\iffalse +%<*doc> +%\fi +\section{Why should I use this package instead of + \texorpdfstring{\pkg{floatrow}}{floatrow} only if I use a \KOMAScript{} + class or \KOMAScript{} package \texorpdfstring{\pkg{tocbasic}}{tocbasic}?} +\label{sec:whywithkomascript} + +The main symptom of using a deprecated interface to \KOMAScript{} by package +\pkg{floatrow}, namely the use of \cs{float@listhead} and +\cs{float@addtolists}, are corresponding warnings when using one of the +\KOMAScript{} classes at the same time, for example: +\begin{verbatim} + Class scrbook Warning: \float@addtolists detected! + (scrbook) Implementation of \float@addtolist became + (scrbook) deprecated in KOMA-Script v3.01 2008/11/14 and + (scrbook) has been replaced by several more flexible + (scrbook) features of package `tocbasic`. + (scrbook) Since Version 3.12 support for deprecated + (scrbook) \float@addtolist interface has been + (scrbook) restricted to only some of the KOMA-Script + (scrbook) features and been removed from others. + (scrbook) Loading of package `scrhack' may help to + (scrbook) avoid this warning, if you are using a + (scrbook) a package that still implements the + (scrbook) deprecated \float@addtolist interface. +\end{verbatim} +or +\begin{verbatim} + Class scrbook Warning: \float@listhead detected! + (scrbook) Implementation of \float@listhead became + (scrbook) deprecated in KOMA-Script v3.01 2008/11/14 and + (scrbook) has been replaced by several more flexible + (scrbook) features of package `tocbasic`. + (scrbook) Maybe implementation of \float@listhead will + (scrbook) removed from KOMA-Script soon. + (scrbook) Loading of package `scrhack' may help to + (scrbook) avoid this warning, if you are using a + (scrbook) a package that still implements the + (scrbook) deprecated \float@listhead interface. +\end{verbatim} + +If you know, that the issue is because of loading package \pkg{floatrow} you +can avoid it using \pkg{floatrowbytocbasic} as explained in +\autoref{sec:howtouse}. + +\section{Why should I use this package instead of + \texorpdfstring{\pkg{floatrow}}{floatrow} only if I don't use a + \KOMAScript{} class or package?} +\label{sec:whywithoutkomascript} + +Package \pkg{floatrow} does not check if a file extension or environment +already has been defined when using \cs{DeclareNewFloatType}. So several +definitions of float environments either with the same name or the same file +extension could happen by accident. Package \pkg*{floatrowbytocbasic} adds +test to avoid such issues. But it also allows to redefine an environment or +reuse a file extension, if you want. Alternatively you can force the +definition or do the definition only if needed. See description of +\cs{DeclareFloatType}, \cs{RedeclareFloatType} and \cs{ProvideFloatType} in +\autoref{sec:howtouse} for more information. + +Package \pkg{tocbasic} provides several additional features, e.g.: +\begin{itemize} +\item automatic handling of language switching using \pkg{babel}, +\item optional numbered heading for a list/table of contents, +\item optional adding an entry to the table of contents for a list/table of + contents even if the heading is not numbered, +\item easy configuration of entries to a list/table of contents. +\end{itemize} +Several more features can be added by the class or other packages. See section +about \pkg*{tocbasic} in the \KOMAScript{} manual, either +\autocite{pkg:koma-script:manual:en} or \autocite{pkg:koma-script:manual:de}. + +\section{How to use + \texorpdfstring{\pkg*{floatrowbytocbasic}}{floatrowbytocbasic}} +\label{sec:howtouse} + +In the document preamble of your document you just can replace +\begin{verbatim} + \usepackage{floatrow} +\end{verbatim} +by +\begin{verbatim} + \usepackage{floatrowbytocbasic} +\end{verbatim} +to load package \pkg*{floatrowbytocbasic}. This does still also load package +\pkg{floatrow} but additionally patches several commands of \pkg{floatrow} to +avoid the issues shown in \autoref{sec:whywithkomascript}. + +If you want you can alternatively also load both packages explicitly, either +\pkg{floatrow} before \pkg{floatrowbytocbasic} or---if you +want---\pkg{floatrowbytocbasic} before \pkg{floatrow}. This is also useful, if +you use a package, that uses \pkg{floatrow} itself. In this case, you always +should load \pkg{floatrowbytocbasic} \emph{before} the package, that uses +\pkg{floatrow}. Otherwise it is very likely that for some new float +environments the enhancements of \pkg*{floatrowbytocbasic} will not be +used. Only if \pkg*{floatrowbytocbasic} is loaded before the first use of +\cs{DeclareNewFloatType} can it be ensured that the definition of the new +sliding environments is really done with the help of \pkg{tocbasic} and thus +its extended user interface is used. + +When using a class that uses \pkg{floatrow}, the correct operation can be +ensured with +\begin{verbatim} + \AddToHook{package/floatrow/after}{\RequirePackage{floatrowbytocbasic}} +\end{verbatim} +even before \cs{documentclass}. This requires at least \LaTeX{} +2020/10/01. For older versions of \LaTeX{} you can use +\begin{verbatim} + \RequirePackage{scrlfile} + \AfterPackage{floatrow}{\RequirePackage{floatrowbytocbasic}} +\end{verbatim} +also before \cs{documentclass}. This would require the \KOMAScript{} package +\pkg{scrlfile}\nocite{pkg:scrlfile}. + +The user interface of \pkg*{floatrowbytocbasic} is the same as of +\pkg{floatrow}, see \autocite{pkg:floatrow:manual}. Following we document only +the differences. + +\DescribeCommand{\DeclareNewFloatType} +\DescribeCommand{\ProvideFloatType} +\DescribeCommand{\RedeclareFloatType} +\DescribeCommand{\DeclareFloatType} +See \autocite[section~2]{pkg:floatrow:manual} for the basic usage of +\cs{DeclareNewFloatType}. The command takes two mandatory arguments. It is of +the form: +\begin{quote} + \cs{DeclareNewFloatType}\marg{type}\marg{options} +\end{quote} +\pkg{floatrowbytocbasic} adds the registration of the file extension of the +new \meta{type} given either by option \opt{fileext} in the \meta{options} or +implicitly (see \autocite[section~4]{pkg:floatrow:manual}). The main problem +here is to decide what to do, if \meta{ext} already has been +registered. Package \pkg{floatrow} simply does not care for this case. It does +neither report an error nor a warning, but just redefine the float \meta{type} +and reuses the auxiliary file extension. Because of the ``\texttt{New}'' in +the name of the command, we have decided to report an error instead, but only +of the owner/category differs and therefore is not \texttt{float}. But we +also decided to define three new commands: +\begin{quote}\raggedright + \cs{DeclareFloatType}\marg{type}\marg{options}\\ + \cs{ProvideFloatType}\marg{type}\marg{options}\\ + \cs{RedeclareFloatType}\marg{type}\marg{options} +\end{quote} +\cs{DeclareFloatTpye} also does not care for already existing \meta{type} +environment or already registered file extension. \cs{DeclareNewFloatType} +reports and error for an already existing \meta{type} +environment. \cs{ProvideFloatType} does not overwrite existing \meta{type} +environment or already registered file extensions for other +owners. \cs{RedeclareFloatType} does overwrite only already existing +\meta{type} environment with registered file extension. There are also cases +like defined \cs{\meta{type}} but not \cs{end\meta{type}} or not defined +environment \meta{type} but registered file extension. But there are no +special commands to handle these. If users need to take care for these cases, +they can test for definition using the \LaTeX{} kernel macro \cs{@ifundefined} +and the \pkg{tocbasic} command \cs{Ifattoclist}, described in the +\KOMAScript{} user manuals \autocite{pkg:koma-script:manual:en} +resp. \autocite{pkg:koma-script:manual:de}. +% +% \iffalse +%</doc> +% \fi +% +% \MaybeStop{\printbibliography[heading=bibintoc]\PrintIndex} +% +% \iffalse +%<*package> +%<@@=floatrowbytocbasic> +% \fi +% \section{Implementation} +% +% \pkg{floatrowbytocbasic} depend on \KOMAScript{} package \pkg{tocbasic}. So +% we load it already before everything else. We use this package also to +% require at least \KOMAScript{} 3.41, which is one version before the +% intended spin-off. +% \begin{macrocode} +\RequirePackage{tocbasic}[2023/07/07] +% \end{macrocode} +% +% We also load package \pkg{floatrow}, because we reuse most of the code: +% \begin{macrocode} +\RequirePackage{floatrow} +% \end{macrocode} +% +% As often as possible, we do not redefine macors of \pkg{floatrow}, but patch +% them using \pkg{xpatch}\nocite{pkg:xpatch}: +% \begin{macrocode} +\RequirePackage{xpatch} +% \end{macrocode} +% +% We also use some \LaTeX3 functions. So if the \LaTeX{} kernel is +% too old, we require \pkg{expl3}: +% \begin{macrocode} +\@ifundefined{ExplSyntaxOn}{% + \RequirePackage{expl3}% +}{} +% \end{macrocode} +% +% \begin{command}{\DeclareFloatType} +% Basicly \cs{DeclareFloatType} is \cs{DeclareNewFloatType} of +% \pkg{floatrow}: +% \begin{macrocode} +\@ifundefined{NewCommandCopy}{\let\DeclareFloatType\DeclareNewFloatType}{% + \NewCommandCopy\DeclareFloatType\DeclareNewFloatType +} +% \end{macrocode} +% But we also have to take care, that a not yet registered file extension has +% to be registered. +% \begin{description} +% \item[Note:] We do not need to setup feature \texttt{chapteratlist}, because +% classes like the \KOMAScript{} classes should use +%\begin{verbatim} +% \AtAddToTocList[float]{\setuptoc{\@currext}{chapteratlist}} +%\end{verbatim} +% to implement such features. +% \end{description} +% \begin{macrocode} +\newcommand*{\floatrowbytocbasic@incompatibility@error}[1]{% + \PackageError{floatrowbytocbasic}{incompatible definition of + \expandafter\string\csname #1\endcsname}{% + Package `floatrowbytocbasic' depends on the original definition of + package\MessageBreal + `floatrow'.\MessageBreak + Some changes to that definition are tolerated.\MessageBreak + \@ifundefined{#1}% + {But it seems the definition is completely missing!}% + {But the current definition is incompatible!}% + \MessageBreak + Make sure, you have installed the original package `floatrow' as + referred\MessageBreak + by section ``References'' of the manual.% + }% +} +\xpatchcmd{\DeclareFloatType}{% + \xdef\@tempa{\noexpand\flrow@types{\the\flrow@types \FR@tmp{#1}}}% + \@tempa +}{% + \Ifattoclist{\@nameuse{ext@\FB@captype}}{% + \let\reserved@a\relax + \owneroftoc[\def\reserved@a]{\@nameuse{ext@\FB@captype}}\relax + \@ifundefined{reserved@a}{}{% + \Ifstr{\reserved@a}{float}{% + \PackageInfo{floarowtbytocbasic}{% + reusing file extension `\@nameuse{ext@\FB@captype}' for\MessageBreak + float type `#1'% + }% + }{% + \PackageWarning{floatrowbytocbasic}{% + reusing file extension `\@nameuse{ext@\FB@captype}' of owner\MessageBreak + `\reserved@a' for float `#1'\MessageBreak + not recommended% + }% + }% + }% + }{% + \addtotoclist[float]{\@nameuse{ext@\FB@captype}}% + }% + \xdef\@tempa{\noexpand\flrow@types{\the\flrow@types \FR@tmp{#1}}}% + \@tempa +}{}{% + \floatrowbytocbasic@incompatibility@error{DeclareNewFloatType}% +} +% \end{macrocode} +% \begin{description} +% \item[Note:] In difference to \pkg{floatrow} we think, reusing a counter is +% not a big problem, so we don't report an error. +% \end{description} +% \begin{macrocode} +\xpatchcmd{\DeclareFloatType}{% + \newcounter{#1}% +}{% + \@ifundefined{c@#1}{\newcounter{#1}}{% + \PackageInfo{floatrowbytocbasic}{% + reusing existing counter for float type `#1'% + }% + }% +}{}{% + \floatrowbytocbasic@incompatibility@error{DeclareNewFloatType}% +} +\xpatchcmd{\DeclareFloatType}{% + \@namedef{l@#1}{\@dottedtocline{1}{1.5em}{2.3em}}% +}{% + \@ifundefined{l@#1}{\expandafter\let\csname l@#1\endcsname\l@figure + \@ifundefined{l@#1}{% + \DeclareTOCStyleEntry[level=1,numwith=2.3em,indent=1.5em]{default}{#1}% + }{}% + }{}% +}{}{% + \floatrowbytocbasic@incompatibility@error{DeclareNewFloatType}% +} +% \end{macrocode} +% \end{command} +% +% \begin{command}{\DeclareNewFloatType,\ProvideFloatType,\RedeclareFloatType} +% \cs{DeclareNewFloatType} and \cs{RedeclareFloatType} similar to +% \cs{newcommand} and \cs{renewcommand} do some tests and maybe report an +% error, before (nevertheless) defining the float. +% \begin{description} +% \item[Note:] The test for already defined floats is somehow complicated, +% because \pkg{floatrow} delays the definition until +% |\begin{document}|. Before, there is only a list of \cs{FR@tmp} commands +% stored in toks register \cs{flrow@types}. But we also have to test for +% reusing another environment instead of a float. +% \end{description} +% \begin{macrocode} +\renewcommand{\DeclareNewFloatType}[2]{% + \floatrowbytocbasic@get@currext{#1}{#2}% + \@tempswatrue + \begingroup + \def\FR@tmp##1{% + \Ifstr{#1}{##1}{\aftergroup\@tempswafalse}{}% + }% + \the\flrow@types + \endgroup + \if@tempswa + \expandafter\@ifdefinable\csname #1\endcsname {% + \Ifattoclist{\floatrowbytocbasic@currext}{% + \let\reserved@a\relax + \owneroftoc[\def\reserved@a]{\floatrowbytocbasic@currext}\relax + \@ifundefined{reserved@a}{% + \DeclareFloatType{#1}{#2}% + }{% + \Ifstr{\reserved@a}{float}{% + \PackageInfo{floatrowbytocbasic}{% + reusing `\floatrowbytocbasic@currext' of owner `float'% + }% + \DeclareFloatType{#1}{#2}% + }{% + \PackageError{floatrowbytocbasic}{% + reusing `\floatrowbytocbasic@currext' of owner `\reserved@a' not + allowed% + }{% + Each file extension should be used only once.\MessageBreak + Reusing is only allowed with the same owner/category.\MessageBreak + You, the class, or another package already uses + `\floatrowbytocbasic@currext'.\MessageBreak + \@eha + }% + }% + }% + }{% + \DeclareFloatType{#1}{#2}% + }% + }% + \else + \PackageError{floatrowbytocbasic}{Float `#1' already defined}{% + Each float can be defined only once using + \string\DeclareNewFloatType.\MessageBreak + If you want to redefine an already existing float, please + use\MessageBreak + \string\RedeclareFloatType.\MessageBreak + \@eha + }% + \fi +} +\newcommand{\ProvideFloatType}[2]{% + \@ifundefined{#1}{% + \@tempswatrue + \begingroup + \def\FR@tmp##1{% + \Ifstr{#1}{##1}{\aftergroup\@tempswafalse}{}% + }% + \the\flrow@types + \endgroup + \if@tempswa + \DeclareNewFloatType{#1}{#2}% + \fi + }{}% +} +\newcommand{\RedeclareFloatType}[2]{% + \@tempswafalse + \@ifundefined{#1}{% + \begingroup + \def\FR@tmp##1{% + \Ifstr{#1}{##1}{\aftergroup\@tempswatrue}{}% + }% + \the\flrow@types + \endgroup + }{\@tempswatrue}% + \floatrowbytocbasic@get@currext{#1}{#2}% + \if@tempswa + \Ifattoclist{\floatrowbytocbasic@currext}{% + \removefromtoclist{\floatrowbytocbasic@currext}% + }{% + \PackageError{floatrowbytocbasic}{% + extension `\floatrowbytocbasic@currext' not yet registered% + }{% + I can only renew floats with already registered + extensions.\MessageBreak + \@ehc + }% + }% + \else + \@latex@error{Environment #1 undefined}\@ehc + \removefromtoclist{\floatrowbytocbasic@currext}% + \fi + \DeclareFloatType{#1}{#2}% +} +% \end{macrocode} +% \end{command} +% +% \ExplSyntaxOn +% \begin{macro}{\__floatrowbytocbasic_get_ext_from_prop:nn, +% \floatrowbytocbasic@get@currext} +% \ExplSyntaxOff +% Helper macros to set \cs{floatrowbytocbasic@currext} to the extension set by +% the options (=\#2). \#1 is the name of the new float type. We are not really +% interested in handling of all the options. So we just use the options to +% setup a property list and then get the one interesting property. +% \begin{macrocode} +\ExplSyntaxOn +\prop_new:N \@@_DeclareNewFloatType_prop +\tl_new:N \@@_ext_tl +\cs_new:Nn \@@_get_ext_from_prop:nn + { + \prop_set_from_keyval:Nn \@@_DeclareNewFloatType_prop { #2 } + \prop_get:NnN \@@_DeclareNewFloatType_prop { fileext } \@@_ext_tl + \quark_if_no_value:NT \@@_ext_tl + { + \tl_set:Nn \@@_ext_tl { lo#1 } + } + } +\newcommand*{\floatrowbytocbasic@get@currext}[2]{% + \@@_get_ext_from_prop:nn { #1 } { #2 } + \let\floatrowbytocbasic@currext\@@_ext_tl +} +\ExplSyntaxOff +% \end{macrocode} +% \end{macro} +% \ExplSyntaxOff +% +% \begin{command}{\listof} +% This command is redefined using a complete new definition using +% \pkg{tocbasic}'s \cs{listoftoc}. +% \begin{macrocode} +\renewcommand*{\listof}[2]{% + \@ifundefined{ext@#1}{\flrow@error{Unknown float style `#1'}}{% + \@ifundefined{l@#1}{\expandafter\let\csname l@#1\endcsname\l@figure + \@ifundefined{l@#1}{% + \DeclareTOCStyleEntry[level=1,numwidth=2.3em,indent=1.5em] + {default}{#1}% + }{}% + }{}% + \listoftoc[{#2}]{\csname ext@#1\endcsname}% + }% +}% +% \end{macrocode} +% \end{command} +% +% \iffalse +%</package> +% \fi +% +% \Finale +% \PrintChanges +% +% \endinput +% Local Variables: +% mode: doctex +% ispell-local-dictionary: "en_US" +% eval: (flyspell-mode 1) +% TeX-master: t +% End: diff --git a/macros/latex/contrib/floatrowbytocbasic/floatrowbytocbasic.pdf b/macros/latex/contrib/floatrowbytocbasic/floatrowbytocbasic.pdf Binary files differnew file mode 100644 index 0000000000..e5d0b15331 --- /dev/null +++ b/macros/latex/contrib/floatrowbytocbasic/floatrowbytocbasic.pdf diff --git a/macros/latex/contrib/joinbox/README.md b/macros/latex/contrib/joinbox/README.md index cb205bed09..327d85d2a8 100644 --- a/macros/latex/contrib/joinbox/README.md +++ b/macros/latex/contrib/joinbox/README.md @@ -1,11 +1,11 @@ Boxes joinning package based on l3coffins developed with Expl3. ======= -`joinbox` is a box joinning package based on l3coffins developed with expl3, which provides the `\joinbox` and `\joinfigs` macros for vertical or horizontal joinning of boxes. Different types of joinning can be set up with the options or `\joinset` macro. +`joinbox` is a box joinning package based on l3coffins developed with expl3, which provides the `\joinbox`, `\joinboxes`and `\joinfigs` macros for vertical or horizontal joinning of boxes. The typeout baseline, size and seprated space can be set up with the options or `\joinset` macro. Boxes can be joined vertically or horizontally. When using vertical joinning, all boxes to be joined will keep same width, while when using horizontal joined, all boxes to be joined will keep same height. -The `\joinbox` and `\joinfigs` macros without star are used for vertical joinning, while the `\joinbox*` and `\joinfigs*` with star are used for horizontal joinning. +The `\joinbox`, `\joinboxes` and `\joinfigs` macros without star are used for vertical joinning, while the `\joinbox*`, `\joinboxes*` and `\joinfigs*` with star are used for horizontal joinning. You can read the manual (in Chinese/English) for more details and examples. @@ -21,7 +21,7 @@ joinbox 盒子拼接宏包 `joinbox` 是一个基于`l3coffins`用`expl3`开发的盒子拼接宏包,它用于实现盒子的垂直或水平拼接。垂直拼接会以各对象等宽的方式拼接,而水平拼接会以各对象等高的方式拼接。 -该宏包提供了`\joinbox`和`\joinfigs`两个命令。其中,`\joinbox`用于拼接两个独立对象,`\joinfigs`用于拼接多个图像。这两个命令的不带`*`版本用于垂直拼接,而带`*`的版本用于水平拼接。同时,该宏包还提供了`\joinset`命令用于对拼接方式进行设置。 +该宏包提供了`\joinbox`, `\joinboxes`和`\joinfigs`三个个命令。其中,`\joinbox`用于拼接两个独立对象,`\joinboxes`用于拼接一组独立对象,`\joinfigs`用于拼接多个图像。这三个命令的不带`*`版本用于垂直拼接,而带`*`的版本用于水平拼接。可以通过命令选项或`\joinset`命令设置输出的基线位置,大小和拼接间距。 可以通过阅读宏包手册(中文/英文)以也解该宏包更多的使用细节和使用样例。 @@ -51,7 +51,7 @@ Copyright and Licence This work has the LPPL maintenance status "maintained". The Current Maintainer of this work is Nan Geng. - + This package consists of joinbox.sty, joinbox.tex and README.md(this file), and the derived files joinbox.pdf. diff --git a/macros/latex/contrib/joinbox/joinbox.pdf b/macros/latex/contrib/joinbox/joinbox.pdf Binary files differindex 374261e3a4..6d31c3aa86 100644 --- a/macros/latex/contrib/joinbox/joinbox.pdf +++ b/macros/latex/contrib/joinbox/joinbox.pdf diff --git a/macros/latex/contrib/joinbox/joinbox.sty b/macros/latex/contrib/joinbox/joinbox.sty index 8cf2cfcb54..a3117aa5ac 100644 --- a/macros/latex/contrib/joinbox/joinbox.sty +++ b/macros/latex/contrib/joinbox/joinbox.sty @@ -7,7 +7,7 @@ \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\ProvidesExplPackage{joinbox}{2023-08-11}{v1.0.0} +\ProvidesExplPackage{joinbox}{2023-08-13}{v1.0.1} {Join figures to same height or width with LaTeX3} \RequirePackage{xparse} @@ -37,12 +37,23 @@ \cs_set_eq:NN \seq_map_indexed_function:NN \seq_indexed_map_function:NN } +\cs_new:Npn \__joinbox_error:n { \msg_error:nn { joinbox } } + +% 函数变体 +\cs_generate_variant:Nn \hcoffin_set:Nn { Nx } + + % 定义变量 \bool_new:N \l__joinbox_vertical_bool \bool_new:N \l__joinbox_out_scale_bool +\bool_new:N \l__joinbox_only_first_bool +\bool_new:N \l__joinbox_only_second_bool + \int_new:N \l__joinbox_baseline_int -\clist_const:Nn \c__joinbox_baseline_clist { t, vc, H, b } + \clist_new:N \l__joinbox_name_clist +\clist_new:N \l__joinbox_contents_clist + \coffin_new:N \l__joinbox_out_coffin \coffin_new:N \l__joinbox_tmpa_coffin \coffin_new:N \l__joinbox_tmpb_coffin @@ -52,6 +63,12 @@ \dim_new:N \l__joinbox_min_width_dim \dim_new:N \l__joinbox_min_height_dim +\dim_new:N \l__joinbox_tmpa_dim +\dim_new:N \l__joinbox_tmpb_dim + +\bool_set_false:N \l__joinbox_only_first_bool +\bool_set_false:N \l__joinbox_only_second_bool + %% 选项设计 \keys_define:nn { joinbox } { @@ -66,16 +83,16 @@ baseline .initial:n = b, % 输出尺寸(垂直拼接:宽度,水平拼接:高度) - outlen .code:n = { \dim_compare:nNnTF { #1 } < { 0pt } + outlen .code:n = { \dim_compare:nNnTF { \dim_eval:n{ #1 } } < \c_zero_dim { \bool_set_false:N \l__joinbox_out_scale_bool }{ - \dim_compare:nNnTF { #1 } = { 0pt } + \dim_compare:nNnTF { \dim_eval:n{ #1 } } = \c_zero_dim { \bool_set_false:N \l__joinbox_out_scale_bool }{ \bool_set_true:N \l__joinbox_out_scale_bool - \dim_set:Nn \l__joinbox_out_length_dim { #1 } + \dim_set:Nn \l__joinbox_out_length_dim { \dim_eval:n{ #1 } } } } }, @@ -87,42 +104,42 @@ sep .default:n = 0pt, sep .initial:n = 0pt, - unknown .code:n = { \__joinbox_error:n { unknown-option } } - % unknown .code:n = \__joinbox_unknown_key:V \l_keys_key_str, + % unknown .code:n = { \__joinbox_error:n { unknown-option } } + unknown .code:n = \__joinbox_unknown_key:V \l_keys_key_str, + } + +\cs_new_protected:Npn \__joinbox_unknown_key:n #1 + { + \str_case:nnF { #1 } + { + { t } { \int_set:Nn \l__joinbox_baseline_int { 1 } } + { vc } { \int_set:Nn \l__joinbox_baseline_int { 2 } } + { H } { \int_set:Nn \l__joinbox_baseline_int { 3 } } + { b } { \int_set:Nn \l__joinbox_baseline_int { 4 } } + } + { + % 转换为token + \tl_set_rescan:Nnn \l_tmpa_tl {} {#1} + % 计算尺寸 + \dim_set:Nn \l_tmpa_dim { \dim_eval:n { \l_tmpa_tl } } + \dim_compare:nNnTF \l_tmpa_dim < \c_zero_dim + { + \bool_set_false:N \l__joinbox_out_scale_bool + }{ + \dim_compare:nNnTF \l_tmpa_dim = \c_zero_dim + { + \bool_set_false:N \l__joinbox_out_scale_bool + }{ + \bool_set_true:N \l__joinbox_out_scale_bool + \dim_set_eq:NN \l__joinbox_out_length_dim \l_tmpa_dim + } + } + } } +\cs_generate_variant:Nn \__joinbox_unknown_key:n { V } -% \cs_new_protected:Npn \__joinbox_unknown_key:n #1 -% { -% \clist_if_in:NnTF \c__joinbox_baseline_clist { #1 } -% { -% \int_zero:N \l_tmpa_int -% \clist_map_inline:Nn \c__joinbox_baseline_clist -% { -% \int_incr:N \l_tmpa_int -% \str_if_eq:nnT { ##1 } { #1 } -% { \clist_map_break: } -% } -% \int_gset_eq:NN \l__joinbox_baseline_int \l_tmpa_int -% } -% { -% \dim_compare:nNnTF { #1 } < { 0pt } -% { -% \bool_gset_false:N \l__joinbox_out_scale_bool -% }{ -% \dim_compare:nNnTF { #1 } = { 0pt } -% { -% \bool_gset_false:N \l__joinbox_out_scale_bool -% }{ -% \bool_gset_true:N \l__joinbox_out_scale_bool -% \dim_gset:Nn \l__joinbox_out_length_dim { #1 } -% } -% } -% } -% } -% \cs_generate_variant:Nn \__joinbox_unknown_key:n { V } - -\msg_new:nnn { joinbox } { unknown-option } - { package~ option~ "\l_keys_key_tl"~ is~ unknown. } +% \msg_new:nnn { joinbox } { unknown-option } +% { package~ option~ "\l_keys_key_tl"~ is~ unknown. } %% 参数设置用户接口 \NewDocumentCommand \joinset { m } @@ -147,6 +164,10 @@ % (最小宽度和最小宽度不一定属于同一个盒子) \cs_new:Npn \__joinbox_calc_min_size:nn #1#2 { + % 最小值清0 + \dim_zero:N \l__joinbox_min_width_dim + \dim_zero:N \l__joinbox_min_height_dim + % 取得第1个盒子的宽度和高度 \hbox_set:Nn \l_tmpa_box { @@ -157,13 +178,13 @@ { \box_wd:N \l_tmpa_box } - \dim_gset_eq:NN \l__joinbox_min_width_dim \l_tmpa_dim + \dim_set_eq:NN \l__joinbox_min_width_dim \l_tmpa_dim \dim_set:Nn \l_tmpb_dim { \box_ht_plus_dp:N \l_tmpa_box } - \dim_gset_eq:NN \l__joinbox_min_height_dim \l_tmpb_dim + \dim_set_eq:NN \l__joinbox_min_height_dim \l_tmpb_dim % 取得第2个盒子的宽度和高度,并与第1个盒子比较 \hbox_set:Nn \l_tmpa_box @@ -175,21 +196,27 @@ { \box_wd:N \l_tmpa_box } - % 比较并记录最小宽度 - \dim_compare:nNnT \l__joinbox_min_width_dim > \l_tmpa_dim - { - \dim_gset_eq:NN \l__joinbox_min_width_dim \l_tmpa_dim - } \dim_set:Nn \l_tmpb_dim { \box_ht_plus_dp:N \l_tmpa_box } - % 比较并记录最小总高度(高度+深度) - \dim_compare:nNnT \l__joinbox_min_height_dim > \l_tmpb_dim + \bool_if:NT \l__joinbox_only_second_bool { - \dim_gset_eq:NN \l__joinbox_min_height_dim \l_tmpb_dim + \dim_set_eq:NN \l__joinbox_min_width_dim \l_tmpa_dim + \dim_set_eq:NN \l__joinbox_min_height_dim \l_tmpb_dim + } + + \bool_if:nT { !(\l__joinbox_only_first_bool) && !(\l__joinbox_only_second_bool) } + { + % 比较并记录最小宽度 + \dim_set:Nn \l__joinbox_min_width_dim + { \dim_min:nn { \l__joinbox_min_width_dim }{ \l_tmpa_dim } } + + % 比较并记录最小总高度(高度+深度) + \dim_set:Nn \l__joinbox_min_height_dim + { \dim_min:nn { \l__joinbox_min_height_dim }{ \l_tmpb_dim } } } } @@ -218,52 +245,66 @@ } } -% 盒子拼接内部函数 -% 将指定文件名列表中的图像拼接成一个盒子并将基线调整为中心线输出 +% 两个盒子拼接内部函数 +% 将指定文件名列表中的图像拼接成一个盒子 % #1---第1个盒子的内容 % #2---第2个盒子的内容 \cs_new:Npn \__joinbox_handle:nn #1#2 { \group_begin: - \coffin_clear:N \l__joinbox_out_coffin % 设置第1个盒子 + \coffin_clear:N \l__joinbox_out_coffin \hcoffin_set:Nn \l__joinbox_out_coffin { #1 } + % 设置第2个盒子 + \coffin_clear:N \l__joinbox_tmpa_coffin + \hcoffin_set:Nn \l__joinbox_tmpa_coffin + { + #2 + } + \bool_if:NTF \l__joinbox_vertical_bool { % 按最小宽度缩放第1个盒子 - \coffin_scale:Nnn \l__joinbox_out_coffin + \bool_if:NF \l__joinbox_only_second_bool { - \dim_ratio:nn { \l__joinbox_min_width_dim }{ \coffin_wd:N \l__joinbox_out_coffin } - } - { - \dim_ratio:nn { \l__joinbox_min_width_dim }{ \coffin_wd:N \l__joinbox_out_coffin } + \coffin_scale:Nnn \l__joinbox_out_coffin + { + \dim_ratio:nn { \l__joinbox_min_width_dim }{ \coffin_wd:N \l__joinbox_out_coffin } + } + { + \dim_ratio:nn { \l__joinbox_min_width_dim }{ \coffin_wd:N \l__joinbox_out_coffin } + } } - % 处理第2个盒子 - \hcoffin_set:Nn \l__joinbox_tmpa_coffin + % 按最小宽度缩放第2个盒子 + \bool_if:NF \l__joinbox_only_first_bool { - #2 + \coffin_scale:Nnn \l__joinbox_tmpa_coffin + { + \dim_ratio:nn { \l__joinbox_min_width_dim }{ \coffin_wd:N \l__joinbox_tmpa_coffin } + } + { + \dim_ratio:nn { \l__joinbox_min_width_dim }{ \coffin_wd:N \l__joinbox_tmpa_coffin } + } } - % 按最小宽度缩放第2个盒子 - \coffin_scale:Nnn \l__joinbox_tmpa_coffin + \bool_if:NT \l__joinbox_only_second_bool { - \dim_ratio:nn { \l__joinbox_min_width_dim }{ \coffin_wd:N \l__joinbox_tmpa_coffin } + \coffin_set_eq:NN \l__joinbox_out_coffin \l__joinbox_tmpa_coffin } + + \bool_if:nT { !(\l__joinbox_only_first_bool) && !(\l__joinbox_only_second_bool) } { - \dim_ratio:nn { \l__joinbox_min_width_dim }{ \coffin_wd:N \l__joinbox_tmpa_coffin } + % 将第2个盒子拼接到第一个盒子 + \coffin_join:NnnNnnnn \l__joinbox_out_coffin + { hc } { b } \l__joinbox_tmpa_coffin { hc } { t } { 0pt } { -\l__joinbox_sep_dim } } - % \dim_show:N \l__joinbox_sep_dim - % 将第2个盒子拼接到第一个盒子 - \coffin_join:NnnNnnnn \l__joinbox_out_coffin - { hc } { b } \l__joinbox_tmpa_coffin { hc } { t } { 0pt } { -\l__joinbox_sep_dim } - % 按指定输出宽度缩放输出盒子 \bool_if:NT \l__joinbox_out_scale_bool { @@ -276,6 +317,12 @@ } } + \hcoffin_set:Nn \l__joinbox_out_coffin + { + \coffin_typeset:Nnnnn \l__joinbox_out_coffin + { l }{ b }{ 0pt }{ 0pt } + }\hcoffin_set_end: + % 输出拼接后的盒子 \__joinbox_typeout_coffin:N \l__joinbox_out_coffin }{ @@ -319,17 +366,64 @@ } } + \hcoffin_set:Nn \l__joinbox_out_coffin + { + \coffin_typeset:Nnnnn \l__joinbox_out_coffin + { l }{ b }{ 0pt }{ 0pt } + }\hcoffin_set_end: + % 输出拼接后的盒子 \__joinbox_typeout_coffin:N \l__joinbox_out_coffin } \group_end: } +% 多个盒子拼接内部函数 +\cs_new:Npn \__joinbox_boxes: + { + % 设置第1个盒子内容 + \clist_pop:NN \l__joinbox_contents_clist \l_tmpa_tl + \hcoffin_set:Nn \l__joinbox_tmpa_coffin + { + \l_tmpa_tl + } + + % 循环处理其它盒子内容 + \clist_map_inline:Nn \l__joinbox_contents_clist + { + \hcoffin_set:Nn \l__joinbox_tmpb_coffin + { + ##1 + } + + \__joinbox_calc_min_size:nn + { + \__joinbox_typeout_coffin:N \l__joinbox_tmpa_coffin + } + { + \__joinbox_typeout_coffin:N \l__joinbox_tmpb_coffin + } + + \hcoffin_set:Nn \l__joinbox_tmpa_coffin + { + \__joinbox_handle:nn + { + \coffin_typeset:Nnnnn \l__joinbox_tmpa_coffin + { l } { b } { 0pt } { 0pt } + } + { + \coffin_typeset:Nnnnn \l__joinbox_tmpb_coffin + { l } { b } { 0pt } { 0pt } + } + } + } + \__joinbox_typeout_coffin:N \l__joinbox_tmpa_coffin + } + \cs_new:Npn \__joinbox_figs: { % 设置第1个图像 \clist_pop:NN \l__joinbox_name_clist \l_tmpa_tl - \coffin_clear:N \l__joinbox_tmpa_coffin \hcoffin_set:Nn \l__joinbox_tmpa_coffin { \includegraphics{ \l_tmpa_tl } @@ -338,7 +432,6 @@ % 循环处理其它图像 \clist_map_inline:Nn \l__joinbox_name_clist { - \coffin_clear:N \l__joinbox_tmpb_coffin \hcoffin_set:Nn \l__joinbox_tmpb_coffin { \includegraphics{ ##1 } @@ -356,10 +449,12 @@ { \__joinbox_handle:nn { - \__joinbox_typeout_coffin:N \l__joinbox_tmpa_coffin + \coffin_typeset:Nnnnn \l__joinbox_tmpa_coffin + { l } { b } { 0pt } { 0pt } } { - \__joinbox_typeout_coffin:N \l__joinbox_tmpb_coffin + \coffin_typeset:Nnnnn \l__joinbox_tmpb_coffin + { l } { b } { 0pt } { 0pt } } } } @@ -381,9 +476,28 @@ \bool_set_true:N \l__joinbox_vertical_bool } + \group_begin: % 设置拼接参数 \keys_set:nn { joinbox } { #2 } + + % 判断第1个拼接对象是否为空 + \tl_set:Nn \l_tmpa_tl { #3 } + \tl_if_empty:VT \l_tmpa_tl + { + \bool_set_true:N \l__joinbox_only_second_bool + } + % 判断第2个拼接对象是否为空 + \tl_set:Nn \l_tmpa_tl { #4 } + \tl_if_empty:VT \l_tmpa_tl + { + \bool_set_true:N \l__joinbox_only_first_bool + } + % 两个拼接对象同时为空,无需拼接 + \bool_if:nT { \l__joinbox_only_first_bool && \l__joinbox_only_second_bool } + { + \__joinbox_error:n { empty-objs } + } % 计算最小宽度和高度 \__joinbox_calc_min_size:nn { #3 } { #4 } % 拼接输出 @@ -391,8 +505,50 @@ \group_end: } +% 两个以上盒子拼接用户接口 +% 将逗号分隔的内容构成的各个盒子拼接成一个盒子 +% #1---是否为*命令,如有*则采用水平拼接,无*则采用垂直拼接 +% #2---可选参数,用key-value选项指定拼接参数 +% #3---必选参数,用逗号分隔的,需要拼接内容(各个内容应该置于大括号内) +\NewDocumentCommand{\joinboxes}{ s O{} m} + { + \IfBooleanTF{#1} + { + \bool_set_false:N \l__joinbox_vertical_bool + }{ + \bool_set_true:N \l__joinbox_vertical_bool + } + + \group_begin: + % 设置拼接参数 + \keys_set:nn { joinbox } { #2 } + % 设置内容列表 + \clist_set:Nn \l__joinbox_contents_clist { #3 } + % 判断是否为空 + \clist_if_empty:NT \l__joinbox_contents_clist + { + \__joinbox_error:n { empty-contents } + } + % 判断是否只有1个图像名称 + \int_compare:nNnT { \clist_count:N \l__joinbox_contents_clist } = { 1 } + { + \bool_set_true:N \l__joinbox_only_first_bool + } + % 拼接盒子 + \__joinbox_boxes: + \group_end: + } + +% 空图像文件名列表出错信息 +\msg_new:nnn { joinbox } { empty-contents } + { The~contents~list~is~empty. } + +% 被拼接对象同时为空,无需拼接 +\msg_new:nnn { joinbox } { empty-objs } + { The~two~objects~which~was~joined~are~empty. } + % 图像拼接用户接口 -% 将指定文件名列表中的图像拼接成一个盒子并将基线调整为中心线输出 +% 将指定文件名列表中的图像拼接成一个盒子 % #1---是否为*命令,如有*则采用水平拼接,无*则采用垂直拼接 % #2---可选参数,用key-value选项指定拼接参数 % #3---必选参数,用逗号分隔的,需要拼接的图像文件名称(可以带有路径) @@ -410,9 +566,23 @@ \keys_set:nn { joinbox } { #2 } % 设置文件名列表 \clist_set:Nn \l__joinbox_name_clist { #3 } + % 判断是否为空 + \clist_if_empty:NT \l__joinbox_name_clist + { + \__joinbox_error:n { empty-fignames } + } + % 判断是否只有1个图像名称 + \int_compare:nNnT { \clist_count:N \l__joinbox_name_clist } = { 1 } + { + \bool_set_true:N \l__joinbox_only_first_bool + } % 拼接图像 \__joinbox_figs: \group_end: } +% 空图像文件名列表出错信息 +\msg_new:nnn { joinbox } { empty-fignames } + { The~figure~namelist~is~empty. } + \endinput diff --git a/macros/latex/contrib/joinbox/joinbox.tex b/macros/latex/contrib/joinbox/joinbox.tex index bb6d7916ef..f0848d8867 100644 --- a/macros/latex/contrib/joinbox/joinbox.tex +++ b/macros/latex/contrib/joinbox/joinbox.tex @@ -119,7 +119,7 @@ { \__codedoc_cmd:no {#1} { #2 } } \ExplSyntaxOff -\def\vers{\texttt{v1.0.0} +\def\vers{\texttt{v1.0.1} \thanks{\url{https://gitee.com/nwafu_nan/joinbox}} } @@ -173,10 +173,29 @@ \marg{对象2}指定需要拼接的对象。拼接对象将被置于coffin中, 然后按需求进行拼接。 + \marg{对象1}或\marg{对象2}可以为空,但两者不能同时为空。 + 在可选项\oarg{拼接方式}中,可以通过key-value指定输出结果 基线位置、 输出尺寸(垂直拼接是输出宽度,水平拼接是输出高度) 和拼接间距。 +\subsection{\cs{joinboxes}拼接多个对象命令} + +\begin{function}{\joinboxes,\joinboxes*} + \begin{syntax} + \cs{joinboxes} \oarg{拼接方式} \marg{拼接内容列表} + \cs{joinboxes*} \oarg{拼接方式} \marg{拼接内容列表} + \end{syntax} + +\end{function} + + 用于拼接多个对象。该命令需要用一个必选参数\marg{拼接内容列表}, + 指定需要拼接的内容,不同内容之间用英文逗号进行分隔,若内容中含 + 有空格或逗号,则需要将其置于|{}|分组中。最少需要有1个拼接内容。 + + 在\oarg{拼接方式}可选项中,可以通过key-value指定结果基线位置、 + 输出尺寸(垂直拼接是输出宽度,水平拼接是输出调试)、拼接间距。 + \subsection{\cs{joinfigs}拼接多个图像命令} \begin{function}{\joinfigs,\joinfigs*} @@ -187,9 +206,9 @@ \end{function} - 用于拼接多个图像。该命令需要用一个必选参数\marg{文件名称列表}, - 用于指定需要拼接图像,文件名称中可以包含路径,不同文件名称之 - 间用英文逗号进行分隔,最少需要有1个图像文件名称。 + 用于拼接多个图像。该命令需要用一个必选参数\marg{文件名称列表} + 指定需要拼接图像,文件名称中可以包含路径,不同文件名称之间用 + 英文逗号进行分隔。最少需要有1个图像文件名称。 在\oarg{拼接方式}可选项中,可以通过key-value指定结果基线位置、 输出尺寸(垂直拼接是输出宽度,水平拼接是输出调试)、拼接间距。 @@ -216,17 +235,25 @@ \item |H|---盒子内容基线、 \item |b|---盒子底端水平线。 \end{Description} +\begin{notezh} + 可以省略\texttt{baseline}键名,但值只能取|t|、|vc|和|b|。 +\end{notezh} \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] - 默认基线\fbox{ + 默认基线->\fbox{ \joinbox{\LaTeX 科技排版} {\LaTeX~Typesetting} } - baseline=t\fbox{ + 指定基线->\fbox{ \joinbox[baseline=t]{\LaTeX 科技排版} {\LaTeX~Typesetting} } + + 省略键名->\fbox{ + \joinbox[vc]{\LaTeX 科技排版} + {\LaTeX~Typesetting} + } \end{SideBySideExample} \bigskip @@ -237,6 +264,13 @@ 若指定的输出尺寸$\le 0$,则表示使用被拼接对象中的最小尺寸输出。 \end{option}\\ +\begin{notezh} + 可以省略\texttt{outlen}键名,但值只能取|dim|尺寸类型。 + + 当同时省略\texttt{baseline}键名和\texttt{outlen}键名时,如果 + 键值为不支持的\texttt{baseline},也是不|dim|尺寸或|dim|尺寸表达式, + 则会出错。 +\end{notezh} \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] 输出宽度\fbox{ \joinbox[outlen=2cm]{\LaTeX 科技排版} @@ -247,6 +281,11 @@ \joinbox*[outlen=0.2cm]{\LaTeX 科技排版} {\LaTeX~Typesetting} } + + 省略键名\fbox{ + \joinbox[3cm]{\LaTeX 科技排版} + {\LaTeX~Typesetting} + } \end{SideBySideExample} \bigskip @@ -267,9 +306,25 @@ } \end{SideBySideExample} +\section{多盒子拼接} + +可以使用\tn{joinboxes}命令一次拼接多个对象。 + +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] + \joinboxes[sep=2pt]{% + \LaTeX 科技排版, + {\LaTeX, Typesetting} + } + + \joinboxes*[0.2cm,sep=2pt]{% + \LaTeX 科技排版, + {\LaTeX, Typesetting} + } +\end{SideBySideExample} + \section{嵌套拼接} -可以嵌套使用\tn{joinbox}命令以实现复杂对象拼接。 +可以嵌套使用\tn{joinbox}、\tn{joinboxes}命令以实现复杂对象拼接。 \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] \joinbox*[outlen=0.04\textheight,sep=-5pt] @@ -281,7 +336,6 @@ } \end{SideBySideExample} - \section{图像拼接} \subsection{原始图像} @@ -308,13 +362,15 @@ \subsection{嵌套拼接图像} +可以嵌套使用\tn{joinbox}、\tn{joinboxes}或\tn{joinfigs}命令以实现复杂图像拼接。 + \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] - \joinbox*[outlen=0.20\textheight, sep=5pt] + \joinbox*[0.20\textheight, sep=5pt] { - \joinfigs[outlen=0.25\textwidth] + \joinfigs[0.25\textwidth] {latexframe, tl-lion, expl3} }{ - \joinfigs[outlen=0.25\textwidth] + \joinfigs[0.25\textwidth] {expl3, tl-lion, latexframe} } \end{SideBySideExample} @@ -361,10 +417,33 @@ while the \cs{joinbox*} and \cs{joinfigs*} with star are used for horizontal joi \marg{content2} to specify the objects to be joined. The contents will be placed in the coffin respectively and then joined. + \marg{content1} or \marg{content2}can be null, but both cannot be null at + the same time. + In the \oarg{options}, the typeout baseline, typeout size (vertical joinning is width, horizontal joinning is height), and joinning seperate spacing can be specified with \textit{key-value}. +\subsection{\cs{joinboxes} for Content Sets Joinning} + +\begin{function}{\joinboxes,\joinboxes*} + \begin{syntax} + \cs{joinboxes} \oarg{options} \marg{content list} + \cs{joinboxes*} \oarg{options} \marg{content list} + \end{syntax} + +\end{function} + + Used for joinning multiple contents. This command requires a + argument\marg{content list} to specify the content to be joined. + They should be separated by commas, it should. Items which contain + either spaces or commas should be surrounded by braces. + At least one content is required. + + In the \oarg{options}, the typeout baseline, typeout size + (vertical joinning is width, horizontal joinning is height), and + joinning seperate spacing can be specified with \textit{key-value}. + \subsection{\cs{joinfigs} for Figure Sets Joinning} \begin{function}{\joinfigs,\joinfigs*} @@ -408,17 +487,26 @@ bottom and top edges of the bounding box (i.e. the “vertical centre”); \item |H|---a pole running along the baseline of the typeset material contained in the coffin; \item |b|---a pole running along the bottom edge of the bounding box of the coffin. \end{Description} +\begin{noteen} + In most cases, you can omit the baseline key names and write only it's value. + But the value must be t, vc or b. +\end{noteen} \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] - baseline=b\fbox{ + default->\fbox{ \joinbox{Hello \LaTeX} {\LaTeX~Typesetting} } - baseline=t\fbox{ + top->\fbox{ \joinbox[baseline=t]{Hello \LaTeX} {\LaTeX~Typesetting} } + + omit baseline->\fbox{ + \joinbox[vc]{Hello \LaTeX} + {\LaTeX~Typesetting} + } \end{SideBySideExample} \bigskip @@ -428,6 +516,14 @@ bottom and top edges of the bounding box (i.e. the “vertical centre”); If $outlen\le 0$,then the typeout size is minimal size of all contents. \end{option}\\ +\begin{noteen} + In most cases, you can omit the outlen key names and write only it's value. + But the value must be dimension expression. + + When omitting both the |baseline| key name and the |outlen| key name, + an error occurs if the key value is an unsupported |baseline| and + not |dim| or |dim| expression. +\end{noteen} \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] width: \fbox{ @@ -439,6 +535,11 @@ bottom and top edges of the bounding box (i.e. the “vertical centre”); \joinbox*[outlen=0.2cm]{Hello \LaTeX} {\LaTeX~Typesetting} } + + omit outlen: \fbox{ + \joinbox[2cm]{Hello \LaTeX} + {\LaTeX~Typesetting} + } \end{SideBySideExample} \bigskip @@ -459,9 +560,25 @@ bottom and top edges of the bounding box (i.e. the “vertical centre”); } \end{SideBySideExample} +\section{Multiple Joinning} + +The \tn{joinboxes} can join multiple contents. + +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] + \joinboxes[sep=2pt]{% + {Hello, \LaTeX}, + \LaTeX~Typesetting + } + + \joinboxes*[0.2cm,sep=2pt]{% + {Hello, \LaTeX}, + \LaTeX~Typesetting + } +\end{SideBySideExample} + \section{Nested Joinning} -The \tn{joinbox} can be nested to get complex joinning. +The \tn{joinbox} \tn{joinboxes} can be nested to get complex joinning. \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] \joinbox*[outlen=0.04\textheight,sep=-5pt] @@ -499,13 +616,16 @@ The \tn{joinbox} can be nested to get complex joinning. \subsection{Nested Joinning} +The\tn{joinbox}, \tn{joinboxes}, or \tn{joinfigs} macros +can be nested for complex image joinning. + \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] - \joinbox*[outlen=0.20\textheight, sep=5pt] + \joinbox*[0.20\textheight, sep=5pt] { - \joinfigs[outlen=0.25\textwidth] + \joinfigs[0.25\textwidth] {latexframe, tl-lion, expl3} }{ - \joinfigs[outlen=0.25\textwidth] + \joinfigs[0.25\textwidth] {expl3, tl-lion, latexframe} } \end{SideBySideExample} diff --git a/macros/latex/contrib/profmaquette/doc/profmaquette-doc.pdf b/macros/latex/contrib/profmaquette/doc/profmaquette-doc.pdf Binary files differindex 07505355dc..6e110bc606 100644 --- a/macros/latex/contrib/profmaquette/doc/profmaquette-doc.pdf +++ b/macros/latex/contrib/profmaquette/doc/profmaquette-doc.pdf diff --git a/macros/latex/contrib/profmaquette/doc/profmaquette-doc.tex b/macros/latex/contrib/profmaquette/doc/profmaquette-doc.tex index 119220d8f1..c0a336a583 100644 --- a/macros/latex/contrib/profmaquette/doc/profmaquette-doc.tex +++ b/macros/latex/contrib/profmaquette/doc/profmaquette-doc.tex @@ -1,7 +1,7 @@ % with lualatex \documentclass[12pt,french]{article} -\usepackage[nonamssymb]{ProfCollegeT} -\usepackage{ProfMaquetteT} +\usepackage[nonamssymb]{ProfCollege} +\usepackage{ProfMaquette} \input{Christ7} \usepackage[warnings-off={mathtools-colon,mathtools-overbracket}]{unicode-math} \usepackage{fourier-otf} @@ -1055,7 +1055,7 @@ Cela engendre, si nécessaire, la création de fichier \lstinline!*.sol! pour le \clearpage \section*{Historique} \begin{description} -\item[\PfMfiledate{}--v \PfMfileversion] Amélioration de la gestion des parcours. +\item[\PfMfiledate{}--v \PfMfileversion] Correction de bugs. \end{description} \end{document} %%% Local Variables: diff --git a/macros/latex/contrib/profmaquette/latex/ProfMaquette.sty b/macros/latex/contrib/profmaquette/latex/ProfMaquette.sty index 5467145dca..51dacc1bcf 100644 --- a/macros/latex/contrib/profmaquette/latex/ProfMaquette.sty +++ b/macros/latex/contrib/profmaquette/latex/ProfMaquette.sty @@ -2,9 +2,9 @@ % licence : Released under the LaTeX Project Public License v1.3c % or later, see http://www.latex-project.org/lppl.txtf \NeedsTeXFormat{LaTeX2e}% -\def\filedate{2023/08/15}% +\def\filedate{2023/08/17}% \let\PfMfiledate\filedate% -\def\fileversion{0.35}% +\def\fileversion{0.4}% \let\PfMfileversion\fileversion% \ProvidesPackage{ProfMaquette}[\filedate\space v\fileversion\space Maquettage de documents]% @@ -15,6 +15,8 @@ \RequirePackage{xlop} +\RequirePackage{varwidth} + \RequirePackage{tcolorbox} \tcbuselibrary{breakable,external,fitting,hooks,magazine,poster,raster,skins,theorems,listings,listingsutf8} @@ -1518,7 +1520,7 @@ \setKV[IE]{#1}% \begin{tcolorbox}[useriecor]% \sffamily \useKV[IE]{Nom} \no\useKV[IE]{Numero} : \useKV[IE]{Theme} \ifboolKV[IE]{Sujets}{\scriptsize(Sujet \useKV[IE]{Sujet})}{}\hfill Correction% - \par{\tiny\useKV[IE]{Code}}\hfill{\scriptsize\useKV[DS]{Date}}% + \par{\tiny\useKV[IE]{Code}}\hfill{\scriptsize\useKV[IE]{Date}}% \end{tcolorbox}% }% |