Integrating Sage with LyX

I have been interested in the LaTeX typesetting system, but not in actually learning the extra syntax. And so I’ve been using a WYSIWYM GUI named ‘LyX‘. The .TEX-Files LyX exports are suitable to creating HTML Files, which in turn can contain typeset Math, by way of scripts, that provide MathJax code.

But then one compromise this has meant for me was, that I could either typeset Math which I had written myself, or that I could do Computer Algebra, the latter through the use of ‘wxMaxima’, which has its own system of exporting to HTML. But so far, I could not do both in one document.

Well, now that I have ‘SageMath’ and ‘SageTeX’ installed, I can do both within the same document. It’s possible to integrate SageTeX into LyX. The following is an article which explains how to do that, under the assumption that the user has both SageTeX and LyX installed:

https://wiki.lyx.org/Layouts/Modules#toc7

There is an important way in which I needed to modify the instructions however, to get the two working. First of all, there is a list of files to download – LyX does not support SageTeX out of the box – that the article above links to. Out of those files, ‘setup.sh’ is absolutely useless on a modern Linux computer. The following files from the repository above are essential:

  1. sage.module
  2. preferences
  3. compile-pdf-sage.sh
  4. example.lyx

The file ‘preferences’ needs to be edited, in that its last line needs to be uncommented.

The file ‘compile-pdf-sage.sh’ needs to be edited, in that the first two lines need to be commented out, and the next three lines which are commented by default, need to be uncommented. Then:

 


(As user:)

$ cp sage.module ~/.lyx/layouts
$ cat preferences >> ~/.lyx/preferences

(As root:)

# cp compile-pdf-sage.sh /usr/local/bin
# chmod a+x /usr/local/bin/compile-pdf-sage.sh


 

Then, within the GUI of LyX, one gives the command ‘Tools -> Reconfigure’. One shuts down and restarts LyX. Next, one opens ‘example.lyx’ to test the setup. The following is the document which I finally obtained (successfully), which was provided by the Web-site above (not written by me):

http://dirkmittler.homeip.net/sg_lyx_1.pdf

Enjoy,

Dirk

 

Update to ‘polkit’ and ‘libpolkit’ today.

Modern Linux computers, that have a considerable GUI, also have a feature called ‘polkit’. The purpose of this feature is not hard to understand. There exist certain operations which require ‘root’ privileges on a Linux computer, but actual users run Graphical User Interfaces, in ‘user mode’, i.e, without elevated privileges. Usually, Linux users want to be able to do such things as to install and update packages, which requires ‘root’ privileges, but want to be able to do so using the GUI. And so the way the feature ‘polkit’ is organized, there exists a daemon running as user ‘root’, which can among other things update packages, and there exists another daemon running as the specific user, which makes requests to the ‘root’ polkit daemon, to update packages. The root daemon carries out the requested action.

This arrangement may seem to make more sense for Ubuntu, where there is no such thing in a pronounced way, as ‘root’, as there is under Debian. But even some Debian setups have partial Ubuntu installs running, and many Debian users also like the ease, of being able to install a package, just by clicking on it, and then, by convincing the ‘root’ polkit daemon, that the user in question is privileged enough to do so.

Well today, my two Debian / Jessie systems, which I name ‘Phoenix’ and ‘Klystron’, have received routine updates to the polkit packages themselves. But the rather unbalanced, immediate result of this is, that on both these computers, the user-space daemon is still running the old binary, from before the update, while a new ‘root’ daemon has been launched, as part of the update. The two versions of ‘polkit’ running on both these computers, may or may not continue to be compatible with each other.

If they should turn out to be incompatible, then in the very near future I’ll need to reboot both computers as well, which could therefore also lead to brief downtime for this blog.

I’m keeping my fingers crossed, that the new service may be running in a way that remained compatible, with the old client.

Dirk

 

Major Upgrade This Evening, Downtime

Both the Linux-laptop I name ‘Klystron’, and the server of this Web-site, this server being named ‘Phoenix’, received a major update this evening. On ‘Phoenix’, a total of 78 packages needed to be updated, including a Kernel-Update, and a Graphics-Driver Update. This collective update effectively converted both computers from Debian 8.7 to Debian 8.8 systems. And both updates appear to have succeeded, at first glance without breaking anything.

However, this was an update that required a reboot for ‘Phoenix’, even though this is my Web-server, and so my site was also down briefly, from approximately 20h40 until 20h50.

I am happy to say however, that ‘Phoenix’ had been running for 58 days straight, without requiring any reboot whatsoever until tonight.

Oh, but I must disappoint some of my readers with the fact that performing these updates also required I restart my ‘memcached‘ service, which means that pages or postings the readers like to visit most often will be a bit slower to fetch, until this server-side caching is replenished.

Dirk