## February 28, 2019

### Instiki 0.30.0 and tex2svg 1.0

Instiki is my wiki-cum-collaboration platform. It has a built-in WYSIWYG vector-graphics drawing program, which is great for making figures. Unfortunately:

• An extra step is required, in order to convert the resulting SVG into PDF for inclusion in the LaTeX paper. And what you end up with is a directory full of little PDF files (one for each figure), which need to be managed.
• Many of my colleagues would rather use Tikz, which has become the de-facto standard for including figures in LaTeX.

Obviously, I needed to include Tikz support in Instiki. But, up until now, I didn’t really see a good way to do that, given that I wanted something that is

1. Portable
2. Secure

Both considerations pointed towards creating a separate, standalone piece of software to handle the conversion, which communicates with Instiki over a (local or remote) port. tex2svg 1.0.1 requires a working TeX installation and the pdf2svg commandline utility. The latter, in turn, requires the poppler-glib library, which is easily obtained from your favourite package manager. E.g., under Fink, on MacOS, you do a

fink install poppler8-glib

before install pdf2svg.

But portability is not enough. If you’re going to expose Instiki over the internet, you also need to make it secure. TeX is a Turing-complete language with (limited) access to the file system. It is trivial to compose some simple LaTeX input which, when compiled, will

• exfiltrate sensitive information from the machine or
• DoS the machine by using up 100% of the CPU time or filling up 100% of the available disk space.

You should never, ever compile a TeX file from an untrusted source.

tex2svg rigorously filters its input, allowing only a known-safe subset of LaTeX commands through. And it limits the size of the input. So it should be safe to use, even on the internet.

After starting up the tex2svg server, you just uncomment the last line of config/environments/production.rb and restart Instiki. Now you can write something like

\begin{tikzpicture}[decoration={markings,
mark=at position .5 with {\arrow{>}}}]
\usetikzlibrary{arrows,shapes,decorations.markings}
\begin{scope}[scale=2.0]
\node[Bl,scale=.75] (or1) at (8,3) {};
\node[scale=1] at (8.7,2.9) {$D3$ brane};
\node[draw,diamond,fill=yellow,scale=.3] (A1) at (7,0) {};
\draw[dashed] (A1) -- (7,-.7);
\node[draw,diamond,fill=yellow,scale=.3] (A2) at (7.5,0) {};
\draw[dashed] (A2) -- (7.5,-.7);
\node[draw,diamond,fill=yellow,scale=.3] (A3) at (8,0) {};
\draw[dashed] (A3) -- (8,-.7);
\node[draw,diamond,fill=yellow,scale=.3] (A4) at (8.5,0) {};
\draw[dashed] (A4) -- (8.5,-.7);
\node[draw,diamond,fill=yellow,scale=.3] (A5) at (9,0) {};
\draw[dashed] (A5) -- (9,-.7);
\node[draw,circle,fill=aqua,scale=.3] (B) at (9.5,0) {};
\draw[dashed] (B) -- (9.5,-.7);
\node[draw,regular polygon,regular polygon sides=5,fill=purple,scale=.3] (C1) at (10,0) {};
\draw[dashed] (C1) -- (10,-.7);
\node[draw,regular polygon,regular polygon sides=5,fill=purple,scale=.3] (C2) at (10.5,0) {};
\draw[dashed] (C2) -- (10.5,-.7);
\draw (6.8,-.7) -- (6.8,-.9) to (9.2,-.9) to (9.2,-.7);
\draw (9.8,-.7) -- (9.8,-.9) to (10.7,-.9) to (10.7,-.7);
\draw[->-=.75] (C2) to (10.2,.35);
\draw[->-=.75] (C1) to (10.2,.35);
\node[scale=.6] at (9.9,.35) {$(2,2)$};
\draw[->-=.7] (B) to (9.6,.7);
\draw (10.2,.35) to (9.6,.7);
\node[scale=.6] at (9.35,.9) {$(4,0)$};
\draw[->-=.5] (9.1,.8) to (A5);
\draw (9.6,.7) to (9.1,.8) to (A5);
\draw (9.1,.8) to [out=170,in=280] (8.3,1.45);
\draw[dashed] (8.3,1.45) to (8.1,2.5);
\draw[->-=.5] (8.1,2.5) to (or1);
\node[scale=.75] at (7.7,2.7) {$(3,0)$};
%\draw (11.4,2.4) to [out=180,in=90] (6.2,-.5) to [out=90,in=0] (or1) -- cycle;
\node[scale=.75] at (8,-1.1) {A-type};
\node[scale=.75] at (9.5,-1.1) {B-type};
\node[scale=.75] at (10.25,-1.1) {C-type};
\draw[dashed] (8.7,.6) to [out=180,in=90] (6.2,-.55) to [out=270,in=180] (8.7,-1.6) to [out=0,in=270] (11.2,-.55) to [out=90,in=0] (8.7,.6) -- cycle;
\node[scale=1] at (12,.6) {$E_6$ singularity};
\end{scope}
\end{tikzpicture}

in Instiki and have it produce

Instiki 0.30.0 incorporates these changes, is compatible with Ruby 2.6, and greatly accelerates the process of saving pages (over previous versions).

Posted by distler at February 28, 2019 2:21 PM

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

### Also in blog posts and comments

Works on this blog, too:

Posted by: Jacques Distler on March 16, 2019 8:18 PM | Permalink | PGP Sig | Reply to this

### … works in comments …

… but only if you choose the “Markdown with itex to MathML” text filter.

Posted by: Jacques Distler on March 16, 2019 8:28 PM | Permalink | PGP Sig | Reply to this

### Re: Instiki 0.30.0 and tex2svg 1.0

Hello, Prof. Distler. Have you seen/read this paper?
https://arxiv.org/pdf/2006.06872.pdf

I wonder if this is a significant result. Is this about Hawking radiation for realistic black holes in our universe, or for a toy universe/extremal black hole?

Thanks.

Posted by: Tim on August 2, 2020 5:38 PM | Permalink | Reply to this

### Re: Instiki 0.30.0 and tex2svg 1.0

Hello, Prof. Distler. Have you seen/read this paper?
https://arxiv.org/pdf/2006.06872.pdf

I wonder if this is a significant result. Is this about Hawking radiation for realistic black holes in our universe, or for a toy universe/extremal black hole?

Thanks.

Posted by: Tim on August 2, 2020 5:45 PM | Permalink | Reply to this

### Re: Instiki 0.30.0 and tex2svg 1.0

It’s ok i think I get what’s going on. Well the paper’s introduction on page 3 tells you what it is about. It is a review of the understanding of Hawking radiation, the general problem. In order to understand it, there are simpler models used where people can calculate. Some of those models are toy models. The review discusses all that, as far as I can tell.

Posted by: Tim on August 3, 2020 12:03 AM | Permalink | Reply to this

Post a New Comment