# Import html page with maths

Hi to all.

I’d like to import html pages such as this one : https://math.stackexchange.com/questions/1072459/what-are-some-applications-of-elementary-linear-algebra-outside-of-math or this one : https://en.wikipedia.org/wiki/D-module and keep the maths formulas within TeXmacs. Does anyone know if one can achieve this ? And if so, how ?

Thank you.

Marc

On the Mac you can do “Cmd+Ctrl+X” to have an interactive dialog for scheme code, then there type (load-document "https://en.wikipedia.org/wiki/D-module") for example. This will load the web page in a new document with all the links and the math formulas. Otherwise you can start a scheme session and give the same command.

I tried this by saving the file on my computer (I used Chrome but as far as I understand the browser is irrelevant) and importing it in TeXmacs. I got an IMO acceptable TeXmacs document.
Most inline math in the Wiki text is written using italic text, so it is not possible to recognize that automatically.
The display math could be improved if one would be able to transform all “description” environments to display math environments (at the same time removing the italic tags).

Maybe someone is able to do that using TeXmacs?

For the other page (StackExchange) one gets a slightly worse imported document, which could be improved if one would be able to remove automatically all labels that are generated converting MathJax expressions. Here too I must leave the word to someone else, as I would be able to do it using different programs, but one would want to do it in TeXmacs.

Perhaps a Scheme program, but let us hear someone else.

G.

On Windows it seems that the key combination is “Windows+Shift+X”—I get an “Interactive command” input field on the footer—but to any Scheme expression I get an “unbound variable” error message.

Are you sure? What happens in a scheme session? It should work (the differences are in your preferences wrt. interactive questions).

Hi.

Under Ubuntu 20.04, the command is Windows+Shift+X … but it doesn’t produce anything.

In a scheme session within TeXmacs, I can load the webpage with th (load-document “…”) command on a new texmacs page.

I don’t know why the Windows+Shift+X command doesn’t produce anything. I went to the preferences and change the script language from None to Scheme without any effect.

Marc

In a Scheme session it works.
In the interactive dialog all Scheme expressions fail.

Example, transcribing the error message from the footer:
In:
1
Out:
(unbound-variable #f "Unbound variable" ~S (#{1}#) #f)

I find strange that the combination does not contain Ctrl: it should be Windows+Ctrl+x. Doesn’t work either? Alternatively you can try Esc Esc Esc Ctrl+X

Neither works in the Windows session I am in.

The shortcut is defined as altcmd X, with altcmd being M-C- on Mac OS and just M- in Emacs, Gnome, KDE and Windows.

There is also altcmd x (note the lower case x, so Meta+x on non-Mac systems) which gives a “Scheme command” dialog window where (load-document "https://...") does work.

CTRL+Windows+X doesn’t open any window under Ubuntu 20.04 whereas Shift+Windows+X does.

But, as Giovanni wrote, under Ubuntu the scheme session in Texmacs works but the script window don’t.

Does somebody has an idea why does not work? Is there any error message in the terminal or the console? It could be appropriate to file a bug, especially if it works in the console but not in the interactive dialog.

As in the message above, on Windows:

When I am going to use Linux I am going to report on that too; the Windows version of TeXmacs does not send its error output to the Power Shell or to the terminal as far as I can remember; in any case it does not send either the standard output or the error output of the interactive dialog.

I’ve just checked the sources and I found the following

  ("altcmd x" (interactive footer-eval))
("altcmd X" (interactive exec-interactive-command))


so I think the problem depends on the fact that you type “lowercase X”. I think you are using the wrong shortcut, there should be one with “uppercase x”, something like Alt+WIndows+X or Ctrl+Window+X. You are supposed to see a prompt asking you for an “Scheme command”. With the other shortcut you are just supposed to indicate a command to exec interactively, so in that case you need to input load-documentand then hit return, TeXmacs will ask you for the argument, which in that case would be the URL you want to load.

The way I found at the moment is first press the caps lock key (Windows+“lowercase X” is intercepted by Windows), then pressing Windows+Shift+X. I discovered it by chance, as I pressed the caps lock without noticing it
Then I get the field for the Scheme command, and it works.