Have cells with %latex occur only once

Issue #6 new
kcrisman
created an issue

Cells with %latex should perhaps be able to be rendered only once, given the duplication.

This was requested (and solved) by the poster at http://ask.sagemath.org/question/733/disable-syntax-highlighting-in-sws2tex, where several other good points were also raised.

Comments (1)

  1. kcrisman reporter

    Here is the solution from the user there, not as a diff, of course.

        def _detect_language(self):
            first_line = self.text.splitlines()[0]
            try:
                second_line = self.text.splitlines()[1]    
            except: 
                second_line = ""
            if first_line == '%latex':
                self.language = 'latex'
            elif second_line == '%latex':
                self.language = 'latex'
            ...
    and
    
        def latex(self):
            if options.hide:
                first_line = self.text.splitlines()[0]
                if first_line == '%hide':
                    return ""
            if self.language == 'latex':
                return ""
            ...
    
  2. Log in to comment