diff options
author | Norbert Preining <norbert@preining.info> | 2020-10-25 03:01:38 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2020-10-25 03:01:38 +0000 |
commit | 3d43e658a41ca0b37fc5f2191ec5a8d57642734b (patch) | |
tree | f7e61ccb6d369cc9b2ac234bd06737f3a0e67998 /macros | |
parent | 77045ec1b3d5364e7cfdc8e0a2710c5453242972 (diff) |
CTAN sync 202010250301
Diffstat (limited to 'macros')
16 files changed, 2056 insertions, 266 deletions
diff --git a/macros/latex/contrib/bytefield/README b/macros/latex/contrib/bytefield/README index e1e0d208b9..b76f221d76 100644 --- a/macros/latex/contrib/bytefield/README +++ b/macros/latex/contrib/bytefield/README @@ -33,7 +33,7 @@ supports hyperref hyperlinks. Copyright and license --------------------- -Copyright (C) 2017 Scott Pakin, scott+bf@pakin.org +Copyright (C) 2000-2020 Scott Pakin, scott+bf@pakin.org This package may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3a of this diff --git a/macros/latex/contrib/bytefield/bytefield.dtx b/macros/latex/contrib/bytefield/bytefield.dtx index deb30c81be..4354a50e78 100644 --- a/macros/latex/contrib/bytefield/bytefield.dtx +++ b/macros/latex/contrib/bytefield/bytefield.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % -% Copyright (C) 2017 by Scott Pakin <scott+bf@pakin.org> -% ------------------------------------------------------ +% Copyright (C) 2000-2020 by Scott Pakin <scott+bf@pakin.org> +% ----------------------------------------------------------- % % This file may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3a @@ -22,7 +22,7 @@ %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] %<package>\ProvidesPackage{bytefield} %<*package> - [2017/09/15 v2.4 Network protocol diagrams] + [2020/10/22 v2.5 Network protocol diagrams] %</package> % %<*driver> @@ -35,6 +35,7 @@ \usepackage{calc} \usepackage{array} \usepackage{wasysym} +\usepackage{needspace} \usepackage{hyperxmp} \usepackage{hypdoc} \usepackage{hyperref} @@ -45,7 +46,7 @@ pdfauthor={Scott Pakin}, pdfsubject={Protocol diagrams for LaTeX}, pdfkeywords={bits, bytes, bit fields, communication, network protocol diagrams, LaTeX2e, memory maps}, - pdfcopyright={Copyright (C) 2017, Scott Pakin}, + pdfcopyright={Copyright (C) 2000-2020, Scott Pakin}, pdflicenseurl={http://www.latex-project.org/lppl/}, pdfcaptionwriter={Scott Pakin}, pdfcontactemail={scott+bf@pakin.org}, @@ -67,7 +68,7 @@ %</driver> % \fi % -% \CheckSum{1028} +% \CheckSum{1161} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -99,6 +100,14 @@ % \cs{endwordgroupl} with a \texttt{leftwordgroup} environment and % also replacing a slew of user-visible lengths and macros with a % single \cs{bytefieldsetup} macro} +% \changes{v2.5}{2020/10/20}{Redefine the \protect\cs{bitbox}, +% \protect\cs{wordbox}, and \protect\cs{bitboxes} commands additionally +% to accept key/value options} +% \changes{v2.5}{2020/10/20}{Accept a new \protect\optname{bgcolor} +% option to set a bit's background color} +% \changes{v2.5}{2020/10/22}{Accept a new \protect\optname{perword} +% option to execute a macro for each word in a word box. This addresses +% a feature request by Victor Toni} % % \GetFileInfo{bytefield.dtx} % @@ -129,7 +138,7 @@ % % \title{The \textsf{bytefield} package\thanks{This document % corresponds to \textsf{bytefield}~\fileversion, dated \filedate.}} -% \author{Scott Pakin \\ \texttt{scott+bf@pakin.org}} +% \author{Scott Pakin \\ \textit{scott+bf@pakin.org}} % % \sloppy % \maketitle @@ -271,10 +280,10 @@ % \item ``skipped words'' within fields. % \end{itemize} % -% Because \pkgname{bytefield} draws its figures using only -% the \LaTeX{} \texttt{picture} environment, these figures are not -% specific to any particular backend, do not require PostScript support, -% and do not need support from external programs. Furthermore, unlike an +% Because \pkgname{bytefield} draws its figures using only the \LaTeX{} +% \texttt{picture} environment, these figures are not specific to any +% particular backend, do not require PostScript or PDF support, and do +% not need support from external programs. Furthermore, unlike an % imported graphic, \pkgname{bytefield} pictures can include arbitrary % \LaTeX{} constructs, such as mathematical equations, |\ref|s and % |\cite|s to the surrounding document, and macro calls. @@ -372,12 +381,12 @@ % \label{sec:basic-cmds} % % This section explains how to use the \pkgname{bytefield} package. It -% lists all the exported macros and environments in approximately +% lists all of the exported macros and environments in approximately % decreasing order of usefulness. % % \begin{decl} % \SpecialEnvIndex{bytefield} -% |\begin{bytefield}| \oarg{parameters} \marg{bit-width} \\ +% |\begin{bytefield}| \oarg{options} \marg{bit-width} \\ % \meta{fields} \\ % |\end{bytefield}| % \end{decl} @@ -385,19 +394,20 @@ % The \pkgname{bytefield} package's top-level environment is called, not % surprisingly, ``|bytefield|''. It takes one mandatory argument, which % is the number of bits in each word, and one optional argument, which -% is a set of parameters, described in Section~\ref{sec:options}, for -% formatting the bit-field's layout. One can think of a |bytefield| as -% being analogous to a |tabular|: words are separated by~``|\\|'', and -% fields within a word are separated by~``|&|''. As in a |tabular|, -% ``|\\|'' accepts a \meta{length} as an optional argument, and this -% specifies the amount of additional vertical whitespace to include -% after the current word is typeset. +% is a comma-separated list of \meta{key}=\meta{value} pairs, described +% in Section~\ref{sec:options}, for formatting the bit-field's layout. +% One can think of a |bytefield| as being analogous to a |tabular|: +% words are separated by~``|\\|'', and fields within a word are +% separated by~``|&|''. As in a |tabular|, ``|\\|'' accepts a +% \meta{length} as an optional argument, and this specifies the amount +% of additional vertical whitespace to include after the current word is +% typeset. % % \begin{decl} % \SpecialUsageIndex{\bitbox} -% |\bitbox| \oarg{sides} \marg{width} \marg{text} \\ +% |\bitbox| \oarg{sides} \marg{width} \oarg{options} \marg{text} \\ % \SpecialUsageIndex{\wordbox} -% |\wordbox| \oarg{sides} \marg{height} \marg{text} +% |\wordbox| \oarg{sides} \marg{height} \oarg{options} \marg{text} % \end{decl} % % The two main commands one uses within a \pkgname{bytefield} @@ -406,16 +416,19 @@ % typesets a field that is an entire word wide and one or more words % tall. % -% The optional argument, \meta{sides}, is a list of letters specifying -% which sides of the field box to draw---[|l|]eft, [|r|]ight, [|t|]op, -% and/or [|b|]ottom.\footnote{Uppercase |L|, |R|, |T|, and |B| undo a -% prior |l|, |r|, |t|, or |b| and may be useful for writing wrapper -% commands around \texttt{\string\bitbox} and +% The first, optional, argument, \meta{sides}, is a list of letters +% specifying which sides of the field box to draw---[|l|]eft, [|r|]ight, +% [|t|]op, and/or [|b|]ottom.\footnote{Uppercase |L|, |R|, |T|, and |B| +% undo a prior |l|, |r|, |t|, or |b| and may be useful for writing +% wrapper commands around \texttt{\string\bitbox} and % \texttt{\string\wordbox}.} The default is ``|lrtb|'' (i.e.,~all -% sides are drawn). \meta{text} is the text to include within the -% |\bitbox| or |\wordbox|. It is typeset horizontally centered within a -% vertically centered |\parbox|. Hence, words will wrap, and ``|\\|'' -% can be used to break lines manually. +% sides are drawn). The second, required, argument is the width in bits +% of a bit box or the height in words of a word box. The third argument +% is an optional, comma-separated list of \meta{key}=\meta{value} pairs, +% described in Section~\ref{sec:options}. The fourth, required, +% argument is the text to typeset within the box. It is typeset +% horizontally centered within a vertically centered |\parbox|. Hence, +% words will wrap, and ``|\\|'' can be used to break lines manually. % % The following example shows how to produce a simple 16-bit-wide field: % @@ -442,6 +455,35 @@ % mandatory argument to the |bytefield| environment); % \pkgname{bytefield} does not currently check for under- or overruns. % +% Here's an example of using the \optname{bgcolor} option to fill each +% box with a different color: +% +% \begin{verbatim} +% \definecolor{lightcyan}{rgb}{0.84,1,1} +% \definecolor{lightgreen}{rgb}{0.64,1,0.71} +% \definecolor{lightred}{rgb}{1,0.7,0.71} +% \begin{bytefield}[bitheight=\widthof{~Sign~}, +% boxformatting={\centering\small}]{32} +% \bitheader[endianness=big]{31,23,0} \\ +% \bitbox{1}[bgcolor=lightcyan]{\rotatebox{90}{Sign}} & +% \bitbox{8}[bgcolor=lightgreen]{Exponent} & +% \bitbox{23}[bgcolor=lightred]{Mantissa} +% \end{bytefield} +% \end{verbatim} +% +% \begin{bffigure} +% \definecolor{lightcyan}{rgb}{0.84,1,1} +% \definecolor{lightgreen}{rgb}{0.64,1,0.71} +% \definecolor{lightred}{rgb}{1,0.7,0.71} +% \begin{bytefield}[bitheight=\widthof{~Sign~}, +% boxformatting={\centering\small}]{32} +% \bitheader[endianness=big]{31,23,0} \\ +% \bitbox{1}[bgcolor=lightcyan]{\rotatebox{90}{Sign}} & +% \bitbox{8}[bgcolor=lightgreen]{Exponent} & +% \bitbox{23}[bgcolor=lightred]{Mantissa} +% \end{bytefield} +% \end{bffigure} +% % Within a |\bitbox| or |\wordbox|, the \pkgname{bytefield} package % defines |\height|, |\depth|, |\totalheight|, and |\width| to the % corresponding dimensions of the box. Section~\ref{sec:tricks} gives an @@ -449,8 +491,8 @@ % % \begin{decl} % \SpecialUsageIndex{\bitboxes} -% |\bitboxes| \oarg{sides} \marg{width} \marg{tokens} \\ -% |\bitboxes*| \oarg{sides} \marg{width} \marg{tokens} \\ +% |\bitboxes| \oarg{sides} \marg{width} \oarg{options} \marg{tokens} \\ +% |\bitboxes*| \oarg{sides} \marg{width} \oarg{options} \marg{tokens} \\ % \end{decl} % % The |\bitboxes| command provides a shortcut for typesetting a sequence @@ -521,17 +563,17 @@ % % \begin{decl} % \SpecialUsageIndex{\bitheader} -% |\bitheader| \oarg{parameters} \marg{bit-positions} +% |\bitheader| \oarg{options} \marg{bit-positions} % \end{decl} % % To make the bit field more readable, it helps to label bit positions % across the top. The |\bitheader| command provides a flexible way to -% do that. The optional argument is a set of parameters from the set -% described in Section~\ref{sec:options}. In practice, the only -% parameters that are meaningful in the context of |\bitheader| are -% |bitformatting|, |endianness|, and |lsb|. See -% Section~\ref{sec:options} for descriptions and examples of those -% parameters. +% do that. The optional argument is a comma-separated list of +% \meta{key}=\meta{value} pairs from the set described in +% Section~\ref{sec:options}. In practice, the only parameters that are +% meaningful in the context of |\bitheader| are |bitformatting|, +% |endianness|, and |lsb|. See Section~\ref{sec:options} for +% descriptions and examples of those parameters. % % |\bitheader|'s mandatory argument, \meta{bit-positions}, is a % comma-separated list of bit positions to label. For example, @@ -691,12 +733,12 @@ % % \begin{decl} % \SpecialUsageIndex{\bytefieldsetup} -% |\bytefieldsetup| \marg{key-value list} +% |\bytefieldsetup| \marg{options} % \end{decl} % % Alter the formatting of all subsequent bit fields. % Section~\ref{sec:options} describes the possible values for each -% \meta{key}=\meta{value} item in the comma-separated list that +% \meta{key}=\meta{value} pair in the comma-separated list that % |\bytefieldsetup| accepts as its argument. Note that changes made % with |\bytefieldsetup| are local to their current scope. Hence, if % used within an environment (e.g.,~|figure|), |\bytefieldsetup| does @@ -709,7 +751,7 @@ % A document author can customize many of the \pkgname{bytefield} % package's figure-formatting parameters, either globally or on a % per-figure basis. The parameters described below can be specified in -% four locations: +% five locations: % % \begin{itemize} % \item as package options (i.e.,~in the @@ -726,6 +768,10 @@ % \item as the optional argument to a |\bitheader|, which affects only % that particular header. (Only a few parameters are meaningful in % this context.) +% +% \item as the second optional argument to a \cs{bitbox}, \cs{wordbox}, +% or \cs{bitboxes}, which affects only that particular box. (Only a +% few parameters are meaningful in this context.) % \end{itemize} % % Unfortunately, \LaTeX\ tends to abort with a ``\texttt{TeX capacity @@ -893,6 +939,17 @@ % \end{bffigure} % % \begin{decl} +% \optname{bgcolor} = \meta{color} +% \end{decl} +% +% Bit and word boxes are normally left unfilled. The \optname{bgcolor} +% option fills them with a specified background color. A document will +% need to include the \pkgname{color}, \pkgname{xcolor}, or similar +% package to expose color names to \pkgname{bytefield}. The +% \optname{boxformatting} option described above can be used to set the +% foreground color. +% +% \begin{decl} % \optname{leftcurly} = \meta{delimiter} \\ % \optname{rightcurly} = \meta{delimiter} % \end{decl} @@ -1067,6 +1124,42 @@ % \end{bytefield} % \end{bffigure} % +% \begin{decl} +% \optname{perword} = \meta{command} +% \end{decl} +% +% Provide a macro that will be invoked once for each word in a word box +% after the regular content is rendered. The macro will be passed two +% arguments: the word number (starting from~0) and the total number of +% words in the word box. Furthermore, the macro will be invoked within +% a one-word-wide box positioned at the base of the word. +% \optname{perword} can therefore be used for delineating words within a +% word box, numbering words, or performing other such annotations. As a +% simple example, the following code draws a gray line at the bottom of +% each word in the ``Descriptive text'' word box: +% +% \begin{verbatim} +% \newcommand{\wordline}[2]{\color[rgb]{0.7,0.7,0.7}\hrulefill} +% \begin{bytefield}[bitwidth=4em]{8} +% \bitheader[lsb=1,bitformatting=\small]{1-8} \\ +% \wordbox[lrt]{7}[perword=\wordline]{Descriptive text (60 bytes)} \\ +% \bitbox[lrb]{4}{} & \bitbox{4}{subsys data offset} \\ +% \bitbox{4}{subsys data offset} & \bitbox{2}{version} & +% \bitbox{2}{endian indicator} \\ +% \end{bytefield} +% \end{verbatim} +% +% \begin{bffigure} +% \newcommand{\wordline}[2]{\color[rgb]{0.7,0.7,0.7}\hrulefill} +% \begin{bytefield}[bitwidth=4em]{8} +% \bitheader[lsb=1,bitformatting=\small]{1-8} \\ +% \wordbox[lrt]{7}[perword=\wordline]{Descriptive text (60 bytes)} \\ +% \bitbox[lrb]{4}{} & \bitbox{4}{subsys data offset} \\ +% \bitbox{4}{subsys data offset} & \bitbox{2}{version} & +% \bitbox{2}{endian indicator} \\ +% \end{bytefield} +% \end{bffigure} +% % % \subsection{Common tricks} % \label{sec:tricks} @@ -1293,40 +1386,16 @@ % \end{bffigure} % % \paragraph{Unused bits} -% Because |\width| and |\height| are defined within bit boxes (also word -% boxes), we can represent unused bits by filling a |\bitbox| with a -% rule of size |\width|~$\times$ |\height|: -% -% \begin{verbatim} -% \begin{bytefield}{32} -% \bitheader{0,4,8,12,16,20,24,28} \\ -% \bitbox{8}{Tag} & \bitbox{8}{Value} & -% \bitbox{4}{\rule{\width}{\height}} & -% \bitbox{12}{Mask} \\ -% \wordbox{1}{Key} -% \end{bytefield} -% \end{verbatim} -% -% \begin{bffigure} -% \begin{bytefield}{32} -% \bitheader{0,4,8,12,16,20,24,28} \\ -% \bitbox{8}{Tag} & \bitbox{8}{Value} & -% \bitbox{4}{\rule{\width}{\height}} & -% \bitbox{12}{Mask} \\ -% \wordbox{1}{Key} -% \end{bytefield} -% \end{bffigure} -% -% \noindent -% The effect is much better when the \pkgname{color} package is used to -% draw the unused bits in color. (Light gray looks nice.) +% The \optname{bgcolor} option can be used to represent unused bits by +% specifying a background fill color---light gray looks nice---and empty +% text: % % \begin{verbatim} % \definecolor{lightgray}{gray}{0.8} % \begin{bytefield}{32} % \bitheader{0,4,8,12,16,20,24,28} \\ % \bitbox{8}{Tag} & \bitbox{8}{Value} & -% \bitbox{4}{\color{lightgray}\rule{\width}{\height}} & +% \bitbox{4}[bgcolor=lightgray]{} & % \bitbox{12}{Mask} \\ % \wordbox{1}{Key} % \end{bytefield} @@ -1337,7 +1406,7 @@ % \begin{bytefield}{32} % \bitheader{0,4,8,12,16,20,24,28} \\ % \bitbox{8}{Tag} & \bitbox{8}{Value} & -% \bitbox{4}{\color{lightgray}\rule{\width}{\height}} & +% \bitbox{4}[bgcolor=lightgray]{} & % \bitbox{12}{Mask} \\ % \wordbox{1}{Key} % \end{bytefield} @@ -1459,44 +1528,6 @@ % % \subsection{Not-so-common tricks} % -% \paragraph{Colored fields} -% A similar approach to that utilized to indicate unused bits can be -% applied to coloring an individual bit field. The trick is to use the -% \TeX\ |\rlap| primitive to draw a colored box that overlaps whatever -% follows it to the right: -% -% \begin{verbatim} -% \newcommand{\colorbitbox}[3]{% -% \rlap{\bitbox{#2}{\color{#1}\rule{\width}{\height}}}% -% \bitbox{#2}{#3}} -% \definecolor{lightcyan}{rgb}{0.84,1,1} -% \definecolor{lightgreen}{rgb}{0.64,1,0.71} -% \definecolor{lightred}{rgb}{1,0.7,0.71} -% \begin{bytefield}[bitheight=\widthof{~Sign~}, -% boxformatting={\centering\small}]{32} -% \bitheader[endianness=big]{31,23,0} \\ -% \colorbitbox{lightcyan}{1}{\rotatebox{90}{Sign}} & -% \colorbitbox{lightgreen}{8}{Exponent} & -% \colorbitbox{lightred}{23}{Mantissa} -% \end{bytefield} -% \end{verbatim} -% -% \begin{bffigure} -% \newcommand{\colorbitbox}[3]{^^A -% \rlap{\bitbox{#2}{\color{#1}\rule{\width}{\height}}}^^A -% \bitbox{#2}{#3}}^^A -% \definecolor{lightcyan}{rgb}{0.84,1,1} -% \definecolor{lightgreen}{rgb}{0.64,1,0.71} -% \definecolor{lightred}{rgb}{1,0.7,0.71} -% \begin{bytefield}[bitheight=\widthof{~Sign~}, -% boxformatting={\centering\small}]{32} -% \bitheader[endianness=big]{31,23,0} \\ -% \colorbitbox{lightcyan}{1}{\rotatebox{90}{Sign}} & -% \colorbitbox{lightgreen}{8}{Exponent} & -% \colorbitbox{lightred}{23}{Mantissa} -% \end{bytefield} -% \end{bffigure} -% % \paragraph{Omitted bit numbers} % It is occasionally convenient to show a wide bit field in which the % middle numbers are replaced with an ellipsis. The trick to @@ -1951,7 +1982,10 @@ % % \section{Implementation} % -% \newcommand{\usermacro}{\marginpar{\vspace*{1ex}{\strut\hspace{18pt}\huge$\star$}\vspace*{-1ex}}} +% \newcommand{\usermacro}{^^A +% \Needspace{2\baselineskip}^^A +% \marginpar{\huge\raisebox{-1.5ex}[0pt][1.5ex]{\strut\hspace{18pt}$\star$}\par}^^A +% } % % This section contains the complete source code for \pkgname{bytefield}. % Most users will not get much out of it, but it should be of use to @@ -2057,7 +2091,8 @@ \newlength{\bytefield@height@increment} \DeclareRobustCommand{\inc@bytefield@height}[1]{% \setlength{\bytefield@height@increment}{#1}% - \global\advance\bytefield@height by \bytefield@height@increment} + \global\advance\bytefield@height by \bytefield@height@increment +} % \end{macrocode} % \end{macro} % @@ -2127,7 +2162,8 @@ }{% \amp\show@wordlabelr\cr\egroup\egroup \end{lrbox}% - \usebox{\entire@bytefield@picture}} + \usebox{\entire@bytefield@picture}% +} % \end{macrocode} % \end{environment} % @@ -2187,35 +2223,151 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\bf@call@box@cmd} +% \begin{macro}{\bf@call@box@func} +% Define any box-drawing macro that accepts the same set of four +% arguments. It takes as input the name of a macro that is defined with +% formal parameters |[#1]#2[#3]#4|. \cs{bf@call@box@cmd} then invokes +% that macro, passing it a set of lines to draw out of the set +% ``\texttt{lrtbLRTB}''~(|#1|), a number of bits or words~(|#2|), a list +% of key/value pairs~(|#3|), and arbitrary text to typeset~(|#4|). +% \begin{macrocode} +\newcommand*{\bf@call@box@cmd}[1]{% + \def\bf@call@box@func{#1}% + \bf@call@box@cmd@i +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\bf@call@box@cmd@i} +% \begin{macro}{\bf@call@box@arg@i} +% \begin{macro}{\bf@call@box@arg@ii} +% Store the set of lines and the bit/word count and invoke +% \cs{bf@call@box@cmd@ii}. +% \begin{macrocode} +\newcommand*{\bf@call@box@cmd@i}[2][lrtb]{% + \def\bf@call@box@arg@i{#1}% + \def\bf@call@box@arg@ii{#2}% + \bf@call@box@cmd@ii +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\bf@call@box@cmd@ii} +% \begin{macro}{\bf@call@box@arg@iii} +% \begin{macro}{\bf@call@box@arg@iv} +% Store the key/value parameters and the text to typeset then invoke the +% macro originally passed to \cs{bf@call@box@cmd}. +% \begin{macrocode} +\newcommand*{\bf@call@box@cmd@ii}[2][]{% + \def\bf@call@box@arg@iii{#1}% + \def\bf@call@box@arg@iv{#2}% + \bf@call@box@func +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% % \begin{macro}{\bitbox} % \usermacro -% Put some text (|#3|) in a box that's a given number of bits (|#2|) -% wide and one byte tall. An optional argument (|#1|) specifies which +% Put some text~(|#4|) in a box that's a given number of bits~(|#2|) +% wide and one byte tall. An optional argument~(|#1|) specifies which % lines to draw---|[l]|eft, |[r]|ight, |[t]|op, and/or |[b]|ottom -% (default: |lrtb|). Uppercase letters suppress drawing the |[L]|eft, -% |[R]|ight, |[T]|op, and/or |[B]|ottom sides. +% (default: |lrtb|). Uppercase letters provide the opposite effect: +% They suppress drawing the |[L]|eft, |[R]|ight, |[T]|op, and/or +% |[B]|ottom sides. Additional drawing parameters can be provided via +% another optional argument~(|#3|). % \begin{macrocode} -\DeclareRobustCommand{\bitbox}[3][lrtb]{% - \setlength{\units@wide}{\bf@bitwidth * #2}% - \bf@parse@bitbox@arg{#1}% - \draw@bit@picture{\strip@pt\units@wide}{\strip@pt\bf@bitheight}{#3}} +\DeclareRobustCommand{\bitbox}{\bf@call@box@cmd{\bf@bitbox}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bf@bitbox} +% Implement all of the \cs{bitbox} logic. +% \begin{macrocode} +\def\bf@bitbox{% + \bgroup + \expandafter\bf@parse@bitbox@arg\expandafter{\bf@call@box@arg@i}% + \setlength{\units@wide}{\bf@bitwidth * \bf@call@box@arg@ii}% + \expandafter\bf@bytefieldsetup\expandafter{\bf@call@box@arg@iii}% + \@ifundefined{bf@bgcolor}{% + }{% +% \end{macrocode} +% If \optname{bgcolor} was specified, draw a colored rule of the full +% size of the box. +% \begin{macrocode} + \rlap{% + \draw@bit@picture{\strip@pt\units@wide}{\strip@pt\bf@bitheight}{% + \color{\bf@bgcolor}% + \rule{\width}{\height}% + }% + }% + }% +% \end{macrocode} +% Draw the user-provided text on top of the rule (if any). +% \begin{macrocode} + \draw@bit@picture{\strip@pt\units@wide}{\strip@pt\bf@bitheight}{% + \bf@call@box@arg@iv + }% + \egroup + \ignorespaces +} % \end{macrocode} % \end{macro} % % \begin{macro}{\wordbox} % \usermacro -% Put some text (|#3|) in a box that's a given number of bytes (|#2|) -% tall and one word (|\bits@wide| bits) wide. -% An optional argument (|#1|) specifies which lines to draw---|[l]|eft, -% |[r]|ight, |[t]|op, and/or |[b]|ottom (default: |lrtb|). Uppercase -% letters suppress drawing the |[L]|eft, |[R]|ight, |[T]|op, and/or -% |[B]|ottom sides. -% \begin{macrocode} -\DeclareRobustCommand{\wordbox}[3][lrtb]{% - \setlength{\units@wide}{\bf@bitwidth * \bits@wide}% - \setlength{\units@tall}{\bf@bitheight * #2}% - \bf@parse@bitbox@arg{#1}% - \draw@bit@picture{\strip@pt\units@wide}{\strip@pt\units@tall}{#3}} +% Put some text~(|#4|) in a box that's a given number of bytes~(|#2|) +% tall and one word (|\bits@wide| bits) wide. An optional +% argument~(|#1|) specifies which lines to draw---|[l]|eft, |[r]|ight, +% |[t]|op, and/or |[b]|ottom (default: |lrtb|). Uppercase letters +% provide the opposite effect: They suppress drawing the |[L]|eft, +% |[R]|ight, |[T]|op, and/or |[B]|ottom sides. Additional drawing +% parameters can be provided via another optional argument~(|#3|). +% \begin{macrocode} +\DeclareRobustCommand{\wordbox}{\bf@call@box@cmd{\bf@wordbox}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bf@wordbox} +% Implement all of the \cs{wordbox} logic. +% \begin{macrocode} +\def\bf@wordbox{% + \bgroup + \expandafter\bf@parse@bitbox@arg\expandafter{\bf@call@box@arg@i}% + \setlength{\units@wide}{\bf@bitwidth * \bits@wide}% + \setlength{\units@tall}{\bf@bitheight * \bf@call@box@arg@ii}% + \expandafter\bf@bytefieldsetup\expandafter{\bf@call@box@arg@iii}% + \@ifundefined{bf@bgcolor}{% + }{% +% \end{macrocode} +% If \optname{bgcolor} was specified, draw a colored rule of the full +% size of the box. +% \begin{macrocode} + \rlap{% + \draw@bit@picture{\strip@pt\units@wide}{\strip@pt\units@tall}{% + \color{\bf@bgcolor}% + \rule{\width}{\height}% + }% + }% + }% +% \end{macrocode} +% Draw the user-provided text on top of the rule (if any). +% \begin{macrocode} + \draw@bit@picture{\strip@pt\units@wide}{\strip@pt\units@tall}{% + \bf@call@box@arg@iv + }% +% \end{macrocode} +% Invoke the user-provided \cs{bf@per@word} macro once per word. +% \begin{macrocode} + \@ifundefined{bf@per@word}{}{\bf@invoke@per@word{\bf@call@box@arg@ii}}% + \egroup + \ignorespaces +} % \end{macrocode} % \end{macro} % @@ -2233,40 +2385,13 @@ \DeclareRobustCommand{\draw@bit@picture}[3]{% \begin{picture}(#1,#2)% % \end{macrocode} -% \begin{macro}{\height} -% \usermacro -% \begin{macro}{\depth} -% \usermacro -% \begin{macro}{\totalheight} -% \usermacro -% \begin{macro}{\width} -% \usermacro -% \begin{macro}{\widthunits} -% \usermacro -% \begin{macro}{\heightunits} -% \usermacro % First, we plot the user's text, with all sorts of useful lengths % predefined. % \begin{macrocode} \put(0,0){\makebox(#1,#2){\parbox{#1\unitlength}{% - \bf@newdimen\height - \bf@newdimen\depth - \bf@newdimen\totalheight - \bf@newdimen\width - \height=#2\unitlength - \depth=0pt% - \totalheight=#2\unitlength - \width=#1\unitlength - \def\widthunits{#1}% - \def\heightunits{#2}% + \bf@set@user@dimens{#1}{#2}% \bf@boxformatting{#3\par}}}}% % \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} % Next, we draw each line individually. I suppose we could make a special % case for ``all lines'' and use a |\framebox| above, but the following % works just fine. @@ -2294,10 +2419,78 @@ \inc@bytefield@height{\unitlength * \real{#2}}% \global\counting@wordsfalse \fi - \ignorespaces} +} % \end{macrocode} % \end{macro} % +% \begin{macro}{\bf@invoke@per@word} +% Invoke \cs{bf@per@word} once per word, passing it the (0-indexed) word +% number and total number of words. +% \begin{macrocode} +\newcommand{\bf@invoke@per@word}[1]{% + \begin{picture}(0,0)% + \@tempcnta=0 + \@tempdima=#1\bf@bitheight +% \end{macrocode} +% Make various useful dimensions available to \cs{bf@per@word}. +% \begin{macrocode} + \bf@set@user@dimens{\strip@pt\units@wide}{\strip@pt\units@tall}% + \loop + \advance\@tempdima by -\bf@bitheight + \bgroup + \put(-\strip@pt\units@wide, \strip@pt\@tempdima){% + \expandafter\bf@per@word\expandafter{\the\@tempcnta}{#1}% + }% + \egroup + \advance\@tempcnta by 1\relax + \ifnum#1>\@tempcnta + \repeat + \end{picture}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bf@set@user@dimens} +% \mbox{}\vspace*{-1ex} +% \begin{macro}{\width} +% \usermacro +% \begin{macro}{\height} +% \usermacro +% \begin{macro}{\depth} +% \usermacro +% \begin{macro}{\totalheight} +% \usermacro +% \begin{macro}{\widthunits} +% \usermacro +% \begin{macro}{\heightunits} +% \usermacro +% Given a width in bits~(|#1|) and a height in words~(|#2|), make a +% number of box dimensions available to the author: \cs{width}, +% \cs{height}, \cs{depth}, \cs{totalheight}. Additionally, make the +% arguments available to the author via the \cs{widthunits} and +% \cs{heightunits} macros. +% \begin{macrocode} +\newcommand{\bf@set@user@dimens}[2]{% + \bf@newdimen\width + \bf@newdimen\height + \bf@newdimen\depth + \bf@newdimen\totalheight + \width=#1\unitlength + \height=#2\unitlength + \depth=0pt% + \totalheight=#2\unitlength + \def\widthunits{#1}% + \def\heightunits{#2}% +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% % \begin{macro}{\bitboxes} % \usermacro % \changes{v2.2}{2014/06/01}{Added this macro based on an idea proposed @@ -2312,7 +2505,9 @@ % command omits interior left and right lines. % \begin{macrocode} \DeclareRobustCommand{\bitboxes}{% - \@ifstar\bf@bitboxes@star\bf@bitboxes@no@star + \@ifstar + {\bf@call@box@cmd{\bf@bitboxes@star}}% + {\bf@call@box@cmd{\bf@bitboxes@no@star}}% } % \end{macrocode} % \end{macro} @@ -2328,112 +2523,114 @@ % \end{macro} % % \begin{macro}{\bf@bitboxes@no@star} -% Implement the unstarred version of |\bitboxes|. +% Implement the unstarred version of \cs{bitboxes}. This macro simply +% expands its text argument into a list of tokens followed by \cs{relax} +% then invokes \cs{bf@bitboxes@no@star@i}. % \begin{macrocode} -\newcommand{\bf@bitboxes@no@star}[3][lrtb]{% +\def\bf@bitboxes@no@star{% + \expandafter\bf@bitboxes@no@star@i\bf@call@box@arg@iv\relax + \ignorespaces +} % \end{macrocode} +% \end{macro} +% % \begin{macro}{\bf@bitboxes@no@star@i} -% Define a helper macro that walks the final argument of -% |\bf@bitboxes@no@star| token-by-token. -% \begin{macrocode} - \def\bf@bitboxes@no@star@i##1{% +% Walk the subsequent tokens one-by-one until \cs{relax} is encountered. +% For each token, invoke \cs{bf@bitbox} (the internal version of +% \cs{bitbox} for which \cs{bf@call@box@arg@}\meta{number} are all +% defined. +% \begin{macrocode} +\def\bf@bitboxes@no@star@i#1{% + \def\bf@call@box@arg@iv{#1}% + \ifx\bf@call@box@arg@iv\bf@relax + \let\next=\relax + \else + \bf@bitbox + \let\next=\bf@bitboxes@no@star@i + \fi + \next +} % \end{macrocode} -% \begin{macro}{\bf@bitboxes@arg} -% \begin{macro}{\next} -% Store the current argument token in |\bf@bitboxes@arg| for use with |\ifx|. -% \begin{macrocode} - \def\bf@bitboxes@arg{##1}% - \ifx\bf@bitboxes@arg\bf@relax - \let\next=\relax - \else - \bitbox[#1]{#2}{##1}% - \let\next=\bf@bitboxes@no@star@i - \fi - \next - }% - \bf@bitboxes@no@star@i#3\relax +% \end{macro} +% +% \begin{macro}{\bf@bitboxes@star} +% \begin{macro}{\bf@bitboxes@sides} +% Implement the starred version of \cs{bitboxes}. This macro simply +% stores the original \meta{sides} argument in \cs{bf@bitboxes@sides}, +% expands its text argument into a list of tokens followed by two +% \cs{relax}es, and invokes \cs{bf@bitboxes@star@i}. +% \begin{macrocode} +\def\bf@bitboxes@star{% + \edef\bf@bitboxes@sides{\bf@call@box@arg@i}% + \expandafter\bf@bitboxes@star@i\bf@call@box@arg@iv\relax\relax \ignorespaces } % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} -% \end{macro} % -% \begin{macro}{\bf@bitboxes@star} -% Implement the starred version of |\bitboxes|. -% \begin{macrocode} -\newcommand{\bf@bitboxes@star}[3][lrtb]{% -% \end{macrocode} % \begin{macro}{\bf@bitboxes@star@i} -% If the argument to |\bitboxes*| contains a single (or no) token, -% simply pass control to |\bitbox| and stop. Otherwise, suppress the -% box's right border by appending ``|R|'' to |\bitboxes*|'s -% argument~|#1| and proceeding with the remaining tokens in~|#3|. -% \begin{macrocode} - \def\bf@bitboxes@star@i##1##2{% -% \end{macrocode} -% \begin{macro}{\bf@bitboxes@arg} -% \begin{macro}{\next} -% Store the current argument token in |\bf@bitboxes@arg| for use with |\ifx|. -% \begin{macrocode} - \def\bf@bitboxes@arg{##2}% - \ifx\bf@bitboxes@arg\bf@relax - \bitbox[#1]{#2}{##1}% - \let\next=\relax - \else - \bitbox[#1R]{#2}{##1}% - \def\next{\bf@bitboxes@star@ii{##2}}% - \fi - \next - }% -% \end{macrocode} -% \begin{macro}{\bf@bitboxes@star@ii} -% Process all tokens in |\bitboxes*|'s argument |#3| following the first -% argument. For each token, produce a box with the left side suppressed -% using~``|L|''. -% \begin{macrocode} - \def\bf@bitboxes@star@ii##1##2{% -% \end{macrocode} -% \begin{macro}{\bf@bitboxes@arg@i} +% \begin{macro}{\bf@call@box@arg@iv} % \begin{macro}{\bf@bitboxes@arg@ii} -% \begin{macro}{\bf@bitboxes@sides} % \begin{macro}{\next} -% Store the next two argument tokens in |\bf@bitboxes@arg@i| and -% |\bf@bitboxes@arg@i| for use with |\ifx|. We use those to set -% |\bf@bitboxes@sides| to |\bitbox*|'s argument~|#1| with the left side -% and, for the final token, the right side suppressed. -% \begin{macrocode} - \def\bf@bitboxes@arg@i{##1}% - \def\bf@bitboxes@arg@ii{##2}% - \ifx\bf@bitboxes@arg@ii\bf@relax - \def\bf@bitboxes@sides{#1L}% - \else - \def\bf@bitboxes@sides{#1LR}% - \fi - \ifx\bf@bitboxes@arg@i\bf@relax - \let\next=\relax - \else - \expandafter\bitbox\expandafter[\bf@bitboxes@sides]{#2}{##1}% - \def\next{\bf@bitboxes@star@ii{##2}}% - \fi - \next - }% -% \end{macrocode} -% \begin{macrocode} - \bf@bitboxes@star@i#3\relax\relax - \ignorespaces +% Process the first token in the text argument passed to \cs{bitboxes*}. +% If it's also the last token (indicated by its being followed by +% \cs{relax}), draw an ordinary bit box with all sides present. If it's +% not the last token, draw a bit box with the right side suppressed and +% invoke \cs{bf@bitboxes@star@ii} on the remaining tokens. +% \begin{macrocode} +\def\bf@bitboxes@star@i#1#2{% + \def\bf@call@box@arg@iv{#1}% + \def\bf@bitboxes@arg@ii{#2}% + \ifx\bf@bitboxes@arg@ii\bf@relax + \bf@bitbox + \let\next=\relax + \else + \edef\bf@call@box@arg@i{\bf@bitboxes@sides R}% + \bf@bitbox + \def\next{\bf@bitboxes@star@ii{#2}}% + \fi + \next } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} +% +% \begin{macro}{\bf@bitboxes@star@ii} +% \begin{macro}{\bf@call@box@arg@iv} +% \begin{macro}{\bf@bitboxes@arg@ii} +% \begin{macro}{\next} +% Process the second and subsequent tokens in the text argument passed +% to \cs{bitboxes*}. If the next token in the stream is the final one +% (indicated by its being followed by \cs{relax}), draw a bit box with +% the left side suppressed. If it's not the final token, draw a bit box +% with both the left and right sides suppressed and invoke itself +% recursively on the remaining tokens. +% \begin{macrocode} +\def\bf@bitboxes@star@ii#1#2{% + \def\bf@call@box@arg@iv{#1}% + \def\bf@bitboxes@arg@ii{#2}% + \ifx\bf@bitboxes@arg@ii\bf@relax + \edef\bf@call@box@arg@i{\bf@bitboxes@sides L}% + \else + \edef\bf@call@box@arg@i{\bf@bitboxes@sides LR}% + \fi + \ifx\bf@call@box@arg@iv\bf@relax + \let\next=\relax + \else + \bf@bitbox + \def\next{\bf@bitboxes@star@ii{#2}}% + \fi + \next +} +% \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} -% \end{macro} +% % % \subsubsection{Parsing arguments} % @@ -2470,7 +2667,8 @@ \bitbox@bottomfalse \bitbox@leftfalse \bitbox@rightfalse - \bf@parse@bitbox@sides#1X} + \bf@parse@bitbox@sides#1X% +} % \end{macrocode} % \end{macro} % @@ -2516,7 +2714,8 @@ \fi \fi \expandafter\bf@parse@bitbox@sides - \fi} + \fi +} % \end{macrocode} % \end{macro} % @@ -2552,7 +2751,8 @@ \ifcounting@words \inc@bytefield@height{\unitlength * \real{\num@tall}}% \global\counting@wordsfalse - \fi} + \fi +} % \end{macrocode} % \end{macro} % @@ -2604,7 +2804,8 @@ \inc@bytefield@height{\unitlength * \real{\strip@pt\units@tall}}% \global\counting@wordsfalse \fi - \ignorespaces} + \ignorespaces +} % \end{macrocode} % \end{macro} % @@ -2621,7 +2822,8 @@ \else \bf@parse@range#1-#1-#1\relax \expandafter\bf@parse@range@list - \fi} + \fi +} % \end{macrocode} % \end{macro} % @@ -2664,7 +2866,8 @@ \makebox(\strip@pt\bf@bitwidth,\strip@pt\units@tall){% \bf@bitformatting{\theheader@val}}} \addtocounter{header@val}{1} - \repeat} + \repeat +} % \end{macrocode} % \end{macro} % @@ -3111,7 +3314,8 @@ % |\begin|. % \begin{macrocode} \def\@currenvir{leftwordgroup}% - \ignorespaces} + \ignorespaces +} % \end{macrocode} % \end{macro} % \end{environment} @@ -3430,6 +3634,26 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\bf@bgcolor} +% \begin{macro}{\KV@bytefield@bgcolor} +% Specify a background color for a bit box or word box. +% \begin{macrocode} +\define@key{bytefield}{bgcolor}{\def\bf@bgcolor{#1}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\bf@per@word} +% \begin{macro}{\KV@bytefield@per@word} +% Specify a macro to invoke for each word of a word box. The macro must +% take two arguments: the word number (0-indexed) and the total number +% of words. +% \begin{macrocode} +\define@key{bytefield}{perword}{\def\bf@per@word{#1}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \begin{macro}{\bytefieldsetup} % \usermacro % \changes{v2.0}{2011/01/18}{Introduced this macro to provide a more diff --git a/macros/latex/contrib/bytefield/bytefield.ins b/macros/latex/contrib/bytefield/bytefield.ins index 37197a9ab0..d00c642405 100644 --- a/macros/latex/contrib/bytefield/bytefield.ins +++ b/macros/latex/contrib/bytefield/bytefield.ins @@ -1,5 +1,5 @@ %% -%% Copyright (C) 2017 by Scott Pakin <scott+bf@pakin.org> +%% Copyright (C) 2000-2020 by Scott Pakin <scott+bf@pakin.org> %% %% This file may be distributed and/or modified under the conditions of %% the LaTeX Project Public License, either version 1.3a of this license @@ -21,7 +21,7 @@ This is a generated file. -Copyright (C) 2017 by Scott Pakin <scott+bf@pakin.org> +Copyright (C) 2000-2020 by Scott Pakin <scott+bf@pakin.org> This file may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3a of this license diff --git a/macros/latex/contrib/bytefield/bytefield.pdf b/macros/latex/contrib/bytefield/bytefield.pdf Binary files differindex 3436fa27fa..44c093147a 100644 --- a/macros/latex/contrib/bytefield/bytefield.pdf +++ b/macros/latex/contrib/bytefield/bytefield.pdf diff --git a/macros/latex/contrib/carlisle/README.txt b/macros/latex/contrib/carlisle/README.txt index 7f4822ffb0..f2dcb0da02 100644 --- a/macros/latex/contrib/carlisle/README.txt +++ b/macros/latex/contrib/carlisle/README.txt @@ -13,17 +13,11 @@ each other except by the fact that they have the same author. David Carlisle https://github.com/davidcarlisle/dpctex -2018-04-01 +2020-10-23 Currently the directory contains the following. -mylatex.ltx - This file provides a method of making a special format tailored to - one document, with all the class and packages, and other preamble - material pre-loaded. This can save quite a lot of time on some - systems. See the comments in the file. - dotlessj.sty If you are using a font set without a dotless j (\j and \jmath) then this package will fake one. It requires the LaTeX color package. @@ -64,6 +58,9 @@ remreset.sty Packages that were formally in this collection. +mylatex.ltx + This file has now moved: see macros/latex/contrib/mylatex + nopageno.sty This file has now moved: see macros/latex/contrib/nopageno diff --git a/macros/latex/contrib/carlisle/ltxtable.pdf b/macros/latex/contrib/carlisle/ltxtable.pdf Binary files differindex 70d868afbb..6e0f1848fe 100644 --- a/macros/latex/contrib/carlisle/ltxtable.pdf +++ b/macros/latex/contrib/carlisle/ltxtable.pdf diff --git a/macros/latex/contrib/carlisle/remreset.sty b/macros/latex/contrib/carlisle/remreset.sty index 0d987ec185..762b8951bf 100644 --- a/macros/latex/contrib/carlisle/remreset.sty +++ b/macros/latex/contrib/carlisle/remreset.sty @@ -41,7 +41,7 @@ }{% \PackageWarningNoLine{remreset} {The remreset package is obsolete:\MessageBreak - \noexpand\@removefomresset is defined}% + \noexpand\@removefromreset is defined}% } diff --git a/macros/latex/contrib/graphpaper/README b/macros/latex/contrib/graphpaper/README new file mode 100644 index 0000000000..58f2e22f9b --- /dev/null +++ b/macros/latex/contrib/graphpaper/README @@ -0,0 +1,69 @@ +********************************************************************* +* GraphPaper class * +********************************************************************* + + This is the README file of the "GraphPaper" LaTeX class. + + + +** License ********************************************************** + + Copyright (c) 2020 by Claudio Beccari e Francesco Biccari. + + This work (specified below) may be distributed and/or + modified under the conditions of the + LaTeX Project Public License, + either version 1.3c 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.3c 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 Francesco Biccari. + + + +** Class information ************************************************ + + Graphpaper is a new LaTeXÂ document class which allows to print + several types of graph papers: bilinear (millimeter paper), + semilogarithmic, bilogarithmic, polar, log-polar, Smith charts. + + The documentation is provided in the file graphpaper.pdf. + + The version number of this class is reported at the top of the + class file graphpaper.cls and in the pdf manual graphpaper.pdf. + + + +** Installation instruction ***************************************** + + GraphPaper can be installed in 3 different ways: + + 1. The simplest way is by the package manager + of your TeX distribution (TeX Live, MiKTeX or MacTeX). + + 2. Instead, if you want to install GraphPaper manually, you have to + download the GraphPaper.zip archive from CTAN. + + The archive contains: + + 1. graphpaper.dtx (main file) + 2. README (this file) + + You can simply copy graphpaper.dtx into your local work directory + and compile it with command "pdflatex.exe graphpaper.dtx", + the documentation pdf file and the class file graphpaper.cls + will be generated. + + 3. The last possibility is to copy the GraphPaper files + (cls and pdf generated as discussed in the previous point and + README file) into your texmf tree (or your localtexmf tree) at + these locations: + + <texmf>/tex/latex/graphpaper/graphpaper.cls + <texmf>/doc/latex/graphpaper/graphpaper.pdf + <texmf>/doc/latex/graphpaper/README + + Then, you need to update the file database. diff --git a/macros/latex/contrib/graphpaper/graphpaper.dtx b/macros/latex/contrib/graphpaper/graphpaper.dtx new file mode 100644 index 0000000000..071f40b1de --- /dev/null +++ b/macros/latex/contrib/graphpaper/graphpaper.dtx @@ -0,0 +1,1048 @@ +%\iffalse +% !TEX encoding = UTF-8 Unicode +% !TEX TS-program = pdflatex +%<*internal> +\begingroup +%^^A Load the docstrip package (DO NOT USE \input{...}) +\input docstrip.tex +\keepsilent +%^^A\usedir{tex/latex/graphpaper} +%^^A insert this text at the beginning of the generated file +\preamble + ________________________________________ + The graphpaper class for generating several types of graph paper + Copyright (C) 2020 C. Beccari & F. Biccari + All rights reserved + + License information appended + +\endpreamble +%^^A insert this text at the end of the generated file +\postamble +Copyright (C) 2020 Claudio Beccari & Francesco Biccari + +Distributable under the LaTeX Project Public License, +version 1.3c or higher (your choice). The latest version of +this license is at: http://www.latex-project.org/lppl.txt + +This work is "author-maintained". + +This work consists of this file graphpaper.dtx, +and the derived files graphpaper.cls and graphpaper.pdf. + +\endpostamble +%^^A +%^^A DocStrip can silently overwrite an already existing cls file +\askforoverwritefalse +%^^A +%^^A Generates the cls file from the dtx file, stripping out all +%^^A the documentation. The option "class" tells to DocStrip to +%^^A extract only the code marked with the "class" tag. +\generate{\file{graphpaper.cls}{\from{graphpaper.dtx}{class}}} +% +\def\tmpa{plain} +\ifx\tmpa\fmtname\endgroup\expandafter\bye\fi +\endgroup +%</internal> +%\fi +%^^A % +%^^A ---------------------------------------------------------------------- +%^^A Here starts the second part +%^^A ProvidesFile must be (more or less) the first command for a class dtx. +%^^A It populates the variables \filename, \filedate, and \fileversion +%^^A +% \iffalse +%<*driver> +\ProvidesFile{graphpaper.dtx} +%</driver> +%<class>\NeedsTeXFormat{LaTeX2e}[2018-01-01] +%<class>\ProvidesClass{graphpaper}% +%<*class> + [2020-10-10 1.0 A LaTeX class to generate several types of graph papers] +%</class> +%<*driver> +\documentclass[11pt,a4paper]{ltxdoc} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{lmodern,textcomp} +\usepackage[a4paper,lines=50]{geometry} +\usepackage{multicol} +\hfuzz 10pt +\let\originalmeta\meta +\renewcommand\meta[1]{{\normalfont\originalmeta{#1}}} +\renewcommand\marg[1]{\texttt{\{\meta{#1}\}}} +\newcommand\Marg[1]{\texttt{\{#1\}}} +\newcommand\opz[1]{\texttt{[\meta{#1}]}} +\newcommand\Opz[1]{\texttt{[#1]}} +\newcommand\amb[1]{\texttt{\slshape#1}}\let\env\amb +\renewcommand\cs[1]{{\normalfont\ttfamily\char92#1}} +\newcommand\Benv[1]{\texttt{\char92begin\{#1\}}} +\newcommand\Eenv[1]{\texttt{\char92end\{#1\}}} +\newcommand\eTeX{$\varepsilon$-\TeX} +\providecommand\prog{} +\renewcommand\prog[1]{\textsf{#1}} +\newcommand\pack[1]{\texttt{\itshape#1}} +\newcommand\class[1]{\texttt{#1}} +% +\newenvironment{ttsintassi}{\begin{lrbox}{0} +\minipage{\dimexpr\linewidth-2\fboxrule-2\fboxsep}\ttfamily\obeylines}% +{\endminipage\end{lrbox}\center\fbox{\box0}\endcenter} +\let\ttsyntax\ttsintassi \let\endttsyntax\endttsintassi +% +\usepackage{color} +\definecolor{sfondoblu}{rgb}{0.94,0.97,1} +\usepackage{listings} +\lstset{language=[LaTeX]TeX, + basicstyle=\footnotesize\ttfamily, + keywordstyle=\color{blue}\bfseries, + commentstyle=\color{gray}, + backgroundcolor=\color{sfondoblu}, + frameround=tttt, + frame=tlrb, + escapechar=|, + morekeywords={bilinear, semilogx, semilogy, loglog, polar, logpolar, smith, setgridcolor, setmajorlinethickness, setmediumlinethickness, setminorlinethickness, setminimumdistance, setxside, setyside, customcode}, + columns=flexible +} +\begin{document} +\GetFileInfo{graphpaper.dtx} +\title{Documentation of the \class{graphpaper} \LaTeX\ class} +\author{Claudio Beccari \and Francesco Biccari\thanks{Corresponding author: biccari@gmail.com}} +\date{Version number \fileversion; last revised on \filedate.} +\maketitle +\setcounter{tocdepth}{2} +\renewcommand{\columnseprule}{0.4pt} +\setlength{\columnsep}{1.5cm} + +\addtocontents{toc}{\protect\begin{multicols}{2}} +{\small +\tableofcontents} + +\DocInput{graphpaper.dtx} +\addtocontents{toc}{\protect\end{multicols}} +\end{document} +%</driver> +% \fi +%^^A \CheckSum{100} +%\begin{abstract} +% This document describes how to use the \LaTeX\ document class \class{graphpaper}. +% It allows to print several types of graph papers: bilinear, +% semilogarithmic, bilogarithmic, polar, Smith charts. +%\end{abstract} +% +%\section{Legal terms} +% This file is part of the |graphpaper| bundle. +% +% 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 at: +% http://www.latex-project.org/lppl.txt +% +% This work has the LPPL maintenance status ``maintained''. +% +% This work consists of this file graphpaper.dtx, +% and the derived files graphpaper.cls and graphpaper.pdf. +% +% The list of derived (unpacked) files belonging to the distribution +% and covered by the LPPL is contained in the README file. +% +%\section{Installation} +% The simplest way to install \class{graphpaper} is by the package manager of your \TeX\ +% distribution (\TeX\ Live or MiK\TeX). For manual installation see the README file. +% +% +% \newpage +% \section{How to use graphpaper} +% \label{sec:howto} +% +% \class{Graphpaper} is a \LaTeX\ class and it is loaded as usual: +% +% \iffalse +%<*example> +% \fi +\begin{lstlisting} +\documentclass|\opz{options}|{graphpaper} +\end{lstlisting} +% \iffalse +%</example> +% \fi +% +% It has three class options to specify the paper format: +% \texttt{a4paper}, \texttt{a3paper}, \texttt{letterpaper}. +% The paper orientation cannot be changed and it is always set +% to landscape. +% +% \class{Graphpaper} provides the following commands (to be used +% inside the body of the document) in order to compose graph papers. +% At the end of the execution of these commands, a new page +% is always started. +% +% \iffalse +%<*example> +% \fi +\begin{lstlisting} +\bilinear + +\semilogx|\marg{decades along x}| + +\semilogy|\marg{decades along y}| + +\loglog|\opz{0/1}||\marg{decades along x}||\marg{decades along y}| + +\polar + +\logpolar|\marg{decades along radius}| + +\smith +\end{lstlisting} +% \iffalse +%</example> +% \fi +% The commands \cs{bilinear}, \cs{semilogx}, and \cs{semilogy} are self +% explanatory. +% The optional parameter in the \cs{loglog} command chooses wether the +% decade length along the abscissa and ordinate axes must have the same +% dimension. It can assume the value 0 (free dimensions) or 1 (same +% dimensions), 0 being the default. +% The commadns \cs{polar}, \cs{logpolar}, \cs{smith} are used to plot +% polar, logpolar, and Smith chart graph papers. The mandatory argument +% of \cs{logpolar} specifies the number of decades. +% +% There are several commands to change the appearance of the graph papers. +% They must be inserted before the graph paper command which we want they +% affect. +% +% The following ones are specific to bilinear, semilog and loglog papers +% only: +% \iffalse +%<*example> +% \fi +\begin{lstlisting} +\setxside|\marg{length}| + +\setyside|\marg{length}| + +\setminimumdistance|\marg{length}| +\end{lstlisting} +% \iffalse +%</example> +% \fi +% \cs{setxside} and \cs{setyside} allow to specify the dimensions of the +% rectangle of the grid. The default values are (260\,mm, 180\,mm) for +% A4 paper, (250\,mm, 190\,mm) for letter paper, and (380\,mm, 280\,mm) +% for A3 paper. +% +% \cs{setminimumdistance} specifies the minimal optical distance +% between two lines. Default is 1\,mm. In this way, the number of +% subdivision is automatically composed. +% +% The following commands are instead general settings for all graph +% papers: +% \iffalse +%<*example> +% \fi +\begin{lstlisting} +\setgridcolor|\marg{color}| + +\setmajorlinethickness|\marg{length}| + +\setmediumlinethickness|\marg{length}| + +\setminorlinethickness|\marg{length}| + +\customcode|\opz{0/1}\marg{picture environment commands}| +\end{lstlisting} +% \iffalse +%</example> +% \fi +% +% \cs{setgridcolor} sets the color of the grid. The argument must be a +% color defined or predefined by the color or |xcolor| package. The +% default color is the typical red-orange color used in many graph papers, +% Pantone 2011 U corresponding to RGB (250,153,89). +% +% \cs{setmajorlinethickness}, \cs{setmediumlinethickness}, +% \cs{setminorlinethickness} can be used to change the thickness of the +% lines. The default values are 1\,pt, 0.6\,pt, 0.25\,pt, respectively. +% +% \cs{customcode} accepts all the commands accepted by the picture +% environment. This snippet of code is inserted inside the picture +% environment used to draw the subsequent graph paper. +% The origin of the coordinate system in the case of rectangular graph +% papers is the lower left vertex. The \cs{unitlength} is set to 1\,mm. +% For circular plots (both polar and Smith) the origin is in the center +% of the circle and the \cs{unitlength} is set to 1/140 of the paper height +% currently in use. +% +% The \cs{customcode} command can be used, for example, to add a logo +% or to draw on the graph paper. +% Its optional argument is by default set to 0. If it is set to 1, the +% content of the \cs{customcode} is erased after its usage in a +% graphpaper. +% +% +%\StopEventually{} +% +%\iffalse +%<*class> +%\fi +%\clearpage +%\section{The implementation} +% This class file has been already identified by the commands extracted +% by the |DocStrip| package, during the |.dtx| file compilation. +% Therefore the commands \cs{NeedsTeXFormat} and \cs{ProvidesClass} are +% already present in the |.cls| file. +% +% \subsection{Loaded packages, class options, and initial settings} +% The |xkeyvalue| package is used in order to define the class options: +% \begin{macrocode} +\RequirePackage{xkeyval} +% \end{macrocode} +% Three class options are implemented and they allows only to change the +% paper format (A4, A3, letter). The orientation of the paper is fixed +% to landscape. +% +% \begin{macrocode} +\def\GP@paper{1} +\define@key[GRP]{}{a4paper}[]{\PassOptionsToPackage{a4paper}{geometry}} +\define@key[GRP]{}{letterpaper}[]{\PassOptionsToPackage{letterpaper}{geometry}% + \def\GP@paper{2}} +\define@key[GRP]{}{a3paper}[]{\PassOptionsToPackage{a3paper}{geometry}% + \def\GP@paper{3}} +\DeclareOptionX*{\ClassError{graphpaper}{Option '\CurrentOption'% + \MessageBreak is not valid}{Remove '\CurrentOption' % + from class options}} +\ProcessOptionsX[GRP]<> +% \end{macrocode} +% +% The class is based on the \class{article} class. The default paper +% is A4. +% \begin{macrocode} +\LoadClass[a4paper,11pt]{article} +% \end{macrocode} +% +% Some packages are loaded. \pack{euclideangeometry} loads \pack{curve2e} +% which in turns loads \pack{pict2e}; all of them are \env{picture} +% environment extensions. +% \begin{macrocode} +\RequirePackage[landscape]{geometry} +\RequirePackage{euclideangeometry,graphicx,xcolor} +% \end{macrocode} +% +% Default line color (Pantone 2011~U). +% \begin{macrocode} +\definecolor{gridcolor}{RGB}{250,153,89} +% \end{macrocode} +% +% Default thickness of the lines used for main divisions and subdivisions. +% The ISO-UNI standards prescribe a geometric progression with $\sqrt{2}$ +% ratio, but it is not respected here. +% It must be keep in mind also that a safe minimum thickness for an offset +% monochromatic printer is about 0.25\,pt, whereas a safe minimum +% thickness for a laser printer is about 0.5\,pt. +% \begin{macrocode} +\newlength\lwa +\setlength{\lwa}{1pt} +\newlength\lwb +\setlength{\lwb}{0.6pt} +\newlength\lwc +\setlength{\lwc}{0.25pt} +% \end{macrocode} +% +% Minimum distance between two subdivision lines. A necessary parameter +% for automatic choice of number of subdivisions. Default 1\,mm. +% \begin{macrocode} +\newlength\mindistanceunit +\setlength{\mindistanceunit}{1mm} +% \end{macrocode} +% +% Definition of the width and height of the main rectangle within which +% the bilinear, semilog and loglog grid is composed. +% \begin{macrocode} +\newlength\xsideunit +\newlength\ysideunit +\if\GP@paper1 + \setlength{\xsideunit}{260mm} + \setlength{\ysideunit}{180mm} +\fi +\if\GP@paper2 + \setlength{\xsideunit}{250mm} + \setlength{\ysideunit}{190mm} +\fi +\if\GP@paper3 + \setlength{\xsideunit}{380mm} + \setlength{\ysideunit}{280mm} +\fi +% \end{macrocode} +% +%\subsection{Rectangular graph papers} +% +% As we will see below, the commands to compose the bilinear, semilog +% and loglog graph papers are just proper calls of the low-level command +% \cs{carta}. +% +%\subsubsection{Service macros for rectangular graph papers} +% +% First of all, four macros are defined. They are used by the +% \cs{carta} service command only. +% +% Two of them are simply two identical classical |whiledo| commands: +% the first cycles on the counter \cs{J} while the second one on the +% counter \cs{K}. +% They are two because in this way two nested |whiledo| commands can be +% implemented. +% These \cs{WhileDo} commands have four parameters: +% 1. the incremental step of the counter between cycles (default 1); +% 2. the initial value of the counter; +% 3. the final value of the counter; +% 4. the code to execute at each cycle. +% \begin{macrocode} +\newcount\J +\newcount\K + +\newcommand\WhileDoOne[4][1]{% + \J=#2 \fpdowhile{\J=<#3 }{#4\advance\J by #1\relax}} + +\newcommand\WhileDoTwo[4][1]{% + \K=#2 \fpdowhile{\K=<#3 }{#4\advance\K by #1\relax}} +% \end{macrocode} +% +% +% The other two commands are used to draw a periodic set of equidistant +% lines in log scale. +% These two commands are practically identical, the only difference is +% that they act on different axes. +% These commands have six parameters: +% 1. number of lines to draw (distance between these lines is the fifth +% parameter); +% 2. value at which the first line must be drawn (x-value for vertical +% lines, y-value for horizontal lines); +% 3. thickness; +% 4. tick length; +% 5. distance between two lines (typically the length of a decade: +% y-decade for horizontal lines, x-decade for vertical lines); +% 6. line length (typically the length of the graph paper sides: +% x-side for horizontal lines and y-side for vertical lines). +% +% \begin{macrocode} +\newcommand\hlines[6]{% +\multiput(-#4,\fpeval{ln(#2) * #5 / ln(10)})(0,#5){#1}% +{\linethickness{#3}\line(1,0){\fpeval{#6 + 2*#4}}}% +} + +\newcommand\vlines[6]{% +\multiput(\fpeval{ln(#2) * #5 / ln(10)},-#4)(#5,0){#1}% +{\linethickness{#3}\line(0,1){\fpeval{#6 + 2*#4}}}% +} +% \end{macrocode} +% +%\subsubsection{Command for rectangular graph papers} +% +% Here starts the definition of the \cs{carta} command. Its syntax is +%\begin{ttsyntax} +%\cs{carta}\opz{0 or1}\marg{no. x decades}\marg{no. of y decades} +%\end{ttsyntax} +% If an axis has zero decades, the scale is linear. +% For example, \cs{carta}\Marg{0}\Marg{0} composes a bilinear graph +% paper, \cs{carta}\Marg{2}\Marg{0} composes a semilog graph paper with +% linear y-axis and two decades along x-axis, and so on. +% Its optional argument can be 0 or 1. If it is set to 0, and both the +% numbers of decades are greater than zero (which means the resulting +% graph paper is loglog), then the length of x-axis and y-axis decades +% are set to be equal. +% +% Declaration of the command and its arguments. +% \begin{macrocode} +\NewDocumentCommand{\carta}{O{0} m m}{% +% \end{macrocode} +% +% Typographical settings and definition of the main features of the +% graphpaper. \cs{xlength} and \cs{ylength} represent the lengths, +% expressed in mm, of the rectangle dimensions. \cs{minimumdistance} +% is the minimum distance at which two subdivision lines can be drawn. +% \begin{macrocode} +\newpage +\parindent=0pt +\pagestyle{empty}% +\color{gridcolor}% +\setlength{\unitlength}{1mm}% +\def\ticklength{2} +\def\minorticklength{1.2} +\def\minimumdistance{\fpeval{(\mindistanceunit/1mm)}} +\def\xlength{\fpeval{round(round(\xsideunit/1cm) * 10)}} +\def\ylength{\fpeval{round(round(\ysideunit/1cm) * 10)}} +% \end{macrocode} +% +% \cs{xlinsq} and \cs{ylinsq} represent the number of big divisions +% (cm) on horizontal and vertical axes for linear scales, respectively. +% \begin{macrocode} +\def\xlinsq{\inteval{\xlength/10}} +\def\ylinsq{\inteval{\ylength/10}} +% \end{macrocode} +% +% Implementation of the same decade length between x-axis and y-axis +% for loglog graph paper. This is obtained properly changing the +% values of \cs{xlength} and \cs{ylength}, making them equal. +% \begin{macrocode} +\edef\decx{#2}% decades along x +\edef\decy{#3}% decades along y +\unless\ifnum#2=0 \unless\ifnum#3=0 \ifnum#1=1% +\fptest{\decx/\decy < \xlength/\ylength}% +{\def\xlength{\fpeval{\ylength*\decx/\decy}}} +{\def\ylength{\fpeval{\xlength*\decy/\decx}}} +\fi\fi\fi +% \end{macrocode} +% +% Using the values of the paper width and height together with the +% length of the graph paper rectangle sides, the margins are calculated +% and passed to the geometry package in order to center the grid with +% respect to the page. +% \begin{macrocode} +\ifcsname ml\endcsname\relax\else\newlength\ml\fi +\ifcsname mr\endcsname\relax\else\newlength\mr\fi +\ifcsname mt\endcsname\relax\else\newlength\mt\fi +\ifcsname mb\endcsname\relax\else\newlength\mb\fi +\unless\ifcsname mr\endcsname\newlength\mr\fi +\unless\ifcsname mt\endcsname\newlength\mt\fi +\unless\ifcsname mb\endcsname\newlength\mb\fi +\setlength{\ml}{\fpeval{(\paperwidth/1mm - \xlength)/2}mm} +\setlength{\mr}{\fpeval{(\paperwidth/1mm - \xlength)/2}mm} +\setlength{\mt}{\fpeval{(\paperheight/1mm - \ylength)/2}mm} +\setlength{\mb}{\fpeval{(\paperheight/1mm - \ylength)/2}mm} +\newgeometry{left=\ml,right=\mr,top=\mt,bottom=\mb} +% \end{macrocode} +% +% Here starts the drawing of the graph paper by the |picture| environment. +% \begin{macrocode} +\begin{picture}(\xlength,\ylength) +% \end{macrocode} +% +% If the horizontal axis is linear, vertical lines are drawn by +% simple \cs{multiput} commands. Otherwise, if the scale is logarithmic, +% the vertical lines are drawn by the \cs{vlines} command defined above. +% \begin{macrocode} +\ifnum#2=0\relax +% vertical lines on linear abscissa. Main lines every 10 mm. +% Second level lines every 5 mm, Third level lines every 1 mm, +% according to the \minimumdistance value + \multiput(0,0)(10,0){\inteval{\xlinsq + 1}}{% + \linethickness{\lwa}\squarecap\line(0,1){\ylength}} + \ifnum\fpeval{\minimumdistance <= 5}=1 + \multiput(5,0)(10,0){\xlinsq}{% + \linethickness{\lwb}\line(0,1){\ylength}}\fi + \ifnum\fpeval{\minimumdistance <= 1}=1 + \multiput(0,0)(1,0){\xlength}{% + \linethickness{\lwc}\line(0,1){\ylength}}\fi +\else + % vertical lines on log abscissa + \edef\decxx{\fpeval{\decx + 1}}% + \edef\xstep{\fpeval{\xlength / \decx}} + % main lines: one for each decade (10) plus one at the end + \vlines{\decxx}{1}{\lwa}{\ticklength}{\xstep}{\ylength} + % second-level lines: one every unit (1), for each decade + \WhileDoOne{2}{9}{\vlines{\decx}{\J}{\lwb}{% + \minorticklength}{\xstep}{\ylength}} + % third-level lines: for each decade (10) and for each unit (1): + % 20, 10, 5, 2 are progressively tested and adopted if the distance + % between two subsequent nearest lines is less to \minimumdistance + \WhileDoTwo{1}{9}{% + \edef\xmindivfloat{% + \fpeval{(\K+1)*(1-10^-(\minimumdistance/\xstep))}} + % xmindiv corresponds to 1/20 of unit + \def\xmindiv{20} + % xmindivfloat corresponds to the distance of two + % subdivision with respect to the unit + \ifnum\fpeval{\xmindivfloat <= 0.5}=1 \def\xmindiv{10}\fi + \ifnum\fpeval{\xmindivfloat <= 0.2}=1 \def\xmindiv{4}\fi + \ifnum\fpeval{\xmindivfloat <= 0.1}=1 \def\xmindiv{2}\fi + \ifnum\fpeval{\xmindivfloat <= 0.05}=1 \def\xmindiv{1}\fi + \ifnum\fpeval{\xmindiv == 20}=1\relax + \else\WhileDoOne[\xmindiv]{\xmindiv}{19}{% + \vlines{\decx}{(\K+\J/20)}{\lwc}{0}{\xstep}{\ylength}}\fi} +\fi +% \end{macrocode} +% +% If the vertical axis is linear, horizontal lines are drawn by +% simple \cs{multiput} commands. Otherwise, if the scale is logarithmic, +% the horizontal lines are drawn by the \cs{hlines} command defined above. +% \begin{macrocode} +\ifnum#3=0\relax +% horizontal lines on linear ordinates. Main lines every 10 mm. +% Second level lines every 5 mm, Third level lines every 1 mm, +% according to the \minimumdistance value + \multiput(0,0)(0,10){\inteval{\ylinsq + 1}}{% + \linethickness{\lwa}\squarecap\line(1,0){\xlength}} + \ifnum\fpeval{\minimumdistance <= 5}=1 + \multiput(0,5)(0,10){\ylinsq}{% + \linethickness{\lwb}\line(1,0){\xlength}}\fi + \ifnum\fpeval{\minimumdistance <= 1}=1 + \multiput(0,0)(0,1){\ylength}{% + \linethickness{\lwc}\line(1,0){\xlength}}\fi +\else + % horizontal lines on log ordinates + \edef\decyy{\fpeval{\decy + 1}}% + \edef\ystep{\fpeval{\ylength / \decy}} + % main lines: one for each decade (10) plus one at the end + \hlines{\decyy}{1}{\lwa}{\ticklength}{\ystep}{\xlength} + % second-level lines: one every unit (1), for each decade + \WhileDoOne{2}{9}{\hlines{\decy}{\J}{\lwb}{% + \minorticklength}{\ystep}{\xlength}} + % third-level lines: for each decade (10) and for each unit (1): + % 20, 10, 5, 2 are progressively tested and adopted if the distance + % between two subsequent nearest lines is less to \minimumdistance + \WhileDoTwo{1}{9}{\edef\ymindivfloat{% + \fpeval{(\K+1)*(1-10^-(\minimumdistance/\ystep))}} + % ymindiv corresponds to 1/20 of unit + \def\ymindiv{20} + % ymindivfloat corresponds to the distance of two subdivisions + % with respect to the unit + \ifnum\fpeval{\ymindivfloat <= 0.5}=1 \def\ymindiv{10}\fi + \ifnum\fpeval{\ymindivfloat <= 0.2}=1 \def\ymindiv{4}\fi + \ifnum\fpeval{\ymindivfloat <= 0.1}=1 \def\ymindiv{2}\fi + \ifnum\fpeval{\ymindivfloat <= 0.05}=1 \def\ymindiv{1}\fi + \ifnum\fpeval{\ymindiv == 20}=1\relax + \else\WhileDoOne[\ymindiv]{\ymindiv}{19}{% + \hlines{\decy}{(\K+\J/20)}{\lwc}{0}{\ystep}{\xlength}}\fi} +\fi +% \end{macrocode} +% +% Custom code provided by the user. After executing the code to compose +% the rectangular graph paper and the user custom code, the latter is +% reset if the \cs{GP@customcodereset} is true. +% \begin{macrocode} +\GP@custom +\end{picture} +\ifGP@customcodereset\def\GP@custom{}\fi} +% \end{macrocode} +% +% +% +%\subsection{Circular graph papers} +% +% The \class{Graphpaper} class provides commands to draw three different +% circular graph papers: linear polar chart, log polar chart, Smith chart. +% +%\subsubsection{Service macros for Smith charts} +% +% Here follows a list of service macros used by circular graph papers. +% +% Definition of the counter \cs{I}, used both in polar paper and Smith chart. +% \begin{macrocode} +\newcount\I +% \end{macrocode} +% +% |Rbox| composes a tick and a label in a rotated box. It is used to +% compose the ticks and labels along the external circle of circular +% graph papers. It accepts three arguments: The first one is +% optional and represents +% the angle of rotation (default 0); the second one is optional too, +% it is inserted by round parentheses, and it represents the position of the +% box which can be given in cartesian $(x,y)$ or polar coordinates $(\theta:\rho)$ +% (default 0:0); the third one is mandatory and +% contains the label. +% \begin{macrocode} +\NewDocumentCommand\Rbox{O{0} D(){0:0} m}{% + \fptest{#1>=0}{\edef\RotLab{\fpeval{#1-90}}}{\edef\RotLab{\fpeval{#1+90}}}% + \put(#2){\color{black}\segment(0,0)(#1:1)\put(#1:1){% + \rotatebox{\RotLab}{\makebox(0,0)[c]{% + \fptest{#1>=0}{\Pbox[b]}{\Pbox[t]}{\scriptstyle#3}[0]}}% + }% + }\ignorespaces} +% \end{macrocode} +% +% |\Xcircle| macro (used only for Smith charts) assumes that the scale +% factor |\Scala| ($s$) has already been defined and it takes only one +% mandatory parameter ($x$). It draws a circle with +% center $(sx/(x+1),0)$ and radius $s/(x+1)$. ($x$ represents the real +% part (resistance) of the normalised impedance.) +% \begin{macrocode} +\NewDocumentCommand\Xcircle{m}{% + \edef\Czero{0,0}\edef\Rzero{\Scala}% + \edef\Rdue{\fpeval{1/(#1+1)*\Scala}}% + \edef\Cdue{\fpeval{\Rzero-\Rdue},0}% + \Circlewithcenter\Cdue radius\Rdue\ignorespaces} +% \end{macrocode} +% +% |\Ycircle| macro (used only for Smith charts) assumes that the scale +% factor |\Scala| ($s$) has already been defined. +% It assumes that the circle diameter is 100|\unitlength|s long and it +% takes only one +% mandatory parameter ($y$). It draws an arc of a circle with +% center $(s,s/y)$, starting point at $(s,0)$ (and therefore radius +% $s/y$) and with an angle calculated in order to have the end point on +% the external circle. ($y$ represents the imaginary part (reactance) +% of the normalised impedance.) +% \begin{macrocode} +\NewDocumentCommand\Ycircle{m s}{% + \edef\Czero{0,0}\edef\Rzero{\Scala}% external circle center and radius + \edef\Rdue{\fpeval{\Scala/abs(#1)}}% Small circle radius + \edef\Cdue{\Rzero,\fpeval{\Scala/#1}}% Small circle center + \edef\Cuno{\Rzero,0}% First intersection point + \ModAndAngleOfVect\Cdue to\Mod and\Alfa % Small circle center polar coordinates + \IntersectionOfLines(\Czero)(\Cdue)and(\Cuno)(\fpeval{\Alfa+90}:1)to\Inter + \SymmetricalPointOf\Cuno respect\Inter to\Idue + \ModAndAngleOfVect\Idue to\Mdue and\Adue + \SubVect\Cdue from\Idue to\IIdue + \ModAndAngleOfVect\IIdue to\Mod and\Alfa + \fptest{#1>0}{\edef\Alfa{\fpeval{270-\Alfa}}\Arc(\Cdue)(\Idue){\Alfa}}% + {\edef\Alfa{\fpeval{270+\Alfa}}\Arc(\Cdue)(\Cuno){\Alfa}}% + \IfBooleanT{#2}{\Rbox[\Adue](\Idue){\color{black}#1}}\relax + \ignorespaces} +% \end{macrocode} +% +% The following two macros are used to compose the resistance axis +% below the Smith chart. +% +% |CalcRxx| macro (used only for Smith charts) assumes that the scale +% factor |Scala| ($s$) has already been defined. +% First, it calculates the reflection coefficient +% $\Gamma = s \frac{x-1}{x+1}$ from resistance $x$. +% A tick and a label are inserted for this value of $x$. +% \begin{macrocode} +\newcommand\CalcRxx[1]{% + \edef\Rxx{\fpeval{\Scala*(#1 - 1)/(#1 + 1)}}% + \segment(\Rxx,\LowResZero)(\Rxx,\LowResUno)\relax + \Pbox(\Rxx,\LowResUno)[t]{$\color{black}\scriptsize#1$}[0]\ignorespaces} +% \end{macrocode} +% +% |GradResist| macro (used only for Smith charts) +% draws the graduated axis for resistance and executes the |CalcRxx| +% for several values of resistance in order to compose the ticks and +% the labels. +% \begin{macrocode} +\newcommand\GradResist[1]{% + \color{black} + \edef\LowResZero{-#1}\edef\LowResUno{\fpeval{\LowResZero-1}}% + \I=0\edef\Auxx{0}\relax + \fpdowhile{\I<=10}{\CalcRxx{\Auxx}% + \advance\I by1\edef\Auxx{\fpeval{\Auxx+0.1}}\ignorespaces} + \CalcRxx{1.5}\I=2\edef\Auxx{2}\relax + \fpdowhile{\I<=9}{\CalcRxx{\Auxx}% + \advance\I by1\edef\Auxx{\fpeval{\Auxx+1}}\ignorespaces} + \CalcRxx{15}\CalcRxx{30}% + \edef\Rxx{\Scala}% + {\segment(-\Rxx,\LowResZero)(\Rxx,\LowResZero)% + \segment(\Rxx,\LowResZero)(\Rxx,\LowResUno)% + \Pbox(\Rxx,\LowResUno)[t]{\infty}[0]}} +% \end{macrocode} +% +% |GradPolar| macro (used only for polar charts) +% draws the graduated axis for log polar charts. +% \begin{macrocode} +\newcommand{\GradPolar}[1]{% + \color{black} + \edef\yline{\fpeval{-1.2 * \Scala}} + \linethickness{\lwa} + \segment(-\Scala,\yline)(\Scala,\yline) + \edef\ytickstart{\yline} + \edef\ytickstop{\fpeval{\yline-2}} + \edef\yytickstop{\fpeval{\yline-1}} + \segment(\Scala,\ytickstart)(\Scala,\ytickstop) + \segment(-\Scala,\ytickstart)(-\Scala,\ytickstop) + \fptest{#1=0}{% + \segment(0,\ytickstart)(0,\ytickstop) + \edef\plstep{\fpeval{\Scala/10}} + \linethickness{\lwb} + \multiput(\plstep,\yline)(\plstep,0){9}{\line(0,-1){1}} + \multiput(-\plstep,\yline)(-\plstep,0){9}{\line(0,-1){1}}% + }{% + \I=0 + \fpwhiledo{\I<#1}{% + \linethickness{\lwa} + \edef\xtick{\fpeval{\I*\Scala/#1}} + \segment(\xtick,\ytickstart)(\xtick,\ytickstop) + \segment(-\xtick,\ytickstart)(-\xtick,\ytickstop) + \J=2 + \fpwhiledo{\J<=9}{% + \linethickness{\lwb} + \edef\xtick{\fpeval{\Scala/#1 * (\I + ln(\J)/ln(10))}} + \segment(\xtick,\ytickstart)(\xtick,\yytickstop) + \segment(-\xtick,\ytickstart)(-\xtick,\yytickstop) + \advance\J by1\relax} + \advance\I by1\relax}} +} +% \end{macrocode} +% +% +%\subsubsection{Polar graph papers} +% +% The polar graph papers are composed by the command \cs{PolarChart}. +% The syntax is +%\begin{ttsyntax} +% \cs{PolarChart}\opz{diameter}\marg{decades} +%\end{ttsyntax} +% where \meta{diameter} is the dimension (plus some extra space for +% labels and margins) of the polar chart. Its default value +% corresponds to the \cs{paperheight} (the minimum dimension of the +% paper). +% The mandatory parameter \meta{decades} must be an integer number. +% Its value corresponds to the number of decades of the radial +% coordinate for the log polar graph paper. +% If its value is zero, the chart is linear. +% The maximum number of allowed decades is set by the macro \cs{NDecMax}: +% its default value is~2. +% +% Declaration of the command and its arguments. +% \begin{macrocode} +\NewDocumentCommand\PolarChart{O{\paperheight} m}{% +% \end{macrocode} +% +% Typographical settings and definition of the main features of the graphpaper. +% \cs{xlength} and \cs{ylength} represent the lengths of the rectangle +% dimensions in which the polar graph is plot. +% The origin of the coordinate system is in the center of the page. +% \begin{macrocode} + \newpage + \parindent=0pt + \pagestyle{empty}% + \ifcsname pmargin\endcsname\relax\else\newlength\pmargin\fi + \setlength{\pmargin}{20pt} + \newgeometry{left=\pmargin,right=\pmargin,top=\pmargin,bottom=\pmargin} + \def\factor{140} + \unitlength=\fpeval{#1/\factor}pt + \def\xlength{\fpeval{(\textwidth-0.01pt)/\unitlength}} + \def\ylength{\fpeval{(\textheight-0.01pt)/\unitlength}} + \begin{picture}(\xlength,\ylength)% + (\fpeval{-\xlength/2},\fpeval{-\ylength/2})% + \color{gridcolor}% + \edef\Scala{50}% The scale factor +% \end{macrocode} +% +% +% Circle stroking. In linear scale 10 radial units are present, +% therefore, 10 circles are drawn with tick lines, +% medium lines circles every 0.5 unit and thin lines circles every +% 0.1 unit. +% \begin{macrocode} + \fptest{#2=0}{% start circle linear radius sequence. + \I=1 + \fpdowhile{\I=<100}{\edef\R{\fpeval{0.01*\Scala*\I}}% + {\fptest{\fpeval{\I-10(round(\I/10,0))}=0}{\linethickness{\lwa}% + }% + {\fptest{\fpeval{\I-5(round(\I/5,0))}=0}{\linethickness{\lwb}}% + {\linethickness{\lwc}}% + }\Circlewithcenter0,0radius\R + }\advance\I by1\relax}% + }% end circle linear radius sequence + {% + \edef\LnDieci{\fpeval{ln(10)}}% + \edef\ScalaDecade{\fpeval{\Scala/#2}}% + \fptest{#2<3}{% + \newcount\Dec \Dec=1\relax + \fpdowhile{\Dec=<#2}{% + \linethickness{\lwa}% + \edef\R{\fpeval{\Dec*\ScalaDecade}}% + \Circlewithcenter0,0radius\R% Thick circles + % First band from 1 to 4 (excluded) + \edef\LPLA{1}% + \fpdowhile{\LPLA<4}{ + \edef\Logaritmo{\fpeval{\Dec-1+(ln(\LPLA))/\LnDieci}}% + \edef\R{\fpeval{\ScalaDecade*\Logaritmo}}% + \fptest{\R>0}{\fptest{\LPLA=round(\LPLA,0)}% + {\linethickness{\lwb}}{\linethickness{\lwc}}% + \Circlewithcenter0,0radius\R}{}% + \edef\LPLA{\fpeval{\LPLA+0.2}}}% + % Second band from 4 to 10 included + \edef\LPLA{4}% + \fpdowhile{\LPLA=<10}{% + \edef\Logaritmo{\fpeval{\Dec-1+(ln(\LPLA))/\LnDieci}}% + \edef\R{\fpeval{\ScalaDecade*\Logaritmo}}% + \fptest{\R>0}{\fptest{\LPLA=round(\LPLA,0)}% + {\linethickness{\lwb}}{\linethickness{\lwc}}% + \Circlewithcenter0,0radius\R}{}% + \edef\LPLA{\fpeval{\LPLA+0.5}}}% + \advance\Dec by1\relax}% + }{% + \ClassWarning{GraphPaper}{Logarithmic polar graph paper:\MessageBreak + too many decades: \number#2\space\MessageBreak + Reduce their number}% + }}% End logarithmic circle radius sequence + \ignorespaces + % +% \end{macrocode} +% +% Radial lines. \cs{I} represents the angle in degrees and it runs +% from 0 to 359. Tick lines every 10$^\circ$; medium lines every 5$^\circ$ +% for units 2, 7, 8, 9, 10; thin lines every 2$^\circ$ for units 3, 4, 5, 6; +% thin lines every 1$^\circ$ for units 7, 8, 9, 10. +% \begin{macrocode} + \I=0\edef\R{\Scala}% + \fpdowhile{\I<360}{\edef\A{\fpeval{\I}}% + \fptest{\fpeval{\I-10(round(\I/10,0))}=0}% + {\linethickness{\lwa}\segment(0,0)(\A:\R) + \Rbox[\A](\A:\R){\color{black}\A}}% multiple of 10 + {\fptest{\fpeval{\I-5(round(\I/5,0))}=0}% + {\linethickness{\lwb}% + \segment(\A:5)(\A:10) + \segment(\A:30)(\A:\R)}% multiple of 5 + {\linethickness{\lwc}% + \fptest{\fpeval{\I-2(round(\I/2,0))}=0}% + {\segment(\A:10)(\A:\R)}% multiple of 2 + {\segment(\A:30)(\A:\R)}% multiple of 1 + }% + }% + \advance\I by 1\relax + }\ignorespaces +% \end{macrocode} +% +% Graduated axis. +% \begin{macrocode} + \GradPolar{#2} +% \end{macrocode} +% +% Custom code provided by the user. After executing the code to compose +% the rectangular graph paper and the user custom code, the latter is +% reset if the \cs{GP@customcodereset} is true. +% \begin{macrocode} + \GP@custom + \end{picture} +\ifGP@customcodereset\def\GP@custom{}\fi} +% \end{macrocode} +% +% +%\subsubsection{Smith chart graph paper} +% +% The Smith chart graph paper is composed by the command \cs{SmithChart}: +%\begin{ttsyntax} +% \cs{SmithChart}\oarg{diameter} +%\end{ttsyntax} +% where +% \meta{diameter} is the dimension (plus some extra space for labels and +% margins) of the Smith chart. Its default value corresponds to the +% \cs{paperheight} (the minimum dimension of the paper). +% +% \begin{macrocode} +\NewDocumentCommand\SmithChart{O{\paperheight}}{% + \newpage + \parindent=0pt + \pagestyle{empty}% + \ifcsname pmargin\endcsname\relax\else\newlength\pmargin\fi + \setlength{\pmargin}{20pt} + \newgeometry{left=\pmargin,right=\pmargin,top=\pmargin,bottom=\pmargin} + \def\factor{140} + \unitlength=\fpeval{#1/\factor}pt\relax + \def\xlength{\fpeval{(\textwidth-0.01pt)/\unitlength}} + \def\ylength{\fpeval{(\textheight-0.01pt)/\unitlength}} + \begin{picture}(\xlength,\ylength)% + (\fpeval{-\xlength/2},\fpeval{-\ylength/2})% + \color{gridcolor}% + \edef\Scala{50}% scale factor based on the main circle but valid + % for everything inside the graph paper. + {\color{black}\Pbox(0,0){}[4]}% Black dot in the origin + % images of the vertical cartesian lines + \I=0\relax + \fpdowhile{\I=<6}{\edef\Aux{\fpeval{\I/20}}{% + \fptest{\I=0}{\color{black}}{\color{gridcolor}}\thicklines\Xcircle{\Aux}}% + \advance\I by1\edef\Aux{\fpeval{\I/20}}\Xcircle{\Aux}% + \advance\I by1\ignorespaces}%fino a 0.4 + \fpdowhile{\I=<16}{\edef\Aux{\fpeval{\I/20}}\relax + {\thicklines\Xcircle{\Aux}}\advance\I by2\edef\Aux{\fpeval{\I/20}}\relax + \Xcircle{\Aux}\advance\I by2\ignorespaces}% fino a 1 + \fpdowhile{\I=<36}{\edef\Aux{\fpeval{\I/20}}\relax + {\thicklines\Xcircle{\Aux}}\advance\I by4\edef\Aux{\fpeval{\I/20}}\relax + \Xcircle{\Aux}\advance\I by4\ignorespaces}% fino a 2 + \fpdowhile{\I=<96}{\edef\Aux{\fpeval{\I/20}}\relax + {\thicklines\Xcircle{\Aux}}\advance\I by8\edef\Aux{\fpeval{\I/20}}\relax + \Xcircle{\Aux}\advance\I by8\ignorespaces}%fino a 5 + \fpdowhile{\I=<296}{\edef\Aux{\fpeval{\I/20}}\relax + {\thicklines\Xcircle{\Aux}}\advance\I by16\edef\Aux{\fpeval{\I/20}}\relax + \Xcircle{\Aux}\advance\I by16\ignorespaces}% up to 15 +% Images of the horizontal cartesian semi-lines + \Ycircle{1}% + {\thicklines\segment(-\Rzero,0)(\Rzero,0)}% diameter + \Rbox[180](-\Rzero,0){0}\Rbox[0](\Rzero,0){\infty} + \Ycircle{0.05}\Ycircle{-0.05}\I=2% \I=2 is to avoid a division by 0 + \fpdowhile{\I=<18}{\edef\Aux{\fpeval{\I/20}}\relax + {\thicklines\Ycircle{\Aux}*\Ycircle{-\Aux}*}% + \advance\I by1\edef\Aux{\fpeval{\I/20}}\relax + \Ycircle{\Aux}\Ycircle{-\Aux}\advance\I by 1\ignorespaces}% restarts from 1 + \fpdowhile{\I<40}{\edef\Aux{\fpeval{\I/20}}\relax + {\thicklines\Ycircle{\Aux}*\Ycircle{-\Aux}*}% + \advance\I by 2\edef\Aux{\fpeval{\I/20}}\relax + \Ycircle{\Aux}\Ycircle{-\Aux}\advance\I by 2\ignorespaces}% restarts from 2 + \fpdowhile{\I<80}{\edef\Aux{\fpeval{\I/20}}\relax + {\thicklines\Ycircle{\Aux}*\Ycircle{-\Aux}*}% + \advance\I by 4\edef\Aux{\fpeval{\I/20}}\relax + \Ycircle{\Aux}\Ycircle{-\Aux}\advance\I by 4\ignorespaces}% restarts from 4 + \fpdowhile{\I=<140}{\edef\Aux{\fpeval{\I/20}}\relax + {\thicklines\Ycircle{\Aux}*\Ycircle{-\Aux}*}% + \advance\I by 10\edef\Aux{\fpeval{\I/20}}\relax + \Ycircle{\Aux}\Ycircle{-\Aux}\advance\I by 10\ignorespaces}% stops at 7.5 + {\thicklines\Ycircle{8}*\Ycircle{-8}*}% + % non linear graduation for the abscissas + \GradResist{62}% + % Polar graduation in normalised wave length percentages + \edef\Rout{\fpeval{1.09*\Rzero}}% + \edef\RoutCifre{\fpeval{\Rout+2}}% + \edef\RoutTak{\fpeval{\Rout+1}}% + {\color{black}% + \Circlewithcenter 0,0radius\Rout + \I=0\fpdowhile{\I<10}% + {\edef\LAng{\fpeval{180-\I*36}}\edef\Cifre{\fpeval{\I*5}}% + \put(\LAng:\RoutCifre){% + \rotatebox{\fpeval{\LAng-90}}{\makebox(0,0)[b]{\scriptsize\Cifre}}}% + \advance\I by 1\ignorespaces} + \I=0\fpdowhile{\I<50}{% + \edef\LAng{\fpeval{180-\I*7.2}}\segment(\LAng:\Rout)(\LAng:\RoutTak)% + \advance\I by1\ignorespaces} + % + % Outside circle encloses everything except the abscissa graduation. + % Everything lays inside a square + \Circlewithcenter0,0radius{\fpeval{\Scala+9}}}% + % Now the user supplied code is executed + \GP@custom + \end{picture} +\ifGP@customcodereset\def\GP@custom{}\fi}% +% \end{macrocode} +% +% +%\subsection{User interface} +% +% Here follows the user commands to draw the graph papers, as described in +% section~\ref{sec:howto}: +% \begin{macrocode} +\NewDocumentCommand{\bilinear}{}{\carta{0}{0}} +\NewDocumentCommand{\semilogx}{m}{\carta{#1}{0}} +\NewDocumentCommand{\semilogy}{m}{\carta{0}{#1}} +\NewDocumentCommand{\loglog}{O{0}mm}{\carta[#1]{#2}{#3}} +\NewDocumentCommand{\polar}{}{\PolarChart{0}} +\NewDocumentCommand{\logpolar}{m}{\PolarChart{#1}} +\NewDocumentCommand{\smith}{}{\SmithChart} +% \end{macrocode} +% +% The user commands to customise the appearance of the graph +% papers is defined. Their syntax was previously described in +% sectio~\ref{sec:howto}: +% \begin{macrocode} +\NewDocumentCommand{\setgridcolor}{m}{\colorlet{gridcolor}{#1}} +\NewDocumentCommand{\setmajorlinethickness}{m}{\setlength{\lwa}{#1}} +\NewDocumentCommand{\setmediumlinethickness}{m}{\setlength{\lwa}{#1}} +\NewDocumentCommand{\setminorlinethickness}{m}{\setlength{\lwa}{#1}} +\NewDocumentCommand{\setminimumdistance}{m}{\setlength{\mindistanceunit}{#1}} +\NewDocumentCommand{\setxside}{m}{% + \ifnum\fpeval{#1 > \paperwidth}=1 \ClassError{graphpaper}{X side too wide!} \fi + \setlength{\xsideunit}{#1}} +\NewDocumentCommand{\setyside}{m}{% + \ifnum\fpeval{#1 > \paperheight}=1 \ClassError{graphpaper}{Y side too wide!} \fi + \setlength{\ysideunit}{#1}} +\def\GP@custom{} +\newif\ifGP@customcodereset \GP@customcoderesettrue +\NewDocumentCommand{\customcode}{O{1} m}{% + \ifnum#1=\z@ \GP@customcoderesetfalse \fi% + \def\GP@custom{#2}} +% \end{macrocode} +% +% +%\subsection{Class code end} +% +% \begin{macrocode} +% +\endinput +% \end{macrocode} +% +%\iffalse +%</class> +%\fi +% +% \Finale +%^^A
\ No newline at end of file diff --git a/macros/latex/contrib/graphpaper/graphpaper.pdf b/macros/latex/contrib/graphpaper/graphpaper.pdf Binary files differnew file mode 100644 index 0000000000..834127e0df --- /dev/null +++ b/macros/latex/contrib/graphpaper/graphpaper.pdf diff --git a/macros/latex/contrib/mylatex/README.txt b/macros/latex/contrib/mylatex/README.txt new file mode 100644 index 0000000000..9160c02984 --- /dev/null +++ b/macros/latex/contrib/mylatex/README.txt @@ -0,0 +1,18 @@ + +CTAN:macros/latex/contrib/supported/mylatex + + All the files in this directory may be redistributed and/or modified + under the terms of the LaTeX Project Public License Distributed from + CTAN archives in directory macros/latex/base/lppl.txt; either version + 1 of the License, or (at your option) any later version. + +David Carlisle https://github.com/davidcarlisle/dpctex + +2020-10-23 + + +mylatex.ltx + This file provides a method of making a special format tailored to + one document, with all the class and packages, and other preamble + material pre-loaded. This can save quite a lot of time on some + systems. See the comments in the file. diff --git a/macros/latex/contrib/carlisle/mylatex.ltx b/macros/latex/contrib/mylatex/mylatex.ltx index d1ea1ea233..51e2f41c78 100644 --- a/macros/latex/contrib/carlisle/mylatex.ltx +++ b/macros/latex/contrib/mylatex/mylatex.ltx @@ -15,8 +15,14 @@ %%% Given a LaTeX file `abc.tex', use initex as follows: %%% %%% initex &latex mylatex.ltx abc (Generic TeX) -%%% initex \&latex mylatex.ltx abc (unix and other TeX's) -%%% tex /i &latex mylatex.ltx abc (emtex) +%%% +%%% You may need to quote the & from your commandline and also +%%% most modern systems use an --ini option rather than a separate +%%% initex program so this may need to be +%%% +%%% pdftex --ini "&latex" mylatex.ltx abc +%%% +%%% To produce a format extending pdflatex for example. %%% %%% If you are on a Mac or using some shell that makes it inconvenient %%% to use a command line such as the above examples then you may @@ -34,7 +40,10 @@ %%%%%%%%%%%%%%%%%%%%%%%% %%% %%% tex &mylatex abc (generic TeX) -%%% virtex \&mylatex abc (Unix TeX) +%%% +%%% As above you may need to quote the & so for pdflatex +%%% +%%% pdflatex "&mylatex" abc %%% %%% This will process your document, abc.tex, just as LaTeX does, but %%% quicker as the contents of the preamble will be stored in the @@ -110,6 +119,8 @@ %%% mylatex.ltx with OzTeX %%% Modified 1999/01/04 Rowland McDonnell corrected notes on how to %%% use mylatex.ltx with OzTeX. +%%% Modified 2020/10/23 Phelype Oleinik updated to work with new hook code +%%% in \begin{document} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \makeatletter @@ -118,6 +129,13 @@ \let\MYLATEXdocument\document \let\MYLATEXopenout\openout +% new for 2020-10-01 +\ifx\@execute@begin@hook\@undefined +\else + \let\MYLATEX@execute@begin@hook\@execute@begin@hook + \def\@execute@begin@hook#1{}% +\fi + % The version of \document to use on the initex run. % Just preloads some fonts, puts back \document and \openout, % sets up the banner to display the file list of files preloaded, @@ -137,6 +155,7 @@ }}% \let\document\MYLATEXdocument \let\openout\MYLATEXopenout + \let\@execute@begin@hook\MYLATEX@execute@begin@hook \makeatother \everyjob\expandafter{\the\everyjob \begingroup diff --git a/macros/latex/contrib/principia/README b/macros/latex/contrib/principia/README new file mode 100644 index 0000000000..ceed875d85 --- /dev/null +++ b/macros/latex/contrib/principia/README @@ -0,0 +1,12 @@ +principia.sty - a LaTeX2e package for typesetting the "Peanese" notation of Whitehead and Russell's 1910 "Principia Mathematica". + +The file principia.sty is the original work of Landon D. C. Elkind (Copyright (c) 2020). It is released under the LaTeX Project Public License 1.3c. + +This is principia package Version 1.0. It covers typesetting the notations through Volume I of "Principia Mathematica". See the file principia.pdf for information on how to typeset these symbols in LaTeX. + +Updates to include all notations throughout Volumes II and III are planned. Further information and updates can be found at https://logicalatomist.github.io/principia/ + +Comments and suggestions are welcomed by the package maintainer, signed below. + +Landon D. C. Elkind +University of Alberta
\ No newline at end of file diff --git a/macros/latex/contrib/principia/principia.pdf b/macros/latex/contrib/principia/principia.pdf Binary files differnew file mode 100644 index 0000000000..6d4b543228 --- /dev/null +++ b/macros/latex/contrib/principia/principia.pdf diff --git a/macros/latex/contrib/principia/principia.sty b/macros/latex/contrib/principia/principia.sty new file mode 100644 index 0000000000..3a1fd3b271 --- /dev/null +++ b/macros/latex/contrib/principia/principia.sty @@ -0,0 +1,231 @@ +%This is the principia package is for representing notations in Whitehead and Russell's ``Principia Mathematica" close to their appearance in the original. +%Copyright (C) 2020 by Landon D. C. Elkind (https://landondcelkind.com/contact/). +%This program is free software. It may be redistributed and/or modified under the terms of the GNU General Public License as published by the Free Software Foundation, Version 3 or any later version. + +%Package Identification +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{principia}[2020/10/20 principia package version 1.0] %Covers typesetting of notation through Volume I + +%Principia package requirements +\RequirePackage{graphicx} %This loads commands that flip iota for definite descriptions, Lambda for the universal class, and so on. The (superseded) graphics package should also work here, but is not recommended. +\RequirePackage{marvosym} %This loads the male and female symbol. +\RequirePackage{pifont} %This loads the symbols such as the eight-pointed asterisk. + +%Meta-logical symbols +\newcommand{\pmdem}{\textit{Dem}.} %This notation begins a proof. +\newcommand{\pmsub}[2]{\bigg \lbrack \small \begin{array}{c} #1 \\ \hline #2 \end{array} \bigg \rbrack} %This is the substitution command. +\newcommand{\pmSub}[3]{\bigg \lbrack \normalsize #1 \text{ } \small \begin{array}{c} #2 \\ \hline #3 \end{array} \bigg \rbrack} %This is the substitution command. +\newcommand{\pmsubb}[4]{\bigg \lbrack \small \begin{array}{c c} #1, & #3 \\ \hline #2, & #4 \end{array} \bigg \rbrack} %This is the substitution command. +\newcommand{\pmSubb}[5]{\bigg \lbrack \normalsize #1 \text{ } \small \begin{array}{c c} #2, & #4 \\ \hline #3, & #5 \end{array} \bigg \rbrack} %This is the substitution command. +\newcommand{\pmsubbb}[6]{\bigg \lbrack \small \begin{array}{c c c} #1, & #3, & #5 \\ \hline #2, & #4, & #6 \end{array} \bigg \rbrack} %This is the substitution command. +\newcommand{\pmSubbb}[7]{\bigg \lbrack \normalsize #1 \text{ } \small \begin{array}{c c c} #2, & #4, & #6 \\ \hline #3, & #5, & #7 \end{array} \bigg \rbrack} %This is the substitution command. +\newcommand{\pmsubbbb}[8]{\bigg \lbrack \small \begin{array}{c c c c} #1, & #3, & #5, & #7 \\ \hline #2, & #4, & #6, & #8 \end{array} \bigg \rbrack} %This is the substitution command. +\newcommand{\pmSubbbb}[9]{\bigg \lbrack \normalsize #1 \text{ } \small \begin{array}{c c c c} #1, & #3, & #5, & #7 \\ \hline #2, & #4, & #6, & #8 \end{array} \bigg \rbrack} %This is the substitution command. +\newcommand{\pmthm}{\text{\scalebox{.5}[1]{$\boldsymbol\vdash$}}} %This is the theorem sign. +\newcommand{\pmast}{\text{\resizebox{!}{.75\height}{\ding{107}}}} %This is the sign introducing a theorem number. +\newcommand{\pmcdot}{\text{\raisebox{.05cm}{$\boldsymbol\cdot$}}} %This is a sign introducing a theorem sub-number. +\newcommand{\pmdf}{=_\text{Df}} +\newcommand{\pmpp}{\text{Pp}} + +%Square dots for scope, defined for up to six dots +\newcommand{\pmdot}{\mathop{\hbox{\rule{.3ex}{.3ex}}}} +\newcommand{\pmdott}{\mathop{\overset{\pmdot}{\pmdot}}} +\newcommand{\pmdottt}{\pmdott \pmdot} +\newcommand{\pmdotttt}{\pmdott\pmdott} +\newcommand{\pmdottttt}{\pmdott\pmdott\pmdot} +\newcommand{\pmdotttttt}{\pmdott\pmdott\pmdott} + +%Logical connectives +\newcommand{\pmnot}{\mathord{\sim}} +\newcommand{\pmimp}{\boldsymbol{\supset}} +\newcommand{\pmiff}{\equiv} +\newcommand{\pmor}{\boldsymbol{\vee}} +\newcommand{\pmall}[1]{(#1)} +\newcommand{\pmsome}[1]{(\text{\raisebox{.5em}{\rotatebox{180}{E}}}#1)} +\newcommand{\pmSome}{\text{\raisebox{.5em}{\rotatebox{180}{E}}}} +\newcommand{\pmand}{\mathrel{\hbox{\rule{.3ex}{.3ex}}}} +\newcommand{\pmandd}{\overset{\pmand}{\pmand}} +\newcommand{\pmanddd}{\pmandd\hspace{.1em}\pmand} +\newcommand{\pmandddd}{\pmandd\hspace{.1em}\pmandd} +\newcommand{\pmanddddd}{\pmandd\hspace{.1em}\pmandd\hspace{.1em}\pmand} +\newcommand{\pmandddddd}{\pmandd\hspace{.1em}\pmandd\hspace{.1em}\pmandd} + +%Additional defined logic signs +\newcommand{\pmhat}[1]{\mathbf{\hat{\text{$#1$}}}} +\newcommand{\pmpf}[2]{#1#2} %for propositional functions of one variable +\newcommand{\pmpff}[3]{#1(#2, #3)} %for propositional functions of two variables +\newcommand{\pmpfff}[4]{#1(#2, #3, #4)} %for propositional functions of three variables +\newcommand{\pmshr}{\textbf{!}} %*12.1 and *12.11, used for predicative propositional functions +\newcommand{\pmpred}[2]{#1\pmshr#2} %for predicates (``predicative functions'') of one variable +\newcommand{\pmpredd}[3]{#1\pmshr(#2, #3)} %for predicates (``predicative functions'') of two variables +\newcommand{\pmpreddd}[4]{#1\pmshr(#2, #3, #4)} %for predicates (``predicative functions'') of three variables +\newcommand{\pmnid}{\mathrel{\ooalign{$=$\cr\hidewidth\footnotesize\rotatebox[origin=c]{210}{\textbf{/}}\hidewidth\cr}}} %*13.01 +\newcommand{\pmiota}{\rotatebox[origin=c]{180}{$\iota$}} %the rotated Greek iota used in definite descriptions +\newcommand{\pmdsc}[1]{(\pmiota#1)} %*14.01 +\newcommand{\pmDsc}{\pmiota} %*14.01 +\newcommand{\pmexists}{\text{E}\pmshr} %*14.02 + +%Class signs +\newcommand{\pmcuni}{\text{\rotatebox[origin=c]{180}{$\Lambda$}}} +\newcommand{\pmcnull}{\Lambda} +\newcommand{\pmcls}[2]{\pmhat{#1}(#2)} +\newcommand{\pmCls}{\text{Cls}} +\newcommand{\pmClsn}[1]{\text{Cls}^{#1}} +\newcommand{\pmcexists}{\text{\raisebox{.5em}{\rotatebox{180}{E}}}\mathop{\pmshr}} +\newcommand{\pmccmp}[1]{\boldsymbol{-}#1} +\newcommand{\pmcmin}[2]{#1\boldsymbol{-}#2} +\newcommand{\pmcin}{\mathop{\epsilon}} +\newcommand{\pmccup}{\mathop{\scalebox{1.3}[1.75]{$\put(3, 2.5){\oval(4,4)[b]}\phantom{\circ}$}}} +\newcommand{\pmccap}{\mathop{\scalebox{1.3}[1.75]{$\put(3, 2){\oval(4,1)[t]}\phantom{\circ}$}}} +\newcommand{\pmcinc}{\mathop{\boldsymbol{\subset}}} + +%Relation signs +\newcommand{\pmruni}{\dot{\text{\rotatebox[origin=c]{180}{$\Lambda$}}}} +\newcommand{\pmrnull}{\dot{\Lambda}} +\newcommand{\pmdscf}[2]{#1\textbf{`}#2} +\newcommand{\pmdscff}[2]{#1\textbf{`}\textbf{`}#2} +\newcommand{\pmdscfff}[2]{#1\textbf{`}\textbf{`}\textbf{`}#2} +\newcommand{\pmdscfr}[2]{#1_{\pmcin}\textbf{`}#2} +\newcommand{\pmdscfR}[1]{#1_{\pmcin}} +\newcommand{\pmdscfe}[2]{\mathop{\text{E}}\mathop{\pmshr\pmshr}\pmdscff{#1}{#2}} +\newcommand{\pmdm}[1]{\text{D}\textbf{`}#1} +\newcommand{\pmDm}{\text{D}} +\newcommand{\pmcdm}[1]{\text{\rotatebox[origin=c]{180}{D}}\textbf{`}#1} +\newcommand{\pmCdm}{\text{\rotatebox[origin=c]{180}{D}}} +\newcommand{\pmcmp}[1]{C\textbf{`}#1} +\newcommand{\pmCmp}{C} +\newcommand{\pmfld}[1]{F\textbf{`}#1} +\newcommand{\pmFld}{F} +\newcommand{\pmrel}[3]{\pmhat{#1}\pmhat{#2}#3} +\newcommand{\pmrele}[5]{#1\{\pmhat{#2}\pmhat{#3}#4(#2, #3)\}#5} +\newcommand{\pmrelep}[3]{#1\{#2\}#3} +\newcommand{\pmrcmp}[1]{\ooalign{$\hidewidth\raisebox{.25em}{$\cdot$}\hidewidth$\cr$\mathbf{\pmccmp}$}#1} +\newcommand{\pmrmin}[2]{#1\mathrel{\ooalign{$\hidewidth\raisebox{.25em}{$\cdot$}\hidewidth$\cr$\mathbf{\pmccmp}$}}#2} +\newcommand{\pmrexists}{\dot{\mathop{\text{\raisebox{.5em}{\rotatebox{180}{E}}}}}\mathop{\pmshr}} +\newcommand{\pmcrel}[1]{\breve{#1}} +\newcommand{\pmCnv}{\text{Cnv}} +\newcommand{\pmcnv}[1]{\breve{#1}} +\newcommand{\pmcnvr}[1]{\text{Cnv}\textbf{`}#1} +\newcommand{\pmrcup}{\mathrel{\ooalign{$\hidewidth\cdot\hidewidth$\cr$\mathbf{\pmccup}$}}} +\newcommand{\pmrcap}{\mathrel{\ooalign{$\hidewidth\raisebox{.3em}{$\cdot$}\hidewidth$\cr$\mathbf{\pmccap}$}}} +\newcommand{\pmrinc}{\mathrel{\ooalign{$\hidewidth\cdot\hidewidth$\cr$\mathbf{\pmcinc}$}}} +\newcommand{\pmrrf}[2]{\overset{\boldsymbol{\rightarrow}}{#1\textbf{`}}#2} +\newcommand{\pmRrf}[1]{\overset{\boldsymbol{\rightarrow}}{#1}} +\newcommand{\pmrrl}[2]{\overset{\boldsymbol{\leftarrow}}{#1\textbf{`}}#2} +\newcommand{\pmRrl}[1]{\overset{\boldsymbol{\leftarrow}}{#1}} +\newcommand{\pmsg}[1]{\text{sg}\textbf{`}#1} +\newcommand{\pmgs}[1]{\text{gs}\textbf{`}#1} +\newcommand{\pmSg}{\text{sg}} +\newcommand{\pmGs}{\text{gs}} +\newcommand{\pmRprd}{\mathop{|}} +\newcommand{\pmrprd}[2]{{#1}\mathop{|}{#2}} +\newcommand{\pmrprdn}[2]{#1^{#2}} +\newcommand{\pmrld}[2]{#1 \boldsymbol{\upharpoonleft} #2} +\newcommand{\pmrlcd}[2]{#1 \boldsymbol{\upharpoonright} #2} +\newcommand{\pmrlf}[3]{#1 \boldsymbol{\upharpoonleft} #2 \boldsymbol{\upharpoonright} #3} +\newcommand{\pmrl}[2]{#1 \boldsymbol{\uparrow} #2} +\newcommand{\pmrlF}[2]{#1 \mathbin{\ooalign{$\upharpoonright$\cr\hidewidth\rotatebox[origin=c]{180}{\text{$\upharpoonleft$}}\hidewidth\cr}} #2} +\newcommand{\pmop}{\mathop{\text{\Female}}} +\newcommand{\pmopc}[2]{#1 \mathop{\underset{\textbf{''}}{\text{\Female}}} #2} + +%Products and sums of classes of classes or relations +\newcommand{\pmccsum}[1]{p\textbf{`}#1} +\newcommand{\pmccprd}[1]{s\textbf{`}#1} +\newcommand{\pmcrsum}[1]{\dot{p}\textbf{`}#1} +\newcommand{\pmcrprd}[1]{\dot{s}\textbf{`}#1} +\newcommand{\pmRprdd}{\mathop{||}} +\newcommand{\pmrprdd}[2]{{#1}\mathop{||}{#2}} + +%Identity and Diversity +\newcommand{\pmrid}{I} +\newcommand{\pmrdiv}{J} +\newcommand{\pmcunit}[1]{\iota\textbf{`}#1} +\newcommand{\pmcUnit}{\iota} +\newcommand{\pmcunits}[1]{\breve{\iota}\textbf{`}#1} + +%Cardinal numbers +\newcommand{\pmcn}[1]{#1} + +%Ordinal numbers +\newcommand{\pmrn}[1]{#1_r} +\newcommand{\pmdn}[1]{\dot{#1}} +\newcommand{\pmoc}[2]{#1 \boldsymbol{\downarrow} #2} + +%Subclasses and subrelations +\newcommand{\pmscl}[1]{\text{Cl}\textbf{`}#1} +\newcommand{\pmsCl}{\text{Cl}} +\newcommand{\pmscle}[1]{\text{Cl ex}\textbf{`}#1} +\newcommand{\pmsCle}{\text{Cl ex}} +\newcommand{\pmscls}[1]{\text{Cls}\textbf{`}#1} +\newcommand{\pmsrl}[1]{\text{Rl}\textbf{`}#1} +\newcommand{\pmsRl}{\text{Rl}} +\newcommand{\pmsrle}[1]{\text{Rl ex}\textbf{`}#1} +\newcommand{\pmsRle}{\text{Rl ex}} +\newcommand{\pmsrel}[1]{\text{Rel}\textbf{`}#1} +\newcommand{\pmRel}{\text{Rel}} +\newcommand{\pmReln}[1]{\text{Rel}^{#1}} +\newcommand{\pmrin}{\mathop{\epsilon}} + +%Relative type symbols +\newcommand{\pmrt}[1]{t\textbf{`}#1} +\newcommand{\pmrti}[2]{t^{#1}\textbf{`}#2} +\newcommand{\pmrtc}[2]{t_{#1}\textbf{`}#2} +\newcommand{\pmrtri}[2]{t^{#1}\textbf{`}#2} +\newcommand{\pmrtrc}[2]{t_{#1}\textbf{`}#2} +\newcommand{\pmrtrci}[3]{t_{#1}^{\text{ }#2}\textbf{`}#3} +\newcommand{\pmrtric}[3]{^{#1}t_{#2}\textbf{`}#3} +\newcommand{\pmrtdi}[2]{#1_{#2}} +\newcommand{\pmrtdc}[2]{#1(#2)} +\newcommand{\pmrtdri}[2]{#1_{#2}} +\newcommand{\pmrtdrc}[2]{#1(#2)} + +%Similarity relation signs +\newcommand{\pmrdc}[2]{#1\boldsymbol{\to}#2} +\newcommand{\pmsm}{\mathrel{\text{sm}}} +\newcommand{\pmsmbar}{\mathrel{\overline{\text{sm}}}} +\newcommand{\pmsmarr}{\overrightarrow{{\pmsm}}} +\newcommand{\pmonemany}{1\boldsymbol{\to}\pmCls} +\newcommand{\pmmanyone}{\pmCls\boldsymbol{\to}1} +\newcommand{\pmoneone}{1\boldsymbol{\to}1} + +%Selections +\newcommand{\pmselp}[1]{P_{\small\Delta}\mathbf{`}#1} +\newcommand{\pmSelp}{P_{\Delta}} +\newcommand{\pmsele}[1]{\pmcin_{\small\Delta}\mathbf{`}#1} +\newcommand{\pmSele}{\pmcin_{\Delta}} +\newcommand{\pmself}[1]{F_{\small\Delta}\mathbf{`}#1} +\newcommand{\pmSelf}{F_{\Delta}} +\newcommand{\pmexc}{\text{Cls}^2 \mathop{\text{excl}}} +\newcommand{\pmexcc}[1]{\text{Cl} \mathop{\text{excl}}\textbf{`}#1} +\newcommand{\pmexcn}{\text{Cls} \mathop{\text{ex}}^2 \mathop{\text{excl}}} +\newcommand{\pmselc}[2]{#1 \mathrel{\rotatebox[origin=c]{270}{$\boldsymbol{\mapsto}$}} #2} +\newcommand{\pmmultr}{\mathop{\text{Rel}} \mathop{\text{Mult}}} +\newcommand{\pmmultc}{\mathop{\text{Cls}^2} \mathop{\text{Mult}}} +\newcommand{\pmmultax}{\mathop{\text{Mult}} \mathop{\text{ax}}} + +%Inductive relations +\newcommand{\pmanc}[1]{#1_\pmast} +\newcommand{\pmancc}[1]{\pmcnv{#1}_\pmast} +\newcommand{\pmrst}[1]{#1_\text{st}} +\newcommand{\pmrts}[1]{#1_\text{ts}} +\newcommand{\pmpot}[1]{\text{Pot}\mathbf{`}#1} +\newcommand{\pmpotid}[1]{\text{Potid}\mathbf{`}#1} +\newcommand{\pmpo}[1]{#1_\text{po}} +\newcommand{\pmB}{B} +\newcommand{\pmmin}[1]{\text{min}_{#1}} +\newcommand{\pmmax}[1]{\text{max}_{#1}} +\newcommand{\pmMin}{\text{min}} +\newcommand{\pmMax}{\text{max}} +\newcommand{\pmgen}[1]{\text{gen}\mathbf{`}#1} +\newcommand{\pmGen}{\text{gen}} +\newcommand{\pmefr}[2]{#1\pmast#2} +\newcommand{\pmipr}[2]{I_{#1}\textbf{`}#2} +\newcommand{\pmjpr}[2]{J_{#1}\textbf{`}#2} +\newcommand{\pmfr}[2]{\overset{\boldsymbol{\leftrightarrow}}{#1}\textbf{`}#2} + +%Cardinality +\newcommand{\pmnc}[1]{\text{Nc}\textbf{`}#1} +\newcommand{\pmNc}{\text{Nc}} +\newcommand{\pmNC}{\text{NC}} +\newcommand{\pmnoc}[1]{\text{N}_0\text{c}\textbf{`}#1} +\newcommand{\pmNoc}{\text{N}_0\text{c}}
\ No newline at end of file diff --git a/macros/latex/contrib/principia/principia.tex b/macros/latex/contrib/principia/principia.tex new file mode 100644 index 0000000000..47db611908 --- /dev/null +++ b/macros/latex/contrib/principia/principia.tex @@ -0,0 +1,172 @@ +\documentclass[12pt]{article} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{principia}[2020/10/20 principia package version 1.0] %Covers typesetting of notation through Volume I +%Licensed under LaTeX Project Public License 1.3c. +%Copyright Landon D. C. Elkind, 2020. + +\usepackage{amssymb} +\usepackage{amsmath} +\usepackage{fullpage} +\usepackage[T1]{fontenc} +\usepackage[utf8]{inputenc} +\usepackage{setspace} + +%Principia package requirements +\usepackage{principia} %The package itself, and its dependencies: +\usepackage{pifont} %This loads the eight-pointed asterisk. +\usepackage{marvosym} %This loads the male and female symbol. +\usepackage{graphicx} %This loads commands that flip iota for definite descriptions, Lambda for the universal class, and so on. The (superseded) graphics package should also work here, but is not recommended. + +\title{\texttt{principia.sty }\\ A \LaTeXe \space Package for Typesetting Whitehead and Russell's \textit{Principia Mathematica} (Version 1.0)} +\author{Landon D. C. Elkind \texttt{elkind@ualberta.ca}} +\date{\today} + +\begin{document} +\maketitle +\onehalfspacing +The \texttt{principia} package is designed for typesetting the Peanese notation of \textit{Principia Mathematica}. ``Peanese'' is something of a misnomer: Whitehead and Russell invented much of the notations used in \textit{Principia Mathematica} even while borrowing from many others. + +\texttt{principia}'s style has antecedents in Kevin C. Klement's excellent \textit{Tractatus} typesetting, to which we owe the device of adding `d's and `t's to typeset further square dots. The device of beginning all \texttt{principia} commands with `\texttt{$\backslash$pm}' is owed to the \texttt{begriff} package, a style that was mimicked in both the \texttt{frege} package and the \texttt{Grundgesetze} package. + +In \textit{Principia Mathematica} some symbols occur with an argument and sometimes that same symbol occurs without an argument. For example, `$\pmsome{x}$' occurs in some formulas, but sometimes `$\pmSome$' occurs in the text when they talk about the symbol itself. \texttt{principia} is designed to accommodate these different occurrences of symbols. When a symbol is to occur without an argument, capitalize the first letter following the `\texttt{$\backslash$pm}' part of the command. E.g. \verb|\pmsome{x}| produces $\pmsome{x}$ and \verb|\pmSome| produces `$\pmSome$'. Note the former command requires an argument and the latter command does not. Not all commands in the \texttt{principia} package admit of such dual use because some symbols in \textit{Principia Mathematica} never occur without an argument or do not take an argument in the usual sense. For example, the propositional connectives do not take an `argument' in the way singular or plural descriptions do. + +Version 1.0 of \texttt{principia} is adequate to typeset all notations throughout Volume I of \textit{Principia}. Updates to include all notations throughout Volumes II and III are planned. + +\texttt{principia}'s dependencies are \texttt{pifont} (for the eight-pointed asterisk), \texttt{marvosym} (for the `$\pmop$' symbol), and \texttt{graphicx} (for singular descriptions, universal classes, and existential quantifiers). Make sure to load these package by typing \texttt{$\backslash$usepackage\{graphicx\}}, etc. + +To load \texttt{principia}, type \texttt{$\backslash$usepackage\{principia\}} in the preamble to the document. + +\noindent \begin{tabular}{@{}p{3cm} | p{5cm} | p{8.25cm}} + \textbf{Symbol} & \textbf{\LaTeX command} & \textbf{Notes} \\ \hline + $\pmthm$ & \verb|\pmthm| & Theorem. \\ + $\pmast$ & \verb|\pmast| & As in $\pmast1$. \\ + $\pmcdot$ & \verb|\pmcdot| & As in, $\pmast1\pmcdot1$. \\ + $\pmpp$ & \verb|\pmpp| & Primitive proposition. \\ + $\pmdf$ & \verb|\pmdf| & Definition. \\ + $\pmdem$ & \verb|\pmdem| & This begins a proof. \\ + $\pmsub{p}{q}$, $\pmsubb{p}{q}{r}{s}$, $\pmsubbb{p}{q}{r}{s}{t}{u}$, ... $\pmSub{\text{Add}}{p}{q}$, ... & \verb|\pmsub{p}{q}|, \verb|\pmsubb{p}{q}{r}{s}|, \verb|\pmsubbb{p}{q}| \par \hfill \verb|{r}{s}{t}{u}|, ... \verb|\pmSub{\text{Add}{p}{q}| & Substitution into theorems. Add `b's to the end of \verb|\pmsub| to increase the number of substitutions (up to four `b's). Each extra `b' adds two arguments. To substitute and specify the theorem as well, capitalize the `s' in \verb|\pmsub|. \\ + $\pmdot$, $\pmdott$, $\pmdottt$, $\pmdotttt$, $\pmdottttt$, $\pmdotttttt$ & \verb|\pmdot|, \verb|\pmdott|, \verb|\pmdottt|, ... & Add `t's to the end of \verb|\pmdot| to increase the number of dots (up to six `t's). Note that the spacing of \verb|\pmand| and \verb|\pmdot| differ. \\ + $\pmand$, $\pmandd$, $\pmanddd$, $\pmandddd$, $\pmanddddd$, $\pmandddddd$ & \verb|\pmand|, \verb|\pmandd|, \verb|\pmanddd|, ...& Add `d's to the end of \verb|\pmand| command to increase the number of dots (up to six `d's). \\ + $\pmor$ & \verb|\pmor| & Disjunction. \\ + $\pmnot$ & \verb|\pmnot| & Negation. Note its spacing differs from \verb|\sim|. \\ + $\pmimp$ & \verb|\pmimp| & Material implication. \\ + $\pmiff$ & \verb|\pmiff| & Material biconditional. \\ + $\pmimp_x, \pmimp_{x,y}$ & \verb|\pmimp_x|, \verb|\pmimp_{x,y}| & And so on for more subscripts. \\ + $\pmiff_x, \pmiff_{x,y}$ & \verb|\pmiff_x|, \verb|\pmiff_{x,y}| & And so on for more subscripts. \\ + $\pmhat{x}$ & \verb|\pmhat{x}| & This command requires one argument. It can be embedded in other commands. E.g., \verb|\pmpf{\phi}{\pmhat{x}}| renders `$\pmpf{\phi}{\pmhat{x}}$'. \\ + $\pmpf{\phi}{x}$ & \verb|\pmpf{\phi}{x}| & This command requires two arguments. \\ + $\pmpff{\phi}{x}{y}$ & \verb|\pmpff{\phi}{x}{y}| & This command requires three arguments. \\ + $\pmpfff{\phi}{x}{y}{z}$ & \verb|\pmpfff{\phi}{x}{y}{z}| & This command requires four arguments. \\ + $\pmall{x}$ &\verb|\pmall{x}| & Universal quantifier. \\ + $\pmsome{x}$, $\pmSome$ & \verb|\pmsome{x}|, \verb|\pmSome| & Existential quantifier. \\ + $\pmshr$ & \verb|\pmshr| & The predicative propositional functions. \\ + $\pmpred{\phi}{x}$ & \verb|\pmpred{\phi}{x}| & This command requires two arguments. \\ + $\pmpredd{\phi}{x}{y}$ & \verb|\pmpredd{\phi}{x}{y}| & This command requires three arguments. \\ + $\pmpreddd{\phi}{x}{y}{z}$ & \verb|\pmpreddd{\phi}{x}{y}{z}| & This command requires four arguments. +\end{tabular} + +\noindent \begin{tabular}{@{}p{3cm} | p{5cm} | p{8.25cm}} + $=$, $\pmnid$ & \verb|=|, \verb|\pmnid| & Identity and its negation. \\ + $\pmdsc{x}$ & \verb|\pmdsc{x}| & Definite description. \\ + $\pmexists$ & \verb|\pmexists| & Existence. \\ + $\pmcls{z}{\psi z}$ & \verb|\pmcls{z}{\psi z}| & The class of $z$s satisfying $\psi$. \\ + $\pmcin$ & \verb|\pmcin| & The class membership symbol. \\ + $\pmClsn{n}$, $\pmCls$ & \verb|\pmClsn{n}|, \verb|\pmCls| & The class of classes of individuals. \\ + $\pmscl{\alpha}$, $\pmsCl$ & \verb|\pmscl{\alpha}|, \verb|\pmsCl| & The subclasses of a class $\alpha$. \\ + $\pmsrl{R}$, $\pmsRl$ & \verb|\pmsrl{R}|, \verb|\pmsRl| & The sub-relations of a relation $R$. \\ + $\pmcuni$ & \verb|\pmcuni| & The universal class. \\ + $\pmcnull$ & \verb|\pmcnull| & The null class. \\ + $\pmcexists$ & \verb|\pmcexists| & The existence of a class. \\ + $\pmccmp{\alpha}$ & \verb|\pmccmp{\alpha}| & This command requires one argument. \\ + $\pmcmin{\alpha}{\beta}$ & \verb|\pmcmin{\alpha}{\beta}| & This command requires two arguments. \\ + $\pmccup$ & \verb|\pmccup| & Class union. \\ + $\pmccap$ & \verb|\pmccap| & Class intersection. \\ + $\pmcinc$ & \verb|\pmcinc| & Class inclusion. \\ + $\pmrel{x}{y}{\phi(x,y)}$ & \verb|\pmrel{x}{y}{\phi(x,y)}| & The relation in extension given by $\phi$. \\ + $\pmrele{a}{x}{y}{R}{b}$ & \verb|\pmrele{a}{x}{y}{R}{b}| & This command requires five arguments. \\ + $\pmrelep{a}{R}{b}$ & \verb|\pmrelep{a}{R}{b}| & This command requires three arguments. \\ + $\pmrin$ & \verb|\pmrin| & The relation membership symbol. \\ + $\pmReln{n}$, $\pmRel$ & \verb|\pmReln{n}|, \verb|\pmRel| & The class of relations ($n$-many `of relations'). \\ + $\pmruni$ & \verb|\pmruni| & The universal relation. \\ + $\pmrnull$ & \verb|\pmrnull| & The null relation. \\ + $\pmrexists$ & \verb|\pmrexists| & This symbol prefixes relations. \\ + $\pmrcmp{R}$ & \verb|\pmrcmp{\alpha}| & This command requires one argument. \\ + $\pmrmin{R}{S}$ & \verb|\pmcmin{R}{S}| & This command requires two arguments. \\ + $\pmrcup$ & \verb|\pmrcup| & Relation union. \\ + $\pmrcap$ & \verb|\pmrcap| & Relation intersection. \\ + $\pmrinc$ & \verb|\pmrinc| & Relation inclusion. \\ + $\pmcrel{R}$ & \verb|\pmcrel{R}| & The converse of a relation. \\ + $\pmCnv$ & \verb|\pmCnv| & The command for `Cnv'. \\ + $\pmdscf{R}{x}$ & \verb|\pmdscf{R}{x}| & A singular descriptive function. \\ + $\pmdscff{R}{\beta}$ & \verb|\pmdscff{R}{\beta}| & A plural descriptive function. \\ + $\pmdscfff{R}{\kappa}$ & \verb|\pmdscfff{R}{\kappa}| & A plural descriptive function. \\ + $\pmdscfe{R}{\beta}$ & \verb|\pmdscfe{R}{\beta}| & The existence of a plural descriptive function. +\end{tabular} + +\noindent \begin{tabular}{@{}p{3cm} | p{5cm} | p{8.25cm}} + $\pmdscfr{R}{x}$, `$\pmdscfR{R}$'& \verb|\pmdscfr{R}{x}|, \verb|\pmdscfR{R}| & The relation of $\pmdscfr{R}{\beta}$ to $\beta$. \\ + $\pmdm{R}$, $\pmDm$ & \verb|\pmdm{R}|, \verb|\pmDm| & The domain of a relation $R$. \\ + $\pmcdm{R}$, $\pmCdm$ & \verb|\pmcdm{R}|, \verb|\pmCdm| & The converse domain of a relation $R$. \\ + $\pmcmp{R}$, $\pmCmp$ & \verb|\pmcmp{R}|, \verb|\pmCmp| & The campus of a relation $R$. \\ + $\pmfld{R}$, $\pmFld$ & \verb|\pmfld{R}|, \verb|\pmFld| & The field of a relation $R$. \\ + $\pmrrf{R}{x}$, $\pmRrf{R}$ & \verb|\pmrrf{R}{x}|, \verb|\pmRrf{R}| & The referents of a given relation. \\ + $\pmrrl{R}{x}$, $\pmRrl{R}$ & \verb|\pmrrl{R}{x}|, \verb|\pmRrl{R}| & The relata of a given relation. \\ + $\pmsg{R}$, $\pmSg$ & \verb|\pmsg{R}|, \verb|\pmSg| & \\ + $\pmgs{R}$, $\pmGs$ & \verb|\pmgs{R}|, \verb|\pmGs| & \\ + $\pmrprd{R}{S}$, $\pmRprd$ & \verb|\pmrprd{R}{S}|, \verb|\pmrprd| & The relative product of $R$ and $S$. \\ + $\pmrprdn{R}{n}$ & \verb|\pmrprdn{R}{n}| & The $n$th relative product of $R$. \\ + $\pmrprdd{R}{S}$, $\pmRprdd$ & \verb|\pmrprdd{R}{S}|, \verb|\pmrprdd| & The double relative product of $R$ and $S$. \\ + $\pmrlcd{\alpha}{R}$ & \verb|\pmrld{\alpha}{R}| & The limitation of $R$'s domain to $\alpha$. \\ + $\pmrlcd{R}{\beta}$ & \verb|\pmrld{R}{\beta}| & The limitation of $R$'s converse domain to $\beta$. \\ + $\pmrlf{\alpha}{R}{\beta}$ & \verb|\pmrlf{\alpha}{R}{\beta}| & The limitation of $R$'s field to $\alpha$ and $\beta$, resp. \\ + $\pmrlF{P}{\alpha}$ & \verb|\pmrlF{\alpha}{R}{\beta}| & The limitation of $P$'s field to $\alpha$. \\ + $\pmrl{\alpha}{\beta}$ & \verb|\pmrl{\alpha}{\beta}| & The relation made of all $x$s in $\alpha$ and $y$s in $\beta$. \\ + $\pmop$ & \verb|\pmop| & The operation symbol. \\ + $\pmopc{\alpha}{y}$ & \verb|\pmopc{\alpha}{y}| & The relation of $x$s in $\alpha$ taken to $y$ by $\pmop$. \\ + $\pmccsum{\alpha}$ & \verb|\pmccsum{\alpha}| & The sum of a class of classes. \\ + $\pmccprd{\alpha}$ & \verb|\pmccprd{\alpha}| & The product of a class of classes. \\ + $\pmcrsum{\alpha}$ & \verb|\pmcrsum{\alpha}| & The sum of a class of relations. \\ + $\pmcrprd{\alpha}$ & \verb|\pmcrprd{\alpha}| & The product of a class of relations. \\ + $\pmrid$, $\pmrdiv$ & \verb|\pmrid|, \verb|\pmrdiv| & The relations of identity and diversity. \\ + $\pmcunit{x}$, $\pmcUnit$ & \verb|\pmcunit{x}|, \verb|\pmcUnit| & The unit class. \\ + $\pmcunits{\alpha}$ & \verb|\pmcunits{\alpha}| & The sum of unit classes of $\alpha$'s elements. \\ + $\pmrn{n}$ & \verb|\pmrn{n}| & The ordinal number $n$. \\ + $\pmdn{n}$ & \verb|\pmdn{n}| & The class of relations equal to an $n$-tuple. \\ + $\pmoc{x}{y}$ & \verb|\pmoc{x}{y}| & The ordinal number restricted to $R=(x,y)$. \\ + $\pmrt{x}$, $\pmrti{n}{x}$ & \verb|\pmrt{x}|, \verb|\pmrti{n}{x}| & The relative type of $x$ ($n$-many `type of's). \\ + $\pmrtc{n}{\alpha}$ & \verb|\pmrtc{n}{\alpha}| & The relative type of $\alpha$ ($n$-many `type of's). \\ + $\pmrtri{n}{R}$, $\pmrtrc{n}{R}$ & \verb|\pmrtri{n}{R}|, \verb|\pmrtrc{n}{R}| & The relative type of (with $n$-many `type of's) $R$ from individuals to individuals, or from classes to classes. `$nm$' can replace `$n$'. +\end{tabular} + +\noindent \begin{tabular}{@{}p{3cm} | p{5cm} | p{8.25cm}} + $\pmrtric{n}{m}{R}$, $\pmrtrci{n}{m}{R}$ & \verb|\pmrtric{n}{R}|, \verb|\pmrtrci{n}{R}| & The relative type of $R$ from individuals to classes, or from classes to individuals. \\ + $\pmrtdi{\alpha}{x}$, $\pmrtdri{R}{(x,y)}$ & \verb|\pmrtdi{\alpha}{x}|, \verb|\pmrtdri{R}{(x,y)}| & The result of determining that the members of $\alpha$ ($R$) belong to the relative type of $x$ (in the domain, and of $y$ in the converse domain). \\ + $\pmrtdc{\alpha}{x}$, $\pmrtdrc{R}{x,y}$ & \verb|\pmrtdc{\alpha}{x}|, \verb|\pmrtdrc{R}{x,y}| & The result of determining that the members of $\alpha$ ($R$) belong to the relative type of $\pmrt{x}$ (in the domain, and of $\pmrt{y}$ in the converse domain). \\ + $\pmrdc{\alpha}{\beta}$ & \verb|\pmrdc{\alpha}{\beta}| & The class of relations $R$ with domain contained in $\alpha$ and converse domain in $\beta$. \\ + $\pmoneone$, $\pmonemany$, $\pmmanyone$ & \verb|\pmoneone|, \verb|\pmonemany|, \verb|\pmmanyone| & The class of one-one, or one-many, or many-one, relations. Note \verb|\pmrdc| can be used here. \\ + $\pmsm$, $\pmsmbar$ & \verb|\pmsm|, \verb|\pmsmbar| & The similarity relation. \\ + $\pmselp{\kappa}$, $\pmSelp$ & \verb|\pmselp{\kappa}|, \verb|\pmSelp| & The $P$-selections from $\kappa$ \\ + $\pmsele{\kappa}$, $\pmSele$ & \verb|\pmsele{\kappa}|, \verb|\pmSele| & The $\pmcin$-selections from $\kappa$ \\ + $\pmself{\kappa}$, $\pmSelf$ & \verb|\pmself{\kappa}|, \verb|\pmSelf| & The $F$-selections from $\kappa$ \\ + $\pmexc$ & \verb|\pmexc| & The class of pairwise-disjoint classes. \\ + $\pmexcn$ & \verb|\pmexcn| & The class of pairwise-disjoint non-null classes. \\ + $\pmexcc{\gamma}$ & \verb|\pmexcc{\gamma}| & A class of mutually exclusive classes in $\gamma$. \\ + $\pmselc{P}{y}$ & \verb|\pmselc{P}{y}| & The class of couples $(y, \pmdscf{P}{y})$. \\ + $\pmmultc$ & \verb|\pmmultc| & The class of multipliable classes. \\ + $\pmmultr$ & \verb|\pmmultr| & The class of multipliable relations. \\ + $\pmmultax$ & \verb|\pmmultax| & The multiplicative axiom. \\ + $\pmanc{R}$, $\pmancc{R}$ & \verb|\pmanc{R}|, \verb|\pmancc{R}| & The ancestral and its converse. \\ + $\pmrst{R}$, $\pmrts{R}$ & \verb|\pmrst{R}|, \verb|\pmrts{R}| & The powers of the ancestral and its converse. \\ + $\pmmin{P}$, $\pmmax{P}$ & \verb|\pmmin{P}|, \verb|\pmmax{P}| & The minimum and maximum under $P$. \\ + $\pmpot{R}$, $\pmpotid{R}$ & \verb|\pmpot{R}|, \verb|\pmpotid{R}| & The products (strict and not) of an ancestral. \\ + $\pmpo{R}$ & \verb|\pmpo{R}| & The product of a class of ancestrals $R$. \\ + $\pmB$ & \verb|\pmB| & The relation of beginning under $P$. \\ + $\pmgen{P}$ & \verb|\pmgen{P}| & The generation of $P$. \\ + $\pmefr{P}{Q}$ & \verb|\pmefr{P}{Q}| & The equi-factor relation. \\ + $\pmipr{R}{x}$ & \verb|\pmipr{R}{x}| & The non-distinct posterity of $x$ under $R$. \\ + $\pmjpr{R}{x}$ & \verb|\pmjpr{R}{x}| & The distinct posterity of $x$ under $R$. \\ + $\pmfr{R}{x}$ & \verb|\pmfr{R}{x}| & The ancestry and posterity of $x$ under $R$. \\ + $\pmnc{\kappa}$, $\pmNc$ & \verb|\pmnc{\kappa}|, \verb|\pmNc| & The cardinal number of $\kappa$. +\end{tabular} + +\end{document}
\ No newline at end of file |