Part answer to my own question, from Aditya Mahajan on ConTeXt mailing
list (verbatim, but with formatting and links):
Read about TDS (TeX Directory Structure).
You need to put files in $TEXMF/tex/plain/
subdirectory for Plain
format to find it, or in $TEXMF/tex/generic/
subdirectory for all
macro packages (plain, latex, context) to find it.
As experiment, placed eplain's source files in $HOME/texmf/tex/generic/eplain/
. No other copies visible. For a file testdox.tex
, containing \input eplain
, the command
luatex --fmt luatex-plain testdoc.tex
does indeed find eplain.tex
. Executed three of the “generate
” commands:
mktexlsr
context --generate
luatools --generate
And now all of the these command will find the file:
luatools --find-file eplain.tex
mtx-run --locate eplain.tex
kpsewhich eplain.tex
In addition, if others have problems with font locations in ConTeXt, for OTF fonts, using Alegreya* as an example, I
- created the directory: ''$HOME/texmf/fonts/opentype/huerta/alegreya'' and
- copied all the ''*.otf'' files there.
- By running the “
generate
” commands above,
- followed by the font update commands below,
\font\x = <font>
also now works without having to install the fonts in the operating system.
mtxrun --script fonts --update --force
mtxrun --script fonts --update --simple --force
Edit: Path issues solved. Works on Windows as well, just ensure you're happy with the setting of %TEXMFHOME%
, which you can set with a batch file, or permanently in %TEXMF%\tex\texmf\web2c\texmf.cnf
). I run this ctxenv.cmd
file from a Cmd Prompt console before starting to work with ConTeXt's LuaTeX:
@echo off
:: Sets ConTeXt environment for running ConTeXt tools.
:: NB: This includes setting TEXMFHOME and calling
:: .\tex\setuptex.bat. It also add the ''.\utl''
:: directory to your PATH. This file must live in
:: your ConTeXt base directory. It will set %CTX%
:: for convenience.
::
set CTX=%~dp0
set CTX=%CTX:~0,-1%
set PATH=%CTX%\utl;%CTX%\bin;%PATH%
set TEXMFHOME=%CTX%\local
.\tex\setuptex.bat
:: optional: remove the colons in front of these commands:
::mktexlsr
::context --generate
::luatools --generate
As for the TL math fonts setting problem, I'll rephrase as a new question.
*Alegrya: http://www.ctan.org/tex-archive/fonts/alegreya/
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.
Best Answer
with latex
shows the fonts used:
eg the first is
so you can set up the same fonts in plain