LaTeX markup in WordPress

I’ve just discovered you can use LaTex markup in WordPress.

Here’s the example they give:

i\hbar\frac{\partial}{\partial t}\left|\Psi(t)\right>=H\left|\Psi(t)\right>

It works for me!

Advertisements
Posted in Uncategorized | 2 Comments

More experiments with [sourcecode] tags

Here is some code in a [sourcecode] in a post (rather than a comment) – it is a program to solve Enigma 1649. Subsequently editing the post seems to work OK.

def check(a, b):
  # check combinations below 120
  N = 120
  c = [0] * N
  for n in range(0, int(N / a) + 1):
    for m in range(0, int((N - a*n) / b) + 1):
      s = a*n + b*m
      if not(s < N): continue
      c[s] += 1
  if not(c[59] == 1): return
  if c[:60].count(0) < 2: return
  if len([x for x in c[:60] if x > 1]) < 2: return
  if len([x for x in c[60:] if x > 1]) < N - 60: return
  print(a, b, c[:60], c[60:])

# OK, let's assume a < b
for b in range(3, 60):
  for a in range(2, b):
    check(a, b)

Edit: Yes, this is the edited post. The [sourcecode] tags are successfully maintained. (In fact the post editor seems to be somewhat better than the comment editor).

Posted in Uncategorized | 2 Comments

Problems with [sourcecode] tags.

I find there is a problem editing posts and comments which contain sourcecode tags.

I have posted about this problem at the WordPress Support Forums.

Here is some Python code that is a solution to Enigma 1646.

from fractions import Fraction
from collections import Counter

ms = Counter()
for x in range(15, 255, 15):
  for y in range(0, 195, 15):
    ms[Fraction(y - 80, x)] += 1

print(len([m for m in ms.values() if m > 1]))

The problem is when presented in the editor the line:

[sourcecode language="python"]

is presented as:

[sourcecode language=""python""]

Notice that the double quotes around python, become duplicated. Unless this is resolved manually before saving the comment, it will be messed up when displayed.

I will now reproduce the code in a comment, and then edit it and add one additional line at the end.

Posted in Uncategorized | 2 Comments

Hello world!

Welcome to WordPress.com. After you read this, you should delete and write your own post, with a new title above. Or hit Add New on the left (of the admin dashboard) to start a fresh post.

Here are some suggestions for your first post.

  1. You can find new ideas for what to blog about by reading the Daily Post.
  2. Add PressThis to your browser. It creates a new blog post for you about any interesting  page you read on the web.
  3. Make some changes to this page, and then hit preview on the right. You can always preview any post or edit it before you share it to the world.
Posted in Uncategorized | 1 Comment