How to Display Source Code and Mathematical Formulas

It is highly recommend you to edit the source code and mathematical formulas in the "wiki text" mode.

Source Code

The formated C++ code:

The wiki text:

<sticky>
%CODE{"cpp" el="textarea"}%
#include <iostream>
int main()
{
  std::cout << "Hello, world." << std::endl;
}
%ENDCODE%
</sticky>

The tag "sticky" can prevent the server to reformat the code, and the using of el="textarea" can avoid the "<iostream>" being treated as HTML tags.

Mathematic Formulas

The formated formulas:

%MATHMODE{ \nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} = \frac{4\pi}{c}\vec{\mathbf{j}} \nabla \cdot \vec{\mathbf{E}} = 4 \pi \rho }%

%MATHMODE{ \nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} = \vec{\mathbf{0}} }%

%MATHMODE{ \nabla \cdot \vec{\mathbf{B}} = 0 }%

The wiki text :
%MATHMODE{ \nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} = \frac{4\pi}{c}\vec{\mathbf{j}} \nabla \cdot \vec{\mathbf{E}} = 4 \pi \rho }%

%MATHMODE{ \nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} = \vec{\mathbf{0}} }%

%MATHMODE{ \nabla \cdot \vec{\mathbf{B}} = 0 }%

Plotting

%FLOTCHART{ "test,more" test="[1, 23],[2, 87],[3, 11],[4, 17],[5, 21],[6, 45],[7, 34],[8, 23]" more="[1, 2],[2, 4],[3, 6],[4, 8],[5, 18],[6, 12],[7, 14],[8, 16]" xticks="[1, 'start'],[4, 'middle'],[8, 'finish']" yticks="1,25,50,75,100" ymax="100" height="120px" width="400px" }%

with code
%FLOTCHART{
    "test,more"
    test="[1, 23],[2, 87],[3, 11],[4, 17],[5, 21],[6, 45],[7, 34],[8, 23]"
    more="[1, 2],[2, 4],[3, 6],[4, 8],[5, 18],[6, 12],[7, 14],[8, 16]"
    xticks="[1, 'start'],[4, 'middle'],[8, 'finish']"
    yticks="1,25,50,75,100"
    ymax="100"
    height="120px"
    width="400px"
}%
-- XunChen - 10 Aug 2013
Topic revision: r2 - 2014-04-02, XunChen - This page was cached on 2024-04-20 - 14:11.

This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback