5

I have the following assumptions:

  • TeX is a kind of language
  • Plain TeX is the original environment for this language
  • LaTeX (and other environments) is a set of compiled macros written using TeX primitives.
  • Lets say MikTeX can organize those macros in local repository so I can reuse them in my LaTeX document.

But I am still not sure if CTAN contains packages for LaTeX or for TeX. Are they written using built-in LaTeX macros or written in pure TeX. If the second is true can I use those packages in plain TeX using \input? How should I organize macros from CTAN just download and put into the same folder with my document? Is there any package manager for plain TeX?

  • Try to use \usepackage{foo} in a plain TeX file ;-) You could use \input (a TeX primitive) but then you would get into troubles with \NeedsTeXFormat, \ProvidesPackage and all the LaTeX specific commands. But I am sure that there are some 'packages' designed for plain TeX on CTAN – user31729 Jun 3 '15 at 14:47
  • Ok. So CTAN is mostly for LaTeX only. Those macros are written using LaTeX built-in macros. I didn't find CTAN said it is for LaTeX only so I thought as you say some packages (geometry for example) were written to be used in TeX as well. – Druid Jun 3 '15 at 14:50
  • No, CTAN is not LaTeX only. I just don't know any plain TeX 'packages' – user31729 Jun 3 '15 at 14:52
  • I see. But don't you know if some environment exists for plain TeX but with support of package management? – Druid Jun 3 '15 at 14:55
  • 1
    ctan is not latex-only but the directory tex/latex on ctan is for macros that are designed for latex, but there are lots of other directories on the archive. – David Carlisle Jun 3 '15 at 15:06
6

In short: Plain TeX and LaTeX are different macro packages that define different formats. So, in general, it is not possible to use LaTeX packages on top of Plain TeX. For a short introduction to all this rather specialized jargon you may check this blog post

It is possible to use some LaTeX packages on Plain TeX (graphics, color and hyperref, for instance), by faking some functionality of LaTeX; only that necessary to load and make the packages operative. Yet another macro package built on top of plain, eplain, has a built-in ability to load some basic LaTeX macro packages.

\beginpackages
  \usepackage{graphicx,color}
  \usepackage{url}
\endpackages

It is also possible to use some Plain TeX functionality in LaTeX documents with the plain package and the plain environment provided. Still, it's not the whole thing, but works for many things.

\usepackage{plain}
\begin{plain}
[plain stuff]
\end{plain}

You can find all this stuff in CTAN, which contains lots of thing TeX related. Beware though that you need to learn how to navigate in the tex-archive tree.

The MikTeX package manager deals mostly with LaTeX packages, so you may need to learn how to install Plain macro files manually.

  • @Druid OPmac is plain TeX package which implements basic LaTeX features but keeps your code straightforward, simple and compact. You needn't a "combo", because hyperlinks and colors (and much more) is implemented. See petr.olsak.net/opmac-letak.pdf – wipet Jun 5 '15 at 3:52
  • @Lusr56 Sorry, OPmac users needn't msfss because font selection system with OPmac is much more simple and comfortable. We needn't combo. And OPmac supports foreign languages. Please, don't judge something what is unknown for you. – wipet Jun 5 '15 at 19:49
  • @Lusr56 \textbf{bold \textit{italics}} -> {\bf bold {\em italics}}, see the middle of page three in the English documentation. Languages switchers must be hardcoded into format, because hyphenation patterns are hardcoded into format too (it is TeX feature). OPmac works with both: csplain and plain based on etex.src. And the markup is simply plain TeX markup. Of course, it is not LaTeX markup. Users can modify the markup by their macros. If we are talking about missing LaTeX markup then the advice is simple: use LaTeX, don't use plain. – wipet Jun 6 '15 at 4:35
  • Original question was about packages on Plain. OPmac is an example. LaTeX packages on Plain is nonsense, IMHO. And you started with alternatives to LaTeX in Plain when you mentioned a combo. – wipet Jun 6 '15 at 21:06
  • ad 1. Of course, if I change plain TeX to a pseudo LaTeX using miniltx then some LaTeX packages work. Ad 2. Users are using plain TeX because LaTeX markup is very uncomfortable for them so your notes are irrelevant. Ad 3. OPmac is a part of csplain package, so ams-math.tex is installed when OPmac is used. But OPmac works on top with classical TeX, pdftex, xetex, luatex. Try tex opmac-u-en or pdftex opmac-u-en. Ad 4. Multiple columns: use \begmulti...\endmulti, read page 6 below of English documentation. – wipet Jun 7 '15 at 4:09
3

This is only a partial answer, as it does not provide the full requested information.

There are macro bundles ('packages') on CTAN designed for PlainTeX, listed under CTAN archive and explicitly stated as such, e.g.

etc.

The directory CTAN plain/contrib archive contains a lot of user contributions as TeX bundles.

The direct usage of LaTeX macros in PlainTeX is difficult, depends on their complexity to bypass the LaTeX style and boil them down to TeX. Either it's necessary to copy the macros out of the LaTeX package or to use some \let\RequirePackage ... etc stuff to calm down TeX.

I doubt that the whole effort to \input LaTeX packages/source files/preambles will gain any profit.

The screen shots just show some of the macro directories in the relevant categories. The overview isn't meant to be complete.

enter image description here

enter image description here

enter image description here

  • your list stops just before the plain subdirectory. that contains a further subdirectory contrib that is full of possibilities. – barbara beeton Jun 3 '15 at 15:03
  • Oh great. It basically answers my question – Druid Jun 3 '15 at 15:03
  • @barbarabeeton: I wasn't finished yet.. I thought about another screen shot – user31729 Jun 3 '15 at 15:05
  • @ChristianHupfer -- i'm too lazy to pull this up on a browser; i keep a local copy of the ctan FILES.byname for reference, and refresh it about once a month. – barbara beeton Jun 3 '15 at 15:08
  • @barbarabeeton: Your comment indicates that I am not clever enough to do this as well? ;-) I have no account on 'comedy' and a I don't want to clone CTAN on a local disk here – user31729 Jun 3 '15 at 15:11
3

CTAN is a TeX & friends-related code repository not a LaTeX snob :P. The contents are separated for convenience and maintenance plus a few esoteric details (as far as I know). For example if you look at your MikTeX directory you can see this separation clearly. Because packages are also installed based on this structure.

But possibility of using a LaTeX package in plain TeX is up to the author of the package. If you use LaTeX constructs in your package and some plain TeX user wants to use it, then it will fail as the LaTeX macros won't be available. If you use \newcommand instead of \def or other LaTeX constructs like \newcounter and so on then plain TeX user needs to either import the latex style file with input which would be more or less using LaTeX hence futile or rewrite the macros from scratch.

Some authors actually check the compilation engine, branch off and decide accordingly during the package import.

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.