From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- .../latex/contrib/listofsymbols/listofsymbols.sty | 223 +++++++++++++++++++++ 1 file changed, 223 insertions(+) create mode 100644 macros/latex/contrib/listofsymbols/listofsymbols.sty (limited to 'macros/latex/contrib/listofsymbols/listofsymbols.sty') diff --git a/macros/latex/contrib/listofsymbols/listofsymbols.sty b/macros/latex/contrib/listofsymbols/listofsymbols.sty new file mode 100644 index 0000000000..e26cb90e29 --- /dev/null +++ b/macros/latex/contrib/listofsymbols/listofsymbols.sty @@ -0,0 +1,223 @@ +%% +%% This is file `listofsymbols.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% listofsymbols.dtx +%% +%% IMPORTANT NOTICE: +%% +%% For the copyright see the source file. +%% +%% Any modified versions of this file must be renamed +%% with new filenames distinct from listofsymbols.sty. +%% +%% For distribution of the original source see the terms +%% for copying and modification in the file listofsymbols.dtx. +%% +%% This generated file may be distributed as long as the +%% original source files, as listed above, are part of the +%% same distribution. (The sources need not necessarily be +%% in the same archive or directory.) + + + +\NeedsTeXFormat{LaTeX2e} \ProvidesPackage{listofsymbols} +\RequirePackage{ifthen} \RequirePackage{calc} \newboolean{b@nomencl} +\newboolean{b@final} \newboolean{b@Final} \newboolean{b@pageno} +\newboolean{b@xspace} +\DeclareOption{nomencl}{\setboolean{b@nomencl}{true}} +\DeclareOption{draft}{\setboolean{b@nomencl}{false} +\setboolean{b@final}{false}\setboolean{b@Final}{false}} +\DeclareOption{final}{\setboolean{b@nomencl}{false} +\setboolean{b@final}{true}\setboolean{b@Final}{false}} +\DeclareOption{Final}{\setboolean{b@nomencl}{false} +\setboolean{b@final}{true}\setboolean{b@Final}{true}} +\DeclareOption{pageno}{\setboolean{b@pageno}{true}} +\DeclareOption{nopageno}{\setboolean{b@pageno}{false}} +\DeclareOption{usexspace}{\setboolean{b@xspace}{true}} +\DeclareOption{noxspace}{\setboolean{b@xspace}{false}} + +\ExecuteOptions{draft,nopageno,usexspace} +\ProcessOptions + +\newlength{\symindent} + %equal to second argument of \l@figure and \l@table: +\setlength{\symindent}{1.5em} +\newlength{\symwidth} +\setlength{\symwidth}{2.5cm} +\newlength{\sympagenowidth} + +\ifthenelse{\boolean{b@nomencl}} + {\RequirePackage{nomencl}}{} +\ifthenelse{\boolean{b@xspace}} + {\RequirePackage{xspace} + \newcommand{\spaceaftersym}{\xspace}} + {\newcommand{\spaceaftersym}{}} +\ifthenelse{\boolean{b@pageno}} + {\settowidth{\sympagenowidth}{9999}} + {\setlength{\sympagenowidth}{0cm}} + +\newcommand{\printsymline}[5] +{\expandafter\providecommand\expandafter{\csname#3include\endcsname}{no} +\ifthenelse{\boolean{b@final} + \AND\(\expandafter\equal{\csname #3include\endcsname}{no}\OR\equal{#4}{}\)} +{\PackageInfo{listofsymbols}{symbol/subscript #3 has no or empty + description or is not used: omitted}} +{\hspace*{\symindent}\makebox[\symwidth][l]{\ensuremath{#2}}% +\parbox[t]{\textwidth-\symwidth-\sympagenowidth-16pt} +{\begin{raggedright}\strut% +\ifthenelse{\boolean{b@final}} {#4}% + {$\backslash$\texttt{#3} --- #4 (\csname #3include\endcsname)}% +\strut\end{raggedright}}% +\ifthenelse{\boolean{b@pageno}}{\hfill #5}{}% +\newline}} + +\newcommand{\losstring}{} + +\ifthenelse{\boolean{b@Final}} +{\newcommand{\addsymline}[5]{} +\newcommand{\opensymdef}{} +\newcommand{\closesymdef}{}} +{\newcommand{\opensymdef} +{\newwrite\@sym \immediate\openout\@sym=\jobname.sym +\newwrite\@sub \immediate\openout\@sub=\jobname.sub} +\newcommand{\closesymdef} +{\immediate\closeout\@sym +\immediate\closeout\@sub} +\newcommand{\addsymline}[5] +{\renewcommand{\losstring}{\string} +\immediate\write#5{\string\printsymline{\string#1}% +{\string#2}{\string#3}{#4}{\thepage}} +\renewcommand{\losstring}{}}} + +\newcommand{\@createsym}[3] +{\expandafter\newcommand\expandafter{\csname#2\endcsname} + {\relax\ensuremath{#3}\spaceaftersym% + \expandafter\protected@xdef\csname#2isused\endcsname {yes}} %evntl. gdef +\expandafter\newcommand\expandafter{\csname#2doc\endcsname}{#1} +\expandafter\newcommand\expandafter{\csname#2tabdoc\endcsname} + {\ensuremath{#3} & #1} +\expandafter\newcommand\expandafter{\csname#2isused\endcsname}{no}} + +\ifthenelse{\boolean{b@nomencl}} +{\newcommand{\newsym}[3][] +{\@createsym{#1}{#2}{#3} +\ifthenelse{\equal{#1}{}}{}{\nomenclature{\ensuremath{#3}}{#1}}}} +{\newcommand{\newsym}[3][] +{\@createsym{#1}{#2}{#3} +\addsymline{#3}{#3}{#2}{#1}{\@sym}}} + +\newcommand{\@createsub}[3] +{\expandafter\newcommand\expandafter{\csname#2\endcsname} + {\relax\ensuremath{_{#3}}\spaceaftersym% + \expandafter\protected@xdef\csname#2isused\endcsname {yes}} +\expandafter\newcommand\expandafter{\csname#2doc\endcsname}{#1} +\expandafter\newcommand\expandafter{\csname#2tabdoc\endcsname} + {\ensuremath{#3} & #1} +\expandafter\newcommand\expandafter{\csname#2isused\endcsname}{no}} + +\ifthenelse{\boolean{b@nomencl}} +{\newcommand{\newsub}[3][] +{\@createsub{#1}{#2}{#3} +\ifthenelse{\equal{#1}{}}{}{\nomenclature{\ensuremath{#3}}{#1}}}} +{\newcommand{\newsub}[3][] +{\@createsub{#1}{#2}{#3} +\addsymline{#3}{#3}{#2}{#1}{\@sub}}} + +\newcommand{\subsep}[1][]{\ensuremath{{}_{#1}{}}} + +\newcommand{\symheadingname}{List of Symbols} + +\newcommand{\subheadingname}{List of Subscripts} + +\newcommand{\bothheadingname}{Notation} + +\ifthenelse{\boolean{b@final}} +{\newcommand{\symheading} +{\section*{\symheadingname}} +\newcommand{\subheading} +{\section*{\subheadingname}}} +{\newcommand{\symheading} +{\section*{\symheadingname\ (draft)} +\makebox[\symwidth+\symindent][l]{\bf Symbol}{\bf Description} +\ifthenelse{\boolean{b@pageno}}{\hfill{\bf Defined on page}}{}} +\newcommand{\subheading} +{\section*{\subheadingname\ (draft)} +\makebox[\symwidth+\symindent][l]{\bf Subscript}{\bf Description} +\ifthenelse{\boolean{b@pageno}}{\hfill{\bf Defined on page}}{}}} + +\ifthenelse{\boolean{b@nomencl}} +{\makeglossary +\renewcommand{\nomname}{\symheadingname} +\setlength{\nomitemsep}{-1\parsep} +\newcommand{\listofsymbols}{\printglossary} +\newcommand{\listofsubscripts}{}} +{\newlength{\old@parskip} +\newlength{\old@parindent} +\newcommand{\listofsymbols} { + \setlength{\old@parskip}{\parskip} + \setlength{\parskip}{0pt} + \setlength{\old@parindent}{\parindent} + \setlength{\parindent}{0pt} +\symheading\par +\makeatletter +\IfFileExists{\jobname.syc}{\@input@{\jobname.syc}}{} +\IfFileExists{\jobname.sym}{\@input@{\jobname.sym}}{} +\makeatother + \setlength{\parskip}{\old@parskip} + \setlength{\parindent}{\old@parindent}} +\newcommand{\listofsubscripts} { + \setlength{\old@parskip}{\parskip} + \setlength{\parskip}{0pt} + \setlength{\old@parindent}{\parindent} + \setlength{\parindent}{0pt} +\subheading\par +\makeatletter +\IfFileExists{\jobname.suc}{\@input@{\jobname.suc}}{} +\IfFileExists{\jobname.sub}{\@input@{\jobname.sub}}{} +\makeatother + \setlength{\parskip}{\old@parskip} + \setlength{\parindent}{\old@parindent}}} + +\ifthenelse{\boolean{b@nomencl}} +{\newcommand{\listofboth}{\listofsymbols}} +{\newcommand{\listofboth} +{\renewcommand{\symheading}{\subsection*{\symheadingname}} +\renewcommand{\subheading}{\subsection*{\subheadingname}} +\section*{\bothheadingname\ifthenelse{\boolean{b@final}}{}{ (draft)}} +\listofsymbols\listofsubscripts}} + +\newcommand{\markasunused}[1] + {\expandafter\protected@xdef\csname#1isused\endcsname {no}} + +\newcommand{\markasused}[1] + {\expandafter\protected@xdef\csname#1isused\endcsname {yes}} + +\newcommand{\los@temp}{} + +\newcommand{\dontmarkasused}[1] + {\protected@xdef\los@temp{\csname#1isused\endcsname} + \csname#1\endcsname% + \expandafter\protected@xdef\csname#1isused\endcsname{\los@temp}} + +\AtEndDocument{ +\renewcommand{\printsymline}[5] +{\immediate\write\@syc{\string\newcommand% + {\expandafter\string\csname #3include\endcsname}% + {\csname #3isused\endcsname}}} +\newwrite\@syc \immediate\openout\@syc=\jobname.syc +\IfFileExists{\jobname.sym}{\@input@{\jobname.sym}}{} +\immediate\closeout\@syc +\renewcommand{\printsymline}[5] +{\immediate\write\@suc{\string\newcommand% + {\expandafter\string\csname #3include\endcsname}% + {\csname #3isused\endcsname}}} +\newwrite\@suc \immediate\openout\@suc=\jobname.suc +\IfFileExists{\jobname.sym}{\@input@{\jobname.sub}}{} +\immediate\closeout\@suc} + +\endinput +%% +%% End of file `listofsymbols.sty'. -- cgit v1.2.3