Question

Normally to print symbols such as the forall symbol, you'd just use &forall, but this doesn't seem to work in pre blocks that literally print out "&forall".

<pre>
&forall o in orders
</pre>

What would be a workaround to this problem?

Was it helpful?

Solution

Almost all browsers have the bug/feature that many entity references are not recognized without a trailing semicolon, even in contexts where it is valid to omit the semicolon. As others have suggested, using &forall; circumvents the bug. The HTML 4.01 spec indirectly refers to the bug when it recommends the use of trailing semicolons for all entity references.

Another solution is to use the FOR ALL character “∀” itself, provided that your document is UTF-8 encoded and declared as such. This makes the source code more readable.

This does not depend on the use of pre markup. The issue is the same e.g. in text directly inside the body element.

Note that pre elements are by default rendered using a monospace font. This is unsuitable for mathematical expressions (they should normally be displayed using a serif font), and the browser’s default monospace font might lack the “∀” character or other mathematical symbols.

OTHER TIPS

It works fine in a pre tag, you just forgot the semicolon at the end of the entity:

<pre>
&forall; o in orders
</pre>

The code is not just &forall. A semicolon is required.

Like: &forall;

you're missing semicolon

<pre>
&forall; o in orders
</pre>
∀ o in orders
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top