9

Is it possible to use LaTeX packages in ConTeXt? I want to know because I'd like to use ConTeXt's greater formatting facilities but I also want to use several LaTeX packages (crossword and xskak in particular) in my document. Are there any methods to do this?

Addendum

Despite similarities to this question, please do not close this question as a duplicate due to the fact that that question never got a satisfactory answered (at least, not one applicable to my situation.).

Edit

As an alternative I would appreciate methods of getting ConTeXt-level formatting in LaTeX+LuaTeX (Why LuaTeX? Font switching + more features than XeTeX.).

  • 3
    No, I don't think it is possible. You would need a "virtual latex machine" in context to use e.g. xskak. It makes use of many functions of the latex kernel (e.g. font handling) and no efforts have been made to write accompanying code for other formats like has been done in pgf/tikz. – Ulrike Fischer Oct 30 '13 at 11:01
  • 1
    for example, font selection is done differently (i don't know which is better, but context seems simpler to use). – wasteofspace Oct 30 '13 at 12:07
  • Can you use gasoline for a diesel engine? – egreg Oct 30 '13 at 15:59
  • 9
    ConTeXt has built in features that are equivalent to most LaTeX packages that provide formatting features. However, for specialized packages like xkak and crossword, there are no equivalent built in features. They can be ported to ConTeXt; crossword should be easy to port; but porting xskak will be a LOT of work. The easiest solution will be to format the chessboard as separate images in LaTeX and then include them in ConTeXt. – Aditya Oct 30 '13 at 21:47
  • @rake Sorry for being late to this. The developer community for LaTeX et al is very limited (small and mostly not programmers). For what it's worth, I have put together a dozen or so engineers and combined pdfTeX, XeTeX, LuaTeX, and ConTeXt over several months (more like a year, actually). We have an automated system that draws "diff's" from every update from CTAN, for quick porting. Obviously, I'm not allowed to share that effort in public. But there may come a time when HTML/CSS/JS combines with the best of LaTeX/ConTeXt. LaTeX can currently be programmed for more convenience; see pgf. – user152148 Jan 31 at 1:08
5

The short answer is: No.

This may be the reason that you find the answer in the linked post unsatisfactory.

To be a little more precise one has to mention that efforts are beeing made to bridge LaTeX and ConTeXt. Namely there is the LaTeX module for ConTeXt that tries to achieve exactly this. But, it is not fully developed as the description states:

This directory contains the rough beginnings of a LaTeX compatibility module for ConTeXt – essentially a complete reimplementation of the LaTeX kernel to operate within ConTeXt. The focus, at present, is on code that will allow excerpts from LaTeX documents to work in ConTeXt documents; having ConTeXt compile complete LaTeX documents will come later, if at all. (I do hope to have package loading working at some point, though, at least for some packages.) You should expect this code to be buggy. You should expect it to occasionally fail to play nice with ConTeXt, in ways that I haven't yet documented because I haven't yet discovered them. You should expect to find it incomplete, sometimes exceptionally so. Hopefully, you may also find it useful.

Furthermore there are a few ports as for instance the TypeArea module -- a reimplementation of KOMA's typearea package. You may test this example file (with mkii, after installing the module and updating with mktexlsr):

\setupoutput[pdftex]
\setupbodyfont[plr,11pt]
\enableregime[utf]

\usemodule[typearea]
\setupTypeArea[bcor=0mm,alphabets=3.1]

\starttext

\title{Testing typearea}

  Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. 

  Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. 

  Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. 

  Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. 

  Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis. 
\stoptext

However, summed up we are far away from beeing able to use LaTeX packages extensively in ConTeXt. That's why I consider your question to be answered negatively in short.

Here are a few concluding thoughts: Though ConTeXt allows modules to extend its functionality it was designed to be a rock solid macro package alternative to LaTeX that does (nearly) everything by itself. This alredy implies that a few things that LaTeX was able to do had been left out, and more important: future things to come (in LaTeX) would most likely not make their way into ConTeXt. I think the comment from @egreg to the OP explains that best: "Can you use gasoline for a diesel engine?" The two programs in question differ too much in their design and their aim, so a proper LaTeX virtual machine for ConTeXt would be needed indeed as @UlrikeFischer also noted.

So much for the official part. What you can actually do -- though I strongly recommend not to for several reasons --, is to reimplement the desired features using Plain TeX (with the e-TeX extension if needed), store those features in one or several .tex files somewhere in your local tree of your distro and to \input them into your ConTeXt file when you want to use them. This shouldn't cause harm in most of the cases, but I can't guarantee it, which is one of the reasons why I wouldn't recommend this procedure. Moreover the solution isn't portable and in my eyes it's just too much work for too little benefit. Better use diesel fuel only... (and ask TeX.SX if it is not clear how to use it exactly. I think we have some great engeneers among us ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.