Skip to content

Commit

Permalink
added rendering of zmagnitude and integer power
Browse files Browse the repository at this point in the history
  • Loading branch information
SKolodynski committed Dec 26, 2024
1 parent c6cdaa4 commit 9b68790
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion isar2html2.0/src/isar2html/Export2Html.fs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(*
This file is part of isar2html2.0 - a tool for rendering IsarMathLib
theories in in HTML.
Copyright (C) 2022-2023 Slawomir Kolodynski
Copyright (C) 2022-2024 Slawomir Kolodynski
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
Expand Down
16 changes: 15 additions & 1 deletion isar2html2.0/src/isar2html/IsarSym2Latex.fs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,24 @@ namespace iml
if args[1].Length = 1 then args[1]+"^{"+args[0]+"}"
else "("+args[1]+")"+"^{"+args[0]+"}"

/// expands integer power in the same way as the natural power,
/// i.e. powz(n,x) --> x^n
let macroPowz = macroPow

/// macro that expands zmagnitude(z) --> |z|_N
let macroZmagnitude (args:string array) :string =
if args[0].Length = 1 then "| "+args[0]+"|\\<^isub>N "
else "\\left| "+args[0]+" \\right|\\<^isub>N "


/// list of macros to be expanded, the first string is macro name,
/// the second is the template
let macros : (string*((string array -> string))) array =
[| "Binom", macroBinom;
"pow",macroPow|]
"pow", macroPow;
"powz", macroPowz;
"zmagnitude", macroZmagnitude |]

/// list of translations from Isar symbols to LaTeX symbols
// TODO: read from a file maybe?
Expand All @@ -43,8 +55,10 @@ namespace iml
("%","\\%")
("$#","\\$\\!\\#\\!")
("$+","\\ \\$\\!+\\ ")
("$*","\\ \\$\\!*\\ ")
("$-","\\ \\$\\!-\\!")
("$- ","\\ \\$\\!-\\ ")
("$\\leq ","\\ \\$\\!\\leq\\ ")
// ("$", "\\ \\$ ")
("\\<longrightarrow>", "\\longrightarrow ")
(".", ".\\ ")
Expand Down
1 change: 0 additions & 1 deletion isar2html2.0/src/isar2html/isar2html.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<Compile Include="IMLP_datatypes.fs" />
<Compile Include="ProcessThys.fs" />
<Compile Include="Export2Html.fs" />
<Compile Include="IMLP_datatypes.fs" />
<Compile Include="IMLParser.fs" />
<Compile Include="Program.fs" />
</ItemGroup>
Expand Down

0 comments on commit 9b68790

Please sign in to comment.