From b65568f44e519d69d9eb8789f1b40981f4b55759 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 25 Oct 2020 21:34:16 +0000 Subject: association-matrix (25oct20) git-svn-id: svn://tug.org/texlive/trunk@56759 c570f23f-e606-0410-a88d-b1316a301751 --- .../doc/latex/association-matrix/DEPENDS.txt | 5 + .../doc/latex/association-matrix/LICENCE | 415 +++++++++++++++++++++ .../doc/latex/association-matrix/README.md | 11 + .../association-matrix/association-matrix.pdf | Bin 0 -> 243321 bytes .../association-matrix/association-matrix.tex | 344 +++++++++++++++++ .../association-matrix/association-matrix.sty | 373 ++++++++++++++++++ 6 files changed, 1148 insertions(+) create mode 100644 Master/texmf-dist/doc/latex/association-matrix/DEPENDS.txt create mode 100644 Master/texmf-dist/doc/latex/association-matrix/LICENCE create mode 100644 Master/texmf-dist/doc/latex/association-matrix/README.md create mode 100644 Master/texmf-dist/doc/latex/association-matrix/association-matrix.pdf create mode 100644 Master/texmf-dist/doc/latex/association-matrix/association-matrix.tex create mode 100644 Master/texmf-dist/tex/latex/association-matrix/association-matrix.sty (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/latex/association-matrix/DEPENDS.txt b/Master/texmf-dist/doc/latex/association-matrix/DEPENDS.txt new file mode 100644 index 00000000000..1f65d892c32 --- /dev/null +++ b/Master/texmf-dist/doc/latex/association-matrix/DEPENDS.txt @@ -0,0 +1,5 @@ +hard etoolbox +hard forloop +hard ifthen +hard textcomp +hard xparse diff --git a/Master/texmf-dist/doc/latex/association-matrix/LICENCE b/Master/texmf-dist/doc/latex/association-matrix/LICENCE new file mode 100644 index 00000000000..f8b699e6eb5 --- /dev/null +++ b/Master/texmf-dist/doc/latex/association-matrix/LICENCE @@ -0,0 +1,415 @@ +The LaTeX Project Public License +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + +LPPL Version 1.3c 2008-05-04 + +Copyright 1999 2002-2008 LaTeX3 Project + Everyone is allowed to distribute verbatim copies of this + license document, but modification of it is not allowed. + + +PREAMBLE +======== + +The LaTeX Project Public License (LPPL) is the primary license under +which the LaTeX kernel and the base LaTeX packages are distributed. + +You may use this license for any work of which you hold the copyright +and which you wish to distribute. This license may be particularly +suitable if your work is TeX-related (such as a LaTeX package), but +it is written in such a way that you can use it even if your work is +unrelated to TeX. + +The section `WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE', +below, gives instructions, examples, and recommendations for authors +who are considering distributing their works under this license. + +This license gives conditions under which a work may be distributed +and modified, as well as conditions under which modified versions of +that work may be distributed. + +We, the LaTeX3 Project, believe that the conditions below give you +the freedom to make and distribute modified versions of your work +that conform with whatever technical specifications you wish while +maintaining the availability, integrity, and reliability of +that work. If you do not see how to achieve your goal while +meeting these conditions, then read the document `cfgguide.tex' +and `modguide.tex' in the base LaTeX distribution for suggestions. + + +DEFINITIONS +=========== + +In this license document the following terms are used: + + `Work' + Any work being distributed under this License. + + `Derived Work' + Any work that under any applicable law is derived from the Work. + + `Modification' + Any procedure that produces a Derived Work under any applicable + law -- for example, the production of a file containing an + original file associated with the Work or a significant portion of + such a file, either verbatim or with modifications and/or + translated into another language. + + `Modify' + To apply any procedure that produces a Derived Work under any + applicable law. + + `Distribution' + Making copies of the Work available from one person to another, in + whole or in part. Distribution includes (but is not limited to) + making any electronic components of the Work accessible by + file transfer protocols such as FTP or HTTP or by shared file + systems such as Sun's Network File System (NFS). + + `Compiled Work' + A version of the Work that has been processed into a form where it + is directly usable on a computer system. This processing may + include using installation facilities provided by the Work, + transformations of the Work, copying of components of the Work, or + other activities. Note that modification of any installation + facilities provided by the Work constitutes modification of the Work. + + `Current Maintainer' + A person or persons nominated as such within the Work. If there is + no such explicit nomination then it is the `Copyright Holder' under + any applicable law. + + `Base Interpreter' + A program or process that is normally needed for running or + interpreting a part or the whole of the Work. + + A Base Interpreter may depend on external components but these + are not considered part of the Base Interpreter provided that each + external component clearly identifies itself whenever it is used + interactively. Unless explicitly specified when applying the + license to the Work, the only applicable Base Interpreter is a + `LaTeX-Format' or in the case of files belonging to the + `LaTeX-format' a program implementing the `TeX language'. + + + +CONDITIONS ON DISTRIBUTION AND MODIFICATION +=========================================== + +1. Activities other than distribution and/or modification of the Work +are not covered by this license; they are outside its scope. In +particular, the act of running the Work is not restricted and no +requirements are made concerning any offers of support for the Work. + +2. You may distribute a complete, unmodified copy of the Work as you +received it. Distribution of only part of the Work is considered +modification of the Work, and no right to distribute such a Derived +Work may be assumed under the terms of this clause. + +3. You may distribute a Compiled Work that has been generated from a +complete, unmodified copy of the Work as distributed under Clause 2 +above, as long as that Compiled Work is distributed in such a way that +the recipients may install the Compiled Work on their system exactly +as it would have been installed if they generated a Compiled Work +directly from the Work. + +4. If you are the Current Maintainer of the Work, you may, without +restriction, modify the Work, thus creating a Derived Work. You may +also distribute the Derived Work without restriction, including +Compiled Works generated from the Derived Work. Derived Works +distributed in this manner by the Current Maintainer are considered to +be updated versions of the Work. + +5. If you are not the Current Maintainer of the Work, you may modify +your copy of the Work, thus creating a Derived Work based on the Work, +and compile this Derived Work, thus creating a Compiled Work based on +the Derived Work. + +6. If you are not the Current Maintainer of the Work, you may +distribute a Derived Work provided the following conditions are met +for every component of the Work unless that component clearly states +in the copyright notice that it is exempt from that condition. Only +the Current Maintainer is allowed to add such statements of exemption +to a component of the Work. + + a. If a component of this Derived Work can be a direct replacement + for a component of the Work when that component is used with the + Base Interpreter, then, wherever this component of the Work + identifies itself to the user when used interactively with that + Base Interpreter, the replacement component of this Derived Work + clearly and unambiguously identifies itself as a modified version + of this component to the user when used interactively with that + Base Interpreter. + + b. Every component of the Derived Work contains prominent notices + detailing the nature of the changes to that component, or a + prominent reference to another file that is distributed as part + of the Derived Work and that contains a complete and accurate log + of the changes. + + c. No information in the Derived Work implies that any persons, + including (but not limited to) the authors of the original version + of the Work, provide any support, including (but not limited to) + the reporting and handling of errors, to recipients of the + Derived Work unless those persons have stated explicitly that + they do provide such support for the Derived Work. + + d. You distribute at least one of the following with the Derived Work: + + 1. A complete, unmodified copy of the Work; + if your distribution of a modified component is made by + offering access to copy the modified component from a + designated place, then offering equivalent access to copy + the Work from the same or some similar place meets this + condition, even though third parties are not compelled to + copy the Work along with the modified component; + + 2. Information that is sufficient to obtain a complete, + unmodified copy of the Work. + +7. If you are not the Current Maintainer of the Work, you may +distribute a Compiled Work generated from a Derived Work, as long as +the Derived Work is distributed to all recipients of the Compiled +Work, and as long as the conditions of Clause 6, above, are met with +regard to the Derived Work. + +8. The conditions above are not intended to prohibit, and hence do not +apply to, the modification, by any method, of any component so that it +becomes identical to an updated version of that component of the Work as +it is distributed by the Current Maintainer under Clause 4, above. + +9. Distribution of the Work or any Derived Work in an alternative +format, where the Work or that Derived Work (in whole or in part) is +then produced by applying some process to that format, does not relax or +nullify any sections of this license as they pertain to the results of +applying that process. + +10. a. A Derived Work may be distributed under a different license + provided that license itself honors the conditions listed in + Clause 6 above, in regard to the Work, though it does not have + to honor the rest of the conditions in this license. + + b. If a Derived Work is distributed under a different license, that + Derived Work must provide sufficient documentation as part of + itself to allow each recipient of that Derived Work to honor the + restrictions in Clause 6 above, concerning changes from the Work. + +11. This license places no restrictions on works that are unrelated to +the Work, nor does this license place any restrictions on aggregating +such works with the Work by any means. + +12. Nothing in this license is intended to, or may be used to, prevent +complete compliance by all parties with all applicable laws. + + +NO WARRANTY +=========== + +There is no warranty for the Work. Except when otherwise stated in +writing, the Copyright Holder provides the Work `as is', without +warranty of any kind, either expressed or implied, including, but not +limited to, the implied warranties of merchantability and fitness for a +particular purpose. The entire risk as to the quality and performance +of the Work is with you. Should the Work prove defective, you assume +the cost of all necessary servicing, repair, or correction. + +In no event unless required by applicable law or agreed to in writing +will The Copyright Holder, or any author named in the components of the +Work, or any other party who may distribute and/or modify the Work as +permitted above, be liable to you for damages, including any general, +special, incidental or consequential damages arising out of any use of +the Work or out of inability to use the Work (including, but not limited +to, loss of data, data being rendered inaccurate, or losses sustained by +anyone as a result of any failure of the Work to operate with any other +programs), even if the Copyright Holder or said author or said other +party has been advised of the possibility of such damages. + + +MAINTENANCE OF THE WORK +======================= + +The Work has the status `author-maintained' if the Copyright Holder +explicitly and prominently states near the primary copyright notice in +the Work that the Work can only be maintained by the Copyright Holder +or simply that it is `author-maintained'. + +The Work has the status `maintained' if there is a Current Maintainer +who has indicated in the Work that they are willing to receive error +reports for the Work (for example, by supplying a valid e-mail +address). It is not required for the Current Maintainer to acknowledge +or act upon these error reports. + +The Work changes from status `maintained' to `unmaintained' if there +is no Current Maintainer, or the person stated to be Current +Maintainer of the work cannot be reached through the indicated means +of communication for a period of six months, and there are no other +significant signs of active maintenance. + +You can become the Current Maintainer of the Work by agreement with +any existing Current Maintainer to take over this role. + +If the Work is unmaintained, you can become the Current Maintainer of +the Work through the following steps: + + 1. Make a reasonable attempt to trace the Current Maintainer (and + the Copyright Holder, if the two differ) through the means of + an Internet or similar search. + + 2. If this search is successful, then enquire whether the Work + is still maintained. + + a. If it is being maintained, then ask the Current Maintainer + to update their communication data within one month. + + b. If the search is unsuccessful or no action to resume active + maintenance is taken by the Current Maintainer, then announce + within the pertinent community your intention to take over + maintenance. (If the Work is a LaTeX work, this could be + done, for example, by posting to comp.text.tex.) + + 3a. If the Current Maintainer is reachable and agrees to pass + maintenance of the Work to you, then this takes effect + immediately upon announcement. + + b. If the Current Maintainer is not reachable and the Copyright + Holder agrees that maintenance of the Work be passed to you, + then this takes effect immediately upon announcement. + + 4. If you make an `intention announcement' as described in 2b. above + and after three months your intention is challenged neither by + the Current Maintainer nor by the Copyright Holder nor by other + people, then you may arrange for the Work to be changed so as + to name you as the (new) Current Maintainer. + + 5. If the previously unreachable Current Maintainer becomes + reachable once more within three months of a change completed + under the terms of 3b) or 4), then that Current Maintainer must + become or remain the Current Maintainer upon request provided + they then update their communication data within one month. + +A change in the Current Maintainer does not, of itself, alter the fact +that the Work is distributed under the LPPL license. + +If you become the Current Maintainer of the Work, you should +immediately provide, within the Work, a prominent and unambiguous +statement of your status as Current Maintainer. You should also +announce your new status to the same pertinent community as +in 2b) above. + + +WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE +====================================================== + +This section contains important instructions, examples, and +recommendations for authors who are considering distributing their +works under this license. These authors are addressed as `you' in +this section. + +Choosing This License or Another License +---------------------------------------- + +If for any part of your work you want or need to use *distribution* +conditions that differ significantly from those in this license, then +do not refer to this license anywhere in your work but, instead, +distribute your work under a different license. You may use the text +of this license as a model for your own license, but your license +should not refer to the LPPL or otherwise give the impression that +your work is distributed under the LPPL. + +The document `modguide.tex' in the base LaTeX distribution explains +the motivation behind the conditions of this license. It explains, +for example, why distributing LaTeX under the GNU General Public +License (GPL) was considered inappropriate. Even if your work is +unrelated to LaTeX, the discussion in `modguide.tex' may still be +relevant, and authors intending to distribute their works under any +license are encouraged to read it. + +A Recommendation on Modification Without Distribution +----------------------------------------------------- + +It is wise never to modify a component of the Work, even for your own +personal use, without also meeting the above conditions for +distributing the modified component. While you might intend that such +modifications will never be distributed, often this will happen by +accident -- you may forget that you have modified that component; or +it may not occur to you when allowing others to access the modified +version that you are thus distributing it and violating the conditions +of this license in ways that could have legal implications and, worse, +cause problems for the community. It is therefore usually in your +best interest to keep your copy of the Work identical with the public +one. Many works provide ways to control the behavior of that work +without altering any of its licensed components. + +How to Use This License +----------------------- + +To use this license, place in each of the components of your work both +an explicit copyright notice including your name and the year the work +was authored and/or last substantially modified. Include also a +statement that the distribution and/or modification of that +component is constrained by the conditions in this license. + +Here is an example of such a notice and statement: + + %% pig.dtx + %% Copyright 2005 M. Y. Name + % + % This work may be distributed and/or modified under the + % conditions of the LaTeX Project Public License, either version 1.3 + % of this license or (at your option) any later version. + % The latest version of this license is in + % http://www.latex-project.org/lppl.txt + % and version 1.3 or later is part of all distributions of LaTeX + % version 2005/12/01 or later. + % + % This work has the LPPL maintenance status `maintained'. + % + % The Current Maintainer of this work is M. Y. Name. + % + % This work consists of the files pig.dtx and pig.ins + % and the derived file pig.sty. + +Given such a notice and statement in a file, the conditions +given in this license document would apply, with the `Work' referring +to the three files `pig.dtx', `pig.ins', and `pig.sty' (the last being +generated from `pig.dtx' using `pig.ins'), the `Base Interpreter' +referring to any `LaTeX-Format', and both `Copyright Holder' and +`Current Maintainer' referring to the person `M. Y. Name'. + +If you do not want the Maintenance section of LPPL to apply to your +Work, change `maintained' above into `author-maintained'. +However, we recommend that you use `maintained', as the Maintenance +section was added in order to ensure that your Work remains useful to +the community even when you can no longer maintain and support it +yourself. + +Derived Works That Are Not Replacements +--------------------------------------- + +Several clauses of the LPPL specify means to provide reliability and +stability for the user community. They therefore concern themselves +with the case that a Derived Work is intended to be used as a +(compatible or incompatible) replacement of the original Work. If +this is not the case (e.g., if a few lines of code are reused for a +completely different task), then clauses 6b and 6d shall not apply. + + +Important Recommendations +------------------------- + + Defining What Constitutes the Work + + The LPPL requires that distributions of the Work contain all the + files of the Work. It is therefore important that you provide a + way for the licensee to determine which files constitute the Work. + This could, for example, be achieved by explicitly listing all the + files of the Work near the copyright notice of each file or by + using a line such as: + + % This work consists of all files listed in manifest.txt. + + in that place. In the absence of an unequivocal list it might be + impossible for the licensee to determine what is considered by you + to comprise the Work and, in such a case, the licensee would be + entitled to make reasonable conjectures as to which files comprise + the Work. diff --git a/Master/texmf-dist/doc/latex/association-matrix/README.md b/Master/texmf-dist/doc/latex/association-matrix/README.md new file mode 100644 index 00000000000..221403ab8b3 --- /dev/null +++ b/Master/texmf-dist/doc/latex/association-matrix/README.md @@ -0,0 +1,11 @@ +# *association-matrix*: LaTeX support for creating association matrices + +The `association-matrix` package allow the creation of association matrices in an clear and concise fashion, without having to deal with manually generating and modifying the tables while working. +By simply specifying the rows and the columns by their unique identifier, and then set which cells should be marked as associated. +Then, the `\amxgenerate` command generates a table that is similar in nature to: + + +| Thesis name | [1] | [2] | [3] | +|:-------------------------|:---:|:---:|:---:| +| 1. Awesome thesis | • | • | | +| 2. The Standard Model | | • | • | diff --git a/Master/texmf-dist/doc/latex/association-matrix/association-matrix.pdf b/Master/texmf-dist/doc/latex/association-matrix/association-matrix.pdf new file mode 100644 index 00000000000..fe97c4b9719 Binary files /dev/null and b/Master/texmf-dist/doc/latex/association-matrix/association-matrix.pdf differ diff --git a/Master/texmf-dist/doc/latex/association-matrix/association-matrix.tex b/Master/texmf-dist/doc/latex/association-matrix/association-matrix.tex new file mode 100644 index 00000000000..bea65f80ced --- /dev/null +++ b/Master/texmf-dist/doc/latex/association-matrix/association-matrix.tex @@ -0,0 +1,344 @@ +%% association-matrix.sty +%% Copyright 2020 Whisperity +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2008/05/04 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Whisperity. +% +% This work consists of the files association-matrix.sty +% and association-matrix.tex. +% +\documentclass{article} +\usepackage{association-matrix} % Own package! :3 + +\usepackage{etoolbox} +\usepackage{hyperref} + \hypersetup{ + pdftitle={The 'association-matrix' Package}, % title + pdfauthor={Whisperity}, % author + pdfsubject={An easy and clear assocation matrix generator}, % subject of the document + pdfnewwindow=true, % links in new window + hidelinks, % disable link borders + %colorlinks=false, % false: boxed links; true: colored links + } +\usepackage[capitalize]{cleveref} +\usepackage{minted} + \usemintedstyle{borland} + \setminted{autogobble} +\usepackage{xcolor} + +\newrobustcmd{\release}[3]{% + \subsection{\emph{#1}: \texttt{#2} - #3}\label{release-#2}% +} + +\newrobustcmd{\command}[3]{% + \paragraph{\textsf{#1}} \textbf{\color{blue} \texttt{#2}} + + #3 +} + +% Turn off the execution of \amxgenerate. +% This is used internally in the document to prevent code examples from firing the matrix when loaded. +\newrobustcmd{\amxDisable}{% + \let\theOldAMX\amxgenerate% + \def\amxgenerate{}% +} +\newrobustcmd{\amxEnable}{% + \let\amxgenerate\theOldAMX +} + +% Escaped special characters for \texttt and the \write calls. +% (via http://tex.stackexchange.com/a/223089) +\def\atchar#1{} +\edef\atchar{\expandafter\atchar\string\@} +\def\bslchar#1{} +\edef\bslchar{\expandafter\bslchar\string\\} +\def\spchar#1{} +\edef\spchar{\expandafter\spchar\string\ } +\def\lbchar#1{} +\edef\lbchar{\expandafter\lbchar\string\{} +\def\rbchar#1{} +\edef\rbchar{\expandafter\rbchar\string\}} +\def\hschar#1{} +\edef\hschar{\expandafter\hschar\string\#} + +\newwrite\tempfile + +\begin{document} + +\vspace*{0in} +\begin{center} + \LARGE The \textsf{association-matrix} Package \\ + \small \rule{0in}{1em} An easy and clear association matrix generator \\ + \large \rule{0in}{2em} Whisperity \\ + % \\ + \rule{0em}{2em}\amxDate \\ + Version \amxVersion +\end{center} + +\tableofcontents + + +\section{Introduction}\label{intro} +The \textsf{association-matrix} package allows the convenient creation of association matrices. +The package aims to automate the generation, without the user having to manually write the table's code and have to deal with the inefficiency of copy-pasting information. +The package's interface is simple, the user needs to define the table's contents (\cref{define}) and then can generate the table (\cref{tablegen}). + +Note that it is important to have \emph{every} necessary row entries and column headings defined \textbf{before} the first call to a table generation, otherwise, only a partial table will be generated. + +\subsection{Association matrix}\label{association-mx} +At the author's University, it is customary for Ph.D.\ students to write their doctoral dissertation organised into individual \emph{theses} (corresponding to chapters), and to provide a breakdown on which of their publications are ``proof'' behind the thesis (chapter). +Originally, the package \textsc{theses-vs-publications} had been devised, but then we turned it to a more generic solution. + +Commonly, the dissertation's \emph{``Introduction''} and \emph{``Summary''} chapters will provide the full table. +In addition, at the end of each individual thesis chapters will provide a table with the current thesis's row in the table \emph{highlighted}. + +An example usage and association matrix is provided in \cref{example}. + +\subsection{Licence} +Copyright \textcopyright\ 2020 Whisperity. +Permission is granted to copy, distribute and\slash or modify this software under the terms of the \emph{\LaTeX{} Project Public License}, version \emph{1.3c} or newer.\footnote{% + \url{http://www.latex-project.org/lppl}% +} + +\subsection{Example}\label{example} +The definitions (\cref{define}) should be done early in the document, but at least before the first table render (\cref{tablegen}) call. + +\immediate\openout\tempfile=assoc-mx-example.aux + \immediate\write\tempfile{\bslchar amxrow{association-matrix}{Association Matrices}} + \immediate\write\tempfile{\bslchar amxrow{latex}{\bslchar LaTeX}} + \immediate\write\tempfile{} + \makeatletter + \immediate\write\tempfile{\@percentchar\spchar Using the bibliography at the end of document!} + \makeatother + \immediate\write\tempfile{\bslchar amxcol{amxdoc}{\bslchar cite{associationmatrix}}} + \immediate\write\tempfile{\bslchar amxcol{latexdoc}{\bslchar cite{latex}}} + \immediate\write\tempfile{\bslchar amxcol{etoolboxdoc}{\bslchar cite{etoolbox}}} + \immediate\write\tempfile{} + \immediate\write\tempfile{\bslchar amxassociate{amxdoc}{association-matrix}} + \immediate\write\tempfile{\bslchar amxassociate{etoolboxdoc}{association-matrix}} + \immediate\write\tempfile{\bslchar amxassociate{latexdoc}{latex}} + \immediate\write\tempfile{\bslchar amxassociate{etoolboxdoc}{latex}} + \immediate\write\tempfile{} + \immediate\write\tempfile{\detokenize{\amxgenerate}} +\immediate\closeout\tempfile + +\amxDisable +\input{assoc-mx-example.aux} +\amxEnable +\begin{figure}[H] + \centering + \inputminted{latex}{assoc-mx-example.aux} + \amxgenerate +\end{figure} + +\clearpage +\section{Commands}\label{commands} +\subsection{Registering entries}\label{define} + +\command{amxrow}{\bslchar amxrow\lbchar \rbchar\lbchar \rbchar}{% +Registers the row entry named \texttt{} with the given \texttt{}. +The \emph{title} of the entry is printed in the first cell of the row, \textbf{in the order of} \texttt{\bslchar amxrow} calls. +} + +\command{amxcol}{\bslchar amxcol\lbchar \rbchar\lbchar \rbchar}{% +Registers the column named \texttt{} with the given \texttt{}. +The contents of \emph{body} is printed as the column headings of the table, \textbf{in the order of} \texttt{\bslchar amxcol} calls. +} + +\command{amxassociate}{\bslchar amxassociate\lbchar \rbchar\lbchar \rbchar}{% +Registers the association between \texttt{} and \texttt{}. +The cells at the intersection of the row and the column will have a \textbullet{}, indicating the relevancy. +} + +\subsection{Queries}\label{query} + +\command{amxrows}{\bslchar amxrows}{% + Returns the number of rows defined. +} + +\command{amxcols}{\bslchar amxcols}{% + Returns the number of columns defined. +} + +\command{amxrowtext}{\bslchar amxrowtext\lbchar \rbchar}{% + Returns the registered \emph{text} for the \textbf{row} registered with \texttt{}. +} + +\command{amxcoltext}{\bslchar amxcoltext\lbchar \rbchar}{% + Returns the registered \emph{text} for the \textbf{column} registered with \texttt{}. +} + +\subsection{Table generator: \texttt{amxgenerate}}\label{tablegen} + +\command{amxgenerate}{\bslchar amxgenerate[]}{% + Generates the full table incorporating the previously registered data. + Internally, a \texttt{tabular} environment is created with the table's data generated by the package. + It is the user's responsibility to wrap this into a floating \texttt{table}, if they so wish. + + If \texttt{[]} is given a row's \emph{key}, the row for that key will be \textbf{highlighted}. + Highlighting is done by typesetting the row's \emph{text} in \textbf{bold face}, and changing every \textbullet{} in the \emph{other} rows to \textopenbullet{}. + + \begin{figure}[H] + \centering + \amxgenerate[latex] + \end{figure} +} + + +% Let's use an example of 2×2 matrix for the customisations. +\newcommand{\docExampleResetTableTwoByTwo}{% + \amxReset% + \amxrow{sample}{Sample}% + \amxrow{simple}{Simple}% + \amxcol{x}{x}% + \amxcol{y}{y}% + \amxassociate{x}{sample}% + \amxassociate{y}{simple}% +} +\newcommand{\loadAndRenderResettingExample}[2][0]{% + \begin{figure}[H] + \centering + \inputminted{latex}{#2} + + \docExampleResetTableTwoByTwo + \input{#2} + \amxgenerate[#1] + \end{figure}% +} + +\subsection{Customisation}\label{customise} +All aspects on how the individual elements in the table are rendered can be customised by setting \emph{renderer} control sequences. + +\makeatletter + \def\defaultTopCorner{\amx@Renderer@Default@TopCorner} +\makeatother +\command{amxsetTopCorner}{\bslchar amxsetTopCorner\lbchar \rbchar}{% + Sets the rendered table's top left cell value (by default, ``\emph{\defaultTopCorner}'') to the given \texttt{} value. + + \immediate\openout\tempfile=settopcorner-example.aux + \immediate\write\tempfile{\bslchar amxsetTopCorner{Correlations}} + \immediate\closeout\tempfile + \loadAndRenderResettingExample{settopcorner-example.aux} +} + +\command{amxsetColumnHeading}{\bslchar amxsetColumnHeading\lbchar\rbchar}{% + Sets the rendered table's top row's cells to be rendered via passing the column heading's text (see \cref{query}) to the given \texttt{}. + This command must be a command that takes \textbf{1} argument, defined by the user earlier. + + \immediate\openout\tempfile=setcolheading-example.aux + \immediate\write\tempfile{\bslchar newcommand{\bslchar ttColHead}[1]{\bslchar texttt{\hschar1}}} + \immediate\write\tempfile{\bslchar amxsetColumnHeading{\bslchar ttColHead}} + \immediate\closeout\tempfile + \loadAndRenderResettingExample{setcolheading-example.aux} +} + +\command{amxsetRowFormat}{\bslchar amxsetRowFormat(Highlighted)\lbchar\rbchar}{% + Sets the rendered table's left cells' to be rendered via passing the row's index and text (see \cref{query}) to the given \texttt{}. + This command must be a command that takes \textbf{2} arguments, defined by the user earlier. + The \texttt{Highlighted} version sets the renderer for the highlighted row, if highlighted rendering (see \cref{tablegen}) is done. + + \immediate\openout\tempfile=setrowformat-example.aux + \immediate\write\tempfile{\bslchar newcommand{\bslchar parenRow}[2]{(\hschar1) \bslchar emph{\hschar2}}} + \immediate\write\tempfile{\bslchar newcommand{\bslchar parenRowBl}[2]{!\hschar1! \bslchar texttt{\hschar2}}} + \immediate\write\tempfile{\bslchar amxsetRowFormat{\bslchar parenRow}} + \immediate\write\tempfile{\bslchar amxsetRowFormatHighlighted{\bslchar parenRowBl}} + \immediate\closeout\tempfile + \loadAndRenderResettingExample[simple]{setrowformat-example.aux} +} + +\clearpage +\makeatletter + \def\defaultIndicator{\amx@Renderer@Default@Indicator} +\makeatother +\command{amxsetIndicator}{\bslchar amxsetIndicator\lbchar\rbchar}{% + Sets the indicators of association in the matrix in \emph{non-highlighting} mode to the result of the \texttt{}. + The default indicator is: \defaultIndicator{}. + + \immediate\openout\tempfile=setindicator-example.aux + \immediate\write\tempfile{\bslchar amxsetIndicator{a}} + \immediate\closeout\tempfile + \loadAndRenderResettingExample{setindicator-example.aux} +} + +\makeatletter + \def\defaultIndicatorHC{\amx@Renderer@Default@Indicator@Highlighted@Current} + \def\defaultIndicatorHO{\amx@Renderer@Default@Indicator@Highlighted@Other} +\makeatother +\command{amxsetIndicatorHighlighted}{\linebreak\bslchar amxsetIndicatorHighlighted\lbchar\rbchar\lbchar\rbchar}{% + Sets the indicators of association in the matrix in \emph{highlighting} mode to the result of the \texttt{} for the \textbf{highlighted row} and \texttt{} for every other row. + The default indicators are: \defaultIndicatorHC{} and \defaultIndicatorHO{}, respectively. + + \immediate\openout\tempfile=setindicator-hl-example.aux + \immediate\write\tempfile{\bslchar amxsetIndicatorHighlighted{c}{o}} + \immediate\closeout\tempfile + \loadAndRenderResettingExample[simple]{setindicator-hl-example.aux} +} + +\subsection{Multiple distinct tables: \texttt{amxReset}} + +\command{amxReset}{\bslchar amxReset}{% + Clears \textbf{all} internal data structures and customisations for the package, allowing the user to later typeset a different, independent matrix. + The previously defined entries are lost, and in case the ``previous'' matrix is needed, it must be set up again with a sequence of definition commands (see \cref{define}). + + For example, putting the code in \cref{example} and the one below into the same source file will create the smaller matrix at the second invocation of \texttt{\bslchar amxgenerate}. + + \immediate\openout\tempfile=reset-example.aux + \immediate\write\tempfile{\bslchar amxReset} + \immediate\write\tempfile{\bslchar amxrow{sample}{Sample}} + \immediate\write\tempfile{\bslchar amxcol{x}{x}} + \immediate\write\tempfile{\bslchar amxassociate{x}{sample}} + \immediate\write\tempfile{\detokenize{\amxgenerate}} + \immediate\closeout\tempfile + + \amxDisable + \input{reset-example.aux} + \amxEnable + + \begin{figure}[H] + \centering + \inputminted{latex}{reset-example.aux} + \amxgenerate + \end{figure} +} + +\clearpage +\section{Development} +The development of \textsf{association-matrix} is done on GitHub: \url{http://github.com/whisperity/association-matrix}. +Please report issues and submit patches here. + +Note that this document acts as a \textbf{test file} to the package, not only a user-facing documentation. +Any new command or change should be supplemented with appropriate documentation, and the check of the rendered examples. +If there is a discrepancy or regression in the looks of \emph{this document} that is not explained by the changes, it should be investigated! + +\section{Changelog}\label{changelog} +\release{2020/10/25}{v1.0}{Initial release} +\begin{itemize} + \item Basic functionality of defining entries, rendering tables, and customising the renderers are implemented. +\end{itemize} + +\begin{thebibliography}{3} +\bibitem{associationmatrix} +Whisperity. \textit{The \textsf{association-matrix} Package -- An easy and clear association matrix generator}. +Online, \url{http://ctan.org/pkg/association-matrix} (accessed 2020/10/25), 2020. + +\bibitem{latex} +Leslie B.\ Lamport, Donald E.\ Knuth et al. +\textit{\LaTeX{} -- A document preparation system}. +Online, \url{http://latex-project.org/} (accessed 2020/10/25), 1984. + +\bibitem{etoolbox} +Philipp Lehman, Joseph Wright. +\textit{The \textsf{etoolbox} Package -- An e-\TeX{} Toolbox for Class and Package Authors} +Online, \url{http://ctan.org/pkg/etoolbox} (accessed 2020/10/25), 2007. +\end{thebibliography} + +\end{document} diff --git a/Master/texmf-dist/tex/latex/association-matrix/association-matrix.sty b/Master/texmf-dist/tex/latex/association-matrix/association-matrix.sty new file mode 100644 index 00000000000..07b73659b63 --- /dev/null +++ b/Master/texmf-dist/tex/latex/association-matrix/association-matrix.sty @@ -0,0 +1,373 @@ +%% association-matrix.sty +%% Copyright 2020 Whisperity +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2008/05/04 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Whisperity. +% +% This work consists of the files association-matrix.sty +% and association-matrix.tex. +% +\NeedsTeXFormat{LaTeX2e}[2017/01/01] +\ProvidesPackage{association-matrix}[2020/10/25 v1.0 Association matrix generator] + +\RequirePackage{etoolbox} +\RequirePackage{forloop} +\RequirePackage{ifthen} +\RequirePackage{textcomp} +\RequirePackage{xparse} + +\newrobustcmd{\amxDate}{2020/10/25} +\newrobustcmd{\amxVersion}{1.0} + +\ExplSyntaxOn +% (via http://tex.stackexchange.com/a/300215) +\NewExpandableDocumentCommand{\egreg@Repeat}{O{}mm} + { + \int_compare:nT { #2 > 0 } + { + #3 \prg_replicate:nn { #2 - 1 } { #1#3 } + } + } +\ExplSyntaxOff + +%%% +%%% FIELDS, REPRESENTATION AND DEFINITION FUNCTIONS +%%% + +%% Internal cursors that are used for various iteration purposes. +\newcounter{amx@CursorR} +\newcounter{amx@CursorC} +\newcounter{amx@Cursor} + +%% Internal data structure holding the row keys. +\newcommand{\amx@Rows}{} +%% The total number of theses defined. +\newcounter{amx@RowCount} +%% +%% Internal data structure holding the column keys. +\newcommand{\amx@Cols}{} +%% The total number of columns defined. +\newcounter{amx@ColumnCount} +%% +%% Internal data structure holding the row-to-column assignments. +\newcommand{\amx@Associations}{} +%% +%% Returns the number of theses that are defined. +\newrobustcmd{\amxrows}{\the\value{amx@RowCount}} +%% Returns the number of columns that are defined. +\newrobustcmd{\amxcols}{\the\value{amx@ColumnCount}} +%% +%% Retrieve the name for the th row. +\newcommand{\amx@RowKey}[1]{\csname amx@Rows@#1\endcsname} +%% Retrieve the text for the th row. +\newcommand{\amx@RowText}[1]{\csname amx@RowTexts@#1\endcsname} +%% Retrieve the name for the th column. +\newcommand{\amx@ColumnKey}[1]{\csname amx@Cols@#1\endcsname} +%% Retrieve the text for the th column. +\newcommand{\amx@ColumnText}[1]{\csname amx@ColTexts@#1\endcsname} +%% + +%% Registers the row with the given key, and text. +\newrobustcmd{\amx@NewRow}[2]{% + \stepcounter{amx@RowCount}% + % + \listcsgadd{amx@Rows}{#1}% + \expandafter\def\csname amx@Rows@\theamx@RowCount\endcsname{#1}% + \expandafter\def\csname amx@RowTexts@\theamx@RowCount\endcsname{#2}% +} +%% \amxrow{}{} +%% registers the row of to be +\newrobustcmd{\amxrow}[2]{% + \amx@NewRow{#1}{#2}% +} + +%% Retrieve the text for the row defined as . +\newrobustcmd{\amxrowtext}[1]{% + \amx@FindRowIndex{#1}% + \amx@RowText{\theamx@CursorR}% +} + +%% Registers the public with the given key, and body. +\newrobustcmd{\amx@NewColumn}[2]{% + \stepcounter{amx@ColumnCount}% + % + \listcsgadd{amx@Cols}{#1}% + \expandafter\def\csname amx@Cols@\theamx@ColumnCount\endcsname{#1}% + \expandafter\def\csname amx@ColTexts@\theamx@ColumnCount\endcsname{#2}% +} +%% \amxcol{}{} +%% registers the column of to be +\newrobustcmd{\amxcol}[2]{% + \amx@NewColumn{#1}{#2}% +} + +%% Retrieve the text for the column defined as . +\newrobustcmd{\amxcoltext}[1]{% + \amx@FindColumnIndex{#1}% + \amx@ColumnText{\theamx@CursorC}% +} + +%% Sets that #1 col is related to #2 row (both args are keys). +\newrobustcmd{\amx@AssociateRowToCol}[2]{% + \amx@FindRowIndex{#1} % CursorR set. + \amx@FindColumnIndex{#2} % CursorC set. + % Format is: (row,column) pairs in the list. + \listcsxadd{amx@Associations}{(\amx@RowKey{\theamx@CursorR},\amx@ColumnKey{\theamx@CursorC})}% +} +%% \amxassociate +%% assigns the given column to be relevant for the given row. +\newrobustcmd{\amxassociate}[2]{% + \amx@AssociateRowToCol{#2}{#1}% +} + +%% +%% ALGORITHMS & ITERATORS +%% + +%% Internal command which sets the counter amx@CursorR to the index of the row with the given . +\newcommand\amx@FindRowIndex[1]{% + \renewcommand*{\do}[1]{% + \ifstrequal{##1}{#1}% + {\listbreak}% + {\stepcounter{amx@CursorR}}% + }% + \setcounter{amx@CursorR}{0}% + \dolistcsloop{amx@Rows}% + \stepcounter{amx@CursorR}% + % + \ifnumgreater{\value{amx@CursorR}}{\value{amx@RowCount}}{% + \PackageError{association-matrix}{Requested information about row '#1' but it doesn't exist}{% + Check that functions such as \detokenize{\amxrowtext} are not given undefined row keys!}% + }% +} + +%% Internal command which sets the counter amx@CursorC to the index of the +%% column with the given . +\newcommand\amx@FindColumnIndex[1]{% + \renewcommand*{\do}[1]{% + \ifstrequal{##1}{#1}% + {\listbreak}% + {\stepcounter{amx@CursorC}}% + }% + \setcounter{amx@CursorC}{0}% + \dolistcsloop{amx@Cols}% + \stepcounter{amx@CursorC}% + % + \ifnumgreater{\value{amx@CursorC}}{\value{amx@ColumnCount}}{% + \PackageError{association-matrix}{Requested information about column '#1' but it doesn't exist}{% + Check that functions such as \detokenize{\amxcoltext} are not given undefined column keys!}% + }% +} + +%% amx@RowColAssigned {} {} {} {} +%% If the column given is assigned by the client to the row given, executes , otherwise, . +\newcommand{\amx@RowColAssigned}[4]{% + \xifinlistcs{(#1,#2)}{amx@Associations}{#3}{#4}% +} + +%% +%% RENDERERS AND FORMAT CUSTOMISATION +%% + +%% Renderer for the table's 1st cell. +\newcommand{\amx@Renderer@Default@TopCorner}{Associations} +\newcommand{\amx@Renderer@TopCorner}{} % Dummy. +\newrobustcmd{\amxsetTopCorner}[1]{% + \renewcommand{\amx@Renderer@TopCorner}{#1}% +} +%% +%% Renderer for the title text entries in the rows. +\newcommand{\amx@Renderer@Default@Row}[2]{% + #1. #2% +} +\newcommand{\amx@Renderer@Default@Row@Highlighted}[2]{% + #1. \textbf{#2}% +} +\newcommand{\amx@Renderer@Row}{} % Dummy. +\newcommand{\amx@Renderer@Row@Highlighted}{} % Dummy. +\newrobustcmd{\amxsetRowFormat}[1]{% + \renewcommand{\amx@Renderer@Row}{#1}% +} +\newrobustcmd{\amxsetRowFormatHighlighted}[1]{% + \renewcommand{\amx@Renderer@Row@Highlighted}{#1}% +} +%% +%% Renderer for the columns' first cells. +\newcommand{\amx@Renderer@Default@ColumnHeading}[1]{#1} +\newcommand{\amx@Renderer@ColumnHeading}{} % Dummy. +\newrobustcmd{\amxsetColumnHeading}[1]{% + \renewcommand{\amx@Renderer@ColumnHeading}{#1}% +} +%% +%% Renderer for the indicators in the rows. +\newcommand{\amx@Renderer@Default@Indicator}{% + \textbullet% +} +\newcommand{\amx@Renderer@Default@Indicator@Highlighted@Current}{% + \textbullet% +} +\newcommand{\amx@Renderer@Default@Indicator@Highlighted@Other}{% + \textopenbullet% +} +\newcommand{\amx@Renderer@Indicator}{} % Dummy. +\newcommand{\amx@Renderer@Indicator@Highlighted@Current}{} % Dummy. +\newcommand{\amx@Renderer@Indicator@Highlighted@Other}{} % Dummy. +\newrobustcmd{\amxsetIndicator}[1]{% + \renewcommand{\amx@Renderer@Indicator}{#1}% +} +\newrobustcmd{\amxsetIndicatorHighlighted}[2]{% + \renewcommand{\amx@Renderer@Indicator@Highlighted@Current}{#1}% + \renewcommand{\amx@Renderer@Indicator@Highlighted@Other}{#2}% +} + +%% +%% RENDERING +%% + +%% Internal toggle that specifies whether the current row of \RowsVSCols +%% should be highlighted or not. +\newtoggle{amx@AreAnyHighlightSet} +\newtoggle{amx@IsCurrentRowHighlighted} +% +\newcommand{\amx@amx@RowRenderHELPER}[1]{} % Dummy. + +%% Renders the heading of the table. +\newcommand{\amx@amx@RenderHeading}{% + \setcounter{amx@CursorC}{\value{amx@ColumnCount}}% + \stepcounter{amx@CursorC}% + % + \amx@Renderer@TopCorner{}% + \forloop{amx@Cursor}{1}{\value{amx@Cursor} < \value{amx@CursorC}}{% + & \amx@Renderer@ColumnHeading{\amx@ColumnText{\theamx@Cursor}}% + }% +} + +%% amx@amx@Indicator{}{} +%% Returns the visual blip part of the generated table. +\newcommand{\amx@amx@Indicator}[2]{% + \amx@RowColAssigned{#1}{#2}{% + \iftoggle{amx@AreAnyHighlightSet}{% + \iftoggle{amx@IsCurrentRowHighlighted}{% + \amx@Renderer@Indicator@Highlighted@Current{}% + }{% + \amx@Renderer@Indicator@Highlighted@Other{}% + }% + }{% + \amx@Renderer@Indicator{}% + }% + }{% + % This field is intentionally left blank. + }% +} + +%% amx@amx@RenderRow{} +%% Renders the row for . +\newcommand{\amx@amx@RenderRow}[1]{% + \amx@FindRowIndex{#1}% + \iftoggle{amx@AreAnyHighlightSet}{% + \iftoggle{amx@IsCurrentRowHighlighted}{% + \amx@Renderer@Row@Highlighted{\theamx@CursorR}{\amx@RowText{\theamx@CursorR}}% + }{% + \amx@Renderer@Row{\theamx@CursorR}{\amx@RowText{\theamx@CursorR}}% + }% + }{% + \amx@Renderer@Row{\theamx@CursorR}{\amx@RowText{\theamx@CursorR}}% + }% + % + \setcounter{amx@CursorC}{\value{amx@ColumnCount}}% + \stepcounter{amx@CursorC}% + \forloop{amx@Cursor}{1}{\value{amx@Cursor} < \value{amx@CursorC}}{% + & \amx@amx@Indicator{#1}{\amx@ColumnKey{\theamx@Cursor}}% + }% +} + +%% Typesets the Rows vs. Cols table, highlighting the row for the given key, or highlighting no rows if #1 is 0. +\newcommand{\amx@amx@MakeTabular}[1]{% + \renewcommand{\amx@amx@RowRenderHELPER}[1]{% + % Set the global toggle whether highlighting is enabled or not. + \ifthenelse{\equal{#1}{0}}{% + \global\togglefalse{amx@AreAnyHighlightSet}% + }{% + \global\toggletrue{amx@AreAnyHighlightSet}% + % + % Set highlight for current row. + \ifthenelse{\equal{##1}{#1}}{% + \global\toggletrue{amx@IsCurrentRowHighlighted}% + }{% + \global\togglefalse{amx@IsCurrentRowHighlighted}% + }% + }% + % + \amx@amx@RenderRow{##1} \\ + \hline% + }% + % + \begin{tabular}{|l|% + \egreg@Repeat[|]{\expandafter\theamx@ColumnCount}{c}% + |% + } + \hline + \amx@amx@RenderHeading \\ + \hline + \forlistcsloop{\amx@amx@RowRenderHELPER}{amx@Rows}% + \end{tabular}% +} +\newrobustcmd{\amxgenerate}[1][0]{% + \amx@amx@MakeTabular{#1}% +} + +%% +%% CLEARING / RESET +%% + +%% Clear all the internal data structures, undefine all commands, and reset all counters. +\newrobustcmd{\amx@Reset}{% + % Clear the data store macros: + \forloop[-1]{amx@Cursor}{\value{amx@RowCount}}{\value{amx@Cursor} > 0}{% + \expandafter\def\csname amx@Rows@\theamx@Cursor\endcsname{}% + \expandafter\def\csname amx@RowTexts@\theamx@Cursor\endcsname{}% + }% + \forloop[-1]{amx@Cursor}{\value{amx@ColumnCount}}{\value{amx@Cursor} > 0}{% + \expandafter\def\csname amx@Cols@\theamx@Cursor\endcsname{}% + \expandafter\def\csname amx@ColTexts@\theamx@Cursor\endcsname{}% + }% + % Reset the lists and counters: + \renewcommand{\amx@Rows}{}% + \setcounter{amx@RowCount}{0}% + \renewcommand{\amx@Cols}{}% + \setcounter{amx@ColumnCount}{0}% + \renewcommand{\amx@Associations}{}% + % + \setcounter{amx@CursorR}{0}% + \setcounter{amx@CursorC}{0}% + \setcounter{amx@Cursor}{0}% + % Reset customisation. + \amx@Renderer@Reset% +} +%% DANGEROUS! Clear the internal data structures! +\newrobustcmd{\amxReset}{% + \amx@Reset% +} +%% Resets the renderers to their default versions. +\newcommand{\amx@Renderer@Reset}{% + \renewcommand{\amx@Renderer@TopCorner}{\amx@Renderer@Default@TopCorner}% + \renewcommand{\amx@Renderer@ColumnHeading}[1]{\amx@Renderer@Default@ColumnHeading{##1}}% + \renewcommand{\amx@Renderer@Row}[2]{\amx@Renderer@Default@Row{##1}{##2}}% + \renewcommand{\amx@Renderer@Row@Highlighted}[2]{\amx@Renderer@Default@Row@Highlighted{##1}{##2}}% + \renewcommand{\amx@Renderer@Indicator}{\amx@Renderer@Default@Indicator}% + \renewcommand{\amx@Renderer@Indicator@Highlighted@Current}{\amx@Renderer@Default@Indicator@Highlighted@Current}% + \renewcommand{\amx@Renderer@Indicator@Highlighted@Other}{\amx@Renderer@Default@Indicator@Highlighted@Other}% +} +% Start the document with the renderers having the default version. +\amx@Renderer@Reset + +\endinput -- cgit v1.2.3