diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/stex/omdoc/omdoc.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/stex/omdoc/omdoc.sty | 66 |
1 files changed, 42 insertions, 24 deletions
diff --git a/Master/texmf-dist/tex/latex/stex/omdoc/omdoc.sty b/Master/texmf-dist/tex/latex/stex/omdoc/omdoc.sty index 8cde99fa719..ae8ac708578 100644 --- a/Master/texmf-dist/tex/latex/stex/omdoc/omdoc.sty +++ b/Master/texmf-dist/tex/latex/stex/omdoc/omdoc.sty @@ -7,18 +7,26 @@ %% omdoc.dtx (with options: `package') %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] -\ProvidesPackage{omdoc}[2016/04/07 v1.2 OMDoc document Structure] -\newif\ifshow@ignores\show@ignoresfalse -\DeclareOption{showignores}{\show@ignorestrue} -\newcount\section@level\section@level=2 -\DeclareOption{report}{\section@level=0} -\DeclareOption{book}{\section@level=0} -\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{sref}} -\ProcessOptions +\ProvidesPackage{omdoc}[2019/03/20 v1.3 OMDoc document Structure] +\RequirePackage{kvoptions} +\SetupKeyvalOptions{family=omdoc@sty,prefix=omdoc@sty@} +\DeclareBoolOption{mh} +\DeclareStringOption[article]{class} +\DeclareBoolOption{showignores} +\DeclareStringOption[section]{topsect} +\newcount\section@level +\DeclareDefaultOption{\PassOptionsToPackage{\CurrentOption}{sref}} +\ProcessKeyvalOptions{omdoc@sty} +\ifomdoc@sty@mh\RequirePackage{omdoc-mh}\fi \RequirePackage{sref} \RequirePackage{xspace} \RequirePackage{comment} \RequirePackage{pathsuris} +\section@level=2 +\ifdefstring{\omdoc@sty@class}{book}{\section@level=0}{} +\ifdefstring{\omdoc@sty@class}{report}{\section@level=0}{} +\ifdefstring{\omdoc@sty@topsect}{part}{\section@level=0}{} +\ifdefstring{\omdoc@sty@topsect}{chapter}{\section@level=1}{} \def\current@section@level{document}% \newcommand\currentsectionlevel{\lowercase\expandafter{\current@section@level}\xspace}% \newcommand\Currentsectionlevel{\expandafter\MakeUppercase\current@section@level\xspace}% @@ -30,11 +38,15 @@ \ifx\hyper@anchor\@undefined\else\phantomsection\fi% \addcontentsline{toc}{#1}{#2}\@nameuse{#1}*{#2}} \newcommand\omgroup@num[2]{% -\sref@label@id{\omdoc@sect@name~\@nameuse{the#1}}% -\ifx\omgroup@short\@empty\@nameuse{#1}{#2}% -\else\@ifundefined{rdfmeta@sectioning}{\@nameuse{#1}[\omgroup@short]{#2}}% -{\@nameuse{rdfmeta@#1@old}[\omgroup@short]{#2}}% -\fi} +\edef\@@ID{\sref@id} +\ifx\omgroup@short\@empty% no short title +\@nameuse{#1}{#2}% +\else% we have a short title +\@ifundefined{rdfmeta@sectioning}% + {\@nameuse{#1}[\omgroup@short]{#2}}% + {\@nameuse{rdfmeta@#1@old}[\omgroup@short]{#2}}% +\fi% +\sref@label@id@arg{\omdoc@sect@name~\@nameuse{the#1}}\@@ID} \def\@true{true} \def\@false{false} \srefaddidkey{omgroup} @@ -47,8 +59,7 @@ \addmetakey*{omgroup}{display} \addmetakey[false]{omgroup}{loadmodules}[true] \newif\if@@num\@@numtrue -\newif\if@frontmatter\@frontmatterfalse -\newif\if@backmatter\@backmatterfalse +\newif\if@mainmatter\@mainmattertrue \newcommand\at@begin@omgroup[3][]{} \addmetakey{omdoc@sect}{name} \addmetakey[false]{omdoc@sect}{clear}[true] @@ -59,24 +70,29 @@ \if@@num% numbering not overridden by frontmatter, etc. \ifx\omdoc@sect@num\@true\omgroup@num{#2}{#3}\else\omgroup@nonum{#2}{#3}\fi% \def\current@section@level{\omdoc@sect@name}% -\else\omgroup@nonum{#2}{#3}\fi} -\newcommand\omgroup@redefine@addtocontents[1]{\edef\@@import{#1}% -\@for\@I:=\@@import\do{\edef\@path{\csname module@\@I @path\endcsname}% -\@ifundefined{tf@toc}\relax{\protected@write\tf@toc{}{\string\@requiremodules{\@path}{sms}}}} +\else\omgroup@nonum{#2}{#3}% +\fi}% if@@num +\newcommand\omgroup@redefine@addtocontents[1]{% +\edef\@@import{#1}% +\@for\@I:=\@@import\do{% +\edef\@path{\csname module@\@I @path\endcsname}% +\@ifundefined{tf@toc}\relax% + {\protected@write\tf@toc{}{\string\@requiremodules{\@path}{sms}}}} \ifx\hyper@anchor\@undefined% hyperref.sty loaded? \def\addcontentsline##1##2##3{% \addtocontents{##1}{\protect\contentsline{##2}{\string\withusedmodules{#1}{##3}}{\thepage}}} -\else\def\addcontentsline##1##2##3{% +\else% hyperref.sty not loaded +\def\addcontentsline##1##2##3{% \addtocontents{##1}{\protect\contentsline{##2}{\string\withusedmodules{#1}{##3}}{\thepage}{\@currentHref}}}% \fi}% hypreref.sty loaded? \newenvironment{omgroup}[2][]% keys, title {\metasetkeys{omgroup}{#1}\sref@target% \ifx\omgroup@display\st@flow\@@numfalse\fi -\if@frontmatter\@@numfalse\fi +\if@mainmatter\else\@@numfalse\fi \ifx\omgroup@loadmodules\@true% \omgroup@redefine@addtocontents{\@ifundefined{mod@id}\used@modules% {\@ifundefined{module@\mod@id @path}{\used@modules}\mod@id}}\fi% -\advance\section@level by 1 +\advance\section@level by 1\relax% \ifcase\section@level% \or\omdoc@sectioning[name=Part,clear,num]{part}{#2}% \or\omdoc@sectioning[name=Chapter,clear,num]{chapter}{#2}% @@ -89,7 +105,7 @@ \at@begin@omgroup[#1]\section@level{#2}}% for customization {\advance\section@level by -1} \providecommand\printindex{\IfFileExists{\jobname.ind}{\input{\jobname.ind}}{}} -\ifshow@ignores +\ifomdoc@sty@showignores \addmetakey{ignore}{type} \addmetakey{ignore}{comment} \newenvironment{ignore}[1][] @@ -99,13 +115,15 @@ \providecommand{\lxDocumentID}[1]{}% \def\LXMID#1#2{\expandafter\gdef\csname xmarg#1\endcsname{#2}\csname xmarg#1\endcsname} \def\LXMRef#1{\csname xmarg#1\endcsname} - \long\def\STRlabel#1#2{\STRlabeldef{#1}{#2}{#2}} \newcommand\STRcopy[2][]{\expandafter\ifx\csname STR@#2\endcsname\relax \message{STR warning: reference #2 undefined!} \else\csname STR@#2\endcsname\fi} \newcommand\STRsemantics[3][]{#2\def\@test{#1}\ifx\@test\@empty\STRlabeldef{#1}{#2}\fi} \def\STRlabeldef#1{\expandafter\gdef\csname STR@#1\endcsname} +\newcommand\setSGvar[1]{\@namedef{sTeX@Gvar@#1}} +\newcommand\useSGvar[1]{\@nameuse{sTeX@Gvar@#1}} +\newcommand\ifSGvar[3]{\def\@test{#2}\expandafter\ifx\csname sTeX@Gvar@#1\endcsname\@test #3\fi} \def\black#1{\textcolor{black}{#1}} \def\gray#1{\textcolor{gray}{#1}} \def\blue#1{\textcolor{blue}{#1}} |