03 Aug 2020I was reading LaTeX3’s documentation for `\dim_to_fp:n`

, where I encountered the following description:

Expands to an internal floating point number equal to the value of the `<dimexpr>`

in
pt. Since dimension expressions are evaluated much faster than their floating point
equivalent, `\dim_to_fp:n`

can be used to speed up parts of a computation where **a low
precision and a smaller range are acceptable.**

At first, I was confused by the subject of this paragraph and thought the precision of `l3fp`

is not ideal.
Because many data processing packages (e.g. datatool) rely on `l3fp`

to do floating point arithmetic, I had this idea of testing `l3fp`

’s accuracy against IEEE 754 double precision
floating point arithmetic. The result shows that the error of `l3fp`

is very small compared to IEEE 754 and is
negligible in everyday applications. However, the trigonometry functions of `l3fp`

seems to be significantly less
precise compared to other operations.

07 Jul 2020In LaTeX, verbatim environments are extremely tricky. Different verbatim environments are based on distinct LaTeX *magic*, which makes their behavior inconsistent. The only realiable way to use a verbatim environment is to write them in the TeX source as-is, for any attempt to construct such environments programmatically usually fails. In existing packages, such problems are avoided by saving the constructed environments into files first and then use `\input`

command to read them as TeX source files. I really dislike this solution as it induces significant I/O overhead (despite the fact that other I/O bottleneck may be more dominant). In this post, I provide a LuaTeX-based method that allows `\input`

from Lua strings.

(This post corresponds to my question on TeX.SE.)

20 Jun 2020LuaTeX is a TeX engine which integrates Lua as its scripting language. The combination of an editing language and programming language allows us to generate beautiful structural documents.

LuaTeX is usually included in TeXLive and MikTeX distributions.

19 Jun 2020Recently, I have been exploring the essence of LaTeX. The discovery of LaTeX3 really uncovers the potential of LaTeX as a “generic” programming language. Although with LuaTeX, writing complicated data structure and algorithms in pure TeX seems to be a waste of time, I still find my effort somehow meaningful in a way: at this point, I haven’t really studied programming languages and compilers formally, but playing with TeX really allows me to feel *the fine line between text and program*. We are able to do amazing things with TeX (which is Turing complete), but accompanied by fact that the foundation of TeX is based on text substitution and some support for numerical evaluation, I am stunned by its simplicity and universality. *Text is program, program is text,* it is the perfect concord.

25 May 2020As I am getting more and more familiar with LaTeX, my personal need of writing complicated LaTeX packages continue to increase. However, I am totally blown away by the complexity of expansion control in tradition LaTeX. Fortunately, the LaTeX3 project provides a way to write large scale LaTeX programs with much simpler expansion control and more systemic naming conventions. This post serves as a quick guide to introduce one to LaTeX3.

LaTeX is turing complete! If you know how to control expansions, you can pretty much do everything with LaTeX (tough the efficiency is awful).

02 Apr 2020*Scire ad trascendere* - Learn to transcend.

Topics covered:

- Mathematical induction
- Strong induction

29 Mar 2020Since I am working with Linux, which is considered to be “insecure” by Syracuse University’s ITS, there is no official
approach to connect to SU’s network with VPN. Fortunately, if you have an OSX or Windows machine around, which are capable
of using SU’s VPN, we can set up a NAT rule to allow Linux computers in the same LAN to access SU hosts.

29 Mar 2020*Scire ad trascendere* - Learn to transcend.

Topics covered:

**Please always pay attention to Blackboard announcements and your mailbox. Prof. Lee and I are trying different approaches
to make sure this course can go on as usual. You do not want to miss major changes in course format or policies.**

25 Mar 2020Link previews can help one understand a link. It is also much more beautiful than a simple hyperlink. Let’s discuss how to generate these beautiful previews for a web page. The resulting preview block looks like this:

Ever wondered how this preview is generated?

📅 Mar 25, 2020
🔗 medium.com

11 Mar 2020*Scire ad trascendere* - Learn to transcend.

Topics covered: