Commit fd229bb0 authored by Dennis Müller's avatar Dennis Müller
Browse files

(partially) anonymized

parent 26824da8
package com.jazzpirate.ml
package com.fifom.ml
import com.jazzpirate.latex.commands.CommandObject
import com.jazzpirate.latex.syntax.LatexObject
import com.jazzpirate.stex.Tokenizer
import com.fifom.latex.commands.CommandObject
import com.fifom.latex.syntax.LatexObject
import com.fifom.stex.Tokenizer
import info.kwarc.mmt.api.utils.{JSONArray, JSONInt, JSONObject, JSONString}
object Labeller {
......
import com.jazzpirate.{latex, stex}
import com.jazzpirate.latex.{LaTeXProcessor, Normalize, Remove}
import com.jazzpirate.latex.bindings.Commands
import com.jazzpirate.latex.syntax.LatexFile
import com.jazzpirate.ml.Labeller
import com.jazzpirate.mmt.MyMMT
import com.jazzpirate.stex.{StexChecker, Tokenizer}
import com.jazzpirate.stex.bindings.StexCommands
import com.fifom.latex.{LaTeXProcessor, Normalize, Remove}
import com.fifom.latex.bindings.{Commands, Environments}
import com.fifom.latex.syntax.LatexFile
import com.fifom.ml.Labeller
import com.fifom.mmt.MyMMT
import com.fifom.stex.{StexChecker, Tokenizer}
import com.fifom.stex.bindings.StexCommands
import info.kwarc.mmt.api.utils.{File, JSONArray, JSONInt, JSONObject, JSONString}
val home = File("/home/jazzpirate/work/Scala/ML/data")
......@@ -16,7 +15,7 @@ val proc = new LaTeXProcessor
proc.addCommands(Commands.defaults:_*)
proc.addCommands(macros:_*)
proc.addCommands(StexCommands.default:_*)
proc.addEnvironments(latex.bindings.Environments.defaults:_*)
proc.addEnvironments(Environments.defaults:_*)
proc.addEnvironments(stex.bindings.Environments.defaults:_*)
val files = mmt.getsmglom()
......
......@@ -2,14 +2,15 @@ package com.jazzpirate
// import breeze.linalg.DenseVector
//import com.jazzpirate.glove.TFGloVe
import com.jazzpirate.latex.bindings.Commands
import com.jazzpirate.latex.{Expand, FileParser, LaTeXParser, LaTeXProcessor, Normalize, ParseError, Remove, StringParser}
import com.jazzpirate.latex.commands.{CommandObject, Environment, EnvironmentObject}
import com.jazzpirate.latex.syntax.{Comment, Latex, LatexFile, LatexObject, NoRef, Whitespace}
import com.jazzpirate.ml.Labeller
import com.jazzpirate.mmt.{Generator, MitM, MyMMT, Textbook}
import com.jazzpirate.stex.bindings.StexCommands
import com.jazzpirate.stex.{CheckSTeX, DesTeXify, Notations, STeX, StexChecker, SymdefMacro, Symdefs, Tokenizer, Verbalizer, bindings}
import com.fifom.latex
import com.fifom.latex.bindings.{Commands, Environments}
import com.fifom.latex.commands.{CommandObject, EnvironmentObject}
import com.fifom.latex.syntax.{Block, CommandToken, Latex, LatexFile, LatexObject, NoRef, Token, Whitespace}
import com.fifom.latex.{Expand, LaTeXProcessor, Normalize, ParseError, Remove, syntax}
import com.fifom.ml.Labeller
import com.fifom.mmt.{Generator, MitM, MyMMT, Textbook}
import com.fifom.stex.{STeX, StexChecker, SymdefMacro, Tokenizer, Verbalizer, bindings}
import com.fifom.stex.bindings.{Basics, Defis, StexCommands}
import scala.util.Try
//import com.jazzpirate.tensorflow.Matrix
......@@ -79,15 +80,15 @@ object Test {
proc.addCommands(Commands.defaults: _*)
proc.addCommands(macros: _*)
proc.addCommands(StexCommands.default: _*)
proc.addEnvironments(latex.bindings.Environments.defaults: _*)
proc.addEnvironments(stex.bindings.Environments.defaults: _*)
proc.addEnvironments(Environments.defaults: _*)
proc.addEnvironments(bindings.Environments.defaults: _*)
// SMGLOM ----------------------
val smgloms = mmt.getsmglom
val paragraphs = smgloms.map {f =>
val doc = proc.parse(f)
proc.expand(doc,Remove(stex.bindings.Basics.ednote) :: Normalize.cleanups ::: stex.bindings.Defis.all_defis.map(Expand),true).asInstanceOf[LatexFile]
proc.expand(doc,Remove(Basics.ednote) :: Normalize.cleanups ::: Defis.all_defis.map(Expand),true).asInstanceOf[LatexFile]
}
val smglom_string = paragraphs.map{p =>
Latex.print(p)
......@@ -104,7 +105,7 @@ object Test {
def expand(doci : File, relFile : File) : String = try {
val doc2 = proc.parse(doci)
val ndoc = proc.expand(doc2, Remove(stex.bindings.Basics.ednote) :: Normalize.cleanups ::: stex.bindings.Defis.all_defis.map(Expand), true).asInstanceOf[LatexFile]
val ndoc = proc.expand(doc2, Remove(bindings.Basics.ednote) :: Normalize.cleanups ::: bindings.Defis.all_defis.map(Expand), true).asInstanceOf[LatexFile]
val doc = Latex.print(Latex.normalize(ndoc :: Nil))
var i = 0
var ret = ""
......@@ -181,7 +182,7 @@ object Test {
val generated = synthesize(macros)
val synth_stex = generated.flatMap { s =>
val doc = proc.parse(s)
val ndoc = proc.expand(doc, Remove(stex.bindings.Basics.ednote) :: Normalize.cleanups ::: stex.bindings.Defis.all_defis.map(Expand), true).asInstanceOf[LatexFile]
val ndoc = proc.expand(doc, Remove(bindings.Basics.ednote) :: Normalize.cleanups ::: bindings.Defis.all_defis.map(Expand), true).asInstanceOf[LatexFile]
Latex.normalize(ndoc :: Nil)
}.mkString("\n")
......@@ -253,12 +254,12 @@ object Test {
proc.addCommands(macros:_*)
proc.addCommands(StexCommands.default:_*)
proc.addEnvironments(latex.bindings.Environments.defaults:_*)
proc.addEnvironments(stex.bindings.Environments.defaults:_*)
proc.addEnvironments(bindings.Environments.defaults:_*)
val files = mmt.getsmglom
val paragraphs = files.flatMap {f =>
val doc = proc.parse(f)
val ndoc = proc.expand(doc,Remove(stex.bindings.Basics.ednote) :: Normalize.cleanups,true).asInstanceOf[LatexFile]
val ndoc = proc.expand(doc,Remove(bindings.Basics.ednote) :: Normalize.cleanups,true).asInstanceOf[LatexFile]
Tokenizer.getParagraphs(ndoc)
}
val labelled = Labeller(paragraphs)
......@@ -322,7 +323,7 @@ object Test {
// proc.addCommands(macros: _*)
proc.addCommands(StexCommands.default: _*)
proc.addEnvironments(latex.bindings.Environments.defaults: _*)
proc.addEnvironments(stex.bindings.Environments.defaults: _*)
proc.addEnvironments(bindings.Environments.defaults: _*)
val donesfile=File("/home/jazzpirate/IfiCluster/done.txt")
var (donenum,dones) = if (donesfile.exists()) File.read(donesfile).split('\n').toList match {
......@@ -344,7 +345,7 @@ object Test {
if (start != -1 || end != -1) {
val fstring = string.slice(start+16,end) //.take(end).drop(start + 16)
val doc = proc.parse(fstring)
val ndoc = proc.expand(doc, Remove(stex.bindings.Basics.ednote) :: Normalize.cleanups ::: stex.bindings.Defis.all_defis.map(Expand), true).asInstanceOf[LatexFile]
val ndoc = proc.expand(doc, Remove(bindings.Basics.ednote) :: Normalize.cleanups ::: bindings.Defis.all_defis.map(Expand), true).asInstanceOf[LatexFile]
val nparas = Latex.normalize(Tokenizer.getParagraphs(ndoc))
nparas.foreach {p =>
......@@ -387,10 +388,10 @@ object Test {
proc.addCommands(macros: _*)
proc.addCommands(StexCommands.default: _*)
proc.addEnvironments(latex.bindings.Environments.defaults: _*)
proc.addEnvironments(stex.bindings.Environments.defaults: _*)
proc.addEnvironments(bindings.Environments.defaults: _*)
val synth_stex = strings.flatMap { s =>
val doc = proc.parse(s)
val ndoc = proc.expand(doc, Remove(stex.bindings.Basics.ednote) :: Normalize.cleanups ::: stex.bindings.Defis.all_defis.map(Expand), true).asInstanceOf[LatexFile]
val ndoc = proc.expand(doc, Remove(bindings.Basics.ednote) :: Normalize.cleanups ::: bindings.Defis.all_defis.map(Expand), true).asInstanceOf[LatexFile]
Latex.normalize(ndoc :: Nil)
}
......@@ -439,9 +440,9 @@ object Test {
proc.addCommands(macros: _*)
proc.addCommands(StexCommands.default: _*)
proc.addEnvironments(latex.bindings.Environments.defaults: _*)
proc.addEnvironments(stex.bindings.Environments.defaults: _*)
proc.addEnvironments(bindings.Environments.defaults: _*)
def norm(o : List[LatexObject]) = Latex.normalize(o.map(s => proc.expand(s, Remove(stex.bindings.Basics.ednote) :: Normalize.cleanups ::: stex.bindings.Defis.all_defis.map(Expand), true)))
def norm(o : List[LatexObject]) = Latex.normalize(o.map(s => proc.expand(s, Remove(bindings.Basics.ednote) :: Normalize.cleanups ::: bindings.Defis.all_defis.map(Expand), true)))
val synth_stex : List[LatexObject] = strings.flatMap { s =>
val doc = proc.parse(s)
......@@ -604,11 +605,11 @@ object Test {
proc.addCommands(macros:_*)
proc.addCommands(StexCommands.default:_*)
proc.addEnvironments(latex.bindings.Environments.defaults:_*)
proc.addEnvironments(stex.bindings.Environments.defaults:_*)
proc.addEnvironments(bindings.Environments.defaults:_*)
val synth_stex = strings.flatMap { s =>
val doc = proc.parse(s)
val ndoc = proc.expand(doc,Remove(stex.bindings.Basics.ednote) :: Normalize.cleanups ::: stex.bindings.Defis.all_defis.map(Expand),true).asInstanceOf[LatexFile]
val ndoc = proc.expand(doc,Remove(bindings.Basics.ednote) :: Normalize.cleanups ::: bindings.Defis.all_defis.map(Expand),true).asInstanceOf[LatexFile]
Latex.normalize(ndoc :: Nil)
}
val synth_latex = STeX.removesTeX(synth_stex,Some(store))
......@@ -763,11 +764,11 @@ object Test {
proc.addCommands(macros:_*)
proc.addCommands(StexCommands.default:_*)
proc.addEnvironments(latex.bindings.Environments.defaults:_*)
proc.addEnvironments(stex.bindings.Environments.defaults:_*)
proc.addEnvironments(bindings.Environments.defaults:_*)
val synth_stex = strings.flatMap { s =>
val doc = proc.parse(s)
val ndoc = proc.expand(doc,Remove(stex.bindings.Basics.ednote) :: Normalize.cleanups ::: stex.bindings.Defis.all_defis.map(Expand),true).asInstanceOf[LatexFile]
val ndoc = proc.expand(doc,Remove(bindings.Basics.ednote) :: Normalize.cleanups ::: bindings.Defis.all_defis.map(Expand),true).asInstanceOf[LatexFile]
Latex.normalize(ndoc :: Nil)
}
val synth_latex = STeX.removesTeX(synth_stex,Some(store))
......@@ -892,17 +893,16 @@ object Test {
proc.addCommands(macros:_*)
proc.addCommands(StexCommands.default:_*)
proc.addEnvironments(latex.bindings.Environments.defaults:_*)
proc.addEnvironments(stex.bindings.Environments.defaults:_*)
proc.addEnvironments(bindings.Environments.defaults:_*)
val synth_stex = strings.flatMap { s =>
val doc = proc.parse(s)
val ndoc = proc.expand(doc,Remove(stex.bindings.Basics.ednote) :: Normalize.cleanups ::: stex.bindings.Defis.all_defis.map(Expand),true).asInstanceOf[LatexFile]
val ndoc = proc.expand(doc,Remove(bindings.Basics.ednote) :: Normalize.cleanups ::: bindings.Defis.all_defis.map(Expand),true).asInstanceOf[LatexFile]
Latex.normalize(ndoc :: Nil)
}
val synth_latex = STeX.removesTeX(synth_stex,Some(store))
// ----------------------------------------------------------------------------------------------------------------
import com.jazzpirate.latex.syntax._
def filterI(ls : List[LatexObject]) : List[LatexObject] = ls match {
case Nil => Nil
case (lf : LatexFile) :: rest =>
......@@ -912,7 +912,7 @@ object Test {
else filterI(rest)
case (env:EnvironmentObject) :: rest =>
filterI(env.children) ::: filterI(rest)
case (m : com.jazzpirate.latex.syntax.Math) :: rest =>
case (m : syntax.Math) :: rest =>
m :: Whitespace(" ",0,NoRef.source) :: filterI(rest)
case (_:Token) :: rest =>
filterI(rest)
......
......@@ -48,7 +48,7 @@ $Y$
\[\eq{\card[bars]{\union{X,Y}},\natplus{\card[bars]{X},\natminus{\card[bars]{Y},\card[bars]{\intersect{X,Y}}}}}\]
$\foral[forall]{\natmethan n1}{\eq{\natplus{1,2,\ldots,n},\natdiv[frac]{\nattimes[invisible]{n,\natplus{n,1}}}2}}$
$\eq{n,5}$
$\eq{\natplus{1,2,3,4,5},\natdiv[slash]{\nattimes[cdot]{5,6}}2}$
$\eq{\natplus{1,2,3,4,5},\natdiv[slash]{\nattimes[cdot]{5,6}}{2},15}$
$\nappa An$
$n$
$\nappa A1$
......
This diff is collapsed.
package com.jazzpirate.latex
package com.fifom.latex
import com.jazzpirate.latex.bindings.Basic
import com.jazzpirate.latex.commands.{CommandObject, DefaultBegin, DefaultEnd, Environment, LatexCommand, SimpleCO}
import com.jazzpirate.latex.syntax.{Block, CommandToken, Comment, Expanded, ExpandedEnv, FileSource, LatexContainer, LatexFile, LatexObject, Math, NoRef, NoSource, RefSource, Reference, StringSource, Token, Whitespace}
import com.fifom.latex.bindings.Basic
import com.fifom.latex.commands.{DefaultBegin, LatexCommand, SimpleCO}
import com.fifom.latex.syntax.{Block, CommandToken, Comment, ExpandedEnv, FileSource, LatexFile, LatexObject, Math, NoSource, RefSource, Reference, StringSource, Token, Whitespace}
import com.jazzpirate.latex.commands.DefaultEnd
import com.jazzpirate.latex.syntax.Math
import info.kwarc.mmt.api.utils.File
import scala.annotation.tailrec
......
package com.jazzpirate.latex
package com.fifom.latex
import com.jazzpirate.latex.commands.{CommandObject, DefaultEnd, Environment, EnvironmentObject, LatexCommand, SimpleEnv}
import com.jazzpirate.latex.syntax.{Block, CommandToken, Comment, Expanded, LatexFile, LatexObject, Math, NoRef, Reference, Token, Whitespace}
import com.fifom.latex.commands.{CommandObject, DefaultEnd, Environment, EnvironmentObject, LatexCommand, SimpleEnv}
import com.fifom.latex.syntax.{Block, CommandToken, Comment, LatexFile, LatexObject, Math, NoRef, Token, Whitespace}
import com.jazzpirate.latex.commands.SimpleEnv
import com.jazzpirate.latex.syntax.Math
import info.kwarc.mmt.api.utils.File
import scala.collection.mutable
......
package com.jazzpirate.latex
package com.fifom.latex
import com.jazzpirate.latex.syntax.{Expanded, Reference, Token}
import com.fifom.latex
import com.fifom.latex.syntax.{Expanded, Reference, Token}
import com.jazzpirate.latex.syntax.Token
object Normalize {
import bindings.Basic._
......@@ -13,13 +15,13 @@ object Normalize {
Remove(vspace),
Remove(strut),
Modifier(colon,co => Token(":",0,Expanded(co)) :: Nil),
Modifier(vert,co => Token("|",0,Expanded(co)) :: Nil),
Modifier(mid,co => Token("|",0,Expanded(co)) :: Nil),
Modifier(_ne,co => neq.simpleObject(Reference(Expanded(co),0,0)) :: Nil),
Modifier(vert,co => Token("|",0,syntax.Expanded(co)) :: Nil),
Modifier(mid,co => Token("|",0,syntax.Expanded(co)) :: Nil),
latex.Modifier(_ne, co => neq.simpleObject(Reference(syntax.Expanded(co),0,0)) :: Nil),
Modifier(rule,{co =>
co.children.map(_.asString) match {
case "{.3ex}" :: "{.3ex}" :: Nil =>
Token(".",0,Expanded(co)) :: Nil
Token(".",0,syntax.Expanded(co)) :: Nil
case _ =>
Nil
}
......
package com.jazzpirate.latex.bindings
package com.fifom.latex.bindings
import java.io.FileNotFoundException
import com.jazzpirate.latex.commands.{CommandObject, Dummy, LatexCommand, SimpleCO}
import com.fifom.latex.{FileParser, LaTeXParser}
import com.fifom.latex.commands.{CommandObject, Dummy, LatexCommand, SimpleCO}
import com.fifom.latex.syntax.{Block, FileSource, LatexObject, Reference}
import com.jazzpirate.latex.commands.SimpleCO
import com.jazzpirate.latex.syntax._
import com.jazzpirate.latex.{FileParser, LaTeXParser}
import com.jazzpirate.latex.LaTeXParser
import info.kwarc.mmt.api.utils.File
case class Simple(skey : String,soptArgs : Boolean = false, sarguments : Int = 0) extends LatexCommand(skey,soptArgs,sarguments)
......
package com.jazzpirate.latex.bindings
package com.fifom.latex.bindings
import com.jazzpirate.latex.commands.Environment
import com.fifom.latex.commands.Environment
object Environments {
val document = new Environment("document",false,0)
......
package com.jazzpirate.latex.commands
package com.fifom.latex.commands
import com.jazzpirate.latex.LaTeXParser
import com.jazzpirate.latex.syntax.{Block, CommandToken, Expanded, Latex, LatexContainer, LatexObject, NoRef, Reference, Token, Whitespace}
import com.fifom.latex.LaTeXParser
import com.fifom.latex.syntax.{Block, Expanded, Latex, LatexContainer, LatexObject, NoRef, Reference, Token, Whitespace}
import com.jazzpirate.latex.syntax.Latex
abstract class CommandObject(ref : Reference, val command:LatexCommand,override val children:List[LatexObject]) extends LatexContainer(ref,children) {
def expand : List[LatexObject]
......
package com.jazzpirate.latex.commands
package com.fifom.latex.commands
import com.jazzpirate.latex.LaTeXParser
import com.jazzpirate.latex.syntax.{Block, Latex, LatexContainer, LatexObject, Reference}
import com.fifom.latex.LaTeXParser
import com.fifom.latex.syntax.{Block, Latex, LatexContainer, LatexObject, Reference}
import com.jazzpirate.latex.syntax.Latex
import scala.collection.mutable
......
package com.jazzpirate.latex.syntax
package com.fifom.latex.syntax
import com.jazzpirate.latex.commands.{CommandObject, EnvironmentObject}
import com.fifom.latex.commands.{CommandObject, EnvironmentObject}
import com.jazzpirate.latex.commands.EnvironmentObject
import info.kwarc.mmt.api.utils.File
class RefSource(val length : Int)
......
package com.jazzpirate.mmt
package com.fifom.mmt
import info.kwarc.mmt.api.checking.Solver
import info.kwarc.mmt.api.frontend.Logger
......
package com.jazzpirate.mmt
package com.fifom.mmt
import info.kwarc.mmt.api
import info.kwarc.mmt.api.{MPath, NamespaceMap, Path}
......
package com.jazzpirate.mmt
package com.fifom.mmt
import info.kwarc.mmt.api.frontend.Controller
import info.kwarc.mmt.api.{DPath, GlobalName, LocalName}
......
package com.jazzpirate.mmt
package com.fifom.mmt
import info.kwarc.mmt.api.{GetError, GlobalName}
import info.kwarc.mmt.api.modules.Theory
......
package com.jazzpirate.stex
package com.fifom.stex
import com.fifom
import com.fifom.latex.{Expand, LaTeXProcessor, Modifier, Normalize, ParseError, Remove, bindings}
import com.fifom.latex.bindings.{Commands, Environments, Greek}
import com.fifom.latex.commands.CommandObject
import com.fifom.latex.syntax.{Expanded, Latex, LatexFile, LatexObject, Math, Reference}
import com.fifom.mmt.{MMT, MitM}
import com.fifom.stex.bindings.{Basics, Defis, StexCommands}
import com.jazzpirate.{latex, stex}
import com.jazzpirate.latex.bindings.{Commands, Greek}
import com.jazzpirate.latex.{Expand, LaTeXProcessor, Modifier, Normalize, ParseError, Remove}
import com.jazzpirate.latex.commands.{CommandObject, Environment}
import com.jazzpirate.latex.syntax.{Expanded, Latex, LatexFile, LatexObject, Reference}
import com.jazzpirate.mmt.{MMT, MitM, MyMMT}
import com.jazzpirate.stex.bindings.StexCommands
import com.jazzpirate.latex.bindings.Commands
import com.jazzpirate.latex.LaTeXProcessor
import com.jazzpirate.latex.commands.Environment
import com.jazzpirate.latex.syntax.Latex
import info.kwarc.mmt.api.{DPath, GlobalName, LocalName, RuleSet}
import info.kwarc.mmt.api.checking.{CheckingUnit, History, Solver}
import info.kwarc.mmt.api.frontend.Controller
......@@ -361,8 +366,8 @@ object Translator {
proc.addCommands(Commands.defaults: _*)
proc.addCommands(macros: _*)
proc.addCommands(StexCommands.default: _*)
proc.addEnvironments(latex.bindings.Environments.defaults: _*)
proc.addEnvironments(stex.bindings.Environments.defaults: _*)
proc.addEnvironments(Environments.defaults: _*)
proc.addEnvironments(fifom.stex.bindings.Environments.defaults: _*)
// Extract body of tex -------------------------------------------------------------------------------------------
......@@ -380,16 +385,16 @@ object Translator {
class Paragraph(lf : LatexObject) {
lazy val orig_string = Latex.print(lf)
lazy val maths_orig = lf.flatten.filter(_.isInstanceOf[latex.syntax.Math])
lazy val maths_orig = lf.flatten.filter(_.isInstanceOf[Math])
lazy val maths_orig_strings = maths_orig.map(Latex.print)
// The "paragraph" normalized (as input for NMT)
lazy val sentence_tex = Latex.normalize(proc.expand(lf, Remove(stex.bindings.Basics.ednote) :: Normalize.cleanups :::
stex.bindings.Defis.all_defis.map(Expand), true) :: Nil).head.asInstanceOf[LatexFile]
lazy val sentence_tex = Latex.normalize(proc.expand(lf, Remove(Basics.ednote) :: Normalize.cleanups :::
Defis.all_defis.map(Expand), true) :: Nil).head.asInstanceOf[LatexFile]
// The math expressions normalized (as input for NMT)
lazy val maths_tex = {
val ret = sentence_tex.flatten.filter(_.isInstanceOf[latex.syntax.Math])
val ret = sentence_tex.flatten.filter(_.isInstanceOf[Math])
assert (ret.length == maths_orig.length)
ret
}
......@@ -617,8 +622,8 @@ object CheckSTeX {
proc.addCommands(Commands.defaults:_*)
proc.addCommands(macros:_*)
proc.addCommands(StexCommands.default:_*)
proc.addEnvironments(latex.bindings.Environments.defaults:_*)
proc.addEnvironments(stex.bindings.Environments.defaults:_*)
proc.addEnvironments(bindings.Environments.defaults:_*)
proc.addEnvironments(fifom.stex.bindings.Environments.defaults:_*)
try {
val doc = proc.parse(f)
val (ndoc, isstex) = new StexChecker(macros).annotate(doc)
......@@ -671,8 +676,8 @@ object DesTeXify {
proc.addCommands(Commands.defaults:_*)
proc.addCommands(macros:_*)
proc.addCommands(StexCommands.default:_*)
proc.addEnvironments(latex.bindings.Environments.defaults:_*)
proc.addEnvironments(stex.bindings.Environments.defaults:_*)
proc.addEnvironments(bindings.Environments.defaults:_*)
proc.addEnvironments(fifom.stex.bindings.Environments.defaults:_*)
try {
val doc = proc.parse(f)
val ndoc = proc.expand(doc,expandcomms,true)
......
package com.jazzpirate.stex
package com.fifom.stex
import com.jazzpirate.latex.bindings.{Basic, Commands}
import com.jazzpirate.latex.{FileParser, LaTeXParser}
import com.jazzpirate.latex.commands.{CommandObject, Environment, EnvironmentObject, LatexCommand, SimpleCO}
import com.jazzpirate.latex.syntax.{Block, CommandToken, Expanded, Latex, LatexObject, NoRef, Reference, Token, Whitespace}
import com.fifom.latex.bindings.Basic
import com.fifom.latex.commands.{CommandObject, EnvironmentObject, SimpleCO}
import com.fifom.latex.syntax.{Block, CommandToken, Expanded, Latex, LatexObject, Reference, Token}
import com.jazzpirate.latex.bindings.Commands
import com.jazzpirate.latex.LaTeXParser
import com.jazzpirate.latex.commands.Environment
import com.jazzpirate.latex.syntax.Latex
object Notations {
private def getPrec(tks : List[LatexObject]): Option[Int] = {
......
package com.jazzpirate.stex
import com.jazzpirate.latex.{Expand, LaTeXProcessor, Normalize, ParseError, Remove}
import com.jazzpirate.latex.bindings.Commands
import com.jazzpirate.latex.syntax.{Latex, LatexFile, LatexObject}
import com.jazzpirate.mmt.{MMT, MitM}
import com.jazzpirate.stex.bindings.StexCommands
package com.fifom.stex
import com.fifom
import com.fifom.latex.{Expand, LaTeXProcessor, Normalize, ParseError, Remove, bindings}
import com.fifom.latex.bindings.{Commands, Environments}
import com.fifom.latex.syntax.{Latex, LatexFile, LatexObject, Math}
import com.fifom.mmt.{MMT, MitM}
import com.fifom.stex.bindings.{Basics, Defis, StexCommands}
import com.jazzpirate.latex.LaTeXProcessor
import com.jazzpirate.latex.syntax.Latex
import com.jazzpirate.{latex, stex}
import info.kwarc.mmt.api.{DPath, LocalName, ParsingNotationComponent}
import info.kwarc.mmt.api.modules.Theory
......@@ -118,13 +121,13 @@ object STeX {
proc.addCommands(Commands.defaults:_*)
proc.addCommands(macros:_*)
proc.addCommands(StexCommands.default:_*)
proc.addEnvironments(latex.bindings.Environments.defaults:_*)
proc.addEnvironments(stex.bindings.Environments.defaults:_*)
proc.addEnvironments(Environments.defaults:_*)
proc.addEnvironments(fifom.stex.bindings.Environments.defaults:_*)
val paragraphs = files.flatMap {f =>
try {
val doc = proc.parse(f)
val ndoc = proc.expand(doc,Remove(stex.bindings.Basics.ednote) :: Normalize.cleanups ::: stex.bindings.Defis.all_defis.map(Expand),true).asInstanceOf[LatexFile]
val ndoc = proc.expand(doc,Remove(Basics.ednote) :: Normalize.cleanups ::: Defis.all_defis.map(Expand),true).asInstanceOf[LatexFile]
Latex.normalize(Tokenizer.getParagraphs(ndoc))
} catch {
case ParseError(ref,_) =>
......@@ -140,7 +143,7 @@ object STeX {
paragraphs.foreach{p =>
val (ret,checks) = checker.annotate(p)
val maths = p.flatten.filter(_.isInstanceOf[latex.syntax.Math])
val maths = p.flatten.filter(_.isInstanceOf[Math])
if (checks && maths.nonEmpty) stexs ::= p
else if (maths.isEmpty) nomath ::= p
else {
......@@ -170,8 +173,8 @@ object STeX {
proc.addCommands(sds:_*)
proc.addCommands(macros:_*)
proc.addCommands(StexCommands.default:_*)
proc.addEnvironments(latex.bindings.Environments.defaults:_*)
proc.addEnvironments(stex.bindings.Environments.defaults:_*)
proc.addEnvironments(bindings.Environments.defaults:_*)
proc.addEnvironments(fifom.stex.bindings.Environments.defaults:_*)
val expandcomms = macros.map(Expand) ::: DesTeXify.eliminations ::: Normalize.cleanups
val objs = Latex.normalize(paragraphs.map(p => proc.expand(p,expandcomms,true)))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment