I'm using the opmac macros. I need to use both Italian and English in my documents, so I need a way to set Italian language (hyphenation and the possibility of directly input the letters à è é ò ù ì) and a way to switch between Italian and English. Is there a particular opmac feature that allows to do it?


OPmac is a macro collection which works with pdftex or xetex or luatex with plain TeX format generated by etex.src or with format csplain. The settings of Italian stuff depends mainly on the chosen engine and format, no on OPmac.

1) If pdfTeX (or XeTeX or LuaTeX) with plain TeX generated by etex.src is used, then the hyphenation is loaded already and you can set it by \uselanguage{italian}. Sorry, I don't know, how to set the non-ASCII characters typesetting (à è é ò ù ì) in this format if pdfTeX engine is used.

2) If csplain is used then hyphenation isn't loaded already. You need to regenerate format by:

pdftex -jobname pdfcsplain -ini -enc "\let\itPatt=y \input csplain-utf8.ini"
xetex -jobname pdfcsplain -ini -etex "\let\itPatt=y \input csplain.ini"
luatex -jobname pdfcsplain -ini "\let\itPatt=y \input csplain.ini"

Then you can use the \itlang selector for setting Italian hyphenation.

Opmac uses only three pre-declared auto-generated words dependent on selected language: Chapter, Table and Figure. Another words can be defined by user. The Italian version of these words can be set by:

\input opmac
   \ifx\uselanguage\undefined \else % etex.src is used:
      \gdef\enlang{\language=0 }

English language is default. So \caption/t prints Table.

\itlang Now the Italian language is set. So \caption/t prints Tabella.

\enlang The English language is used here. \caption/t prints Table.   

The following text is about interpretation of UTF-8 codes like à è é ò ù ì. This is not explicitly connected with OPmac macro package.

CSplain (with 8bit pdfTeX) accepts only UTF-8 codes from ASCII plus Czech and Slovak alphabet as default. If you need to use à è é ò ù ì, then \input utf8lat1 is recommended and T1 encoding of font must be selected before:

\input t1code    % T1 encoding
\input lmfonts   % T1 encoded fonts, other family can be selected too
\input utf8lat1  % Latin 1 Unicode subtable interpreted by encTeX

Now you can type à è é ò ù ì.

CSplain with xetex or luatex or plain TeX generated by etex.src with xetex or luatex interprets UTF-8 codes without \input utf8lat1, but proper font family must be loaded:

\input ucode   % Unicode encoding
\input lmfonts % Unicode encoded LM fonts

Now you can type à è é ò ù ì.
  • 2
    Any particular reason for not loading all languages in the csplain format? – egreg May 9 '15 at 14:04
  • @egreg The set of non-Czech/Slovak users of csplain is almost empty (maybe this will be changed...). Second: ls -lah pdftex.fmt (all languages) : 3.3M, ls -lah pdfcsplain.fmt (only en/cs/sk): 480K. And the (pdf)csplain.fmt is stored four times in TeX distribution: two times for pdfTeX (dvi and pdf output), once for XeTeX and once for LuaTeX. There is big difference between 13M or 2M in files storage, moreover when almost empty set of users will use the 11M of difference. – wipet May 9 '15 at 17:12
  • I am surprised that Italian have accented letters because the hyph-it.tex is pure ASCII hyphenation patters (English has second pure ASCII patterns and none others). Why the letters à è é ò ù ì are missing in your patterns? – wipet May 9 '15 at 17:40
  • 1
    Because the accent is found only on the last vowel of some words, which never participate to hyphenation. The accent is only exceptionally found in other positions, which don't warrant bothering with defining specific patterns. These days, 13 or 2 MB is unimportant. – egreg May 9 '15 at 17:54
  • @egreg It also was an explicit decision of Claudio Beccari to not use any accents at all in the pattern files. You could have supported accented Italian otherwise, like it's found in some dictionaries. – Arthur Reutenauer May 30 '15 at 8:27

OPmac is oblivious to language settings. If you want to typeset documents with different languages, you may try to set up the hyplain format instead of plain, add your languages at will, and load OPmac manually in your document. So,

  1. Grab hyplain from CTAN and follow the installation instructions.
  2. Grab and install your hyphenation dictionaries: I recommend you the files from ec-plain; they are a bit outdated, but small and beautiful.
  3. Edit the hylang.tex file to add and name your languages according to the instructions.
  4. Build your format and use it!

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.