Wednesday, March 27, 2024

Line breaking in math using MathJax

Line breaking in math using MathJax

This is in response to a discussion thread in the MathJax email list.

I would write the inline version with a separate math container for each of the components in this list so that spacing and breaking is handled by the browser in the standard way for HTML. This avoids bad line breaks. Thus: A long line \(\{\)$\frac{3}{4},$ $x,$ $y,$ $z,$ $3,$ $10,$ $x+3,$ $10-x,$ $13-y-z,$ $13-z,$ $y+z,$ $x,$ $y,$ $z,$ $3,$ $10,$ $x+3,$ $10-x,$ $13-y-z,$ $13-z,$ $y+z$\(\}\) which stretches and stretches.

In my opinion any form of displayed math should not have automatic line breaking. So I would not use displaymath for this long sequence of expressions. However, HTML display techniques — for example, a nested pair of suitably styled divs — can be applied for the inline markup above as here:

\(\{\)$\frac{3}{4},$ $x,$ $y,$ $z,$ $3,$ $10,$ $x+3,$ $10-x,$ $13-y-z,$ $13-z,$ $y+z,$ $x,$ $y,$ $z,$ $3,$ $10,$ $x+3,$ $10-x,$ $13-y-z,$ $13-z,$ $y+z$\(\}.\)

Thursday, January 27, 2022

For the TeX world: An old story

We live in a time when it is difficult to send TeX source through email except as an attachment. That poses a dilemma for writing to a list that does not accept attachments. Fortunately, for the discussion I have in mind, the list does accept URLs. The blog here offers an opportunity for me to post TeX source using HTML's pre.

This example relates to a discussion about the handling of accented characters with xetex. It should run through xetex on any platform equipped with the Latin Modern Roman opentype font that in recent years has been distributed with TeXLive. It is UTF-8 encoded text. One thing that will be noticed on close observation is that, in the paragraph added to DEK's story.tex, the first appearance of the character é is U+00E9 while the second appearance is entered by following an e with U+0301, the combining acute accent.

\font\lmr="Latin Modern Roman"
\lmr
\hrule
\vskip 1in
\centerline{\bf A SHORT STORY}
\vskip 6pt
\centerline{\sl    by A. U. Thor}
\vskip .5cm
Once upon a time, in a distant
  galaxy called Ööç,
there lived a computer
named R.~J. Drofnats.

Mr.~Drofnats---or ``R. J.,'' as
he preferred to be called---
was happiest when he was at work
typesetting beautiful documents.

He was only able to do this while drawing an annual
salary of €100,000 because of the generosity
of his employer, the Université de Léland.

\vskip 1in
\hrule
\vfill
\bye

Sunday, December 26, 2021

The 3n+1 Problem in 5 minutes<br>    A Quick Introduction   

The 3n + 1 Problem

A transformation

This is about the transformation (or function) which takes a given positive integer n and produces another as follows:

n3n+1ifnis oddn2ifnis even It is sometimes called the Syracuse transformation.

Iteration

One may pick a positive integer as starting point, apply the Syracuse transformation, then apply it again to the result, apply it yet again to the result of that, and so on, to see what eventually happens.

Here is a table of examples:

1421
21
3105168421
5168421
7221134175226134020105168421
175226134020105168421
216432168421
23703510653160804020105168421

An open question

Since the 1930s it has been an open question whether for any starting point the sequence generated will eventually reach 1.

There is a conjecture that every such sequence will eventually reach 1. It is known by various names, including the “3n + 1 Conjecture”, the “Collatz Conjecture”, the “Syracuse Conjecture”, and others. More information may be found at Wikipedia, https://en.wikipedia.org/wiki/Collatz_conjecture.

Saturday, October 20, 2018

Example of 'align' (20181020)

Sylvain G. writes: I just want to report that I was not able to add the following line with mathjax on my blogger:

Trying this: \begin{align*}\frac{x^n- a^n}{x-a} &= \frac{a^n\left((\frac{x}{a})^n - 1\right)}{a\left(\frac{x}{a}-1\right)}\\ &= a^{n-1}\left( \left(\frac{x}{a}\right)^{n-1} + \left(\frac{x}{a}\right)^{n-2} +\ldots + \frac{x}{a} + 1 \right) \\ &= x^{n-1} + x^{n-2}a + +\ldots + xa^{n-2} + a^{n-1}. \end{align*}

Saturday, May 25, 2013

Baby Test No. 4

Testing MathJax with TeX Input

Now let's try some displayed math using MathJax (so suitable for most commonly used browsers) with TeX input. \[ x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} \]

That should be it.

Baby Test No. 3

Testing MathJax with MathML Input

Now let's try the same displayed math with MathJax enabled (so suitable for most commonly used engines). This time the "math" element has no xmlns attribute. x = b ± b2 4ac 2a

That should be it.

Baby Test No. 2

Testing MathML Without MathJax

Now let's try some displayed math without MathJax (so suitable for some Gecko and some Webkit engines). I will use the xmlns attribute, which should be inert with HTML5, in case it helps. x = b ± b2 4ac 2a

That should be it.