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/
First some personal experience: for one of the conference proceedings I was in charge of for the TeXnical aspects, I got several papers to put into shape. One of them was in Word: I asked for a printout and then converted the “saved as text” version line by line following the printout.
Another one was in plain TeX. The conversion was quite easy: I changed the initial macro definitions to use \newcommand
or \newtheorem
; then I went through the document and the translation to LaTeX was a rather short and easy job.
Much more painful was translating most papers from their authors' concept of LaTeX to the real one.
About your specific points in the list, here's my two cent.
You never use \hsize
in a LaTeX document, not even in the preamble (sole exceptions, some tricks with tabularx
). Using \textwidth
is not “simpler”: would you say that driving on the left side in the UK is simpler? Well, it's the same: setting the text width with \hsize
is like driving on the right side in the UK.
You never (with no exception) change \@outputpage
, unless your name is Frank and you're German (plus some other strict conditions).
While it's possible to specify page parameters by explicitly changing \oddsidemargin
and friends, it's much better done with geometry
. By the way, \hoffset
and \voffset
should always be zero.
The current value of the page number is accessible as \thepage
(which changes according to the chosen numbering style). Using \value{page}
(or \c@page
) should be a very rare need. Besides, one should not use \pageno
in plain TeX document, but \folio
, that's analogous to \thepage
.
Probably your point 2 is about adding structure the the header and footer; this is done with packages such as fancyhdr
, scrlayer-scrpage
or titleps
.
If you use \beginsection
and \proclaim
, it's not difficult to switch to LaTeX; of course, you'll remove all manually assigned numbers.
Most common plain TeX constructions work also in LaTeX; the manual mentions \line
among those having different meaning. Of course, no font selection command will work.
However, the mere fact that a plain TeX macro also works in LaTeX should not mean we can keep it. A typical example is \centerline
, that has essentially no place in a LaTeX document (it's not color safe, for instance), but also \root 3\of{2017}
should not be used.
Yes, I know that \centerline
can in some cases get me simply out of a problem, but such usages should always be buried in macros defined in the preamble.
The well structured plain TeX document I mentioned before, was written in a logical fashion, with consistent markup. The markup was not the same as in LaTeX, but this was not a problem: I just had to make a translation table and apply some search-and-replace.
A badly written document, using plain TeX, AMS-TeX, ConTeXt, LaTeX, Lollipop or whatever format, is just badly written and sometimes it's a pain also making it a valid document for the original format.
Best Answer
Here's an example, taken from here.
Result: