Exemple #1
0
 def control(self, cmd):
     if cmd == "reset":
         self.reset()
         return None
     elif cmd == "all":
         return parsing.latex_output(self.env, self.env)
     elif cmd == "ambiguity":
         self.cur_ambiguity = True
     else:
         if cmd in self.specials.keys():
             return self.specials[cmd](self)
         else:
             if cmd not in self.specials_post:
                 print("Don't know what to do with '%s'" % cmd)
             return None
Exemple #2
0
 def control(self, cmd):
     if cmd == "reset":
         self.reset()
         return None
     elif cmd == "all":
         return parsing.latex_output(self.env, self.env)
     elif cmd == "ambiguity":
         self.cur_ambiguity = True
     else:
         if cmd in self.specials.keys():
             return self.specials[cmd](self)
         else:
             if cmd not in self.specials_post:
                 print("Don't know what to do with '%s'" % cmd)
             return None
Exemple #3
0
 def lamb(self, line, cell=None):
     """Magic that works both as %lcmagic and as %%lcmagic"""
     self.cur_ambiguity = self.ambiguity
     if cell is None:
         (accum, env) = parsing.parse(line, self.env)
         self.env = env
     else:
         if len(line) > 0:
             r = self.control_line(line)
             if r is not None:
                 return r  #TODO fix this up, not right
         (accum, env) = parsing.parse(cell,
                                      self.env,
                                      ambiguity=self.cur_ambiguity)
         self.env = env
         self.control_line(line, post=True, accum=accum)
     self.push_accum(accum)
     IPython.display.display(parsing.latex_output(accum, self.env))
Exemple #4
0
 def lamb(self, line, cell=None):
     "Magic that works both as %lcmagic and as %%lcmagic"
     self.cur_ambiguity = self.ambiguity
     if cell is None:
         # print("Called as line magic")
         (accum, env) = parsing.parse(line, self.env)
         self.env = env
     else:
         # print("Called as cell magic")
         # return line, cell
         if len(line) > 0:
             r = self.control_line(line)
             if r is not None:
                 return r  # TODO fix this up, not right
         (accum, env) = parsing.parse(cell, self.env, ambiguity=self.cur_ambiguity)
         self.env = env
         self.control_line(line, post=True, accum=accum)
     self.shadow_warnings(accum)
     self.shell.push(accum)
     return parsing.latex_output(accum, self.env)