HP Forums

Full Version: How to use a formula in a post
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

cf. How to use a formula in a post

A LaTeX-tag would be cool:

[latex]e^{i\pi}+1=0[/latex]

This would be displayed as:

Best regards

Thomas

Wow, brings back memories. I used to know TeX by heart and a good amount of LaTeX as well. I was in college when it first came out. This one lady at the computer center was just gaga over it.

Another consideration may be MathML. I thought it was dead but it looks like they just updated it...
http://www.w3.org/Math/

Perl is a unix routine. How do I run that on my wodoze machine?

Quote:
How do I run that on my wodoze machine?

You may install strawberryperl or activeperl. Use a file for the formula instead of the here-document:

perl -MURI::Escape -ne 'chomp; printf "[img:http://latex.codecogs.com/png.latex?%s]\n\n", uri_escape $_' formula.txt

There might be other utilities to uri-escape.

HTH

Thomas


I can't test that right now, but the following should work. Create a file "uri-escape.pl" with your favorite text-editor and enter the following lines:

use URI::Escape;
while (<>) {
chomp;
printf "[img:http://latex.codecogs.com/png.latex?%s]\n\n", uri_escape $_;
}

Create a 2nd file "formula.txt". It may contain several formulas each on a separate line:

e^{i\pi}+1=0

Now run in a command prompt:

perl uri-escape.pl formula.txt

If you are too lazy to upload images you can use aamath for "a-text":

$ echo "e^(i*pi)+1=0" | aamath

__
i ||
e + 1 = 0

$ echo "sum([n-1;r],r = 0 .. min(n-1,4))" | aamath

min(n - 1, 4)
=====
\ / n - 1 \
> | |
/ \ r /
=====
r = 0

Edited: 9 Nov 2010, 10:20 a.m.