## September 28, 2010

### Instiki 0.19

After much delay, I’m releasing Instiki 0.19.

It’s been 9 months since the previous release, so – naturally – there’s a lot of new stuff to report.

The most visible change comes when you unpack the distribution. External dependencies have always been a pain to deal with. With Instiki, we’ve tried to minimized their number; but sometimes they’re unavoidable. With Instiki 0.19, I’ve started using Bundler to manage external dependencies. What that means is that, when you’ve unpacked the distribution, you need to type

ruby bundle

at the commandline, from the main Instiki directory. This will download and install the Rubygems used by Instiki. The list of Rubygems is in the Gemfile. And, if your situation is special, you can tweak that list. If, for instance, you’re using MySQL instead of the default sqlite3 database, you need to add a line

gem "mysql"

to the Gemfile. Users on Dreamhost will find that they need to modify the entry for sqlite3-ruby. But, in general, you should find that you won’t have to muck with it and that the whole installation experience is more hassle-free than before.

The next most visible change is that itex2MML is now a Rubygem (managed by Bundler), so you don’t need to worry about installing it separately. In fact, with 0.19, every Instiki installation now provides an itex-to-MathML translation service as a web service. Perhaps, you’ll find other uses for it, but the main reason for its existence is that …

Instiki now includes a WYSIWYG drawing package, based on SVG-Edit. You can embed SVG figures directly in your wiki pages, and you can embed MathML content in those SVG figures. This has proven really useful to me, personally, what with the ability to export Instiki pages to LaTeX, and export the figures to PDF.

This release is based on Rails 2.3.9. I expect that the next release will be based on Rails 3.

#### Update: Nested Extensible Arrows

Thanks to some discussions with Frédéric Wang (of Mozilla MathML fame), I’ve improved itex2MML, so that it can now accommodate nested extensible arrows with optional arguments. Users of Instiki 0.19 can update their version of itextomml by typing

ruby bundle update

Posted by distler at September 28, 2010 12:44 PM

TrackBack URL for this Entry:   http://golem.ph.utexas.edu/cgi-bin/MT-3.0/dxy-tb.fcgi/2282

### Extensible Arrows in itex2MML

I’ve just looked to your new code for the extensible arrows and I think there is a problem with the bracket parameter: it can not contain brackets. For example something like $\xrightarrow[\frac{x[0]} 2]{}$ is not allowed. Is it intentional (I haven’t checked what LaTeX does)?

A proposal for an alternative implementation (not tested): add two terminals BRACKETOPEN and BRACKETCLOSE (returned for [ and ]) and two nonterminals leftdelim = LEFTDELIM | BRACKETOPEN and rightdelim = RIGHTDELIM | BRACKETCLOSE to replace the right and left delimiters. Then use BRACKETCLOSE and BRACKETOPEN in place of OPTARGOPEN and OPTARGCLOSE.

Posted by: Frédéric Wang on September 29, 2010 1:19 PM | Permalink | Reply to this

### Re: Extensible Arrows in itex2MML

I need to check, but I think that LaTeX will allow you to put square brackets inside optional arguments provided that they are “protected” by braces.

In any case, I realize that my implementation has another much more elementary bug, so I will need to do some fixing, in any case …

Posted by: Jacques Distler on September 29, 2010 3:10 PM | Permalink | PGP Sig | Reply to this

### Re: Extensible Arrows in itex2MML

Fixed in itex2MML 1.4.3.

A\xrightarrow[x{[0]}]{}B

produces $A\xrightarrow[x{[0]}]{}B$ as you’d expect.

See here, if you’re curious about the details.

Posted by: Jacques Distler on September 29, 2010 3:54 PM | Permalink | PGP Sig | Reply to this

### Re: Extensible Arrows in itex2MML

Thanks, but I’m now concerned about issues with recursive constructions such that \xrightarrow[{\xrightarrow[x]{}}]{}. I guess you can increase itex2MML_inoptarg again to workaround that but I suspect it could still be possible to find weird cases with escaped chars or similar.

My suggestion was not to use these itex2MML_inoptarg and OPTARG mode at all, but rather move the parsing of the optional argument from flex to bison. This seems possible with slight modifications to the grammar, in the spirit of my first comment. Moreover, I think it would more correspond to the respective roles of Flex & Bison: tokenization and grammar parsing.

(BTW, I believe that with my suggestion, bison will behave as LaTeX if the brackets are not “protected”.)

Posted by: Frédéric Wang on September 29, 2010 5:45 PM | Permalink | Reply to this

### Re: Extensible Arrows in itex2MML

It’s a real pain when itex’s behaviour doesn’t match LaTeX’s. It’s kinda OK when itex doesn’t allow certain constructions that LaTeX allows (it’s only promised to provide a ‘useful subset’), but it’s a real headache when itex allows constructs that are forbidden in LaTeX.

Instiki is supposed to provide export to LaTeX, and that becomes problematic wherever itex and LaTeX differ. For legacy reasons, some of those differences are never going to go away, but I am loath to create new ones.

So, before discussing implementation, let’s look at LaTeX’s behaviour.

• A\xrightarrow[{x[0]}]{}B
• A\xrightarrow[{{x[0]}}]{}B
• A\xrightarrow[{C\xrightarrow[{x[0]}]{}D}]{}B
• A\xrightarrow[{C\xrightarrow[a]{x[0]}D}]{}B
• A\xrightarrow[C\xrightarrow{x[0]}D]{}B
• A\xrightarrow[[a,b)]{}B

are all legal constructs in LaTeX, but

• A\xrightarrow[x[0]]{}B
• A\xrightarrow[C\xrightarrow[{x[0]}]{}D]{}B

are not. (Nor, of course, are any number of variations with mismatched braces, etc.)

I think you were proposing a grammar in which the last two would be legal in itex (but seemingly #6 would not?). That sounds bad to me, but perhaps I have misunderstood your suggestion.

I agree that it would be rather hackish to (further) extend Flex to handle nested extensible arrows. That really needs to be part of the grammar (and, if done right, might entirely obviate the need for the itex2MML_inoptarg counter).

Posted by: Jacques Distler on September 29, 2010 8:04 PM | Permalink | PGP Sig | Reply to this

### Re: Extensible Arrows in itex2MML

The changes I was thinking about are:

munder: XARROW BRACKETOPEN compoundTermList BRACKETCLOSE EMPTYMROW | …
mover: XARROW closedTerm | …
munderover: XARROW BRACKETOPEN compoundTermList BRACKETCLOSE closedTerm | …
left: LEFT leftdelim | …
(and idem for “right”, “bigdelim” etc)
leftdelim: LEFTDELIM | BRACKETOPEN
rightdelim: RIGHTDELIM | BRACKETCLOSE

I agree that itex2MML should try to match LaTeX’s behaviour. I think it will be the case in the constructs you indicated?

Posted by: Frédéric Wang on September 30, 2010 12:44 AM | Permalink | Reply to this

### Re: Extensible Arrows in itex2MML

I guess I’m missing something.

With the grammar you suggest, why are

A\xrightarrow[x[0]]{}B

and

A\xrightarrow[C\xrightarrow[{x[0]}]{}D]{}B

illegal constructs?

It looks like your grammar would treat them as perfectly legal (which is to say, it would not act as LaTeX does).

Posted by: Jacques Distler on September 30, 2010 1:03 AM | Permalink | PGP Sig | Reply to this

### Re: Extensible Arrows in itex2MML

To be completely fair, LaTeX will parse

A\xrightarrow[x[0]]{}B

as $A\underoverset{x[0}{]}{\to}{}B$ which, I think, is what your grammar will do, too.

But

A\xrightarrow[C\xrightarrow[{x[0]}]{}D]{}B

generates a Latex error, whereas your grammar will yield

$A\underoverset{C\xrightarrow[{x[0]}]{}D}{}{\to}B$

Posted by: Jacques Distler on September 30, 2010 1:16 AM | Permalink | PGP Sig | Reply to this

### Re: Extensible Arrows in itex2MML

Yes sorry, I think you are right. I haven’t another solution in mind…

Posted by: Frédéric Wang on September 30, 2010 11:20 AM | Permalink | Reply to this

### Re: Extensible Arrows in itex2MML

Well, OK. I really don’t see how to do implement this in Bison. But it’s pretty trivial (albeit not pretty) to do it in Flex.

So here goes:

$\begin{gathered} A\xrightarrow[{x[0]}]{}B\\ A\xrightarrow[{{x[0]}}]{}B\\ A\xrightarrow[{C\xrightarrow[{x[0]}]{}D}]{}B\\ A\xrightarrow[{C\xrightarrow[a]{x[0]}D}]{}B\\ A\xrightarrow[C\xrightarrow{x[0]}D]{}B\\ A\xrightarrow[[a,b)]{}B \end{gathered}$ and the “bad” ones: $A\xrightarrow[x[0]]{}B$ and

Posted by: Jacques Distler on September 30, 2010 2:43 PM | Permalink | PGP Sig | Reply to this

### Re: Extensible Arrows in itex2MML

I think doing that in bison would require to add more nonterminals in order to change the priority of the bracket with respect to other terms. Hence it will really make the grammar non-natural and unclear, which is definitely not what I intended when I made the initial suggestion. If behaving as LaTeX is the most important for your purpose, then I guess your solution with Flex is the most reasonable one (I think you could also have done that with only one integer by increasing/decreasing it when we enter/exit xarrow constructs). Hopefully, nobody will ever exceed the limit of nested xarrows ;-)

Posted by: Frédéric Wang on September 30, 2010 3:49 PM | Permalink | Reply to this

### Re: Extensible Arrows in itex2MML

(I think you could also have done that with only one integer by increasing/decreasing it when we enter/exit xarrow constructs)

I don’t think so.

We need to keep track of how deeply-nested we are in brace-brackets (within each nested optional argument), to determine whether “]” signals the close of an optional argument, or is just another delimiter.

I suppose, by prime factorization, I could do it with a pair of integers. If C came with a next_prime(i) and a previous_prime(i) function, that would even be the elegant way to do it.

Failing that, the approach I took is the simplest (and, is doubtless much faster).

Hopefully, nobody will ever exceed the limit of nested xarrows ;-)

Not a big worry for me. :-)

Posted by: Jacques Distler on September 30, 2010 4:14 PM | Permalink | PGP Sig | Reply to this

### Re: Instiki 0.19

Thanks for the streamlined installation. Embarassingly, it is the first time I managed to actually install instiki (I used to give up due to some complex dependencies issue)

The suggested method for updating rubygems didn’t work for me, I had to download it directly from

It may be of use to put this on the install page.

I have an actual question though: I was thinking of using instiki to conduct a private mathematical collaboration (not on just one file, but rather on a bunch of ideas/projects) Other alternatives were to keep a tiddlywiki file or an org-mode file in a dropbox folder which was accessible only to the participants.

Instiki seems like it would be well-suited to this, but what is the best way to make it private yet web-accessible to a couple of users?

Thanks
Marco

Posted by: marco gualtieri on October 3, 2010 5:13 PM | Permalink | Reply to this

### Re: Instiki 0.19

The suggested method for updating rubygems didn’t work for me …

It would be worthwhile knowing what went wrong, so that we can fix the installation instructions, appropriately.

Perhaps you should email me, privately.

Instiki seems like it would be well-suited to this, but what is the best way to make it private yet web-accessible to a couple of users?

Instiki is quite unsophisticated, in that regard.

• Go to “Edit Web” of the web that you want to make “private”.
• Add a password to the web.
• Send the password to your friends.
Posted by: Jacques Distler on October 3, 2010 6:23 PM | Permalink | PGP Sig | Reply to this

### Re: Instiki 0.19

Hello,
I am wondering if it is possible to have some LaTeX \newcommand macros in a text file which would be used by instiki for a) each page of a web and b) would be exported to the preamble of the latex output. This would be a great timesaver.

Also, I wonder if one can place tags on a bunch of pages in the wiki and then export all the pages which are appropriately tagged to a latex document - this is one of the many fantastic features that org-mode has. In my perfect world there would be an unholy marriage of inter-operability between orgmode and instiki…

Many thanks,

Posted by: marco gualtieri on October 7, 2010 6:58 PM | Permalink | Reply to this

### Re: Instiki 0.19

I am wondering if it is possible to have some LaTeX \newcommand macros in a text file which would be used by instiki for a) each page of a web and b) would be exported to the preamble of the latex output. This would be a great timesaver.

LaTeX macros are an oft-requested feature.

There are two issues

1. Making it secure. Among other things, one needs to protect against the itex equivalent of the billion laughs attack.

2. Making it useful. itex2MML is called, independently, for each equation. (To see this, most graphically, check out the itex endpoint of your Instiki installation.) It’s (oviously) not very useful to have to define macros, anew, for each equation. Drawing some additional parsing rules from an external file, as part of some initialization process, makes a lot of sense. But I don’t know how to implement that in Flex/Bison (probably due to my profound ignorance).

Whenever I’ve thought about implementing macros, I’ve gotten hung-up on one or the other of these issues.

Also, I wonder if one can place tags on a bunch of pages in the wiki and then export all the pages which are appropriately tagged to a latex document.

There used to be an “export entire web to LaTeX” action in Instiki. This was pretty borked, so I removed it. But perhaps that should be reconsidered.

Would an “export all pages in a Category” work for you?

Posted by: Jacques Distler on October 8, 2010 1:34 AM | Permalink | PGP Sig | Reply to this

### Re: Instiki 0.19

- Exporting categories would be quite good I think. I didn’t know about them until you mentioned it, thanks.

- I noticed some people on nlab talking about having some emacs ways of editing instiki, I’ll try to look into that, it may make things easier.

Cheers

Posted by: marco gualtieri on October 8, 2010 8:39 PM | Permalink | Reply to this

### Re: Instiki 0.19

Exporting categories would be quite good I think.

Try the latest development version, then. You might find it enjoyable…

I didn’t know about them until you mentioned it, thanks.

Probably a lot of things you haven’t discovered yet… like S5 slideshows.

Posted by: Jacques Distler on October 9, 2010 3:01 AM | Permalink | PGP Sig | Reply to this

### XLink or MathML3 href

(it seems that your mail server has rejected my reply, so I post it here)

Hi Jacques,

As you know, Gecko will support both @href and @xlink:href (with priority given to the first) so it won’t be a problem to go that way. I don’t think other implementations recognize @xlink:href (apart Amaya) and I imagine that Webkit/MathJax will only implement the @href attribute. However, it seems that XLink is not entirely broken in Firefox and so may still be useful, given that the MathML linking patch won’t be taken for Firefox 4. In the future, you should consider only emitting the @href attribute.

HTH

Frédéric

Posted by: Frédéric Wang on January 19, 2011 4:26 AM | Permalink | Reply to this

### Re: Instiki 0.19

Hello,
I tried to install instiki, so I followed the steps outlined on the project site but the last step is hindered by ”

./config/../config/preinitializer.rb:20: Bundler couldn’t find some gems.Did you run bundle install? (RuntimeError)
from ./config/boot.rb:28:in load’
from ./config/boot.rb:28:in preinitialize’
from ./config/boot.rb:10:in boot!’
from ./config/boot.rb:124
from ./script/server:3:in require’
from ./script/server:3
from ./instiki:6:in load’
from ./instiki:6

As to the question in the error report: I did not run ”bundle install” since this command does not exist in the instiki directory.

Posted by: Stephan Alexander Spahn on September 5, 2011 5:04 AM | Permalink | Reply to this

### Re: Instiki 0.19

I did not run ”bundle install”

The (rather detailed) installation instructions tell you to run

   ruby bundle


(that instruction is repeated in this very blog post).

If you were to follow those instructions, you would not receive that error message.

Posted by: Jacques Distler on September 5, 2011 9:02 AM | Permalink | PGP Sig | Reply to this

### Re: Instiki 0.19

I’m using Mac OS X Lion 10.7.1. I followed all the instructions, including running ruby bundle on instiki main directory. But, the, when I run

./instiki –daemon

I get the message

./config/../config/preinitializer.rb:20: Bundler couldn’t find some gems.Did you run bundle install? (RuntimeError)
from ./config/boot.rb:28:in preinitialize’
from ./config/boot.rb:10:in boot!’
from ./config/boot.rb:124
from ./script/server:3:in require’
from ./script/server:3
from ./instiki:6

thanks,
john.

Posted by: john on September 18, 2011 9:40 PM | Permalink | Reply to this

### Re: Instiki 0.19

You can try doing a

  ruby bundle update


to ensure that your Bundler-installed gems are up-to-date.

If you’re still having trouble, you can do a

  ruby bundle list


to list the installed gems, and a

  ruby bundle show GEM_NAME


to show where the gem “GEM_NAME” is installed.

Posted by: Jacques Distler on September 18, 2011 9:58 PM | Permalink | PGP Sig | Reply to this

### Re: Instiki 0.19

It didn’t work out. Here is the message I got:

Could not find gem ‘mongrel (>= 1.2.0.pre2)’ in any of the gem sources listed in your Gemfile.

Then, after a google search I decided to install Xcode 4.1 and, after updating ruby again, everything seems to be working now.

Maybe this is useful to someone else.

Thanks,
john.

Posted by: john on September 19, 2011 8:38 AM | Permalink | Reply to this

### Re: Instiki 0.19

I guess that I was insufficiently-explicit in stating that you need the Developer Tools (i.e., Xcode) installed.

Posted by: Jacques Distler on September 19, 2011 12:36 PM | Permalink | PGP Sig | Reply to this

### Re: Instiki 0.19

Is it possible to include mathematica presentations inside instiki (http://www.wolfram.com/cdf/adopting-cdf/deploying-cdf/web-delivery.html)? More specifically, is it possible to include something like

-tagged object in your HTML.

var cdf = new cdfplugin();
cdf.embed('wave2.cdf', 588, 380);

in a instiki page and ask it to interpret this code?

Thanks!

Posted by: naive guy on October 28, 2011 2:58 PM | Permalink | Reply to this

### CDF

Unfortunately, <embed>, <object> and <script> elements are forbidden, for security reasons. The only multi-media elements that are allowed are the HTML5 elements, <audio> and <video>.

So, no, there’s currently no way to embed a Wolfram CDF file in an Instiki page.

It is an interesting idea for the future, though.

Posted by: Jacques Distler on October 28, 2011 3:30 PM | Permalink | PGP Sig | Reply to this

Post a New Comment