This is a follow of Spanish hyphenation and UTF8 characters in plain TeX with pdfcsplain, xetex and luatex in my attempts of use OPmac with or whitout pdfcsplain for Spanish documents.

In the cited question, egreg's solution to Spanish hyphenation with xetex/luatex worked like a charm for normal text,...but with respect OPmac macros I have found two problems:

1) load a OpenType font as in the egreg's MWE seem not compatible with OPmac macros as text or \tit Mañana or \sec Mañana loss the ñ and print "Maana" with the default font (but it is OK in normal text).

This is the minor problem since \input ucode plus \input cs-xxxxx (where xxxxx must be a TeX Gyre font) produce the correct output (This is a somewhat limited solution, but fortunately with a nice font family).

2) The most severe problem is related with the hyphenation solution, as\uselanguage{espanol} produce an error with \caption/f or \caption/t macros, so the PDF cannot be compiled.

Minimal not-working example to test:

\font\tenrm="DejaVu Serif" at 12pt  
\input opmac

\tit  Mañana % Missing "ñ'', without DejaVu Serif

\sec Mañana % Missing "ñ'' without DejaVu Serif 

Mañana  % No problem 

\input ucode 
\input cs-pagella  % only TeX Gyre fonts (try \input cs-charter)  

\tit  Mañana % Now OK

\sec Mañana % Now OK

\uselanguage{espanol} % Spanish hyphenation (see egreg's answer)

\caption/f Test % Error only due to \uselanguage{espanol}

  • And your question is...?
    – jarnosz
    Sep 8 '15 at 23:07
  • @Louie Obviosly, avoid these problems :), i.e., how to have Spanish hyphenation activated (\uselanguage{espanol}) and working captions at the same time, and if possible, how to have others fonts that TeX Gyre fonts working smoothly with \tit or \sec macros.
    – Fran
    Sep 8 '15 at 23:15
  • When I try to compile this, I get, Font \tenrm=DejaVu Serif at 12pt not loadable: metric data not found or bad.
    – Davislor
    Sep 8 '15 at 23:16
  • Fran: I fear you may have a spaghetti of engines, formats, and macros. From context and the other question I collect you are trying to use xetex+hyplain+opmac. Is that correct? Beware that OPmac has its own Font Selection Scheme, so trying to load other fonts may break.
    – jarnosz
    Sep 8 '15 at 23:20
  • @Lorehead after you follow egreg's instructions comment \uselanguage{espanol} to have a compilable version and see the problem 1. To see the problem 2, uncomment \uselanguage{espanol} and comment \caption/f Test
    – Fran
    Sep 8 '15 at 23:23

I suppose that you need to run OPmac in standard xetex or luatex formats. They are generated using etex.src macros and hyphenation for all languages are preloaded. So, you needn't to re-generate format, just simply run xetex on command line.

The Spanish hyphenation pattern is activated in document by \uselanguage{espanol} in mentioned format.

OPmac uses three auto-generated words: Chapter, Table, Figure. It must know the translation of these words in selected language. But only Czech and Slovak translations are ready, because the author of OPmac isn't multilingual person(:. So, you must to set these three words in your language. And more words, if you will use \mtext macro (multilingual text) in your macros.

Moreover, the short-cut of used languages must be set: es for Spanish. OPmac sets only en, cs and sk. These short-cuts are set for all languages only in csplain, but you are using format from etex.src macros. So, you have to write this:

{\uselanguage{espanol}  \sxdef{lan:\the\language}{es}}

This is bug in OPmac documentation that this isn't mentioned there. I hope that this will be corrected. Thank you for your testing and reporting.

Finally, you can use the OTF font, but load all variants: \tenrm, \tenit, \tenbf and \tenbi. This means, you must to load whole family. Then the bold variant is used in titles. Your mistake was that bold variant was not loaded. Then the default Knuth's non-OTF font was used for titles.

OPmac uses csplain's font selection system: if the whole family \tenrm, \tenit, \tenbf and \tenbi is loaded then it is used in all desired sizes. The size of normal text in the document is set by \typosize. Don't use at12pt clause when \font primitive is used.

Your example looks like:

\input opmac

\font\tenrm="DejaVu Serif"
\font\tenbf="DejaVu Serif/B"
\font\tenit="DejaVu Serif/I"
\font\tenbi="DejaVu Serif/IB"

{\uselanguage{espanol}  \sxdef{lan:\the\language}{es}}


\uselanguage{espanol} % Spanish hyphenation

\tit  Mañana

\sec Mañana


\caption/f Test 


Process it using xetex example or luatex example.

  • 1
    Excellent answer. Now all seem correct, including special symbols and hyphenation. I will accept just now, but for the shake of the completeness, it would be nice see a similar solution for pdfcsplain.
    – Fran
    Sep 9 '15 at 7:38
  • One minor thing about your translation: babel traslate "Table" as "Cuadro". Although at the present time almost everybody use "Tabla" for any type of table by English influence, "tabla" in Spanish should be used for tables with numbers only (like the multiplication table). A "tabla" is always a "cuadro", bust rarely a "cuadro" is only a "tabla".
    – Fran
    Sep 9 '15 at 8:20
  • 1
    Note, that the section about non-Czech non-English language were added to the OPmac documantation.
    – wipet
    Sep 15 '15 at 6:17
  • 1
    At the end of day, in common documents I saw little difference between the "encoding hell" of pdfcsplain+TeX Gyre fonts and the "xetex paradise", since most free OpenType fonts only have a little subset of uft8 symbols (a nice exception is the >3400 glyphs of DejaVu), but I wanted to be sure of stack to the best option. Many thanks to clarify, and overall, thanks to extent the documentation to another languages. It is nice known \sortingdata before to facing the problem of sorting a Spanish index!
    – Fran
    Sep 15 '15 at 10:42
  • 1
    When \input luafonts is included before first usage of \font primitive then it does work with LuaTeX.
    – wipet
    Jan 2 '18 at 7:32

OPmac was designed to work with csplain by default, so you don't need to fiddle with other formats. You may add hyphenation patterns for more languages (Spanish among others) following the instructions given here; after that, you need to regenerate the csplain format for your favourite engine as explained here. Make sure you have installed the Spanish hyphenation patterns available here.

  • 1
    Thanks. That is what I tried first with pdfcsplain, but I made something wrong (may be \eslang without \input t1code or forget texhash). Finally I have been able to do, so that \input opmac \input t1code \input utf8lat1 \eslang work with the right hyphenation, but this way remain at least the inconvenient of some unknown symbols, even using TeX Gyre fonts (\input cs-pagella, etc.).
    – Fran
    Sep 9 '15 at 11:08

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.