3
grün
gr\"un
\bye

yields

grn
grün

Is it possible to have the Unicode ü correctly rendered with plain LuaTeX?


Would it also be possible with plain TeX and a METAFONT font? Or would a METAFONT font have to be converted into something else if one wanted to use it with Unicode input?

7
  • 7
    Try \input luaotfload.sty \font\lmr = name:"lmroman10-regular" gr\"un \lmr grün \bye Commented Jul 2, 2020 at 18:12
  • METAFONT fonts have 256 slots. Actually it is theoretically possible to have more “planes”, but with severe limitations on the font metrics: two characters in corresponding slots in two different planes must have the same metrics. You can draw characters with MF, then convert them to build an OpenType font with some tracing program (which is what has basically been done to produce the CM Unicode fonts, for instance).
    – egreg
    Commented Jul 2, 2020 at 20:07
  • @egreg, so, with an appropriately limited font, Unicode input can be mapped to the appropriate glyphs, even with plain TeX (not necessarily LuaTeX)?
    – Toothrot
    Commented Jul 2, 2020 at 20:27
  • @Toothrot I'm not sure I understand.
    – egreg
    Commented Jul 2, 2020 at 20:47
  • @egreg, let's say I have a small METAFONT font with polytonic Greek, but I want to be able to type alpha using the Unicode alpha rather than a Latin "a". Would there be any obstacle to that (in plain TeX, not LuaTeX)?
    – Toothrot
    Commented Jul 2, 2020 at 20:52

2 Answers 2

1

You might use METAFONT fonts:

\catcode`ü=\active
\protected\def ü{\"u}

grün
gr\"un
\fontname\font
\bye

enter image description here

You might study sections from 6.3 to 6.5 of the LuaTeX manual to see whether an approach with virtual fonts is feasible. However, this would require extensive work for defining virtual fonts from existing ones. Using European Modern fonts (that are T1 encoded, using LaTeX lingo) might be easier.

On the other hand, you can easily inject a font loader in LuaTeX and use OpenType fonts. For instance

\input luaotfload.sty

\font\tenrm="Latin Modern Roman"
\tenrm

grün
gr\"un
\fontname\font

\bye

enter image description here

Note that the second “grün” prints wrongly, because accents are not in the slots used by plain TeX and one needs to redefine the accent commands, for instance

\input luaotfload.sty

\def\"#1{#1^^^^0308}

\font\tenrm="Latin Modern Roman"
\tenrm

grün
gr\"un
\fontname\font

\bye

enter image description here

Redefining a few accents is obviously easier than many active characters.

2
  • Compare the 2 words "grün". The position of the dots is different. The second "grün" looks wrong. Is there a way to fix this? Can they be made equal? Commented Jan 11, 2021 at 19:17
  • OK, for MinionPro, they look equal, but when I copy and paste them, only the first "ü" appears correctly, the second one loses its dots (result: "u"). What is happening here? Commented Jan 11, 2021 at 19:21
0

I'm not an expert on this, so I cannot exactly explain how it works and why it works and stuff. But since nobody gave you satisfying answer on your second question sofar, I try to contribute myself. So, I guess I have a solution if your concern is using German. If you also want to use the Greek alphabet or math symbols and stuff, then I am afraid, this cannot work without LuaTeX or something similar that supports Unicode.

This problem is solved in the Czech-Slovak distribution of TeX, which, if I understand it corretly, has its own slightly modified fonts and internally it transforms the utf8 input into iso8859-2 coding, where all the Czech, as well as German, characters appear. See https://www.ctan.org/pkg/csplain

You can write, for example

Příliš žluťoučký kůň úpěl ďábelské ódy.

„Fix, Schwyz!“, quäkt Jürgen blöd vom Paß.

\bye

And after compiling using pdfcsplain instead of pdftex, you get the right result.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .