diff options
author | Karl Berry <karl@freefriends.org> | 2024-10-25 21:28:21 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2024-10-25 21:28:21 +0000 |
commit | 114580555314d73da44240f5699bf9b1e540bdc7 (patch) | |
tree | a355a2981b1aed9beed3d1943e64a8f415f077a8 /Master/texmf-dist | |
parent | 3accd62cb4f63fe8d66916ef3aa09d7ba187cc6a (diff) |
cora-macs (25oct24)
git-svn-id: svn://tug.org/texlive/trunk@72655 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/cora-macs/LICENSE | 21 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/cora-macs/README.md | 91 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/cora-macs/cora-macs-doc.pdf | bin | 0 -> 183263 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/cora-macs/cora-macs-doc.tex | 119 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/cora-macs/cora-macs.sty | 198 |
5 files changed, 429 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/cora-macs/LICENSE b/Master/texmf-dist/doc/latex/cora-macs/LICENSE new file mode 100644 index 00000000000..bbcc4848ccb --- /dev/null +++ b/Master/texmf-dist/doc/latex/cora-macs/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Tobias Ladner, Lukas Koller + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Master/texmf-dist/doc/latex/cora-macs/README.md b/Master/texmf-dist/doc/latex/cora-macs/README.md new file mode 100644 index 00000000000..7cf36ee8af8 --- /dev/null +++ b/Master/texmf-dist/doc/latex/cora-macs/README.md @@ -0,0 +1,91 @@ +# `cora-macs` LaTeX Package + +## Overview + +The `cora-macs` package is a LaTeX package designed to assist in the representation and manipulation of continuous sets, operations, neural networks, and color schemes tailored for use in the context of cyber-physical systems. It provides a comprehensive set of macros that streamline the process of documenting complex mathematical objects and operations. + +## Authors + +- **Tobias Ladner** +- **Lukas Koller** + +TUM - Cyber-Physical Systems Group + +Visit our website: [TUM CPS Group](https://www.ce.cit.tum.de/cps) + +## Features + +- **Continuous Sets**: Macros for defining and working with intervals, zonotopes, polynomial zonotopes, and other set-based representations. +- **Operations**: A collection of macros for common mathematical operations used in cyber-physical systems analysis. +- **Neural Networks**: Notations for layers, activations, set propagation, and more. +- **Color Schemes**: Predefined color palettes including TUM-specific colors and custom `cora-macs` colors. + +## Installation + +To use the `cora-macs` package in your LaTeX documents, follow these steps: + +1. **Download the Package**: Download the `cora-macs.sty` file and save it to your project directory or in a directory where LaTeX can find it (e.g., in the local `texmf` tree). + +2. **Include the Package**: Add the following line to the preamble of your LaTeX document: + ```latex + \usepackage[options]{cora-macs} + ``` + Replace `[options]` with the desired options (e.g., `sets`, `operations`, `nn`, `colors`, `tumcolors`). + +## Usage + +### Basic Example + +Here’s a simple example of how to use some of the features provided by the `cora-macs` package: + +```latex +\documentclass{article} +\usepackage[sets, operations]{cora-macs} + +\begin{document} + +% Define a set +\contSet{X} = \shortContSet{a}{b}{X} + +% Use an operation +\diag{A} = \operator{diag}{A} + +\end{document} +``` + +### Options + +- **`sets`**: Enables macros for working with continuous sets. +- **`operations`**: Enables macros for common operations in mathematical analysis. +- **`nn`**: Enables macros related to neural networks. +- **`colors`**: Defines a set of colors specific to the `cora-macs` package. +- **`tumcolors`**: Defines TUM-specific colors. + +You can combine these options as needed when including the package. + +## Documentation + +For detailed documentation, including a complete list of commands and options, please refer to the [documentation](./documentation.pdf). + +## License + +This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details. + +## Acknowledgments + +This package was developed as part of the work done by the Cyber-Physical Systems Group at TUM. We would like to thank the contributors and users who provided valuable feedback. + +## Contributing + +If you wish to contribute to the `cora-macs` package, feel free to submit a pull request or open an issue on the repository. + +## Contact + +For questions, issues, or suggestions, please contact: + +- Tobias Ladner - [tobias.ladner@tum.de](mailto:tobias.ladner@tum.de) +- Lukas Koller - [lukas.koller@tum.de](mailto:lukas.koller@tum.de) + +--- + +Developed at TUM - Cyber-Physical Systems Group
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/cora-macs/cora-macs-doc.pdf b/Master/texmf-dist/doc/latex/cora-macs/cora-macs-doc.pdf Binary files differnew file mode 100644 index 00000000000..4da722f6c44 --- /dev/null +++ b/Master/texmf-dist/doc/latex/cora-macs/cora-macs-doc.pdf diff --git a/Master/texmf-dist/doc/latex/cora-macs/cora-macs-doc.tex b/Master/texmf-dist/doc/latex/cora-macs/cora-macs-doc.tex new file mode 100644 index 00000000000..825fe508362 --- /dev/null +++ b/Master/texmf-dist/doc/latex/cora-macs/cora-macs-doc.tex @@ -0,0 +1,119 @@ +\documentclass{article} +\usepackage{amsmath} +\usepackage{amssymb} +\usepackage{hyperref} +\usepackage[sets,operations,nn,colors]{cora-macs} + +\title{The \texttt{cora-macs} Package} +\author{Tobias Ladner, Lukas Koller\\ + TUM - Cyber-Physical Systems Group\\ + \texttt{\small tobias.ladner@tum.de, lukas.koller@tum.de}} +\date{2024-10-25} + +\begin{document} +\maketitle + +\begin{abstract} +The \texttt{cora-macs} package provides tools for working with continuous sets, operations, neural networks, and color schemes tailored for use in the context of cyber-physical systems. This document serves as the official documentation for the package, detailing the available commands and options. +\end{abstract} + +\tableofcontents + +\section{Introduction} +The \texttt{cora-macs} package is designed to assist in the representation and manipulation of various mathematical objects such as sets, intervals, zonotopes, and operations often encountered in cyber-physical systems analysis. It also includes predefined color schemes based on the TUM corporate design and other custom colors. + +\section{Installation} +To install the \texttt{cora-macs} package, follow these steps: +\begin{enumerate} + \item Place the \texttt{cora.sty} file in your working directory or in a directory where LaTeX can find it (e.g., in the local \texttt{texmf} tree). + \item Include the package in your LaTeX document with the command: + \begin{verbatim} + \usepackage{cora} + \end{verbatim} +\end{enumerate} + +\section{Package Options} +The \texttt{cora-macs} package provides several options that can be passed when loading the package. These options control the inclusion of different sets of commands. + +\begin{itemize} + \item \texttt{sets}: Includes commands for continuous set notation and operations. + \item \texttt{operations}: Includes commands for various mathematical operations. + \item \texttt{nn}: Includes commands for working with neural networks. + \item \texttt{colors}: Defines a set of colors specific to the \texttt{cora-macs} package. + \item \texttt{tumcolors}: Defines TUM-specific colors. +\end{itemize} + +Example usage: +\begin{verbatim} +\usepackage[sets, operations]{cora} +\end{verbatim} + +\section{Commands and Environments} + +\subsection{Sets (\texttt{sets} option)} +When the \texttt{sets} option is enabled, the package provides several commands for defining and manipulating continuous sets. + +\begin{itemize} + \item \texttt{\textbackslash contSet\{name\}}: Defines a set in calligraphic font, e.g., $\contSet{A}$. + \item \texttt{\textbackslash shortContSet[abbr]\{content\}\{set\}}: Defines a short-hand notation for continuous sets with optional abbreviation. + \item \texttt{\textbackslash defContSet\{elements\}\{conditions\}}: Defines a set using the format $\{x \mid \text{conditions}\}$. + \item \texttt{\textbackslash defContSetSplit\{elements\}\{conditions\}}: Defines a set with split conditions for better formatting in large equations. + \item \texttt{\textbackslash shortI\{a\}\{b\}}: Defines a closed interval $[a, b]$. + \item \texttt{\textbackslash defZ}: Defines a zonotope. + \item \texttt{\textbackslash defPZ}: Defines a polynomial zonotope. +\end{itemize} + +\subsection{Operations (\texttt{operations} option)} +Enabling the \texttt{operations} option introduces a variety of operations that are useful in mathematical and cyber-physical systems contexts. + +\begin{itemize} + \item \texttt{\textbackslash operator\{name\}\{args\}}: Defines a custom operator with the given name and arguments. + \item \texttt{\textbackslash opEnclose\{set1\}\{set2\}}: Encapsulates a set within another. + \item \texttt{\textbackslash opIntervalEnclosure\{interval\}}: Specifies an interval enclosure. + \item \texttt{\textbackslash opProject\{dimension\}}: Projects a set onto a given dimension. + \item \texttt{\textbackslash diag\{matrix\}}: Produces the diagonal matrix of the given input. +\end{itemize} + +\subsection{Neural Networks (\texttt{nn} option)} +The \texttt{nn} option introduces commands related to neural networks, including notation for layers, inputs, outputs, and propagations. + +\begin{itemize} + \item \texttt{\textbackslash NN}: Represents the symbol for a neural network $\NN$. + \item \texttt{\textbackslash nnLayer\{layer\}\{input\}}: Represents a neural network layer with a specified input. + \item \texttt{\textbackslash nnInput}, \texttt{\textbackslash nnOutput}: Notation for input and output points in a neural network. +\end{itemize} + +\subsection{Colors (\texttt{colors} and \texttt{tumcolors} options)} +The \texttt{colors} and \texttt{tumcolors} options define a variety of colors that can be used in your documents. + +\begin{itemize} + \item \texttt{\textbackslash definecolor\{CORAcolorReachSet\}}: A predefined color for reachability sets (blue). + \item \texttt{\textbackslash definecolor\{TUMblue\}}: TUM corporate blue color. +\end{itemize} + +\section{Examples} +Here are some examples demonstrating how to use the commands from the \texttt{cora-macs} package. + +\subsection{Set Notation} +\begin{verbatim} +\contSet{X} = \shortContSet{a}{b}{X} +\end{verbatim} +This code will produce $\contSet{X} = \left<a, b\right>_X$. + +\subsection{Operations} +\begin{verbatim} +\diag{A} = \operator{diag}{A} +\end{verbatim} +This code will produce $\diag{A} = \text{\normalfont\small diag}(A)$. + +\subsection{Neural Networks} +\begin{verbatim} +\NN(\nnInput) = \nnLayer{1}{\nnInput} +\end{verbatim} +This code will produce $\NN(\nnInput) = L_1(\nnInput)$. + +\section{Concluding Remarks} +The \texttt{cora-macs} package offers a comprehensive set of tools for researchers working in cyber-physical systems. By providing a consistent notation and color scheme, this package simplifies the process of documenting complex mathematical objects and operations. + +For more information, visit the \href{https://www.ce.cit.tum.de/cps}{TUM CPS Group website}. +\end{document} diff --git a/Master/texmf-dist/tex/latex/cora-macs/cora-macs.sty b/Master/texmf-dist/tex/latex/cora-macs/cora-macs.sty new file mode 100644 index 00000000000..3fcee03d457 --- /dev/null +++ b/Master/texmf-dist/tex/latex/cora-macs/cora-macs.sty @@ -0,0 +1,198 @@ + +% package information -------------------------------------------------------------------------------------------------- + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{cora-macs}[2024-10-25] + +% Authors: Tobias Ladner, Lukas Koller +% TUM - Cyber-Physical Systems Group +% Website: https://www.ce.cit.tum.de/cps + +% Based on: https://www.overleaf.com/learn/latex/Writing_your_own_package + +% required packages ---------------------------------------------------------------------------------------------------- + +\RequirePackage{xifthen} +\RequirePackage{xstring} +\RequirePackage{amsfonts} +\RequirePackage{xcolor} + +% pre-processing ------------------------------------------------------------------------------------------------------- + +% for better logging +\newcommand{\DeclareCORAOption}[2]{ + \DeclareOption{#1}{ + % display information + \PackageInfo{cora-macs}{Loading '#1' option..} + % content + #2 + } +} + +% nice to have +\providecommand{\R}{\ensuremath{\mathbb{R}}} +\providecommand{\N}{\ensuremath{\mathbb{N}}} + +% all sets should be written in mathcal +\newcommand{\contSet}[1]{\ensuremath{\mathcal{#1}}} + +% process options ------------------------------------------------------------------------------------------------------ + +\DeclareCORAOption{sets}{ % --- continuous sets + % contSet --- + + % formatting + \newcommand{\neghphantom}[1]{\settowidth{\dimen0}{#1}\hspace*{-\dimen0}} + + % short-hand notation (including nice punctuation for large sets) + \newcommand{\shortContSet}[3][]{\ensuremath{% \defContSet[punctuation]{abbreviation}{cs parameters of set} + \left<#2\right>_{#3\,}% + \ifthenelse{\isempty{#1}}% add abbreviation + {} % none given + {\neghphantom{\scriptsize #3}#1\neghphantom{#1}\hphantom{\scriptsize #3}} + }} + \newcommand{\defContSet}[2]{\left\{ #1 \ \middle|\ #2 \right\}} + \newcommand{\defContSetSplit}[2]{\left\{ #1 \vphantom{#2} \ \right| \\ &\qquad \left. \vphantom{#1} #2 \right\}} + + % interval --- + \providecommand{\I}{\contSet{I}} + \newcommand{\shortI}[2]{\ensuremath{\left[#1,#2\right]}} + + % zonotope --- + \providecommand{\Z}{\contSet{Z}} + \newcommand{\shortZ}[3][]{\shortContSet[#1]{#2,#3}{Z}} + \newcommand{\defZ}{\left\{ c + \sum_{i=1}^{p} \beta_i G_{(\cdot,i)} ~\middle|~ \beta_i \in [-1,1] \right\}} + + % polynomial zonotope --- + \providecommand{\PZ}{\contSet{PZ}} + \newcommand{\shortPZ}[5][]{\shortContSet[#1]{#2,#3,#4,#5}{PZ}} + \newcommand{\defPZmain}{c + \sum_{i=1}^h \left(\prod_{k=1}^p \alpha_k^{E_{(k,i)}}\right) G_{(\cdot, i)} + \sum_{j=1}^{q} \beta_j G_{I(\cdot, j)}} + \newcommand{\defPZcond}{\alpha_k, \beta_j \in \left[-1,1\right]} + \newcommand{\defPZ}{\defContSet{\defPZmain}{\defPZcond}} + \newcommand{\defPZSplit}{\defContSetSplit{\defPZmain}{\defPZcond}} +} + + +\DeclareCORAOption{operations}{ % --- operations + + % define monospace operator including inline operator + \newcommand{\operator}[3][]{% + \text{\normalfont\small#2}% + \IfSubStr{#1}{inline}% if inline + {(#3)}% no \left/\right + {\left(#3\right)}} + \newcommand{\operatortt}[3][]{\operator[#1]{{\ensuremath{\mathtt{#2}}}}{#3}} + + % enclosure + \newcommand{\opEnclose}[3][]{\operatortt[#1]{enclose}{#2,#3}} + \newcommand{\opEnclosePrime}[3][]{\operatortt[#1]{enclose}{#2,#3}} + \newcommand{\opIntervalEnclosure}[2][]{\operatortt[#1]{interval}{#2}} + \newcommand{\opBoxEnclosure}[2][]{\operatortt[#1]{box}{#2}} + \newcommand{\opBound}[2][]{\operatortt[#1]{bound}{#1}} + \newcommand{\opZonotopeEnclosure}[2][]{\operatortt[#1]{zonotope}{#2}} + \newcommand{\opZonoEnclosure}[2][]{\operatortt[#1]{zono}{#2}} + \newcommand{\opPolyZonotopeEnclosure}[2][]{\operatortt[#1]{polyZonotope}{#2}} + \newcommand{\opPolyZonoEnclosure}[2][]{\operatortt[#1]{polyZono}{#2}} + + % further operations + \newcommand{\opProject}[2][]{\operatortt{project}{#2}} + + % operations that should be stantard latex operations + \newcommand{\diag}[2][]{\operator[#1]{diag}{#2}} + \providecommand{\Diag}[2][]{\operator[#1]{Diag}{#2}} + \providecommand{\mod}[3][]{\operator[#1]{mod}{#2,#3}} + \newcommand{\dia}[2][]{\operator[#1]{dia}{#2}} + \newcommand{\sign}[2][]{\operator[#1]{sign}{#2}} +} + + +\DeclareCORAOption{nn}{ % ------ neural networks + + % neural network + \newcommand{\NN}[0]{\ensuremath{\Phi}} + \newcommand{\numLayers}[0]{\ensuremath{\kappa}} + \newcommand{\numNeurons}[0]{\ensuremath{n}} + + % layers + \newcommand{\nnLayerName}[2]{\ensuremath{L_{#1}^\text{#2}}} + \newcommand{\nnLayer}[3]{\ensuremath{\nnLayerName{#1}{#2}\left(#3\right)}} + \newcommand{\nnActFun}{\ensuremath{\phi}} + \newcommand{\actfun}{\nnActFun} % remove? + + % point propagation + \newcommand{\nnInput}[0]{\ensuremath{x}} + \newcommand{\nnHidden}[0]{\ensuremath{h}} + \newcommand{\nnOutput}[0]{\ensuremath{y}} + \newcommand{\nnGrad}{\ensuremath{g}} + + % set propagation + \newcommand{\nnInputSet}[0]{\contSet{X}} + \newcommand{\nnHiddenSet}[0]{\contSet{H}} + \newcommand{\nnHiddenSetExact}[0]{\nnHiddenSet^*} + \newcommand{\nnOutputSet}[0]{\contSet{Y}} + \newcommand{\nnOutputSetExact}[0]{\nnOutputSet^*} + \newcommand{\nnGradSet}{\contSet{G}} + + % set-based training + \newcommand{\nnTarget}{\ensuremath{t}} + + % other + \newcommand{\nnPertRadius}{\epsilon} + + % specification + \newcommand{\unsafeSet}[0]{\contSet{S}} + +} + +% --- colors + +\DeclareCORAOption{colors}{ % --- cora colors + + % cora colors (see CORAcolor in cora) + \definecolor{CORAcolorReachSet}{rgb}{0.2706, 0.5882, 1.0000} % blue + \definecolor{CORAcolorReachSet2}{rgb}{0.6902, 0.8235, 1.0000} % light-blue + \definecolor{CORAcolorOnitialSet}{rgb}{1, 1, 1} % white + \definecolor{CORAcolorFinalSet}{rgb}{0.9000, 0.9000, 0.9000} % light-gray + \definecolor{CORAcolorSimulations}{rgb}{0.9000, 0.9000, 0.9000} % black + \definecolor{CORAcolorUnsafe}{rgb}{0.9451, 0.5529, 0.5686} % red + \definecolor{CORAcolorUnsafeLight}{rgb}{0.9059, 0.7373, 0.7373} % light red + \definecolor{CORAcolorSafe}{rgb}{0.4706, 0.7725, 0.4980} % light green + \colorlet{CORAcolorInvariant}{CORAcolorSafe} % light green + + % default colors (also default matlab colors) + \definecolor{CORAcolorBlue}{rgb}{0, 0.4470, 0.7410} + \definecolor{CORAcolorRed}{rgb}{0.8500, 0.3250, 0.0980} + \definecolor{CORAcolorYellow}{rgb}{0.9290, 0.6940, 0.1250} + \definecolor{CORAcolorPurple}{rgb}{0.4940, 0.1840, 0.5560} + \definecolor{CORAcolorGreen}{rgb}{0.4660, 0.6740, 0.1880} + \definecolor{CORAcolorLightBlue}{rgb}{0.3010, 0.7450, 0.9330} + \definecolor{CORAcolorDarkRed}{rgb}{0.6350, 0.0780, 0.1840} + + % define order of colors (see useCORAcolors in cora) + \colorlet{CORAcolor1}{CORAcolorBlue} + \colorlet{CORAcolor2}{CORAcolorRed} + \colorlet{CORAcolor3}{CORAcolorYellow} + \colorlet{CORAcolor4}{CORAcolorPurple} + \colorlet{CORAcolor5}{CORAcolorGreen} + \colorlet{CORAcolor6}{CORAcolorLightBlue} + \colorlet{CORAcolor7}{CORAcolorDarkRed} + + \definecolor{CORAcolorHighlight1}{rgb}{1.0000,0.6824,0.2980} % 'CORA:highlight1 (orange)' + \definecolor{CORAcolorHighlight2}{rgb}{0.3804,0.6275,1.0000} % 'CORA:highlight2 (lightblue)' +} + +\DeclareCORAOption{tumcolors}{ % ---- tum colors + + \definecolor{TUMblue}{rgb}{0.00, 0.40, 0.74} + \definecolor{TUMgray}{rgb}{0.85, 0.85, 0.86} + \definecolor{TUMpantone285C}{rgb}{0.00, 0.45, 0.81} + \definecolor{TUMpantone300C}{RGB}{27, 94, 170} %uncorrected TUMpantone300C + \definecolor{lightblue}{rgb}{0.7529,0.8118,0.9333} + +} + + +% process all options +\ProcessOptions\relax + +% post-processing ------------------------------------------------------------------------------------------------------ |