Exemplo n.º 1
0
    }
    if ($show_problem->get_val("output") != "") {
        $html .= "<h2 style='margin-top:10px'>Output</h2>" . latex_content($show_problem->get_val("output"));
    }
    if ($show_problem->get_val("sample_in") != "") {
        $html .= "<h2 style='margin-top:10px'>Sample Input</h2>";
        if (stristr($show_problem->get_val("sample_in"), '<br') == null && stristr($show_problem->get_val("sample_in"), '<pre') == null && stristr($show_problem->get_val("sample_in"), '<p>') == null) {
            $html .= "<pre>" . $show_problem->get_val("sample_in") . "</pre>";
        } else {
            $html .= $show_problem->get_val("sample_in");
        }
    }
    if ($show_problem->get_val("sample_out") != "") {
        $html .= "<h2 style='margin-top:10px'>Sample Output</h2>";
        if (stristr($show_problem->get_val("sample_out"), '<br') == null && stristr($show_problem->get_val("sample_out"), '<pre') == null && stristr($show_problem->get_val("sample_out"), '<p>') == null) {
            $html .= "<pre>" . $show_problem->get_val("sample_out") . "</pre>";
        } else {
            $html .= $show_problem->get_val("sample_out");
        }
    }
    if (trim(strip_tags($show_problem->get_val("hint"))) != "" || strlen($show_problem->get_val("hint")) > 50) {
        $html .= "<h2 style='margin-top:10px'>Hint</h2>" . latex_content($show_problem->get_val("hint"));
    }
    echo $html . '<div style="PAGE-BREAK-AFTER: always"></div>';
}
?>
</body>
</html>


Exemplo n.º 2
0
 * --------------------------------------------------------------------
 * @author Benjamin Zeiss <*****@*****.**>
 * @version v0.8
 * @package latexrender
 *
 */
// the final image is shown on the page using
// echo latex_content($text);
// this is just an example page
echo "<html><title>LatexRender Demo</title>\r\n    <head><script language=\"JavaScript\" type=\"text/javascript\">\r\n\tfunction addtags() {\r\n\t\tif (document.selection.createRange().text!='') {\r\n\t  \t\tdocument.selection.createRange().text = '[tex]'+document.selection.createRange().text+'[/tex]';\r\n\t  \t}\r\n\t}//--></script></head>";
echo "<body bgcolor='lightgrey'><center><h3>LatexRender Demo</h3>";
echo "<font size=-1><i>Add tags around text you want to convert to an image<br>\r\n    or press the button to add them around highlighted text</i></font>";
echo "<form method='post'>";
echo "<input onclick=\"addtags()\" type=\"button\" value=\"Add TeX tags\" name=\"btnCopy\"><br><br>";
echo "<textarea name='latex_formula' rows=8 cols=50>";
if (isset($_POST['latex_formula'])) {
    echo stripslashes($_POST['latex_formula']);
} else {
    echo "Example Text:\nThis is just text but [tex]\\sqrt{2}[/tex] should be shown as an image and so should [tex]\frac {1}{2}[/tex].\r\n\t\t\t\nAnother formula is [tex]\frac {43}{12} \\sqrt {43}[/tex]";
}
echo "</textarea>";
echo "<br><br><input type='submit' value='Render'>";
echo "</form>";
if (isset($_POST['latex_formula'])) {
    $text = stripslashes($_POST['latex_formula']);
    echo "<u>Result</u><br><br>";
    // now convert and show the image
    include_once "latex.php";
    echo nl2br(latex_content($text));
}
echo "</center></body></html>";
Exemplo n.º 3
0
                ?>
            <pre class="content-wrapper"><?php 
                echo $sout;
                ?>
</pre>
<?php 
            } else {
                echo '<div class="content-wrapper well">' . $sout . "</div>\n";
            }
        }
        if (trim(strip_tags($show_problem->get_val("hint"))) != "" || strlen($show_problem->get_val("hint")) > 50) {
            ?>
            <h3> Hint </h3>
            <div class="content-wrapper well">
<?php 
            echo latex_content($show_problem->get_val("hint")) . "\n";
            ?>
                <div style="clear:both"></div>
            </div>
<?php 
        }
        ?>
            <div class="functions tcenter" style="margin-bottom:20px">
              <div class="btn-group">
                <a href="#" class="submitprob btn btn-primary">Submit</a>
                <a href="#status/<?php 
        echo $label;
        ?>
" class="btn">Status</a>
<?php 
        if (contest_passed($cid) && $show_problem->get_val("hide") == 0) {