environment/lib/python2.7/site-packages/IPython/core/magic.py
def format_latex(self, strng):
        """Format a string for latex inclusion."""

        # Characters that need to be escaped for latex:
        escape_re = re.compile(r'(%|_|\$|#|&)',re.MULTILINE)
        # Magic command names as headers:
        cmd_name_re = re.compile(r'^(%s.*?):' % ESC_MAGIC,
                                 re.MULTILINE)
        # Magic commands
        cmd_re = re.compile(r'(?P<cmd>%s.+?\b)(?!\}\}:)' % ESC_MAGIC,
                            re.MULTILINE)
        # Paragraph continue
        par_re = re.compile(r'\\$',re.MULTILINE)

        # The "\n" symbol
        newline_re = re.compile(r'\\n')

        # Now build the string for output:
        #strng = cmd_name_re.sub(r'\n\\texttt{\\textsl{\\large \1}}:',strng)
        strng = cmd_name_re.sub(r'\n\\bigskip\n\\texttt{\\textbf{ \1}}:',
                                strng)
        strng = cmd_re.sub(r'\\texttt{\g<cmd>}',strng)
        strng = par_re.sub(r'\\\\',strng)
        strng = escape_re.sub(r'\\\1',strng)
        strng = newline_re.sub(r'\\textbackslash{}n',strng)
        return strng
def format_latex(self, strng):
        # Characters that need to be escaped for latex:
        escape_re = re.compile(r'(%|_|\$|#|&)',re.MULTILINE)
        # Magic command names as headers:
        cmd_name_re = re.compile(r'^(%s.*?):' % ESC_MAGIC,
                                 re.MULTILINE)
        # Magic commands
        cmd_re = re.compile(r'(?P<cmd>%s.+?\b)(?!\}\}:)' % ESC_MAGIC,
                            re.MULTILINE)
        # Paragraph continue
        par_re = re.compile(r'\\$',re.MULTILINE)

        # The "\n" symbol
        newline_re = re.compile(r'\\n')

        # Now build the string for output:
        #strng = cmd_name_re.sub(r'\n\\texttt{\\textsl{\\large \1}}:',strng)
        strng = cmd_name_re.sub(r'\n\\bigskip\n\\texttt{\\textbf{ \1}}:',
                                strng)
        strng = cmd_re.sub(r'\\texttt{\g<cmd>}',strng)
        strng = par_re.sub(r'\\\\',strng)
        strng = escape_re.sub(r'\\\1',strng)
        strng = newline_re.sub(r'\\textbackslash{}n',strng)
        return strng
def format_latex ( self , strng ) : # Characters that need to be escaped for latex: escape_re = re . compile ( r'(%|_|\$|#|&)' , re . MULTILINE ) # Magic command names as headers: cmd_name_re = re . compile ( r'^(%s.*?):' % ESC_MAGIC , re . MULTILINE ) # Magic commands cmd_re = re . compile ( r'(?P<cmd>%s.+?\b)(?!\}\}:)' % ESC_MAGIC , re . MULTILINE ) # Paragraph continue par_re = re . compile ( r'\\$' , re . MULTILINE ) # The "\n" symbol newline_re = re . compile ( r'\\n' ) # Now build the string for output: #strng = cmd_name_re.sub(r'\n\\texttt{\\textsl{\\large \1}}:',strng) strng = cmd_name_re . sub ( r'\n\\bigskip\n\\texttt{\\textbf{ \1}}:' , strng ) strng = cmd_re . sub ( r'\\texttt{\g<cmd>}' , strng ) strng = par_re . sub ( r'\\\\' , strng ) strng = escape_re . sub ( r'\\\1' , strng ) strng = newline_re . sub ( r'\\textbackslash{}n' , strng ) return strng
Format a string for latex inclusion.
Format a string for latex inclusion .