From fb1e5bbb445f82f464ddeb9e5c8dd4d59b7ce310 Mon Sep 17 00:00:00 2001 From: Gaetano Date: Sun, 29 Apr 2018 12:40:12 +0200 Subject: [PATCH] [Git] Initial commit (version 0.95). --- newnotation.sty | 680 ++++++++++++++++++++++++++++++++++++++++++++++++ newnotation.tex | 470 +++++++++++++++++++++++++++++++++ 2 files changed, 1150 insertions(+) create mode 100755 newnotation.sty create mode 100755 newnotation.tex diff --git a/newnotation.sty b/newnotation.sty new file mode 100755 index 0000000..397138f --- /dev/null +++ b/newnotation.sty @@ -0,0 +1,680 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% PACKAGE: NewNotation +% AUTHOR: Gaetano Geck +% +% OPTIONS: +% * rtl - Enables right-to-left orientation of table columns +% +% +% HISTORY: +% * 2015-12-23: First stable version, supporting: +% (v0.1) - commands with/without parameters +% - commands with/without descriptions +% - counting of uses of commands +% - grouped tables +% * 2015-12-25: Added +% (v0.2) - support for new tables +% - saving/loading of tables +% * 2015-12-25: use \newrobustcmd instead of \newcommand +% * 2015-12-26: - Added support for long tables and multiline descriptions +% (v0.3) - Renamed commands, allowed respecification of text & layout +% - Added support for right-to-left tables +% - Allowed specification of layout for table and groups +% * 2015-12-27: - Use package 'translations' +% (v0.4) - Allowed specification of layout for column headers +% * 2015-12-28: - Complete refacorization of the implementation +% (v0.5) (using lists, booleans) +% - Handled printing of empty groups +% - Support detailed and non-detailed tables +% * 2015-12-28: - Support redefinition +% (v0.6) +% * 2015-12-28: - Support package warnings and error messages +% (v0.7) - Support customized argument replacements +% * 2015-12-29: - Print number of arguments in detailed table +% (v0.8) - Improved spacing in output +% * 2015-12-29: Support output levels +% (v0.9) +% * 2015-12-29: Loosened dependency on babel +% (v0.91) +% * 2016-02-21: Added support for default values for optional first arguments. +% (v0.92) +% * 2016-06-18: Added starred versions for \newnotation and \renewnotation, +% (v0.93) which do do not embrace the replacement such that additional +% spaces (as for math relation or operator symbols) remain. +% * 2016-09-10: Added support for classes. +% (v0.94) +% * 2018-02-07: Added support relation symbols. +% (v0.95) +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\ProvidesPackage{newnotation}[2018/02/07 v0.95] + +\RequirePackage{ifthen} +\RequirePackage{xparse} +\RequirePackage{xcolor} +\RequirePackage{xspace} +\RequirePackage{etoolbox} +\RequirePackage{tabularx} +\RequirePackage{ltablex} +\RequirePackage{amsmath} +\RequirePackage{pgffor} + +\provideboolean{PackageBabelAvailable} +\ifcsdef{bbl@loaded}{\setboolean{PackageBabelAvailable}{true}}{} + +\ifbool{PackageBabelAvailable}{% + \RequirePackage{translations}% +}{} + + + +%============================================================================== +% TABLE OF CONTENTS +% ----------------- +% 1. Translations +% 2. Internal interface +% a) Layout +% b) Printing +% c) Groups +% 3. External interface +% a) Layout +% b) Printing +% c) Groups/Tables +% d) Defining notation +%============================================================================== + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% BEGIN OF IMPLEMENTATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\makeatletter %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +% helper functions ------------------------------------------------------------ +\newcommand{\providecounter}[1]{% + \ifcsdef{c@#1}% + {\setcounter{#1}{0}}% + {\newcounter{#1}}% +} +%!helper functions ------------------------------------------------------------ + + +\provideboolean{@NNUseRTL} +\provideboolean{@NNDetailed} +\provideboolean{@NNInListMode} +\provideboolean{@NNPrintGroup} +\providecounter{@NNCurrentGroup} +\providecounter{@NNNumberOfAllGroups} +\providecounter{@NNNumberOfEntriesInGroup0}% +\providecounter{@NNNumberOfAllEntries}% + +\DeclareOption{rtl}{\setboolean{@NNUseRTL}{true}} % right-to-left +\ProcessOptions\relax + + + +% ============================================================================= +% 1. TRANSLATIONS ------------------------------------------------------------- +% ============================================================================= +\ifbool{PackageBabelAvailable}{% + \DeclareTranslationFallback{Table of notation}{Table of notation}% + \DeclareTranslation{German}{Table of notation}{Notationstabelle}% + \DeclareTranslationFallback{symbol}{symbol}% + \DeclareTranslation{German}{symbol}{Symbol}% + \DeclareTranslationFallback{macro name}{macro name}% + \DeclareTranslation{German}{macro name}{Makroname}% + \DeclareTranslationFallback{uses}{uses}% + \DeclareTranslation{German}{uses}{Verw.}% + \DeclareTranslationFallback{description}{description}% + \DeclareTranslation{German}{description}{Beschreibung}% + \DeclareTranslationFallback{no entries}{no entries}% + \DeclareTranslation{German}{no entries}{keine Einträge}% +}{} + +\ifbool{PackageBabelAvailable}% + {\newcommand{\gettranslation}[1]{\GetTranslation{#1}}}% + {\newcommand{\gettranslation}[1]{#1}} + + + +% ============================================================================= +% 2. INTERNAL INTERFACE-------------------------------------------------------- +% ============================================================================= + + + +% ----------------------------------------------------------------------------- +% 2a) Layout +% ----------------------------------------------------------------------------- +% NOTE: Redefinition of these layouters from outside this package is easily +% possible by using the commands defined in Section 3a). +\newcommand{\@NNLAYOUTArgument}[1]{\textcolor{blue}{#1}} +\newcommand{\@NNLAYOUTZeroUses}[1]{\textcolor{red}{#1}} +\newcommand{\@NNLAYOUTColumnHeader}[1]{\textbf{#1}} +\newcommand{\@NNLAYOUTTable}[1]{% + \notbool{@NNUseRTL}% + {{\Large\textbf{#1}}\hrulefill}% + {\hrulefill{\Large\textbf{#1}}}% +} +\newcommand{\@NNLAYOUTGroup}[1]{% + \notbool{@NNUseRTL}% + {{\large\textbf{#1}}\dotfill}% + {{\dotfill{\large\textbf{#1}}}}% +} + +\newcommand{\@NNDefaultArgumentA}{1} +\newcommand{\@NNDefaultArgumentB}{2} +\newcommand{\@NNDefaultArgumentC}{3} +\newcommand{\@NNDefaultArgumentD}{4} +\newcommand{\@NNDefaultArgumentE}{5} +\newcommand{\@NNDefaultArgumentF}{6} +\newcommand{\@NNDefaultArgumentG}{7} +\newcommand{\@NNDefaultArgumentH}{8} +\newcommand{\@NNDefaultArgumentI}{9} +\let\@NNArgumentA\@NNDefaultArgumentA +\let\@NNArgumentB\@NNDefaultArgumentB +\let\@NNArgumentC\@NNDefaultArgumentC +\let\@NNArgumentD\@NNDefaultArgumentD +\let\@NNArgumentE\@NNDefaultArgumentE +\let\@NNArgumentF\@NNDefaultArgumentF +\let\@NNArgumentG\@NNDefaultArgumentG +\let\@NNArgumentH\@NNDefaultArgumentH +\let\@NNArgumentI\@NNDefaultArgumentI + +% ************************************* +% \@NNShowIf +% ************************************* +% Fancy layout for argument numbers in a command description: +% shows text a_1 only if a_2 <= a_3, for another given number a_3: +\newcommand{\@NNShowIf}[3]{\ifthenelse{#2 > #3}{}{{\@NNLAYOUTArgument{#1}}}} + + + +% ----------------------------------------------------------------------------- +% 2b) Printing +% ----------------------------------------------------------------------------- +% ************************************* +% \@NNPrintTableHeader +% ************************************* +% Print non-detailed or detailed table header +% either left-to-right or right-to-left. +\newcommand{\@NNPrintTableHeader}{% + \notbool{@NNDetailed}% + {% + \notbool{@NNUseRTL}% + {% + \@NNLAYOUTColumnHeader{\gettranslation{symbol}} &% + \@NNLAYOUTColumnHeader{\gettranslation{description}} \\% + }% + {% + \@NNLAYOUTColumnHeader{\gettranslation{description}} & % + \@NNLAYOUTColumnHeader{\gettranslation{symbol}} \\ % + }% + }% + {% + \notbool{@NNUseRTL}% + {% + \@NNLAYOUTColumnHeader{\gettranslation{symbol}} &% + \@NNLAYOUTColumnHeader{\gettranslation{macro name}} &% + \@NNLAYOUTColumnHeader{\gettranslation{uses}} &% + \@NNLAYOUTColumnHeader{\gettranslation{description}}\\% + }% + {% + \@NNLAYOUTColumnHeader{\gettranslation{description}}&% + \@NNLAYOUTColumnHeader{\gettranslation{uses}} &% + \@NNLAYOUTColumnHeader{\gettranslation{macro name}} &% + \@NNLAYOUTColumnHeader{\gettranslation{symbol}} \\% + }% + }% +} + +% ************************************* +% \@NNPrintCommand +% ************************************* +% Fancy output of symbol by macro expansion (with number arguments). +\newcommand{\@NNPrintCommand}[1]{% + \letcs{\NNnum}{@NNArgumentsOfEntry#1}% + \ensuremath{% + \csname @NNCommandOfEntry#1\endcsname% + {\@NNShowIf{\@NNArgumentA}{1}{\NNnum}}% + {\@NNShowIf{\@NNArgumentB}{2}{\NNnum}}% + {\@NNShowIf{\@NNArgumentC}{3}{\NNnum}}% + {\@NNShowIf{\@NNArgumentD}{4}{\NNnum}}% + {\@NNShowIf{\@NNArgumentE}{5}{\NNnum}}% + {\@NNShowIf{\@NNArgumentF}{6}{\NNnum}}% + {\@NNShowIf{\@NNArgumentG}{7}{\NNnum}}% + {\@NNShowIf{\@NNArgumentH}{8}{\NNnum}}% + {\@NNShowIf{\@NNArgumentI}{9}{\NNnum}}% + }% +} + +% ************************************* +% \@NNPrintCommandName +% ************************************* +\newcommand{\@NNPrintCommandName}[1]{% + \texttt{% + \csname @NNMacroNameOfEntry#1\endcsname% + \expandafter\ifthenelse{\csname @NNArgumentsOfEntry#1\endcsname < 1}{}{% + [\csname @NNArgumentsOfEntry#1\endcsname]}% + }% +} + +% ************************************* +% \@NNPrintEntry +% ************************************* +\newcommand{\@NNPrintEntry}[1]{% + \@nameuse{@NNArgDescsOfEntry#1}% + \notbool{@NNDetailed}{% + \notbool{@NNUseRTL}% + {\@NNPrintCommand{#1} & \csname @NNDescriptionOfEntry#1\endcsname \\}% + {\csname @NNDescriptionOfEntry#1\endcsname & \@NNPrintCommand{#1} \\}% + }% + {% + \notbool{@NNUseRTL}% + {% + \@NNPrintCommand{#1} & % + \@NNPrintCommandName{#1} & % + \csname @NNNumberOfUsesOfEntry#1\endcsname & % + \csname @NNDescriptionOfEntry#1\endcsname \\ % + }% + {% + \csname @NNDescriptionOfEntry#1\endcsname & % + \csname @NNNumberOfUsesOfEntry#1\endcsname & % + \@NNPrintCommandName{#1} & % + \@NNPrintCommand{#1} \\ % + }% + }% +} + +% ************************************* +% \@NNPrintGroup +% ************************************* +\newcommand{\@NNPrintGroup}[1]{% + \setboolean{@NNPrintGroup}{true} + \ifbool{@NNDefaultGroup#1}% + {% + \ifthenelse{\expandafter\value{@NNNumberOfEntriesInGroup#1} < 1}% + {\setboolean{@NNPrintGroup}{false}}% + {}% + }% + {% + \noindent\expandafter\@NNLAYOUTGroup{\csname @NNNameOfGroup#1\endcsname}% + \ifthenelse{\expandafter\value{@NNNumberOfEntriesInGroup#1} < 1}% + {\setboolean{@NNPrintGroup}{false}\gettranslation{no entries}}% + {}% + }% + % + \ifbool{@NNPrintGroup}% + {% + \keepXColumns% + \ifbool{@NNDetailed}{% + \notbool{@NNUseRTL}% + {\begin{tabularx}{\textwidth}{lllX}}% + {\begin{tabularx}{\textwidth}{Xlll}}% + }% + {% + \notbool{@NNUseRTL}% + {\begin{tabularx}{\textwidth}{lX}}% + {\begin{tabularx}{\textwidth}{Xl}}% + }% + \@NNPrintTableHeader % + \forlistcsloop{\@NNPrintEntry}{@NNEntriesInGroup#1} % + \end{tabularx}% + }{}% +} + +% ----------------------------------------------------------------------------- +% 2c) Grouping +% ----------------------------------------------------------------------------- +\newcommand{\@NNGroups}{} + +\newcommand{\@NNNewGroup}[3]{% + \stepcounter{@NNNumberOfAllGroups}% + \setcounter{@NNCurrentGroup}{\value{@NNNumberOfAllGroups}}% + \listeadd{\@NNGroups}{\the@NNCurrentGroup}% + \csedef{@NNNameOfGroup\the@NNCurrentGroup}{#1}% + \csedef{@NNOutputLevelOfGroup\the@NNCurrentGroup}{#3}% + \expandafter\provideboolean{@NNDefaultGroup\the@NNCurrentGroup}% + \expandafter\setboolean{@NNDefaultGroup\the@NNCurrentGroup}{#2}% + \expandafter\providecounter{@NNNumberOfEntriesInGroup\the@NNCurrentGroup}% +} + +\newcommand{\@NNPrepareEntry}[1]{% + \stepcounter{@NNNumberOfAllEntries}% + \stepcounter{@NNNumberOfEntriesInGroup\the@NNCurrentGroup}% + \providecounter{@NNCounter#1}% + \csdef{@NNNumberOfUsesOfEntry\the@NNNumberOfAllEntries}% + {% + \ifthenelse{\value{@NNCounter#1} > 0 }% + {\arabic{@NNCounter#1}}% + {\@NNLAYOUTZeroUses{\arabic{@NNCounter#1}}}% + }% +} + +\newcommand{\@NNAddEntry}[5]{% + \listcseadd{@NNEntriesInGroup\the@NNCurrentGroup}{\the@NNNumberOfAllEntries}% + \csedef{@NNCommandOfEntry\the@NNNumberOfAllEntries}{#1}% + \csedef{@NNMacroNameOfEntry\the@NNNumberOfAllEntries}{#2}% + \csedef{@NNArgumentsOfEntry\the@NNNumberOfAllEntries}{#3}% + \csedef{@NNDescriptionOfEntry\the@NNNumberOfAllEntries}{#4}% + \csdef{@NNArgDescsOfEntry\the@NNNumberOfAllEntries}{#5}% +} + + + +% ============================================================================= +% EXTERNAL COMMANDS ----------------------------------------------------------- +% ============================================================================= + +% ----------------------------------------------------------------------------- +% 3a) Layout +% ----------------------------------------------------------------------------- +\newcommand{\notationSetLayoutTable}[1]{\renewcommand{\@NNLAYOUTTable}[1]{#1}} +\newcommand{\notationSetLayoutGroup}[1]{\renewcommand{\@NNLAYOUTGroup}[1]{#1}} +\newcommand{\notationSetLayoutColumnHeader}[1]{\renewcommand{\@NNLAYOUTColumnHeader}[1]{#1}} +\newcommand{\notationSetLayoutArgument}[1]{\renewcommand{\@NNLAYOUTArgument}[1]{#1}} +\newcommand{\notationSetLayoutZeroUses}[1]{\renewcommand{\@NNLAYOUTZeroUses}[1]{#1}} + +\newcommand{\notationarg}[2]{% + \ifthenelse{#1 = 1}{\renewcommand{\@NNArgumentA}{#2}}{% + \ifthenelse{#1 = 2}{\renewcommand{\@NNArgumentB}{#2}}{% + \ifthenelse{#1 = 3}{\renewcommand{\@NNArgumentC}{#2}}{% + \ifthenelse{#1 = 4}{\renewcommand{\@NNArgumentD}{#2}}{% + \ifthenelse{#1 = 5}{\renewcommand{\@NNArgumentE}{#2}}{% + \ifthenelse{#1 = 6}{\renewcommand{\@NNArgumentF}{#2}}{% + \ifthenelse{#1 = 7}{\renewcommand{\@NNArgumentG}{#2}}{% + \ifthenelse{#1 = 8}{\renewcommand{\@NNArgumentH}{#2}}{% + \ifthenelse{#1 = 9}{\renewcommand{\@NNArgumentI}{#2}}% + {\PackageWarning{newnotation}{notationarg: Invalid argument number}{Must be an integer between 1 and 9.}}% + }}}}}}}}% +} + + + +% ----------------------------------------------------------------------------- +% 3b) Printing +% ----------------------------------------------------------------------------- +% ************************************* +% \tableofnotation +% ************************************* +% Print groups in current table (without macro name or number of uses). +\DeclareDocumentCommand{\tableofnotation}{O{0}}{% + \setboolean{@NNInListMode}{true}% + {% (deliberate free line below) + + \bigskip\noindent% + \@NNLAYOUTTable{\gettranslation{Table of notation}} + + % (deliberate free line above) + }% + \renewcommand*{\do}[1]{% + \ifthenelse{\@nameuse{@NNOutputLevelOfGroup##1} < #1}{}{% + \@NNPrintGroup{##1}% + }% + }% + \dolistloop{\@NNGroups}% + \setboolean{@NNInListMode}{false}% +} + +% ************************************* +% \detailedtableofnotation +% ************************************* +% Print groups in current table (with macro name and number of uses). +\DeclareDocumentCommand{\detailedtableofnotation}{O{0}}{% + \setboolean{@NNDetailed}{true}% + \tableofnotation[#1]% + \setboolean{@NNDetailed}{false}% +} + + + +% ----------------------------------------------------------------------------- +% 3c) Groups/Tables +% ----------------------------------------------------------------------------- +% ************************************* +% \notationnewgroup +% ************************************* +% Creates a subtable with the given group name. +\DeclareDocumentCommand{\notationnewgroup}{O{0} m}{% + \@NNNewGroup{#2}{false}{#1}% +} + + +% ************************************* +% \notationnewtable +% ************************************* +% Creates a new table. +\newcommand{\notationnewtable}{% + \renewcommand{\@NNGroups}{}% + \@NNNewGroup{}{true}{0}% +} + +\notationnewtable % create new table right at the beginning + +% ************************************* +% \notationsavetable +% ************************************* +% Saves current table's groups in a variable of the given name. +\newcommand{\notationsavetable}[1]{% + \csedef{@NNTableCurrentGroup#1}{\the@NNCurrentGroup}% + \forlistloop{\listcsadd{@NNTable#1}}{\@NNGroups}% +} + +% ************************************* +% \notationloadtable +% ************************************* +% Restores current table's groups from the variable of the given name +\newcommand{\notationloadtable}[1]{% + \ifcsundef{@NNTable#1}{\PackageError{newnotation}{notationloadtable: Unknown table '#1'.}{Misspelled name?}}{}% + \notationnewtable% + \expandafter\setcounter{@NNCurrentGroup}{\csname @NNTableCurrentGroup#1\endcsname}% + \forlistcsloop{\listcsadd{@NNGroups}}{@NNTable#1}% +} + +% ----------------------------------------------------------------------------- +% 3d) Defining notation +% ----------------------------------------------------------------------------- +% ************************************* +% \newnotationclass +% ************************************* +% Define a class and its replacement +\newcommand{\newnotationclass}[2]{% + \csdef{@NNClass#1}{#2}% +} + +% ************************************* +% \newnotation +% ************************************* +% Define macro and add entry to current group. +% +% Arguments: +% 1. star: prevent extra embracing +% 2. optional: class name +% 3. mandatory: macro name +% 4. optional: number of arguments (default: 0) +% 5. optional: default value for first argument +% 6. mandatory: replacement +% 7. optional: description for table of notation +% 8. optional: description of arguments for table of notation +\DeclareDocumentCommand{\newnotation}{s o m O{0} o m O{} O{}}{% + % Check whether macro is already defined: + \ifdef{#3}% + {\PackageError{newnotation}{newnotation: Command '\string#3' already defined.}{Misspelled name?}}{}% + % + \@NNPrepareEntry{\string#3}% + % DEFAULT VALUE: no ------------------------------------------------ + \IfNoValueTF{#5}{% + \newrobustcmd{#3}[#4]{% + \IfNoValueTF{#2}% + % CLASS: no -------------------------------------------- + %{no class defined}{class defined} + {\IfBooleanTF{#1}% + % STAR: yes + {\ensuremath{#6}}% + % STAR: no + {\ensuremath{{#6}}}}% + % CLASS: yes ------------------------------------------- + {\IfBooleanTF{#1}% + % STAR: yes + {\ensuremath{\@nameuse{@NNClass#2}{#6}}}% + % STAR: no + {\ensuremath{{\@nameuse{@NNClass#2}{#6}}}}}% + \ifthenelse{\boolean{@NNInListMode}}{}{\protect\stepcounter{@NNCounter\string#3}}% + \xspace% + }% + }{% + % DEFAULT VALUE: yes ----------------------------------------------- + \newrobustcmd{#3}[#4][#5]{% + \IfNoValueTF{#2}% + % CLASS: no -------------------------------------------- + {\IfBooleanTF{#1}% + % STAR: yes + {\ensuremath{#6}}% + % STAR: no + {\ensuremath{{#6}}}}% + % CLASS: yes ------------------------------------------- + {\IfBooleanTF{#1}% + % STAR: yes + {\ensuremath{\@nameuse{@NNClass#2}{#6}}}% + % STAR: no + {\ensuremath{{\@nameuse{@NNClass#2}{#6}}}}}% + \ifthenelse{\boolean{@NNInListMode}}{}{\protect\stepcounter{@NNCounter\string#3}}% + \xspace% + }% + }% + \@NNAddEntry{#3}{\string#3}{#4}{#7}{#8}% +} +% ************************************* +% \newrelation +% ************************************* +% Define macro and add entry to current group. +% +% Arguments: +% 1. star: prevent extra embracing +% 2. optional: class name +% 3. mandatory: macro name +% 4. optional: number of arguments (default: 0) +% 5. optional: default value for first argument +% 6. mandatory: replacement +% 7. optional: description for table of notation +% 8. optional: description of arguments for table of notation +\DeclareDocumentCommand{\newrelation}{s o m O{0} o m O{} O{}}{% + % Check whether macro is already defined: + \ifdef{#3}% + {\PackageError{newnotation}{newrelation: Command '\string#3' already defined.}{Misspelled name?}}{}% + % + \@NNPrepareEntry{\string#3}% + % DEFAULT VALUE: no ------------------------------------------------ + \IfNoValueTF{#5}{% + \newrobustcmd{#3}[#4]{% + \IfNoValueTF{#2}% + % CLASS: no -------------------------------------------- + %{no class defined}{class defined} + {\IfBooleanTF{#1}% + % STAR: yes + {\ensuremath{\mathrel{#6}}}% + % STAR: no + {\ensuremath{\mathrel{{#6}}}}}% + % CLASS: yes ------------------------------------------- + {\IfBooleanTF{#1}% + % STAR: yes + {\ensuremath{\mathrel{\@nameuse{@NNClass#2}{#6}}}}% + % STAR: no + {\ensuremath{\mathrel{\@nameuse{@NNClass#2}{#6}}}}}% + \ifthenelse{\boolean{@NNInListMode}}{}{\protect\stepcounter{@NNCounter\string#3}}% + \xspace% + }% + }{% + % DEFAULT VALUE: yes ----------------------------------------------- + \newrobustcmd{#3}[#4][#5]{% + \IfNoValueTF{#2}% + % CLASS: no -------------------------------------------- + {\IfBooleanTF{#1}% + % STAR: yes + {\ensuremath{\mathrel{#6}}}% + % STAR: no + {\ensuremath{\mathrel{{#6}}}}}% + % CLASS: yes ------------------------------------------- + {\IfBooleanTF{#1}% + % STAR: yes + {\ensuremath{\mathrel{\@nameuse{@NNClass#2}{#6}}}}% + % STAR: no + {\ensuremath{\mathrel{\@nameuse{@NNClass#2}{#6}}}}}% + \ifthenelse{\boolean{@NNInListMode}}{}{\protect\stepcounter{@NNCounter\string#3}}% + \xspace% + }% + }% + \@NNAddEntry{#3}{\string#3}{#4}{#7}{#8}% +} + +% ************************************* +% \renewnotation +% ************************************* +% Redefine macro and add entry to current group. +% +% Arguments: +% 1. star: prevent extra embracing +% 2. optional: class name +% 3. mandatory: macro name +% 4. optional: number of arguments (default: 0) +% 5. optional: default value for first argument +% 6. mandatory: replacement +% 7. optional: description for table of notation +% 8. optional: description of arguments for table of notation +\DeclareDocumentCommand{\renewnotation}{s o m O{0} o m O{} O{}}{% + % Check whether macro is not defined so far: + \ifundef{#2}% + {\PackageError{newnotation}{renewnotation: Command '\string#2' not defined.}% + {Misspelled name?}}{}% + % + \@NNPrepareEntry{\string#3}% + % DEFAULT VALUE: no ------------------------------------------------ + \IfNoValueTF{#5}{% + \renewrobustcmd{#3}[#4]{% + \IfNoValueTF{#2}% + % CLASS: no -------------------------------------------- + {\IfBooleanTF{#1}% + % STAR: yes + {\ensuremath{#6}}% + % STAR: no + {\ensuremath{{#6}}}}% + % CLASS: yes ------------------------------------------- + {\IfBooleanTF{#1}% + % STAR: yes + {\ensuremath{\@nameuse{@NNClass#2}{#6}}}% + % STAR: no + {\ensuremath{{\@nameuse{@NNClass#2}{#6}}}}}% + \ifthenelse{\boolean{@NNInListMode}}{}{\protect\stepcounter{@NNCounter\string#3}}% + \xspace% + }% + }{% + % DEFAULT VALUE: yes ----------------------------------------------- + \renewrobustcmd{#3}[#4][#5]{% + \IfNoValueTF{#2}% + % CLASS: no -------------------------------------------- + %{no class defined}{class defined} + {\IfBooleanTF{#1}% + % STAR: yes + {\ensuremath{#6}}% + % STAR: no + {\ensuremath{{#6}}}}% + % CLASS: yes ------------------------------------------- + {\IfBooleanTF{#1}% + % STAR: yes + {\ensuremath{\@nameuse{@NNClass#2}{#6}}}% + % STAR: no + {\ensuremath{{\@nameuse{@NNClass#2}{#6}}}}}% + \ifthenelse{\boolean{@NNInListMode}}{}{\protect\stepcounter{@NNCounter\string#3}}% + \xspace% + }% + }% + \@NNAddEntry{#3}{\string#3}{#4}{#7}{#8}% +} + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\makeatother %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% END OF IMPLEMENTATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + diff --git a/newnotation.tex b/newnotation.tex new file mode 100755 index 0000000..4df87d0 --- /dev/null +++ b/newnotation.tex @@ -0,0 +1,470 @@ +\documentclass{article} +\usepackage[utf8x]{inputenc} +\usepackage[ngerman,english]{babel} +\usepackage[dvipsnames]{xcolor} +\usepackage{amssymb} +\usepackage{fancyvrb} +\usepackage{newverbs} +\newverbcommand{\cverb}{\color{Plum}}{} + +\usepackage{newnotation} + +\newcommand{\decorate}[1]{\textcolor{Plum}{#1}} +\newcommand{\paren}[1]{(#1)} + +\title{The \textsf{newnotation} package} +\author{Gaetano Geck} + +\begin{document} + \maketitle + + \begin{abstract} + This package implements a \verb#\newnotation# command that allows definition of macros in the style of \verb#\newcommand#. The table of all macros defined this way can be printed by \verb#\tableofnotation# or, with additional information, by \verb#\detailedtableofnotation#. Tables can be grouped, saved, loaded and reset. + \end{abstract} + + \section{Example} + \label{sec:example} + %========================================================================== + Consider the following \LaTeX-file. + \begin{Verbatim}[frame=single,fontsize=\footnotesize,tabsize=4,commandchars=+()] +\documentclass{article} +\usepackage{newnotation} + +\begin{document} +% COMMAND DEFINITIONS (AND DESCRIPTIONS) ----------------- ++decorate(\newnotation){\powerset}{\mathcal{P}}[powerset] ++decorate(\newnotation){\pair}[2]{\left(#1,#2\right)} + ++decorate(\notationnewgroup){Logics} ++decorate(\newnotation*){\satisfies}{\models} ++decorate(\newnotation){\interpretation}{\alpha}[interpretation] ++decorate(\newnotation){\bigand}[2]{\bigwedge^{#2}_{#1=1}} ++decorate(\newnotation){\disclause}[3]{(#1 \lor #2 \lor #3)} + [OR-clause containing literals 1, 2 and 3] + ++decorate(\notationnewgroup){Calculus} ++decorate(\newnotation){\mylimit}{\lim_{n \to \infty}} ++decorate(\newnotation){\xintegral}[1]{\int^\infty_0 {#1} dx} + + + +% TEXT CONTENT ------------------------------------------- +Let $\phi=\disclause{x_1}{x_2}{x_3} \land \disclause{\lnot x_1} +{x_2}{\lnot x_3}$ be a formula and let $\interpretation$ be an +interpretation that satisfies formula~$\phi$ (i.e. $\alpha \satisfies \phi$), +then $\interpretation+paren(x_2)=1$ or $\interpretation+paren(x_1) \neq +\interpretation+paren(x_3)$. + ++decorate(\detailedtableofnotation) +\end{document} +\end{Verbatim} + \newpage + + The \LaTeX-code above results in the following output (displayed in brown). + + % Definitions -------------------------------------------- + \newnotation{\powerset}{\mathcal{P}}[powerset] + \newnotation{\pair}[2]{\left(#1,#2\right)} + + \notationnewgroup{Logics} + \newnotation*{\satisfies}{\models} + \newnotation{\interpretation}{\alpha}[interpretation] + \newnotation{\bigand}[2]{\bigwedge^{#2}_{#1=1}} + \newnotation{\disclause}[3]{(#1 \lor #2 \lor #3)}[OR-clause containing literals 1, 2 and 3] + + \notationnewgroup{Calculus} + \newnotation{\mylimit}{\lim_{n \to \infty}} + \newnotation{\xintegral}[1]{\int^\infty_0 {#1} dx} + + % Text --------------------------------------------------- + + \medskip + \noindent + {\color{teal} + Let $\phi=\disclause{x_1}{x_2}{x_3} \land \disclause{\lnot x_1}{x_2}{\lnot x_3}$ be a formula and let $\interpretation$ be an interpretation that satisfies formula~$\phi$ (i.e. $\alpha \satisfies \phi$), then $\interpretation(x_2)=1$ or $\interpretation(x_1) \neq \interpretation(x_3)$. + + \detailedtableofnotation + } + + \paragraph*{Remark.} + Using \cverb#\tableofnotation# instead of \verb#\detailedtableofnotation# will result in a table that lists only the symbols with their descriptions. + + \newpage + \section{Defining notation} + \label{sec:defining} + %========================================================================== + Macros for specific notation can be defined with \cverb#\newnotation# in the same fashion as with \verb#\newcommand#.\footnote{Internally, however, \texttt{\textbackslash{}newrobustcmd} is used. This way, a counter recording the number of uses of a command defined via \texttt{\textbackslash{}newnotation} also work in section titles and the like.} In particular, \verb#\newnotation# has two \textbf{mandatory arguments}: + \begin{itemize} + \setlength{\itemsep}{0em} + \setlength{\parsep}{0em} + \setlength{\parskip}{0em} + \item the macro name (position~2) and + \item its replacement (position~5). + \end{itemize} + Furthermore, \verb#\newnotation# can handle some \textbf{optional arguments}: + \begin{itemize} + \setlength{\itemsep}{0em} + \setlength{\parsep}{0em} + \setlength{\parskip}{0em} + \item a class name (position~1); + \item a number of arguments for the macro definition (position~3); + \item a default value (position~4)), in case the first argument is unspecified; and + \item a description for the table of notation (position~6), + \item with possibly detailed description of the arguments (position~7). + \end{itemize} + Disregarding the possible definition of a default value, this results in a total of four variants of the \verb#\newnotation# command. The general scheme + + \begin{Verbatim}[tabsize=4,commandchars=+()] + +decorate(\newnotation)[class]{macro name}[number of arguments] + [default value]{replacement} + [description][argument description] + \end{Verbatim} + is illustrated by the four commands from the introductory example: + \begin{enumerate} + \item {No arguments, no description:}\\ + \verb#\newnotation*{\satisfies}{\models}# + + \item {No arguments but description:}\\ + \verb#\newnotation{\interpretation}{\alpha}[interpretation]# + + \item {Arguments, no description:}\\ + \verb+\newnotation{\bigand}[2]{\bigwedge^{#2}_{#1=1}}+ + + \item {Arguments and description:}\\ + \verb+\newnotation{\disclause}[3]{(1 \lor #2 \lor #3)}+\\ + \verb+ [OR-clause containing literals 1, 2 and 3]+ + \end{enumerate} + + \paragraph*{Starred and non-starred version.} + Every replacement text is wrapped in an \verb#\ensuremath#, with an \verb#\xspace# appended. Therefore you can, for instance, safely write + \begin{Verbatim}[tabsize=4] + Interpretation~\interpretation satisfies \dots +\end{Verbatim} + resulting in + \textcolor{teal}{Interpretation~\interpretation satisfies \dots}. + + Using the non-starred version \verb#\newnotation#, an additional pair of curly braces added to the replacment allows the command to be used in a sub- or superscript. For example, writing \verb#$a_\pair{i}{j}$# results in \textcolor{teal}{$a_\pair{i}{j}$}. + + \newcommand{\badpair}[2]{\ensuremath{}\xspace} + + Note, however, that this wrapping prevents extra spaces (like those surrounding relation or operator symbols, defined by \verb#\mathrel# or \verb#\mathop#, for example). If you want these extra spaces, you can avoid the additional pair of braces by using the starred version \cverb#\newnotation*#; like for the binary satisfaction relation \verb#\satisfies# above. + + \paragraph*{Default value for first argument.} As for \verb#\newcommand#, you can specify a default value for the first argument, which will be considered as an optional argument then. + For example, the definition + \begin{Verbatim}[tabsize=4,commandchars=+()] + \newnotation{\myfunc}[2]+decorate([\mathbb{R}]){#2: #1 \to #1} + \end{Verbatim} + \newnotation{\myfunc}[2][\mathbb{R}]{#2: #1 \to #1} + leads to output + \begin{itemize} + \item \textcolor{teal}{$\myfunc{f}$} when using \verb#\myfunc{f}# and + \item \textcolor{teal}{$\myfunc[\mathbb{N}]{g}$} when using \verb#\myfunc[\mathbb{N}]{g}#. + \end{itemize} + + \paragraph*{Redefinition.} + Of course, you can also redefine a command, whether previously defined via \verb#\newnotation# or not. If you want the new definition to be contained in the table of notation, simply use \cverb#\renewnotation# in one of the flavors described above. + + For the purpose of illustration, we redefine our \verb#\myfunc# macro. This time, we interpret the first argument as the optional mapping's name (default name $f$) and the following two arguments restrict the mapping's domain and range: + \begin{Verbatim}[tabsize=4,commandchars=+()] + +decorate(\renewnotation){\myfunc}[3][f]{#1: #2 \to #3} + \end{Verbatim} + \renewnotation{\myfunc}[3][f]{#1: #2 \to #3} + + After this redefinition, we get output + \begin{itemize} + \item \textcolor{teal}{$\myfunc{X \times Y}{Z}$} when using \verb#\myfunc{X \times Y}{Z}# and + \item \textcolor{teal}{$\myfunc[f^{-1}]{Z}{X \times Y}$} when using \verb#\myfunc[f^{-1}]{Z}{X \times Y}#. + \end{itemize} + + \paragraph*{Remark.} + Indeed, there's a sixth argument that can optionally be supplied to both \verb#\newnotation# and \verb#\renewnotation#. This argument, which is explained in detail in Section~\ref{sec:listing}, specifies the replacement for potential arguments of a macro in the table of notation. + + + \paragraph*{Classes.} + Often, entitites of a certain type are formatted in a particular way, just to indicate that type. For instance, set names may always be bold, problem names in small caps \dots It is desirable to separate the choice of layout for some type from the choice of type for the entity (or its denotation, more precisely). To this end, the \cverb#\newnotation# command supports classes. + + They can be used like in the following example. + \begin{Verbatim}[tabsize=4,commandchars=+()] + +decorate(\newnotationclass){set}{\boldsymbol} + +decorate(\newnotationclass){problem}{\textsc} + + \newnotation+decorate([set]){\setX}{X} + \newnotation+decorate([set]){\setY}{Y} + \newnotation+decorate([set]){\setZ}{Z} + \newnotation+decorate([problem]){\HC}{HamiltonCircuit} + \newnotation+decorate([problem]){\ThreeSat}{3-Sat} + + \begin{itemize} + \item sets: $\setX$, $\setY$, $\setZ$ + \item problems: $\HC$ and $\ThreeSat$ + \end{itemize} + \end{Verbatim} + + + \notationsavetable{beforeClasses} + \notationnewtable + \newnotationclass{set}{\boldsymbol} + \newnotationclass{problem}{\textsc} + + \newnotation[set]{\setX}{X} + \newnotation[set]{\setY}{Y} + \newnotation[set]{\setZ}{Z} + \newnotation[problem]{\HC}{HamiltonCircuit} + \newnotation[problem]{\ThreeSat}{3-Sat} + + \notationloadtable{beforeClasses} + + The output produced will be: + + {\color{teal} + \begin{itemize} + \setlength{\itemsep}{0em} + \setlength{\parsep}{0em} + \setlength{\parskip}{0em} + \item sets: $\setX$, $\setY$, $\setZ$ + \item problems: $\HC$ and $\ThreeSat$ + \end{itemize} + } + + The \cverb#\newnotationclass# has two mandatory arguments: + \begin{itemize} + \item class name and + \item a macro \emph{that expects exactly one argument}. + \end{itemize} + When defining notation for an entity that should belong to a specific class, the name of this class can be passed to the \cverb#\newnotation# command as a first optional argument (right before the name of the new macro). + + \paragraph*{Relation symbols.} + Relation symbols require some extra space around them. Using \cverb#\newcommand# this can be achieved with \cverb#\mathrel#. This is done implicitly, when \cverb#\newrelation# (or \cverb#\newrelation*#) is used instead of \cverb#\newnotation#. + + \newpage + \section{Grouping notation} + \label{sec:grouping} + %========================================================================== + Even for a single paper, it is not uncommon to define several dozen notational macros. For ease of maintenance and look-up, it therefore seems desirable to group such definitions. + + This package supports (one-level) grouping of macro definitions. Simply set a new group name by + \begin{Verbatim}[tabsize=4,commandchars=+()] + +decorate(\notationnewgroup)[output level]{group name} + \end{Verbatim} + Every use of \verb#\newnotation# will add an entry to the list of the group that was most recently added to the active table. If no group was specified explicitly before, the entry is added to the (unnamed) default group. + + When printing a table, groups are filtered based on their output level. You can provide an integer value as the group's output level. By default, the output level is set to 0. See Section~\ref{sec:listing} for more information. + + \paragraph*{Remark.} + You can use the same group name several times, but every use will create an own list, even if immediately following a group of the same name. + + \newpage + \section{Listing notation} + \label{sec:listing} + %========================================================================== + If you do not want to use \verb#\newnotation# as an abbreviation for + \begin{Verbatim}[tabsize=4,commandchars=+()] + \newrobustcmd{macro name}{{\ensuremath{replacement}}\xspace} + \end{Verbatim} + or its argument-variant + only, then you want eventually a table of the notational macros to be printed. To this end, simply use + \begin{Verbatim}[tabsize=4,commandchars=+()] + +decorate(\tableofnotation)[table output level] + \end{Verbatim} + where you want to print a table of the macros defined \emph{so far}. Each entry in this table contains the symbol with its description. While writing a document, a more informative variant, + \begin{Verbatim}[tabsize=4,commandchars=+()] + +decorate(\detailedtableofnotation)[table output level], + \end{Verbatim} + which also displays the macro name and the number of uses, might be interesting. + + \paragraph*{Remark.} + You can use this command several times. The column `uses' shows the number of times a macro has been expanded up to the moment where the table is printed. Possible expansions within the table itself are \emph{not} counted. + + \medskip\noindent + Each command is expanded with an appropriate number of arguments in the `symbol' column. By default, value `1' is used for the first argument, value `2' for the second and so on. Sometimes, a different replacement is more meaningful. In this case, you can supply a fifth argument to \verb#\newnotation# or \verb#\renewnotation#, respectively. This argument should contain a sequence of \verb#\notationarg# commands. Command \verb#\notationarg# expects two arguments: the first argument is the number of the argument whose replacement is to be changed, the second argument is the new replacement for this argument. The following example illustrates its use: + + \begin{Verbatim}[frame=single,fontsize=\footnotesize,tabsize=4,commandchars=+()] +\newnotation{\problem}[1]{\textsc{#1}}[layout for problems] + +decorate([\notationarg{1}{Name}]) +\newnotation{\bigor}[2]{\bigvee^{#2}_{#1=1}} + [provide (1) variable~$i$; (2) upper bound~$n$] + +decorate([\notationarg{1}{i}\notationarg{2}{n}]) +\detailedtableofnotation + \end{Verbatim} + This code procduces the following output: + + {\color{teal} + \notationsavetable{main} + \notationnewtable + \newnotation{\problem}[1]{\textsc{#1}}[layout for problems][\notationarg{1}{Name}] + \newnotation{\bigor}[2]{\bigvee^{#2}_{#1=1}}[provide (1) variable~$i$; (2) upper bound~$n$][\notationarg{1}{i}\notationarg{2}{n}] + \detailedtableofnotation + \notationloadtable{main} + } + + \newpage + \medskip\noindent + Both variants, \verb#\tableofnotation# and \verb#\detailedtableofnotation# can handle an optional integer argument, the \emph{table output level}. This argument allows to control which of the groups in the table are to be printed, namely those with an output level at least as high the table output level. + + Consider the following example. + \begin{Verbatim}[frame=single,fontsize=\footnotesize,tabsize=4,commandchars=+()] +\newnotation{\cmdA}{a} +\notationnewgroup[2]{For the interested reader} +\newnotation{\cmdB}{b} +\notationnewgroup[3]{For everyone} +\newnotation{\cmdC}{c} + +Show content for interested readers:\\ ++decorate(\detailedtableofnotation[2]) + +Show content for the average reader:\\ ++decorate(\detailedtableofnotation[3]) + \end{Verbatim} + + The corresponding output is: + + \medskip + {\color{teal} + \notationsavetable{main} + \notationnewtable + \newnotation{\cmdA}{a} + \notationnewgroup[2]{For the interested reader} + \newnotation{\cmdB}{b} + \notationnewgroup[3]{For the average reader} + \newnotation{\cmdC}{c} + + \noindent + Show content for interested readers:\\ + \detailedtableofnotation[2] + + Show content for the average reader:\\ + \detailedtableofnotation[3] + \notationloadtable{main} + } + + \newpage + \section{Saving, loading and resetting tables} + \label{sec:saving} + %========================================================================== + If you use \verb#\tableofnotation# or its variant \verb#\detailedtableofnotation# more than once, chances are you do not want to list notation already listed previously. Simply use \verb#\notationnewtable# before the next \verb#\newnotation# that should be contained in the new table (a good place might be directly after the last \verb#\tableofnotation#). + + \paragraph*{Remark.} + Use of \verb#\notationnewtable# only clears the contents of the table; it does \emph{not} undefine the commands defined by \verb#\newnotation#. + + \medskip + \noindent + Maybe you want to use \verb#\newnotation# and its companions locally, for a single section or an involved proof that requires very specific notation. As usual, you can restrict the definition of a command via \verb#\newnotation# by grouping (using curly braces or \verb#\begingroup# and \verb#\endgroup#). + + The following example demonstrates that. After opening the new group, the current contents of the table are saved by \cverb#\notationsavetable{mytable}#. Then, the table is reset by \cverb#\notationnewtable# and finally, after printing it, the previous contents are restored by \cverb#\notationloadtable#. + + + \bigskip + \noindent + Think of the following \LaTeX-code being inserted just before \verb#\end{document}# in the example code on page~1. + + \begin{Verbatim}[frame=single,fontsize=\footnotesize,tabsize=4,commandchars=+()] +% GROUP: group theory ---------------------------------------------- +{ + +decorate(\notationsavetable){mytable} + +decorate(\notationnewtable) + \notationnewgroup{Group theory} + \newnotation*{\composition}{\circ}[composition of elements] + \newnotation{\identity}{e}[identity element] + \newnotation{\inverse}[1]{{#1}^{-1}}[inverse of element~1] + + For every element~$g$ in a group~$G$ it holds $g \composition \inverse{g} + = \inverse{g} \composition g = \identity$, where $\identity$ is the identity + element of~$\composition$. + + \tableofnotation + +decorate(\notationloadtable){mytable} +} +%!GROUP: group theory ---------------------------------------------- + +\bigskip\noindent +Enough group theory, let's return to our old table: +\tableofnotation + \end{Verbatim} + + This code leads to the additional output shown below: + \newpage\noindent + \medskip + {\color{teal} + % GROUP: group theory ---------------------------------------------- + { + \notationsavetable{mytable} + \notationnewtable + \notationnewgroup{Group theory} + \newnotation*{\composition}{\circ}[composition of elements] + \newnotation{\identity}{e}[identity element] + \newnotation{\inverse}[1]{{#1}^{-1}}[inverse of element~1] + + \noindent + For every element~$g$ in a group~$G$ it holds $g \composition \inverse{g} = \inverse{g} \composition g = \identity$, where $\identity$ is the identity element of~$\composition$. + + \tableofnotation + \notationloadtable{mytable} + } + %!GROUP: group theory ---------------------------------------------- + + \bigskip\noindent + Enough group theory, let's return to our old table: + \tableofnotation + } + + \paragraph*{Remark.} + Even though the command definitions via \verb#\newnotation# are lost when leaving the group and so are the locally added entries in the table, use of \verb#\notationloadtable# is required to reset internal counters (otherwise newly defined commands are added to the last local group, which won't be printed). + + \newpage + \section{Customization} + \label{sec:customization} + %========================================================================== + + \subsection{Right-to-left} + If you want the columns to be printed in reverse order, then simply pass option \verb#rtl# to the package: \verb#\usepackage[rtl]{newnotation}#. + + \subsection{Translations} + This package uses the \textsf{translations} package in combination with \textsf{babel}. You can provide your own translations in a fashion analogous to the example below.\\ + (This German translation is already provided by the \textsf{newnotation} package.) + + \begin{Verbatim}[frame=single,fontsize=\footnotesize,tabsize=4,commandchars=+()] +\DeclareTranslation{German}{List of notation}{Notationstabelle} +\DeclareTranslation{German}{symbol}{Symbol} +\DeclareTranslation{German}{macro name}{Makroname} +\DeclareTranslation{German}{uses}{Verw.} +\DeclareTranslation{German}{description}{Beschreibung} +\DeclareTranslation{German}{no entries}{keine Einträge} + \end{Verbatim} + + When printing the table of notation, \textsf{newnotation} uses the active language, as determined by \textsf{babel}. For instance, this document uses \textsf{babel} with options \texttt{[ngerman,english]}, that is, English as it's main language and German as an additional one. Therefore the previous tables used English translations whereas the following \LaTeX-code + \begin{Verbatim}[frame=single,fontsize=\footnotesize,tabsize=4,commandchars=+()] +\selectlanguage{ngerman} +\tableofnotation + \end{Verbatim} + results in a table headers translated to German: + + {\color{teal} + \selectlanguage{ngerman} + \tableofnotation + %\selectlanguage{english} + } + + \subsection{Layout} + You can specify the layout for the table caption, the group names and even for arguments in the `symbol' column and occurrences of zeros in the `uses' column (all replacements can refer to the first argument): + + \begin{Verbatim}[frame=single,fontsize=\footnotesize,tabsize=4,commandchars=+()] ++decorate(\notationSetLayoutTable){\textsc{#1}\dotfill} ++decorate(\notationSetLayoutGroup){\textit{#1}} ++decorate(\notationSetLayoutColumnHeader){\underline{#1}} ++decorate(\notationSetLayoutArgument){\textcolor{Green}{#1}} ++decorate(\notationSetLayoutZeroUses){\textcolor{Magenta}{#1}} + \end{Verbatim} + + Using this code, the ouptut by \verb#\tableofnotation# is: + + + {\color{teal} + \notationSetLayoutTable{\textsc{#1}\dotfill} + \notationSetLayoutGroup{\textit{#1}} + \notationSetLayoutColumnHeader{\underline{#1}} + \notationSetLayoutArgument{\textcolor{Green}{#1}} + \notationSetLayoutZeroUses{\textcolor{Magenta}{#1}} + + \tableofnotation + } +\end{document}