# Porting LaTeX packages to ConTeXt modules

From seeing quite a few questions here, it seems ConTeXt is often able to easily address problems that LaTeX has a hard time with. I'd be willing to give it a try, but there is one package that I depend heavily on, which is `bibleref` and is not ported to ConTeXt (that I know of).

How hard is it to port LaTeX packages to ConTeXt modules? What are the things to know when doing so?

-
Very close: tex.stackexchange.com/questions/28013/… –  Andrey Vihrov Sep 16 '11 at 6:07
@Andrey: Yes, I saw this one. It is close indeed, but it doesn't answer my question. –  ℝaphink Sep 16 '11 at 6:14
There are no LaTeX modules, just LaTeX packages. ConTeXt calls them modules. So it should be "Porting LaTeX packages to ConTeXt modules" –  Martin Scharrer Sep 16 '11 at 6:29
@Martin: thanks, fixed. –  ℝaphink Sep 16 '11 at 6:39
add comment

## 1 Answer

Porting a LaTeX module to ConTeXt (or the other way around) involves two steps: porting functionality and porting interface.

For modules like bibleref which do not do not touch the output routine (unlike say some of the footnote packages) or are not huge (unlike say biblatex), porting functionality is relative straight forward. For bibleref, I will say porting functionality is almost trivial.

Porting interface is trickier. One of the strongest point of ConTeXt is the consistent interface of all commands and if you want a new ConTeXt module to fit in with the rest of ecosystem, the interface should follow ConTeXt idioms. For example, for bibleref, this will mean having a key-value driven setup command `\setupbiblereferences` rather than macro driven configuration; using ConTeXt style for references `\inbible[book=...,chapter={list}, verse={list}]` (or some such variant) rather than "smart" encoding, using full names, for example `separator` instead of `sep`, providing standard features like `style` and `color` keys to change the style and color of output, having proper multi-lingual support so that the interface (names of keys and values) and the output (name of say the book) changes with change of main language (this is not as difficult as it sounds), etc.

Choosing an interface requires you to be familiar with the existing interface. So that is the hardest part if you want to switch from LaTeX to ConTeXt. Having said that, the ConTeXt mailing list is very supportive for implementing user request. If you specify what features you want (rather than simply pointing to a LaTeX package), someone on the ConTeXt mailing list will typically post some code implementing those features. You can then use that sample code as a reference for the interface and all other features that you need.

-
Very interesting. I really like the idea of standard features and unified interfaces in modules. –  ℝaphink Sep 16 '11 at 6:41
add comment