[JAVA] Kinx Library-Automatic Typesetting (Tiny Tyesetting)

Introduction

** "Looks like JavaScript, brain (contents) is Ruby, (stability is AC / DC)" ** Scripting language Kinx ). This time is the latest information on Tiny Typesetting. This is a continuation of ** this **.

Cocontokoro, I was doing this much. Yes. Now that I can do what I wanted to do first, I will publish it.

It's named KiTTy so it can be used as a single function rather than as a library (at this point). We also have run commands kxkitty.exe (Windows) and kxkitty (Linux).

For the time being, I made a manual with Essa Hoisa, so please refer to it. The manual itself is written in KiTTy (it was hard to make both Japanese and English ...). Both Japanese and English are listed here. I'm not very confident because I gave priority to finishing English roughly.

This is the original file.

KiTTy processing this gives: I'm not confident, but I'll post the English version as well.

How about?

By the way, the processing speed is slow so far, but I can put up with it personally (I think it's a favor because I'm a child). I have some ideas for improvements that could improve execution speed, but I don't have time to spare so it will stay that way for a while. I would like to apologize in advance so that I can forgive you. I'm sorry.

Technical information etc. used

List of supported functions

As mentioned in the manual, KiTTy supports the following functions as formatting functions. Kerning is not currently supported. I would be grateful if you could read the manual for details.

Some Japanese typesetting functions are also supported. Ruby also swings. Vertical writing is not supported.

Key individual technical information

It's a technical blog, so I'll give you some technical information.

Knuth-Plass Line Breaking Algorithm

The line splitting algorithm used in LaTeX. After hyphenation, insert Glue and Penalty in individual Box units and control the line break at the position where Penalty is minimized.

For technical details, the following may be helpful in Japanese.

In addition, the implementation was used by modifying the following (BSD-2-Clause License). ** It looks like JavaScript **.

Formula

If you're aiming for LaTeX (but not), you need mathematical formulas. So, there are KaTeX and MathJax in JavaScript, so I thought I would take advantage of the features of JavaScript ** here as well, but the details (fonts and CSS required) are too different ** I can't. was**. So, here I implemented it with ** Duktape + KaTeX **. ** But it stumbled upon rendering ** and eventually imaged based on ** Phantomjs **. I'm wondering if Duktape was necessary, but since Duktape may be used elsewhere, I decided to stay as it is (I didn't have much time to fix it).

At this point, there are some voices saying that ** Phantomjs is subtle **, but it's working, so it's okay. I think it's okay to close it in the library because it can be done with a single command without using node.js or Chrome, but there is information that "Yes (it can be closed with just a single command)" by other means. Please have it.

Chart.js

** With Phantomjs built-in **, I tried to do various things first and it worked. I find it very convenient to freely chart in the document. Or rather, it's convenient.

By the way, I tried to incorporate Mermaid.js in a good way and failed (I hope I can write UML). I may try again soon.

Other

There seems to be various other things that I can introduce, but due to time constraints, this is all for today.

Installation method

The installation method is also described in the manual, but I will introduce it. It's originally Markdown, so it looks like a basic copy (although it needs some modifications).

The installation involves two steps:

  1. Install Kinx
  2. Installation of KiTTy additional modules

By the way, the Kinx core module is about 8.5-9M, but the KiTTy additional module (including fonts) is about 74M. You can see it by looking at Assets at ** here (release page) **. Creating a package manager is difficult, so I sought a way to keep everything out of the core. I'd like to prepare a package manager equivalent in the future, but for now this method.

Linux

On Linux, download the module as follows: v0.15.2 is the officially added version of the KiTTy library. Please rewrite when using the latest version. Create a work directory and move it.

$ mkdir temp
$ cd temp

First download and unpack the kinx module, then Then download and unzip the KiTTy package.

$ curl -L \
    https://github.com/Kray-G/kinx/releases/download/v0.15.2/package_linux-amd64.tar.gz \
    --output package_linux-amd64.tar.gz
$ tar -xvf package_linux-amd64.tar.gz
$ curl -L \
    https://github.com/Kray-G/kinx/releases/download/v0.15.2/package_kitty.zip \
    --output package_kitty.zip
$ unzip package_kitty.zip

When you unzip it, a folder with the version number will be created. Go and run the ʻinstall.sh` command.

$ cd v0.15.2
$ sudo ./install.sh

This completes the installation. Let's check the position of the execution fill [^ exe].

$ which kxkitty
/usr/bin/kxkitty

[^ exe]: The manual is looking for the location of kinx. Should be here. I'll fix it soon.

Windows

On Windows, download the latest packages (2 points below) from the Release page (https://github.com/Kray-G/kinx/releases).

Extract each and copy the contents of package_kitty.zip under the lib folder [^ winbuild].

At that time, make sure that the fonts and phantomjs folders are placed under lib. The file structure in the compressed file may not always be the case.

[^ winbuild]: We don't have an installer at this time, but we plan to have a Windows installer in the future.

Build

Normally, you don't need to do it from build. An execution module that has already been built is provided, and you can use this system by installing it according to the procedure. If you dare to execute from the build, you can execute the build by the following procedure.

Linux

Clone from Github and make.

$ git clone https://github.com/Kray-G/kinx.git
$ cd kinx
$ make

Install it.

$ git clone https://github.com/Kray-G/kinx.git
$ cd kinx
$ sudo make install
$ sudo make kitty-install

Windows

Clone from Github and make.

$ git clone https://github.com/Kray-G/kinx.git
$ cd kinx
$ make.cmd

In particular, we don't currently have a command for installation, It can be used in the built environment. Please use it in the built environment.

hello, world

Create the following document and save it as a helloworld.md file.

% Hello Kinx Tiny Typesetting
% Your name
% October 7, 2020

<param style="ArticleA4"/>

# Greeting
hello, world

Execute the kxkitty command as shown below to create helloworld.pdf.

$ kxkitty helloworld.md

Currently, it is necessary to describe about a sample, We plan to improve it so that we can present a slightly simpler sample.

in conclusion

If you think, "Isn't it okay?", I'd be happy if you could give me a GitHub star (although I always say the same thing). We would also like to thank all the people who have supported us so far **. It's been a little late to update, but I'd like to proceed little by little, so I'd be very grateful if you could make an Issue or Pull Request on GitHub.

Thank you for your continued support.

Recommended Posts

Kinx Library-Automatic Typesetting (Tiny Tyesetting)
Kinx Tiny Typesetting --LaTeX faction? Do you know?