Difference between revisions of "Wiki editing guide"
(Created page with " == MathJax == <nomathjax>User either $ $ or \( \) for inline math and $$ $$ or \[ \] for display style math. You can also use environments, such as align, align*, equation. E...") |
|||
| (13 intermediate revisions by 3 users not shown) | |||
| Line 2: | Line 2: | ||
== MathJax == | == MathJax == | ||
<nomathjax>User either $ $ or \( \) for inline math and $$ $$ or \[ \] for display style math. You can also use environments, such as align, align*, equation. | <nomathjax>User either $ $ or \( \) for inline math and $$ $$ or \[ \] for display style math. You can also use environments, such as align, align*, equation. | ||
| − | Equations within numbered environments may be labeled with \label and referenced with \ref or, better, \eqref.</nomathjax> | + | Equations within numbered environments may be labeled with \label and referenced with \ref or, better, \eqref. |
| + | All numbers in text should be in $ $, e.g. $100$ m, $35$ kg.</nomathjax> | ||
=== New commands === | === New commands === | ||
New $\LaTeX$ command for the current document can be defined using \newcommand. | New $\LaTeX$ command for the current document can be defined using \newcommand. | ||
Globally, commands can be added as macros in the <code>wiki/MathJax/config/default.js</code> file around line 544. | Globally, commands can be added as macros in the <code>wiki/MathJax/config/default.js</code> file around line 544. | ||
| + | |||
| + | Defined commands: | ||
| + | * \N, \Z, \Q, \R, \C for basic sets $\N, \Z, \Q, \R, \C$ | ||
| + | * \T for matrix transpose $A^\T$. | ||
| + | * \b{x} for bold symbols (including greek letters $\b{\alpha}$. | ||
| + | |||
| + | == Static pages == | ||
| + | We have a script that [https://gitlab.com/e62Lab/e62numcodes/blob/master/scripts/backup_wiki_static.sh copies wiki as static pages]. It is located in <code>scripts/</code> folder in our repo. | ||
| + | It can be run directly or by going into your build folder and running <code>make static_wiki</code>. | ||
| + | |||
| + | ==References== | ||
| + | How to use multiple use of the same footnote | ||
| + | https://www.mediawiki.org/wiki/Extension:Cite#Multiple_uses_of_the_same_footnote | ||
| + | |||
| + | ==Adding figures== | ||
| + | There is a drag&drop option to upload an image. To actually insert it in the article (wanting to refer to it later) use the following example | ||
| + | |||
| + | <syntaxhighlight lang="html" line> | ||
| + | <figure id="fig:my_figure_label"> | ||
| + | [[File:name_of_my_figure.png|thumb|upright=2|alt=An alternative text, that appears if the figure cannot be shown|<caption>The caption under the figure</caption>]] | ||
| + | </figure> | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | To make a reference to the image, use the code | ||
| + | <syntaxhighlight lang="html" line> | ||
| + | <xr id="fig:my_figure_label"/> | ||
| + | </syntaxhighlight> | ||
| + | == adding code snippets == | ||
| + | Copyable C++ code for closed form solution: | ||
| + | <syntaxhighlight lang="c++" line> | ||
| + | std::function<Vec2d(Vec2d)> analytical = [=](const Vec2d& p) { | ||
| + | double x = p[0], y = p[1], r2 = x*x + y*y, factor = -force / (4.0*M_PI*mu); | ||
| + | double ux = 2*x*y/r2 + 2*mu/(lam + mu)*std::atan2(y, x); | ||
| + | double uy = (y*y-x*x)/r2 - (lam + 2*mu)/(lam + mu)*std::log(r2); | ||
| + | return Vec2d(factor*ux, factor*uy); | ||
| + | }; | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | Copyable Matlab code for closed form solution: | ||
| + | <syntaxhighlight lang="matlab" line> | ||
| + | function [ux, uy] = point_contact_analytical(x, y, lam, mu, P) | ||
| + | % Evaluates closed form solution for point contact. | ||
| + | % lam and mu are Lame parameters, P is the point force magnitude | ||
| + | r2 = x.^2 + y.^2; factor = -P / (4.0*pi*mu); | ||
| + | ux = factor*(2*x.*y./r2 + 2*mu/(lam + mu)*atan2(y, x)); | ||
| + | uy = factor*((y.^2-x.^2)./r2 - (lam + 2*mu)/(lam + mu)*log(r2)); | ||
| + | end | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | === Wiki backup guide === | ||
| + | This guide covers two ways to backup this wiki, either as html files, only for viewing, or creating a complete backup of the underlying system. | ||
| + | |||
| + | == Backup as static files == | ||
| + | This scrapes our wiki for html pages and saves them to ninestein <strong>home/mmachine/mm_wiki_backup/</strong>. The [https://gitlab.com/e62Lab/e62numcodes/blob/master/scripts/backup_wiki_static.sh script] is in our scripts directory. | ||
| + | It can be run with | ||
| + | make static_wiki | ||
| + | from the usual <code>build/</code> folder. | ||
| + | The script runs for a few minutes and back up the relevant part of the wiki. | ||
| + | |||
| + | == Full mediawiki backup == | ||
| + | The script for this is located in | ||
| + | /var/www/html/ParallelAndDistributedSystems/MeshlessMachine/full_wiki_backup.sh | ||
| + | and runs weekly as a cron job. | ||
| + | To edit the cron job run | ||
| + | crontab -e | ||
| + | while logged in as the mmachine user. The backup is copied to ninestein home/mmachine. Last 5 backups are stored, and this number can be changed in the script. | ||
| + | To backup manually, run the script and download the backup from ninestein. | ||
Latest revision as of 16:06, 5 October 2017
Contents
MathJax
User either $ $ or \( \) for inline math and $$ $$ or \[ \] for display style math. You can also use environments, such as align, align*, equation. Equations within numbered environments may be labeled with \label and referenced with \ref or, better, \eqref. All numbers in text should be in $ $, e.g. $100$ m, $35$ kg.
New commands
New $\LaTeX$ command for the current document can be defined using \newcommand.
Globally, commands can be added as macros in the wiki/MathJax/config/default.js file around line 544.
Defined commands:
- \N, \Z, \Q, \R, \C for basic sets $\N, \Z, \Q, \R, \C$
- \T for matrix transpose $A^\T$.
- \b{x} for bold symbols (including greek letters $\b{\alpha}$.
Static pages
We have a script that copies wiki as static pages. It is located in scripts/ folder in our repo.
It can be run directly or by going into your build folder and running make static_wiki.
References
How to use multiple use of the same footnote https://www.mediawiki.org/wiki/Extension:Cite#Multiple_uses_of_the_same_footnote
Adding figures
There is a drag&drop option to upload an image. To actually insert it in the article (wanting to refer to it later) use the following example
1 <figure id="fig:my_figure_label">
2 [[File:name_of_my_figure.png|thumb|upright=2|alt=An alternative text, that appears if the figure cannot be shown|<caption>The caption under the figure</caption>]]
3 </figure>
To make a reference to the image, use the code
1 <xr id="fig:my_figure_label"/>
adding code snippets
Copyable C++ code for closed form solution:
1 std::function<Vec2d(Vec2d)> analytical = [=](const Vec2d& p) {
2 double x = p[0], y = p[1], r2 = x*x + y*y, factor = -force / (4.0*M_PI*mu);
3 double ux = 2*x*y/r2 + 2*mu/(lam + mu)*std::atan2(y, x);
4 double uy = (y*y-x*x)/r2 - (lam + 2*mu)/(lam + mu)*std::log(r2);
5 return Vec2d(factor*ux, factor*uy);
6 };
Copyable Matlab code for closed form solution:
1 function [ux, uy] = point_contact_analytical(x, y, lam, mu, P)
2 % Evaluates closed form solution for point contact.
3 % lam and mu are Lame parameters, P is the point force magnitude
4 r2 = x.^2 + y.^2; factor = -P / (4.0*pi*mu);
5 ux = factor*(2*x.*y./r2 + 2*mu/(lam + mu)*atan2(y, x));
6 uy = factor*((y.^2-x.^2)./r2 - (lam + 2*mu)/(lam + mu)*log(r2));
7 end
Wiki backup guide
This guide covers two ways to backup this wiki, either as html files, only for viewing, or creating a complete backup of the underlying system.
Backup as static files
This scrapes our wiki for html pages and saves them to ninestein home/mmachine/mm_wiki_backup/. The script is in our scripts directory. It can be run with
make static_wiki
from the usual build/ folder.
The script runs for a few minutes and back up the relevant part of the wiki.
Full mediawiki backup
The script for this is located in
/var/www/html/ParallelAndDistributedSystems/MeshlessMachine/full_wiki_backup.sh
and runs weekly as a cron job. To edit the cron job run
crontab -e
while logged in as the mmachine user. The backup is copied to ninestein home/mmachine. Last 5 backups are stored, and this number can be changed in the script. To backup manually, run the script and download the backup from ninestein.