forked from OpenLogicProject/forallx-cam
-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathlatexml.sty
176 lines (158 loc) · 6.99 KB
/
latexml.sty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
% /=====================================================================\ %
% | latexml.sty | %
% | Style file for latexml documents | %
% |=====================================================================| %
% | Part of LaTeXML: | %
% | Public domain software, produced as part of work done by the | %
% | United States Government & not subject to copyright in the US. | %
% |---------------------------------------------------------------------| %
% | Bruce Miller <bruce.miller@nist.gov> %_% | %
% | http://dlmf.nist.gov/LaTeXML/ (o o) | %
% \=========================================================ooo==U==ooo=/ %
% You can conditionalize code for latexml or normal latex using this.
\newif\iflatexml\latexmlfalse
%======================================================================
\DeclareOption{ids}{}
\DeclareOption{noids}{}
\DeclareOption{comments}{}
\DeclareOption{nocomments}{}
\DeclareOption{profiling}{}
\DeclareOption{noprofiling}{}
\DeclareOption{mathparserspeculate}{}
\DeclareOption{nomathparserspeculate}{}
\DeclareOption{guesstabularheaders}{}
\DeclareOption{noguesstabularheaders}{}
% Just ignore unknown options, so that binding can evolve more easily.
\DeclareOption*{\PackageWarning{latexml}{option \CurrentOption\space ignored}}
\ProcessOptions
%======================================================================
% NOTE: Figure out where this should go.
% At least should define various `semantic enhancement' macros that
% authors using latexml might want.
% But, be careful not to step on the toes of other packages (naming scheme),
% Nor, to assume to much about what semantics authors might want.
% NOTE: Am I stepping on toes by including these here?
% Common markup junk for LaTeXML docs.
\providecommand{\XML}{\textsc{xml}}%
\providecommand{\SGML}{\textsc{sgml}}%
\providecommand{\HTML}{\textsc{html}}%
\providecommand{\XHTML}{\textsc{xhtml}}%
\providecommand{\XSLT}{\textsc{xslt}}%
\providecommand{\CSS}{\textsc{css}}%
\providecommand{\MathML}{\textsc{MathML}}%
\providecommand{\OpenMath}{OpenMath}%
\RequirePackage{url}
% Shorthand to present a URL the actual text (also linked in HTML)
% \URL[alternative text]{url}
\def\URL{\@ifnextchar[{\@URL}{\@@URL}}%]
%\def\@@URL{\begingroup\def\UrlLeft##1\UrlRight{\stepcounter{footnote}%
%[Footnote~\thefootnote\footnotetext{##1}]}\Url}
\def\@@URL{\begingroup\Url}
\def\@URL[#1]{#1\begingroup\def\UrlLeft##1\UrlRight{\footnote{\texttt{##1}}}\Url}
% The LaTeXML Logo.
\DeclareRobustCommand{\LaTeXML}{L\kern-.36em%
{\sbox\z@ T%
\vbox to\ht\z@{\hbox{\check@mathfonts
\fontsize\sf@size\z@
\math@fontsfalse\selectfont
A}%
\vss}%
}%
\kern-.15em%
% T\kern-.1667em\lower.5ex\hbox{E}\kern-.125em\relax
% {\tt XML}}
T\kern-.1667em\lower.4ex\hbox{E}\kern-0.05em\relax
{\scshape xml}}%
\providecommand{\LaTeXMLversion}{}
\providecommand{\LaTeXMLrevision}{}
\providecommand{\LaTeXMLfullversion}{\LaTeXML}
%======================================================================
% id related features
\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}
%======================================================================
% class related features
% Add a class to the constructed xml (ignored in latex)
\providecommand{\lxAddClass}[1]{}%
\providecommand{\lxWithClass}[2]{#2}%
\providecommand{\lxAddAnnotation}[1]{}%
\providecommand{\lxWithAnnotation}[2]{#2}%
%======================================================================
% links
\def\lxRef#1#2{#2}
%======================================================================
% Resources
\providecommand{\lxRequireResource}[2][]{}
%======================================================================
% Page customization
\def\lxKeywords#1{}
\RequirePackage{comment}
\def\lxContextTOC{}%
\excludecomment{lxNavbar}
\excludecomment{lxHeader}
\excludecomment{lxFooter}
%======================================================================
% Table beautification.
% Low-level support to mark column and row headers.
% This really calls for styling, but why should we get into that game?
% There are many other packages for that.
% To mark the table head/foot (table column headers)
% Put this before first table heading row
\def\lxBeginTableHead{}
% put this after the \\ ending the table heading.
\def\lxEndTableHead{}
% Ditto for table foot (last rows in table)
\def\lxBeginTableFoot{}
\def\lxEndTableFoot{}
% To mark an individual cell as a column header
\def\lxTableColumnHead{}
% To mark an individual cell as a row header
\def\lxTableRowHead{}
% Easy way to mark a whole column as row headers:
% \usepackage{array}
% then put this in the column spec
% >{\lxTableRowHead}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Declarative information for Mathematics
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%======================================================================
% Marking the type of particular instances of a symbol
% Expose other declarative macros
\providecommand{\lxFcn}[1]{#1}
\providecommand{\lxID}[1]{#1}
\providecommand{\lxPunct}[1]{#1}
\providecommand{\lxMathTweak}[2]{#2}
%======================================================================
% Math definining macro.
% Define a math function such that the TeX output is what you might
% expect, while providing the semantic hooks for generating useful xml.
% \lxDefMath{\cs}[nargs][optargs]{presentation}[declarations]
\providecommand{\lxDefMath}{\lx@defmath}%
\def\lx@defmath#1{%
\@ifnextchar[{\lx@defmath@a{#1}}{\lx@defmath@a{#1}[0]}}%
\def\lx@defmath@a#1[#2]{%
\@ifnextchar[{\lx@defmath@opt{#1}[#2]}{\lx@defmath@noopt{#1}[#2]}}%
\def\lx@defmath@opt#1[#2][#3]#4{%
\providecommand{#1}[#2][#3]{#4}%
\@ifnextchar[{\lx@@skipopt}{}}%
\def\lx@defmath@noopt#1[#2]#3{%
\providecommand{#1}[#2]{#3}%
\@ifnextchar[{\lx@@skipopt}{}}%
\def\lx@@skipopt[#1]{}%
% \lxDeclare[declarations]{match}
\newcommand{\lxDeclare}[2][]{\@bsphack\@esphack}%
% \lxDeclRef{label}
\newcommand{\lxRefDeclaration}[2][]{\@bsphack\@esphack}%
% NOTE: It would be good to incorporate Scoping into this macro.
% As defined, it obeys TeX's usual grouping scope.
% However, scoping by `module' (M.Kohlhase's approach) and/or
% `document' scoping could be useful.
% In module scoping, the definition is only available within a
% module environment that defines it, AND in other module envs
% that `use' it.
% In document scoping, the definition would only be available within
% the current sectional unit. I'm not sure the best way to achieve this
% within latex, itself, but have ideas about latexml...
% But, perhaps it is only the declarative aspects that are important to
% latexml...