Fwd: Shutter :: ltx2sxl

472 views
Skip to first unread message

Kurt Pagani

unread,
Sep 27, 2016, 3:15:43 PM9/27/16
to fricas-devel
Hi George

You need xterm (-ti vt340), mintty or mlterm for sixel, and libsixel-bin of course  (on Ubuntu via apt).
The script below is just a draft and far from complete (see dvipng options to experiment with).
BTW if you want gnuplot to emit sixel then you'll have to compile it with "configure --with-bitmap-terminals".  

Kurt

---------- Forwarded message ----------
From: <nil...@gmail.com>
Date: 27 September 2016 at 20:58
Subject: Shutter :: ltx2sxl



kfp@nilqed:~/Desktop/work/Gnuplot$ cat latex2sixel
#!/bin/bash

# config (default)
pt=11pt
fg=Green
bg=Black
D=150  #120
T=bbox  #bbox,tight ...
O=-1.0cm,-2.0cm
img=img.png

# need  sudo apt install libsixel-bin

TEX=$(cat <<EOF
\documentclass[$pt]{article}
\usepackage{amsmath,amssymb}
\usepackage{breqn}
\pagestyle{empty}
\begin{document}
 $1
\end{document}
EOF
)

#echo $TEX
LATEX="latex -jobname=sixel -interaction=nonstopmode"
DVIPNG="dvipng -T $T -D $D -O $O -fg $fg -bg $bg -q -o $img"

#mkfifo sixel.dvi
#ls -l sixel.dvi

echo $TEX | $LATEX > /dev/null 2>&1
$DVIPNG sixel.dvi  > /dev/null 2>&1
img2sixel img.png

rm sixel.*
rm img.png


---
For xterm you'll need a .Xresources:

kfp@nilqed:~/Desktop/work/Gnuplot$ cat ~/.Xresources
XTerm*locale: true
XTerm*faceName: Bitstream Vera Serif Mono
!XTerm*faceName: Terminus
xterm*faceSize: 12
!xterm*font: terminus-12
!xterm*boldFont: terminus-12
xterm*loginShell: true
xterm*vt100.geometry: 80x32
xterm*saveLines: 20000
xterm*selectToClipboard: true
xterm*charClass: 33:48,35:48,37:48,43:48,45-47:48,64:48,95:48,126:48
xterm*termName: xterm-color
xterm*eightBitInput: false
xterm*foreground: rgb:a8/a8/a8
xterm*background: rgb:00/00/00
xterm*color0: rgb:00/00/00
xterm*color1: rgb:a8/00/00
xterm*color2: rgb:00/a8/00
xterm*color3: rgb:a8/54/00
xterm*color4: rgb:00/00/a8
xterm*color5: rgb:a8/00/a8
xterm*color6: rgb:00/a8/a8
xterm*color7: rgb:a8/a8/a8
xterm*color8: rgb:54/54/54
xterm*color9: rgb:fc/54/54
xterm*color10: rgb:54/fc/54
xterm*color11: rgb:fc/fc/54
xterm*color12: rgb:54/54/fc
xterm*color13: rgb:fc/54/fc
xterm*color14: rgb:54/fc/fc
xterm*color15: rgb:fc/fc/fc
xterm*boldMode: false
xterm*colorBDMode: true
xterm*colorBD: rgb:fc/fc/fc


Selection_003.png
Workspace 1_002.png

oldk1331

unread,
Sep 28, 2016, 6:16:58 AM9/28/16
to fricas...@googlegroups.com
This is very interesting, however I can not make in work on xterm.
I will try other terminals later. Which terminal are you using?

Kurt Pagani

unread,
Sep 28, 2016, 9:09:28 AM9/28/16
to fricas...@googlegroups.com
Oh, apparently I've misdirected that mail. Thanks for making me aware of this ;)

I'm using "xterm -ti vt340" on Linux and mintty version 2.6.1 on Windows
(Cygwin64) for instance. 'Mlterm' works as well.

Here some links on the topic:
https://github.com/saitoha/libsixel
https://github.com/mintty/mintty
https://sourceforge.net/projects/mlterm/

Kurt

oldk1331

unread,
Sep 28, 2016, 9:21:38 AM9/28/16
to fricas...@googlegroups.com
> Oh, apparently I've misdirected that mail.

:) I thought you want to integrate this with FriCAS, to have image
result of LaTeX output in terminal ...

I used "xterm -ti vt340" and I got nothing. I'll try mlterm.

Kurt Pagani

unread,
Sep 28, 2016, 1:29:03 PM9/28/16
to fricas...@googlegroups.com
Am 28.09.2016 um 15:21 schrieb oldk1331:
>> Oh, apparently I've misdirected that mail.
>
> :) I thought you want to integrate this with FriCAS, to have image
> result of LaTeX output in terminal ...

Good point, thereby providing justification to be not off-topic in this forum :)

Well, actually I use it this way, but only by using 'tex + systemCommand' (as a
previewer, so to say). I'll send the code ... must be somewhere


>
> I used "xterm -ti vt340" and I got nothing. I'll try mlterm.
>

mlterm should work out of the box ... however, I'm definitely a xterm fan.

Did you check the requirements? latex, dvipng, libsixel-bin (especially
img2sixel --version => [img2sixel 1.7.2], 1.5 works as well. And how looks your
.Xresources? (https://wiki.archlinux.org/index.php/Xterm)

This might also be of help: https://github.com/jart/hiptext/issues/21

The best way testing sixel seems to me:

* Get latest gnuplot version: wget
https://sourceforge.net/projects/gnuplot/files/gnuplot/5.0.4/gnuplot-5.0.4.tar.gz

* unpack
* ./configure --with-bitmap-terminals | make | make install
* xterm -i vt340 -rv ### -rv only if background is black
* gnuplot> set term sixel
* gnuplot> test



Kurt Pagani

unread,
Sep 28, 2016, 6:51:19 PM9/28/16
to fricas...@googlegroups.com
Am 28.09.2016 um 19:28 schrieb Kurt Pagani:
> Am 28.09.2016 um 15:21 schrieb oldk1331:
>>> Oh, apparently I've misdirected that mail.
>>
>> :) I thought you want to integrate this with FriCAS, to have image
>> result of LaTeX output in terminal ...
>
> Good point, thereby providing justification to be not off-topic in this forum :)
>
> Well, actually I use it this way, but only by using 'tex + systemCommand' (as a
> previewer, so to say). I'll send the code ... must be somewhere
>

Eventually I found it. Since I've only a Windows notebook at hand at the moment
(with Xming at least) the quality of the shots isn't as good as if taken from a
local xterm (usually I prefer black background). It's a brute hack as you can
see, however, one could certainly elaborate on this. The pictures are
self-explanatory, unless the calibration procedure perhaps. One should match the
background color of the terminal of course and some tries might be necessary to
find the parameters for the 'sixel' function in 'f2sx.input'.

Usually I have the function in ".fricas.input" but it will only be read in
-nosman mode. I guess it's connected with the intial frame, so one probably
should construct the function in lisp.

Now as I see it again, I really like this terminal graphics (reminds me of the
DEC terminals in olden days). There is qtconsole of course, but with sixel you
won't need much infrastructure.





fricas2sixel
f2sx.input
1.PNG
2.PNG
calibrate.PNG
gnuplot_test.PNG

oldk1331

unread,
Sep 28, 2016, 8:05:32 PM9/28/16
to fricas...@googlegroups.com
I still can't make xterm work, I configured .Xresources and xrdb it.
But mlterm works well.

It's really nice and interesting to have such things in terminal.
(although I'll prefer emacs myself :)

Kurt Pagani

unread,
Sep 28, 2016, 9:11:16 PM9/28/16
to fricas...@googlegroups.com
Am 29.09.2016 um 02:05 schrieb oldk1331:
> I still can't make xterm work, I configured .Xresources and xrdb it.
> But mlterm works well.

Strange, indeed; the only reason I can think of is that your xterm was not built
with --enable-sixel-graphics (configure). Either it's very old or your distro is
not Ubuntu? (e.g. afaik Fedora does not enable).

I get: xterm -v => XTerm(322)
Ubuntu has * Enable sixel graphics (Closes: #716660) since xterm (297-1).

>
> It's really nice and interesting to have such things in terminal.
Yes, indeed. My colleague (the actual addressee) has written a program in Pure
(http://purelang.bitbucket.org/) that is latex based (similar to Cadabra), so
it's imo the quickest way to get reasonable output.

> (although I'll prefer emacs myself :)
I'm not surprised :)
>

oldk1331

unread,
Sep 28, 2016, 9:39:03 PM9/28/16
to fricas...@googlegroups.com
> with --enable-sixel-graphics (configure).

Oops, I compiled xterm with "--enable-sixel", which is what
https://github.com/saitoha/libsixel said.

Now I compile it with "--enable-sixel-graphics" and it works.

I guess you should open an issue for https://github.com/saitoha/libsixel .

Kurt Pagani

unread,
Sep 28, 2016, 10:34:45 PM9/28/16
to fricas...@googlegroups.com
Am 29.09.2016 um 03:39 schrieb oldk1331:
>> with --enable-sixel-graphics (configure).
>
> Oops, I compiled xterm with "--enable-sixel", which is what
> https://github.com/saitoha/libsixel said.
>
> Now I compile it with "--enable-sixel-graphics" and it works.
Great, nevertheless.
>
> I guess you should open an issue for https://github.com/saitoha/libsixel .
>

I did it.
https://github.com/saitoha/libsixel/issues/51
Reply all
Reply to author
Forward
0 new messages