├── .gitignore ├── LICENSE ├── coqtheorem.sty ├── example-acmart.tex ├── example-amsthm.tex ├── example-lipics.tex ├── example-llncs.tex ├── example-ntheorem.tex └── example-svjour3.tex /.gitignore: -------------------------------------------------------------------------------- 1 | ## Core latex/pdflatex auxiliary files: 2 | *.aux 3 | *.lof 4 | *.log 5 | *.lot 6 | *.fls 7 | *.out 8 | *.toc 9 | *.fmt 10 | *.fot 11 | *.cb 12 | *.cb2 13 | 14 | ## Intermediate documents: 15 | *.dvi 16 | *-converted-to.* 17 | # these rules might exclude image files for figures etc. 18 | # *.ps 19 | # *.eps 20 | # *.pdf 21 | 22 | ## Bibliography auxiliary files (bibtex/biblatex/biber): 23 | *.bbl 24 | *.bcf 25 | *.blg 26 | *-blx.aux 27 | *-blx.bib 28 | *.brf 29 | *.run.xml 30 | 31 | ## Build tool auxiliary files: 32 | *.fdb_latexmk 33 | *.synctex 34 | *.synctex.gz 35 | *.synctex.gz(busy) 36 | *.pdfsync 37 | 38 | ## Auxiliary and intermediate files from other packages: 39 | # algorithms 40 | *.alg 41 | *.loa 42 | 43 | # achemso 44 | acs-*.bib 45 | 46 | # amsthm 47 | *.thm 48 | 49 | # beamer 50 | *.nav 51 | *.snm 52 | *.vrb 53 | 54 | # cprotect 55 | *.cpt 56 | 57 | # fixme 58 | *.lox 59 | 60 | #(r)(e)ledmac/(r)(e)ledpar 61 | *.end 62 | *.?end 63 | *.[1-9] 64 | *.[1-9][0-9] 65 | *.[1-9][0-9][0-9] 66 | *.[1-9]R 67 | *.[1-9][0-9]R 68 | *.[1-9][0-9][0-9]R 69 | *.eledsec[1-9] 70 | *.eledsec[1-9]R 71 | *.eledsec[1-9][0-9] 72 | *.eledsec[1-9][0-9]R 73 | *.eledsec[1-9][0-9][0-9] 74 | *.eledsec[1-9][0-9][0-9]R 75 | 76 | # glossaries 77 | *.acn 78 | *.acr 79 | *.glg 80 | *.glo 81 | *.gls 82 | *.glsdefs 83 | 84 | # gnuplottex 85 | *-gnuplottex-* 86 | 87 | # hyperref 88 | *.brf 89 | 90 | # knitr 91 | *-concordance.tex 92 | # TODO Comment the next line if you want to keep your tikz graphics files 93 | *.tikz 94 | *-tikzDictionary 95 | 96 | # listings 97 | *.lol 98 | 99 | # makeidx 100 | *.idx 101 | *.ilg 102 | *.ind 103 | *.ist 104 | 105 | # minitoc 106 | *.maf 107 | *.mlf 108 | *.mlt 109 | *.mtc 110 | *.mtc[0-9] 111 | *.mtc[1-9][0-9] 112 | 113 | # minted 114 | _minted* 115 | *.pyg 116 | 117 | # morewrites 118 | *.mw 119 | 120 | # mylatexformat 121 | *.fmt 122 | 123 | # nomencl 124 | *.nlo 125 | 126 | # sagetex 127 | *.sagetex.sage 128 | *.sagetex.py 129 | *.sagetex.scmd 130 | 131 | # sympy 132 | *.sout 133 | *.sympy 134 | sympy-plots-for-*.tex/ 135 | 136 | # pdfcomment 137 | *.upa 138 | *.upb 139 | 140 | # pythontex 141 | *.pytxcode 142 | pythontex-files-*/ 143 | 144 | # thmtools 145 | *.loe 146 | 147 | # TikZ & PGF 148 | *.dpth 149 | *.md5 150 | *.auxlock 151 | 152 | # todonotes 153 | *.tdo 154 | 155 | # xindy 156 | *.xdy 157 | 158 | # xypic precompiled matrices 159 | *.xyc 160 | 161 | # endfloat 162 | *.ttt 163 | *.fff 164 | 165 | # Latexian 166 | TSWLatexianTemp* 167 | 168 | ## Editors: 169 | # WinEdt 170 | *.bak 171 | *.sav 172 | 173 | # Texpad 174 | .texpadtmp 175 | 176 | # Kile 177 | *.backup 178 | 179 | # KBibTeX 180 | *~[0-9]* 181 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Yannick Forster 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /coqtheorem.sty: -------------------------------------------------------------------------------- 1 | \ProvidesPackage{coqtheorem} 2 | \RequirePackage{xparse} 3 | \RequirePackage{hyperref} 4 | \RequirePackage{mfirstuc} 5 | \RequirePackage{etoolbox} 6 | \RequirePackage{suffix} 7 | 8 | 9 | \DeclareOption{nolabels}{ 10 | \def\nolabels{} 11 | } 12 | \DeclareOption{countsame}{ 13 | \def\countsame{} 14 | } 15 | \DeclareOption{hidelinks}{ 16 | \def\hidecoqtheoremlinks 17 | } 18 | \DeclareOption{nosections}{ 19 | \let\nocountsections\relax 20 | } 21 | \ProcessOptions\relax 22 | 23 | \newcommand{\setCoqFilename}[1]{\def\filename{#1}} 24 | \newcommand{\setBaseUrl}[1]{\def\baseurl#1} 25 | \setBaseUrl{{}} 26 | \setCoqFilename{} 27 | 28 | \ifcsdef{nolabels}{\newcommand{\insertlabel}[1]{}}{\newcommand{\insertlabel}[1]{\label{coq:#1}}} 29 | 30 | \ifcsdef{hidecoqtheoremlinks} 31 | {\newcommand{\coqlink}[2][]{{\hypersetup{hidelinks}\ifx{#1}\empty% 32 | #2\else{\href{\baseurl\filename.html\##1}{#2}}\fi}}} 33 | {\newcommand{\coqlink}[2][]{\ifx{#1}\empty% 34 | #2\else{\href{\baseurl\filename.html\##1}{#2}}\fi}} 35 | 36 | \@ifpackageloaded{paralist}{% 37 | \newcommand{\coqitem}[1][]{\stepcounter{enumi}\item[{\coqlink[#1]{\labelenumi}}]} 38 | }{% 39 | \@ifclassloaded{lipics-v2019} 40 | {\newcommand{\coqitem}[1][]{\stepcounter{enumi}\item[{\coqlink[#1]{\labelenumi}}]}} 41 | {\newcommand{\coqitem}[1][]{\stepcounter{enumi}\item[{\coqlink[#1]{\theenumi.}}]}} 42 | }% 43 | 44 | \newcommand*\ifcounter[1]{% 45 | \ifcsname c@#1\endcsname 46 | \expandafter\@firstoftwo 47 | \else 48 | \expandafter\@secondoftwo 49 | \fi 50 | } 51 | 52 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 53 | %%%%% If the loaded class is Springer's LLNCS 54 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 55 | 56 | \@ifclassloaded{llncs} 57 | { 58 | \patchcmd{\@spthm}{\phantomsection}{}{}{} 59 | \def\ok{} 60 | 61 | \let\theorem\relax 62 | \let\lemma\relax 63 | \let\definition\relax 64 | \let\fact\relax 65 | \let\corollary\relax 66 | 67 | \def\theoremname{} 68 | \def\showname{} 69 | \def\theoremtype{} 70 | 71 | \spnewtheorem{dummy}{}{}{} 72 | 73 | \newcommand{\genFancyTheoremEnvironment}[1]{% 74 | \expandafter\providecommand\csname #1autorefname\endcsname{\capitalisewords{#1}} 75 | \expandafter\newcommand\csname #1Auxautorefname\endcsname{\csname #1autorefname\endcsname} 76 | \expandafter\newcommand\csname #1AuxCoqautorefname\endcsname{\csname #1autorefname\endcsname} 77 | 78 | \ifcounter{#1}{}{\newcounter{#1}} 79 | 80 | 81 | \@ifpackageloaded{cleveref}{ 82 | \crefformat{#1AuxCoq}{\capitalisewords{#1}~##2##1##3} 83 | }{} 84 | 85 | \spnewtheorem{#1Aux}[\ifcsdef{countsame}{dummy}{#1}]{}{\bfseries\theoremtype}{{\bfseries\showname}\itshape} 86 | \spnewtheorem{#1AuxCoq}[#1Aux]{}{\bfseries \coqlink[\theoremname]{\theoremtype}}{{\bfseries\showname}\itshape\insertlabel{\theoremname}} 87 | \NewDocumentEnvironment{#1}{oo}% 88 | {% 89 | \IfValueT{##1}{\ifx&##1&% 90 | \else\def\showname{\hspace{-0.6em} (##1)~}\fi}% 91 | \def\theoremtype{\capitalisewords{#1}}% 92 | \IfValueTF{##2}{\def\theoremname{##2}\begin{#1AuxCoq}}{\begin{#1Aux}}% 93 | }% 94 | {\IfValueTF{##2}{\end{#1AuxCoq}}{\end{#1Aux}}\def\theoremname{}\def\showname{}}} 95 | 96 | \genFancyTheoremEnvironment{theorem} 97 | \genFancyTheoremEnvironment{lemma} 98 | \genFancyTheoremEnvironment{definition} 99 | \genFancyTheoremEnvironment{fact} 100 | \genFancyTheoremEnvironment{corollary} 101 | } 102 | {} 103 | 104 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 105 | %%%%% If the loaded class is Springer's svjour3 106 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 107 | 108 | \@ifclassloaded{svjour3} 109 | { 110 | \patchcmd{\@spthm}{\phantomsection}{}{}{} 111 | \def\ok{} 112 | 113 | \let\theorem\relax 114 | \let\lemma\relax 115 | \let\definition\relax 116 | \let\fact\relax 117 | \let\corollary\relax 118 | 119 | \def\theoremname{} 120 | \def\showname{} 121 | \def\theoremtype{} 122 | 123 | \ifcsdef{nocountsections} 124 | {\spnewtheorem{dummy}{}{}{}} 125 | {\spnewtheorem{dummy}{}[section]{}{}} 126 | 127 | 128 | \newcommand{\genFancyTheoremEnvironment}[1]{% 129 | \expandafter\providecommand\csname #1autorefname\endcsname{\capitalisewords{#1}} 130 | \expandafter\newcommand\csname #1Auxautorefname\endcsname{\csname #1autorefname\endcsname} 131 | \expandafter\newcommand\csname #1AuxCoqautorefname\endcsname{\csname #1autorefname\endcsname} 132 | 133 | \ifcounter{#1}{}{\newcounter{#1}} 134 | 135 | 136 | \@ifpackageloaded{cleveref}{ 137 | \crefformat{#1AuxCoq}{#1~##2##1##3} 138 | \crefformat{#1Aux}{#1~##2##1##3} 139 | }{} 140 | 141 | \ifcsdef{countsame} 142 | { 143 | \spnewtheorem{#1Aux}[dummy]{}{\bfseries\theoremtype}{{\bfseries\showname}\itshape}{}{} 144 | \spnewtheorem{#1AuxCoq}[dummy]{}{\bfseries \coqlink[\theoremname]{\theoremtype}}{{\bfseries\showname}\itshape\insertlabel{\theoremname}} 145 | } 146 | { 147 | \ifcsdef{nocountsections} 148 | { 149 | \spnewtheorem{#1Aux}[#1]{}{\bfseries\theoremtype}{{\bfseries\showname}\itshape}{}{} 150 | \spnewtheorem{#1AuxCoq}[#1Aux]{}{\bfseries \coqlink[\theoremname]{\theoremtype}}{{\bfseries\showname}\itshape\insertlabel{\theoremname}} 151 | } 152 | { 153 | \spnewtheorem{#1Aux}{}[section]{\bfseries\theoremtype}{{\bfseries\showname}\itshape}{}{} 154 | \spnewtheorem{#1AuxCoq}[#1Aux]{}{\bfseries \coqlink[\theoremname]{\theoremtype}}{{\bfseries\showname}\itshape\insertlabel{\theoremname}} 155 | } 156 | } 157 | 158 | \NewDocumentEnvironment{#1}{oo}% 159 | {% 160 | \IfValueT{##1}{\ifx&##1&% 161 | \else\def\showname{\hspace{-0.6em} (##1)~}\fi}% 162 | \def\theoremtype{\capitalisewords{#1}}% 163 | \IfValueTF{##2}{\def\theoremname{##2}\begin{#1AuxCoq}}{\begin{#1Aux}}% 164 | }% 165 | {\IfValueTF{##2}{\end{#1AuxCoq}}{\end{#1Aux}}\def\theoremname{}\def\showname{}}} 166 | 167 | \newcommand{\genFancyTheoremEnvironmentNoIt}[1]{% 168 | \expandafter\providecommand\csname #1autorefname\endcsname{\capitalisewords{#1}} 169 | \expandafter\newcommand\csname #1Auxautorefname\endcsname{\csname #1autorefname\endcsname} 170 | \expandafter\newcommand\csname #1AuxCoqautorefname\endcsname{\csname #1autorefname\endcsname} 171 | 172 | \ifcounter{#1}{}{\newcounter{#1}} 173 | 174 | 175 | \@ifpackageloaded{cleveref}{ 176 | \crefformat{#1AuxCoq}{#1~##2##1##3} 177 | \crefformat{#1Aux}{#1~##2##1##3} 178 | }{} 179 | 180 | \ifcsdef{countsame} 181 | { 182 | \spnewtheorem{#1Aux}[dummy]{}{\bfseries\theoremtype}{{\bfseries\showname}}{}{} 183 | \spnewtheorem{#1AuxCoq}[dummy]{}{\bfseries \coqlink[\theoremname]{\theoremtype}}{{\bfseries\showname}\insertlabel{\theoremname}} 184 | } 185 | { 186 | \ifcsdef{nocountsections} 187 | { 188 | \spnewtheorem{#1Aux}[#1]{}{\bfseries\theoremtype}{{\bfseries\showname}}{}{} 189 | \spnewtheorem{#1AuxCoq}[#1Aux]{}{\bfseries \coqlink[\theoremname]{\theoremtype}}{{\bfseries\showname}\insertlabel{\theoremname}} 190 | } 191 | { 192 | \spnewtheorem{#1Aux}{}[section]{\bfseries\theoremtype}{{\bfseries\showname}}{}{} 193 | \spnewtheorem{#1AuxCoq}[#1Aux]{}{\bfseries \coqlink[\theoremname]{\theoremtype}}{{\bfseries\showname}\insertlabel{\theoremname}} 194 | } 195 | } 196 | 197 | \NewDocumentEnvironment{#1}{oo}% 198 | {% 199 | \IfValueT{##1}{\ifx&##1&% 200 | \else\def\showname{\hspace{-0.6em} (##1)~}\fi}% 201 | \def\theoremtype{\capitalisewords{#1}}% 202 | \IfValueTF{##2}{\def\theoremname{##2}\begin{#1AuxCoq}}{\begin{#1Aux}}% 203 | }% 204 | {\IfValueTF{##2}{\end{#1AuxCoq}}{\end{#1Aux}}\def\theoremname{}\def\showname{}}} 205 | 206 | 207 | \genFancyTheoremEnvironment{theorem} 208 | \genFancyTheoremEnvironment{lemma} 209 | \genFancyTheoremEnvironmentNoIt{definition} 210 | \genFancyTheoremEnvironment{fact} 211 | \genFancyTheoremEnvironment{corollary}} 212 | {} 213 | 214 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 215 | %%%%% If the loaded class is Leibniz Center's LIPIcs 216 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 217 | 218 | \@ifclassloaded{lipics-v2019} 219 | { 220 | \def\ok{} 221 | 222 | \thm@headfont{% 223 | \textcolor{darkgray}{$\blacktriangleright$}\nobreakspace\sffamily\bfseries} 224 | \def\th@remark{% 225 | \thm@headfont{% 226 | \textcolor{darkgray}{$\blacktriangleright$}\nobreakspace\sffamily}% 227 | \normalfont % body font 228 | \thm@preskip\topsep \divide\thm@preskip\tw@ 229 | \thm@postskip\thm@preskip 230 | } 231 | \def\@endtheorem{\endtrivlist}%\@endpefalse 232 | 233 | \def\theoremname{} 234 | 235 | \let\theorem\relax 236 | \let\lemma\relax 237 | \let\corollary\relax 238 | \let\definition\relax 239 | \let\proposition\relax 240 | \let\example\relax 241 | \let\remark\relax 242 | 243 | \newtheoremstyle{coqtheorem}% 244 | {}{}% 245 | {\itshape}{}% 246 | {\textcolor{darkgray}{$\blacktriangleright$}\nobreakspace\sffamily\bfseries}{.}% % Note that final punctuation is omitted. 247 | {.5em}{\coqlink[\theoremname]{\thmname{#1}\thmnumber{ #2}}\normalfont\sffamily\thmnote{ (#3)}} 248 | 249 | \theoremstyle{coqtheorem} 250 | \newtheorem{dummy}{} 251 | 252 | \newcommand{\genFancyTheoremEnvironment}[1]{% 253 | \expandafter\providecommand\csname #1autorefname\endcsname{\capitalisewords{#1}} 254 | \expandafter\newcommand\csname #1Auxautorefname\endcsname{\csname #1autorefname\endcsname} 255 | \expandafter\newcommand\csname #1AuxCoqautorefname\endcsname{\csname #1autorefname\endcsname} 256 | 257 | \@ifpackageloaded{cleveref}{ 258 | \crefformat{#1Aux}{{\capitalisewords{#1}}~##2##1##3} 259 | \Crefformat{#1Aux}{{\capitalisewords{#1}}~##2##1##3} 260 | }{} 261 | 262 | \newtheorem{#1Aux}[dummy]{\capitalisewords{#1}} 263 | 264 | \NewDocumentEnvironment{#1}{oo}% 265 | {% 266 | \IfValueT{##2}{\def\theoremname{##2}}% 267 | \IfValueTF{##1}{\ifx&##1&% 268 | \begin{#1Aux}[]% 269 | \else\begin{#1Aux}[##1]\fi}% 270 | {\begin{#1Aux}[]} 271 | \IfValueT{##2}{\insertlabel{##2}}% 272 | }% 273 | {\end{#1Aux}\def\theoremname{}}} 274 | 275 | \genFancyTheoremEnvironment{theorem} 276 | \genFancyTheoremEnvironment{lemma} 277 | \genFancyTheoremEnvironment{corollary} 278 | \genFancyTheoremEnvironment{fact} 279 | \genFancyTheoremEnvironment{definition} 280 | \genFancyTheoremEnvironment{proposition} 281 | \genFancyTheoremEnvironment{example} 282 | \genFancyTheoremEnvironment{remark} 283 | } 284 | { 285 | 286 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 287 | %%%%% If the loaded class is ACM's acmart 288 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 289 | 290 | \@ifclassloaded{acmart} 291 | { 292 | \def\ok{} 293 | \let\c@theorem\relax 294 | 295 | \let\theorem\relax 296 | \let\lemma\relax 297 | \let\corollary\relax 298 | % \let\theorem\relax 299 | % \let\c@theorem\relax 300 | % \let\lemma\relax 301 | % \let\corollary\relax 302 | 303 | \def\theoremname{} 304 | 305 | \newtheoremstyle{coqtheorem}% 306 | {.5\baselineskip\@plus.2\baselineskip 307 | \@minus.2\baselineskip}% space above 308 | {.5\baselineskip\@plus.2\baselineskip 309 | \@minus.2\baselineskip}% space below 310 | {\@acmplainbodyfont}% body font 311 | {\@acmplainindent}% indent amount 312 | {\@acmplainheadfont}% head font 313 | {.}% punctuation after head 314 | {.5em}% spacing after head 315 | {\coqlink[\theoremname]{\thmname{#1}\thmnumber{ #2}}\thmnote{ {\@acmplainnotefont(#3)}}}% head spec 316 | 317 | \theoremstyle{coqtheorem} 318 | \ifcsdef{nocountsections}{\newtheorem{dummy}{Dummy}}{\newtheorem{dummy}{Dummy}[section]} 319 | 320 | 321 | \NewDocumentCommand{\newcoqtheorem}{smm}{% 322 | \expandafter\providecommand\csname #2autorefname\endcsname{\capitalisewords{#2}} 323 | \expandafter\newcommand\csname #2Auxautorefname\endcsname{\csname #2autorefname\endcsname} 324 | \expandafter\newcommand\csname #2AuxCoqautorefname\endcsname{\csname #2autorefname\endcsname} 325 | 326 | 327 | \@ifpackageloaded{cleveref}{ 328 | \crefformat{#2Aux}{\capitalisewords{#2}~##2##1##3} 329 | }{} 330 | 331 | \newcounter{#2} 332 | \ifcsdef{countsame} 333 | { 334 | \IfBooleanTF{#1}{\newtheorem*{#2Aux}{#3}}{\newtheorem{#2Aux}[dummy]{#3}} 335 | } 336 | { 337 | \ifcsdef{nocountsections} 338 | { 339 | \IfBooleanTF{#1}{\newtheorem*{#2Aux}[#2]{#3}}{\newtheorem{#2Aux}[#2]{#3}} 340 | } 341 | { 342 | \IfBooleanTF{#1}{\newtheorem*{#2Aux}{#3}}{\newtheorem{#2Aux}{#3}[section]} 343 | } 344 | } 345 | 346 | \NewDocumentEnvironment{#2}{oo}% 347 | {% 348 | \IfValueT{##2}{\def\theoremname{##2}}% 349 | \IfValueTF{##1}{\ifx&##1&% 350 | \begin{#2Aux}[]% 351 | \else\begin{#2Aux}[##1]\fi}% 352 | {\begin{#2Aux}[]} 353 | \IfValueT{##2}{\insertlabel{##2}}% 354 | }% 355 | {\end{#2Aux}\def\theoremname{}}} 356 | } 357 | { 358 | 359 | 360 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 361 | %%%%% If no known class is loaded, but the amsthm package 362 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 363 | 364 | \@ifpackageloaded{amsthm}{ 365 | \def\ok{} 366 | \let\theorem\relax 367 | \let\c@theorem\relax 368 | \let\lemma\relax 369 | \let\corollary\relax 370 | 371 | \def\theoremname{} 372 | 373 | \newtheoremstyle{coqtheorem}% 374 | {}{}% 375 | {\itshape}{}% 376 | {\bfseries}{.}% % Note that final punctuation is omitted. 377 | {.5em}{\coqlink[\theoremname]{\thmname{#1}\thmnumber{ #2}}\normalfont\thmnote{ (#3)}} 378 | 379 | \theoremstyle{coqtheorem} 380 | \newtheorem{dummy}{} 381 | 382 | \newcommand{\newcoqtheorem}[2]{% 383 | \expandafter\providecommand\csname #1autorefname\endcsname{\capitalisewords{#1}} 384 | \expandafter\newcommand\csname #1Auxautorefname\endcsname{\csname #1autorefname\endcsname} 385 | \expandafter\newcommand\csname #1AuxCoqautorefname\endcsname{\csname #1autorefname\endcsname} 386 | \newcounter{#1} 387 | 388 | \@ifpackageloaded{cleveref}{ 389 | \crefformat{#1Aux}{\capitalisewords{#1}~##2##1##3} 390 | }{} 391 | 392 | \newtheorem{#1Aux}[\ifcsdef{countsame}{dummy}{#1}]{#2} 393 | \NewDocumentEnvironment{#1}{oo}% 394 | {% 395 | \IfValueT{##2}{\def\theoremname{##2}}% 396 | \IfValueTF{##1}{\ifx&##1&% 397 | \begin{#1Aux}[]% 398 | \else\begin{#1Aux}[##1]\fi}% 399 | {\begin{#1Aux}[]} 400 | \IfValueT{##2}{\insertlabel{##2}}% 401 | }% 402 | {\end{#1Aux}\def\theoremname{}}} 403 | } 404 | { 405 | % Fallthrough 406 | } 407 | } 408 | } 409 | 410 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 411 | %%%%% If no known class is loaded, but the ntheorem package 412 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 413 | 414 | 415 | \ifcsdef{ok} 416 | { 417 | 418 | } 419 | { 420 | % If no known class or package is loaded, load ntheorem 421 | \RequirePackage{ntheorem} 422 | \PackageWarning{coqtheorem}{No known class or package was loaded. Loading ntheorem}{} 423 | } 424 | \@ifpackageloaded{ntheorem} 425 | { 426 | \def\ok{} 427 | 428 | \newtheoremstyle{coqtheorem} 429 | {\linkableTheoremAux{##1}{##2}} 430 | {\linkableTheoremAux{##1}{##2}[##3]} 431 | \NewDocumentCommand\linkableTheoremAux{mmou\ignorespaces o} 432 | {\item[\hskip\labelsep \theorem@headerfont 433 | \IfValueTF{#5}{\coqlink[#5]{#1\ 434 | #2\IfValueT{#3}{\ifx&% 435 | \else\ (#3)\fi}{}}}{#1\ #2 \IfValueT{#3}{(#3)}{}} 436 | \theorem@separator]#4\ignorespaces\IfValueT{#5}{\insertlabel{#5}}} 437 | }{} 438 | -------------------------------------------------------------------------------- /example-acmart.tex: -------------------------------------------------------------------------------- 1 | \documentclass[sigplan]{acmart} 2 | \usepackage{coqtheorem} 3 | 4 | \theoremstyle{coqtheorem} 5 | \newcoqtheorem{theorem}{Theorem} 6 | \newcoqtheorem{lemma}{Lemma} 7 | \newcoqtheorem{fact}{Fact} 8 | 9 | % Note that the double braces are mandatory 10 | \setBaseUrl{{http://www.ps.uni-saarland.de/courses/cl-ss16/LectureNotes/html/}} 11 | \setCoqFilename{LectureNotes.Base} 12 | 13 | \begin{document} 14 | 15 | \section{Bla} 16 | 17 | % Leave the name field empty if you do not want a name 18 | \begin{theorem}[][DM_or] 19 | DM for or holds. 20 | \end{theorem} 21 | 22 | \begin{lemma}[Name] 23 | Some lemma that is not in Coq. 24 | \end{lemma} 25 | 26 | \setCoqFilename{LectureNotes.Chapter1} 27 | \begin{fact}[Boolean and is commutative][andb_com] 28 | Commutativity for and holds. 29 | \end{fact} 30 | 31 | \begin{fact}~ 32 | \begin{enumerate} 33 | \coqitem[plus_O] $x + 0 = x$ 34 | \coqitem[plus_S] $x + S y = S (x + y)$ 35 | \item Thus $x + y = y + x$ (\coqlink[plus_com]{Link}) 36 | \end{enumerate} 37 | \end{fact} 38 | 39 | In Theorem \ref{coq:DM_or} we say something about logical or, in 40 | Fact~\ref{coq:andb_com} something about boolean and. 41 | 42 | \end{document} 43 | 44 | %%% Local Variables: 45 | %%% mode: latex 46 | %%% TeX-master: t 47 | %%% End: 48 | -------------------------------------------------------------------------------- /example-amsthm.tex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | % Remove the option hidelinks to make link boxes visible 3 | \usepackage[hidelinks]{hyperref} 4 | \usepackage{amsthm} 5 | \usepackage{coqtheorem} 6 | 7 | \theoremstyle{coqtheorem} 8 | \newcoqtheorem{theorem}{Theorem} 9 | \newcoqtheorem{lemma}{Lemma} 10 | \newcoqtheorem{corollary}{Corollary} 11 | \newcoqtheorem{fact}{Fact} 12 | 13 | % Note that the double braces are mandatory 14 | \setBaseUrl{{http://www.ps.uni-saarland.de/courses/cl-ss16/LectureNotes/html/}} 15 | \setCoqFilename{LectureNotes.Base} 16 | 17 | \begin{document} 18 | 19 | % Leave the name field empty if you do not want a name 20 | \begin{theorem}[][DM_or] 21 | DM for or holds. 22 | \end{theorem} 23 | 24 | \begin{lemma}[Name] 25 | Some lemma that is not in Coq. 26 | \end{lemma} 27 | 28 | \setCoqFilename{LectureNotes.Chapter1} 29 | \begin{lemma}[Boolean and is commutative][andb_com] 30 | Commutativity for and holds. 31 | \end{lemma} 32 | 33 | \begin{fact}~ 34 | \begin{enumerate} 35 | \coqitem[plus_O] $x + 0 = x$ 36 | \coqitem[plus_S] $x + S y = S (x + y)$ 37 | \item Thus $x + y = y + x$ (\coqlink[plus_com]{Link}) 38 | \end{enumerate} 39 | \end{fact} 40 | 41 | In Theorem \ref{coq:DM_or} we say something about logical or, in 42 | Fact~\ref{coq:andb_com} something about boolean and. 43 | 44 | \end{document} 45 | 46 | 47 | 48 | %%% Local Variables: 49 | %%% mode: latex 50 | %%% TeX-master: t 51 | %%% End: 52 | -------------------------------------------------------------------------------- /example-lipics.tex: -------------------------------------------------------------------------------- 1 | \documentclass[a4paper,UKenglish,cleveref]{lipics-v2019} 2 | % Remove the option hidelinks to make link boxes visible 3 | \usepackage[countsame]{coqtheorem} 4 | \usepackage{cleveref} 5 | 6 | % Note that the double braces are mandatory 7 | \setBaseUrl{{http://www.ps.uni-saarland.de/courses/cl-ss16/LectureNotes/html/}} 8 | \setCoqFilename{LectureNotes.Base} 9 | 10 | \begin{document} 11 | 12 | % Leave the name field empty if you do not want a name 13 | \begin{theorem}[][DM_or] 14 | DM for or holds. 15 | \end{theorem} 16 | 17 | \begin{lemma}[Name] 18 | Some lemma that is not in Coq. 19 | \end{lemma} 20 | 21 | \setCoqFilename{LectureNotes.Chapter1} 22 | \begin{lemma}[Boolean and is commutative][andb_com] 23 | Commutativity for and holds. 24 | \end{lemma} 25 | 26 | \begin{lemma} 27 | \begin{enumerate} 28 | \coqitem[plus_O] $x + 0 = x$ 29 | \coqitem[plus_S] $x + S y = S (x + y)$ 30 | \item Thus $x + y = y + x$ (\coqlink[plus_com]{Link}) 31 | \end{enumerate} 32 | \end{lemma} 33 | 34 | \begin{align*} 35 | x = x 36 | \end{align*} 37 | 38 | In Theorem \ref{coq:DM_or} we say something about logical or, in 39 | \Cref{coq:andb_com} something about boolean and. 40 | 41 | \end{document} 42 | 43 | 44 | 45 | %%% Local Variables: 46 | %%% mode: latex 47 | %%% TeX-master: t 48 | %%% End: 49 | -------------------------------------------------------------------------------- /example-llncs.tex: -------------------------------------------------------------------------------- 1 | \documentclass{llncs} 2 | % Remove the option hidelinks to make link boxes visible 3 | \usepackage[hidelinks]{hyperref} 4 | \usepackage{cleveref} 5 | \usepackage[countsame]{coqtheorem} 6 | 7 | % Note that the double braces are mandatory 8 | \setBaseUrl{{http://www.ps.uni-saarland.de/courses/cl-ss16/LectureNotes/html/}} 9 | \setCoqFilename{LectureNotes.Base} 10 | 11 | \begin{document} 12 | 13 | % Leave the name field empty if you do not want a name 14 | \begin{theorem}[][DM_or] 15 | DM for or holds. 16 | \end{theorem} 17 | 18 | \begin{lemma}[Name] 19 | Some lemma that is not in Coq. 20 | \end{lemma} 21 | 22 | \setCoqFilename{LectureNotes.Chapter1} 23 | \begin{fact}[Boolean and is commutative][andb_com] 24 | Commutativity for and holds. 25 | \end{fact} 26 | 27 | \begin{fact}~ 28 | \begin{enumerate} 29 | \coqitem[plus_O] $x + 0 = x$ 30 | \coqitem[plus_S] $x + S y = S (x + y)$ 31 | \item Thus $x + y = y + x$ (\coqlink[plus_com]{Link}) 32 | \end{enumerate} 33 | \end{fact} 34 | 35 | In \cref{coq:DM_or} we say something about logical or, in 36 | \autoref{coq:andb_com} something about boolean and. 37 | 38 | \end{document} 39 | 40 | 41 | 42 | %%% Local Variables: 43 | %%% mode: latex 44 | %%% TeX-master: t 45 | %%% End: 46 | -------------------------------------------------------------------------------- /example-ntheorem.tex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | 3 | \usepackage{ntheorem} 4 | \usepackage[hidelinks]{coqtheorem} 5 | 6 | \theoremstyle{coqtheorem} 7 | \newtheorem{theorem}{Theorem} 8 | \newtheorem{lemma}[theorem]{Lemma} 9 | \newtheorem{fact}[theorem]{Fact} 10 | 11 | % Note that the double braces are mandatory 12 | \setBaseUrl{{http://www.ps.uni-saarland.de/courses/cl-ss16/LectureNotes/html/}} 13 | \setCoqFilename{LectureNotes.Base} 14 | 15 | \begin{document} 16 | 17 | % Leave the name field empty if you do not want a name 18 | \begin{theorem}[][DM_or] 19 | DM for or holds. 20 | \end{theorem} 21 | 22 | \begin{lemma}[Name] 23 | Some lemma that is not in Coq. 24 | \end{lemma} 25 | 26 | \setCoqFilename{LectureNotes.Chapter1} 27 | \begin{fact}[Boolean and is commutative][andb_com] 28 | Commutativity for and holds. 29 | \end{fact} 30 | 31 | \begin{fact}~ 32 | \begin{enumerate} 33 | \coqitem[plus_O] $x + 0 = x$ 34 | \coqitem[plus_S] $x + S y = S (x + y)$ 35 | \item Thus $x + y = y + x$ (\coqlink[plus_com]{Link}) 36 | \end{enumerate} 37 | \end{fact} 38 | 39 | In Theorem \ref{coq:DM_or} we say something about logical or, in 40 | Fact~\ref{coq:andb_com} something about boolean and. 41 | 42 | \end{document} 43 | 44 | 45 | 46 | %%% Local Variables: 47 | %%% mode: latex 48 | %%% TeX-master: t 49 | %%% End: 50 | -------------------------------------------------------------------------------- /example-svjour3.tex: -------------------------------------------------------------------------------- 1 | \documentclass[envcountsame,envcountsect]{svjour3} 2 | 3 | % Remove the option hidelinks to make link boxes visible 4 | \usepackage[hidelinks]{hyperref} 5 | \usepackage{cleveref} 6 | \usepackage[countsame]{coqtheorem} 7 | 8 | % on svjour3, default is envcountsame and envcountsect 9 | % if you do not want envcountsmae, remove it from class and add nosections as option of coqtheorem 10 | % if you do not want envcountsect, remove it from class and remove countsame as option of coqtheorem 11 | 12 | % Note that the double braces are mandatory 13 | \setBaseUrl{{http://www.ps.uni-saarland.de/courses/cl-ss16/LectureNotes/html/}} 14 | \setCoqFilename{LectureNotes.Base} 15 | 16 | \begin{document} 17 | 18 | \section{Section A} 19 | 20 | % Leave the name field empty if you do not want a name 21 | \begin{theorem}[][DM_or] 22 | DM for or holds. 23 | \end{theorem} 24 | 25 | \begin{lemma}[Name] 26 | Some lemma that is not in Coq. 27 | \end{lemma} 28 | 29 | \section{Section B} 30 | 31 | \setCoqFilename{LectureNotes.Chapter1} 32 | \begin{fact}[Boolean and is commutative][andb_com] 33 | Commutativity for and holds. 34 | \end{fact} 35 | 36 | \begin{fact}~ 37 | \begin{enumerate} 38 | \coqitem[plus_O] $x + 0 = x$ 39 | \coqitem[plus_S] $x + S y = S (x + y)$ 40 | \item Thus $x + y = y + x$ (\coqlink[plus_com]{Link}) 41 | \end{enumerate} 42 | \end{fact} 43 | 44 | In \cref{coq:DM_or} we say something about logical or, in 45 | \autoref{coq:andb_com} something about boolean and. 46 | 47 | \end{document} 48 | 49 | 50 | 51 | %%% Local Variables: 52 | %%% mode: latex 53 | %%% TeX-master: t 54 | %%% End: 55 | --------------------------------------------------------------------------------