|
| 1 | +%% Copyright (C) 2018 The University of Sheffield |
| 2 | +%% 2018 The University of Paris-Sud |
| 3 | +%% 2019 The University of Exeter |
| 4 | +%% |
| 5 | +%% License: |
| 6 | +%% This program can be redistributed and/or modified under the terms |
| 7 | +%% of the LaTeX Project Public License Distributed from CTAN |
| 8 | +%% archives in directory macros/latex/base/lppl.txt; either |
| 9 | +%% version 1 of the License, or any later version. |
| 10 | +%% OR |
| 11 | +%% The 2-clause BSD-style license. |
| 12 | +%% |
| 13 | +%% SPDX-License-Identifier: LPPL-1.0+ OR BSD-2-Clause |
| 14 | + |
| 15 | +\NeedsTeXFormat{LaTeX2e}\relax |
| 16 | +\ProvidesPackage{DOF-core} |
| 17 | + [0000/00/00 Unreleased v0.0.0+% |
| 18 | + Document-Type Support Framework for Isabelle.] |
| 19 | + |
| 20 | +\RequirePackage{keycommand} |
| 21 | +\RequirePackage{environ} |
| 22 | +\RequirePackage{graphicx} |
| 23 | +\RequirePackage{xspace} |
| 24 | +\RequirePackage{etoolbox} |
| 25 | +\RequirePackage{fp} |
| 26 | + |
| 27 | +\newcommand{\isadof}{Isabelle/DOF\xspace} |
| 28 | + |
| 29 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 30 | +% begin: newcommand wrapper |
| 31 | +\newcommand\newisadof[1]{\expandafter\newkeycommand\csname isaDof.#1\endcsname}% |
| 32 | +\newcommand\renewisadof[1]{\expandafter\renewkeycommand\csname isaDof.#1\endcsname}% |
| 33 | +\newcommand\provideisadof[1]{\expandafter\providekeycommand\csname isaDof.#1\endcsname}% |
| 34 | +% end: newcommand wrapper |
| 35 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 36 | + |
| 37 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 38 | +% begin: generic dispatcher |
| 39 | +\newkeycommand+[\|]\isaDof[env={UNKNOWN},label=,type={dummyT},args={}][1]{% |
| 40 | + \ifcsname isaDof.\commandkey{type}\endcsname% |
| 41 | + \csname isaDof.\commandkey{type}\endcsname% |
| 42 | + [label=\commandkey{label},\commandkey{args}]{#1}% |
| 43 | + \else\relax\fi% |
| 44 | + \ifcsname isaDof.\commandkey{env}.\commandkey{type}\endcsname% |
| 45 | + \csname isaDof.\commandkey{env}.\commandkey{type}\endcsname% |
| 46 | + [label=\commandkey{label},\commandkey{args}]{#1}% |
| 47 | + \else% |
| 48 | + \message{Isabelle/DOF: Using default LaTeX representation for concept % |
| 49 | + "\commandkey{env}.\commandkey{type}".}% |
| 50 | + \ifcsname isaDof.\commandkey{env}\endcsname% |
| 51 | + \csname isaDof.\commandkey{env}\endcsname% |
| 52 | + [label=\commandkey{label}]{#1}% |
| 53 | + \else% |
| 54 | + \errmessage{Isabelle/DOF: No LaTeX representation for concept % |
| 55 | + "\commandkey{env}.\commandkey{type}" defined and no default % |
| 56 | + definition for "\commandkey{env}" available either.}% |
| 57 | + \fi% |
| 58 | + \fi% |
| 59 | +} |
| 60 | +% end: generic dispatcher |
| 61 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 62 | + |
| 63 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 64 | +% begin: text*-dispatcher |
| 65 | +\NewEnviron{isamarkuptext*}[1][]{\isaDof[env={text},#1]{\BODY}} |
| 66 | +% end: text*-dispatcher |
| 67 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 68 | + |
| 69 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 70 | +% begin: chapter*-dispatcher |
| 71 | +\NewEnviron{isamarkupchapter*}[1][]{\isaDof[env={chapter},#1]{\BODY}} |
| 72 | +% end: chapter*-dispatcher |
| 73 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 74 | + |
| 75 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 76 | +% begin: section*-dispatcher |
| 77 | +\NewEnviron{isamarkupsection*}[1][]{\isaDof[env={section},#1]{\BODY}} |
| 78 | +% end: section*-dispatcher |
| 79 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 80 | + |
| 81 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 82 | +% begin: subsection*-dispatcher |
| 83 | +\NewEnviron{isamarkupsubsection*}[1][]{\isaDof[env={subsection},#1]{\BODY}} |
| 84 | +% end: subsection*-dispatcher |
| 85 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 86 | + |
| 87 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 88 | +% begin: subsubsection*-dispatcher |
| 89 | +\NewEnviron{isamarkupsubsubsection*}[1][]{\isaDof[env={subsubsection},#1]{\BODY}} |
| 90 | +% end: subsubsection*-dispatcher |
| 91 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 92 | + |
| 93 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 94 | +% begin: paragraph*-dispatcher |
| 95 | +\NewEnviron{isamarkupparagraph*}[1][]{\isaDof[env={paragraph},#1]{\BODY}} |
| 96 | +% end: paragraph*-dispatcher |
| 97 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 98 | + |
| 99 | + |
| 100 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 101 | +% begin: text default implementation |
| 102 | +\newisadof{text}[label=,type=][1]{% |
| 103 | + \begin{isamarkuptext}\label{\commandkey{label}}% |
| 104 | + #1 |
| 105 | + \end{isamarkuptext}% |
| 106 | +} |
| 107 | +% end: text default implementation |
| 108 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 109 | + |
| 110 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 111 | +% begin: chapter/section default implementations |
| 112 | +\newisadof{chapter}[label=,type=][1]{% |
| 113 | + \isamarkupfalse\isamarkupchapter{#1}\label{\commandkey{label}}\isamarkuptrue% |
| 114 | +} |
| 115 | +\newisadof{section}[label=,type=][1]{% |
| 116 | + \isamarkupfalse\isamarkupsection{#1}\label{\commandkey{label}}\isamarkuptrue% |
| 117 | +} |
| 118 | +\newisadof{subsection}[label=,type=][1]{% |
| 119 | + \isamarkupfalse\isamarkupsubsection{#1}\label{\commandkey{label}}\isamarkuptrue% |
| 120 | +} |
| 121 | +\newisadof{subsubsection}[label=,type=][1]{% |
| 122 | + \isamarkupfalse\isamarkupsubsubsection{#1}\label{\commandkey{label}}\isamarkuptrue% |
| 123 | +} |
| 124 | +\newisadof{paragraph}[label=,type=][1]{% |
| 125 | + \isamarkupfalse\isamarkupparagraph{#1}\label{\commandkey{label}}\isamarkuptrue% |
| 126 | +} |
| 127 | +% end: chapter/section default implementations |
| 128 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 129 | + |
| 130 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 131 | +% begin: label and ref |
| 132 | +\newisadof{label}[label=,type=][1]{\label{#1}} |
| 133 | +\newisadof{ref}[label=,type=][1]{\autoref{#1}} |
| 134 | +% end: label and ref |
| 135 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
0 commit comments