Forums

[resolved] [Plugin: WP LaTeX] Change the $latex ....$ to $...$ (2 posts)

  1. ivanwangsacl
    Member
    Posted 3 years ago #

    how to change from $latex ....$ to $...$
    So, if I want to post $latex 1+1=2$, I could post it as $1+1=2$.
    Thanks!

    http://wordpress.org/extend/plugins/wp-latex/

  2. Michael Adams (mdawaffe)
    Member
    Posted 1 year ago #

    This is probably a bad idea since it's likely it will break (the rare) "real" text in your post.

    Example:

    I bought the drink for $2, and the the popcorn for $3.

    That said, if you really want to do this, you can change the \$latex[= ] to \$ in http://plugins.trac.wordpress.org/browser/wp-latex/trunk/wp-latex.php?rev=255694#L112

    The plugin itself will probably never have this feature, so every time you upgrade the plugin, you'll have to make this change.

    Alternatively, could write a little baby plugin yourself to "fix" this, so that you don't have to change the plugin code every time there is a new version.

    /*
    Plugin Name: My WP LaTeX "fix"
    */
    
    function my_wp_latex_fix( $content ) {
            return preg_replace( '#(\s+\$(?!latex))(.*?[^\\\\])(\$\s+)#i', '\\1latex \\2\\3', $content );
    }
    
    add_filter( 'the_content', 'my_wp_latex_fix', 5 );

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags