Comibined characters in Math

15 October, 2017 (3 minute read). Category: Mathematics. Tags: asciimath.

There is a new feature in ConTeXt that replaces some ascii math (I am using this term informally. The symbols do not match the asciimath symbol list). It is enabled by default and replaces a combination of characters by a glyph. For example,

A function $f$ is an increasing function
    x <= y  ===> f(x) <= f(y)


{map[src:/context-blog/post/math-combined-characters/ex-1.png class:center alt:Example of combined characters]  Page("Comibined characters in Math") <nil> true <nil>}

Read more >

Typesetting differential equations

18 September, 2017 (4 minute read). Category: Macros. Tags: luatex, programming, separating content and presentation.

This semester I am teaching a course involving linear differential equations, so I have typeset many differential equations that look like this:

{map[class:center alt:Simple example src:/context-blog/post/typesetting-differential-equations/LDE.png]  Page("Typesetting differential equations") <nil> true <nil>}

Believe me, writing such equations by hand gets tedious very quickly. So, I wanted a macro \LDE (for Linear Differential Equation), so that I could just type

\LDE{1, -3, 2}{2, 1}

and get the above result. This post describes how to write such a macro using LuaTeX + ConTeXt.

Read more >

Frame with solid left line

18 August, 2017 (1 minute read). Category: Visualization. Tags: backgrounds, framed.

Adding a solid line of the left side of a frame, block quote, etc. creates a simple, clean, and attractive visual effect that I like.

{map[alt:Simple example src:/context-blog/post/frame-with-solid-left-line/leftframe-0.png class:center]  Page("Frame with solid left line") <nil> true <nil>}

I don’t know when I first came across this style, but it is used commonly on the Internet to show blockquotes. So, how do we get this style with ConTeXT?

Read more >

Drop shadows with lifted corners

6 August, 2017 (2 minute read). Category: Visualization. Tags: metapost, backgrounds, shadows.

There is an old question on TeX.SE asking how to draw drop shadows with a lifted corner. For fun, I decided to translate the code to Metapost and release it as a module: t-backgrounds. I hope to add a few other backgrounds to the module in the near future.

The module provides two overlays liftedshadow:big and liftedshadow:medium. These may be used like any other overlay. Let’s see an example:

{map[src:/context-blog/post/drop-shadow-with-lifted-corners/example.png class:center alt:Simple example]  Page("Drop shadows with lifted corners") <nil> true <nil>}

Read more >

Correct math escape in t-vim

22 July, 2017 (3 minute read). Category: Formatting. Tags: t-vim, math, horizontal spacing, code formatting.

There is a feature in t-vim module that allows the use of TeX code in comments, which is useful when typeset math in comments. For example:

\definevimtyping[C][syntax=c, escape=on]

/* The following function computes the roots of \m{ax^2+bx+c=0}
 * using the determinant \m{\Delta=\frac{-b\pm\sqrt{b^2-2ac}}{2a}}

double root (double a, double b, double c) {....}

Read more >

Rising from the ashes

10 June, 2017 (1 minute read). Category: Announcement. Tags: blog.

I used to blog on Wordpress, mainly about ConTeXt, but occasionally about other stuff as well. It has been almost three years since I last posted there. I got busy. Both in my personal and professional life. This is an attempt to restart that blog.

Read more >

Metapost and TeX labels

22 January, 2014 (3 minute read). Category: Metapost. Tags: label, metapost.

Default Metapost has the concept of two types of labels, postscript labels and TeX labels. Postscript labels are created using

label("text", location);

while TeX labels are created using

label(btex text etex, location);

In the latter case, Metapost collects everything between btex and etex in a separate file, processes that file through TeX, and includes the resulting postscript code at an appropriate location. Such a Rube Golberg-esque mechanism is needed to propertly typeset mathematics, get proper kerning, etc.; tasks that TeX can do but Postscript cannot.

Read more >

Creating a clean presentation style in 40 commits

13 January, 2013 (1 minute read). Category: Visualization. Tags: git, presentation, tutorial.

Did you always want to learn ConTeXt, but did not know where to start? I have written a git-based tutorial that should help you get started. The idea of the tutorial is to start with an empty document, and add features one-by-one. Each git commit corresponds to one small change in the document, and includes pointers to the documentation corresponding to that change. Read Use this tutorial as follows: Clone the git repository:

Read more >

Separation of content and presentation in tables

18 November, 2012 (4 minute read). Category: Formatting. Tags: tables, separating content and presentation.

Separation of content and presentation is one of the selling points of TeX over word-processors. Strictly speaking, TeX is not superior compared to word-processors in this regard. It is possible to obtain a clean separation between content and presentation in word-processors (using styles) and it is possible to mix content and presentation in TeX code, as is illustrated by the following example from sample tex file for the IEEE Conference on Decision and Control:

\title{\LARGE \bf
Preparation of Papers for IEEE CSS Sponsored Conferences \& Symposia

(Seriously, how can anyone recommend writing TeX code like that!)

Read more >

Removing multiple blank lines when typesetting code listings

29 September, 2012 (2 minute read). Category: Formatting. Tags: t-vim, code formatting, blank lines.

The listings package in LaTeX has an option to collapse multiple empty lines into a single empty line when typesetting code lists. Today, there was a question on TeX.SE how to do something similar when using the minted package. The t-vim module uses the same principle as the minted package. So, I wondered how one could collapse multiple empty lines into a single line in t-vim?

Read more >
Next Page >