Character translation with Luaotfload
Since Luaotfload is extracted from ConTeXt, I figure people here will know this: In the code below, math mode '.' and ',' are translated into ':'and ';', which seems to occur because that is what ASCII/Unicode has in those positions, unlike CMMI. So how to correct this? The issue is really trying to find get texinfo.tex working with Unicode fonts using LuaTeX, as it probably does not work with ConTeXt. (Later versions of the former use LuaTeX UTF-8 directly without translations.) ---- \input luaotfload.sty \font\stix={file:STIX-Regular.otf} at 10pt \font\stixit={name:STIXMath-Regular} at 10pt \font\stixsc={file:STIX-Regular.otf} at 7pt \font\stixscsc={file:STIX-Regular.otf} at 5pt \stix \textfont0=\stix \textfont1=\stixit % Translates ',' into ';'. \scriptfont0=\stixsc \scriptscriptfont0=\stixscsc \scriptfont1=\stixsc \scriptscriptfont1=\stixscsc \textfont2=\stix \textfont3=\stix Hello 𝑃, ±, $𝑥 = ±𝑦_𝑃$, $$𝑃_0, …, 𝑃_{𝑘 - 1} ⊢ 𝑃.$$ \end ----
On 4/15/2017 10:42 AM, Hans Åberg wrote:
Since Luaotfload is extracted from ConTeXt, I figure people here will know this:
In the code below, math mode '.' and ',' are translated into ':'and ';', which seems to occur because that is what ASCII/Unicode has in those positions, unlike CMMI. So how to correct this?
The issue is really trying to find get texinfo.tex working with Unicode fonts using LuaTeX, as it probably does not work with ConTeXt. (Later versions of the former use LuaTeX UTF-8 directly without translations.)
---- \input luaotfload.sty
\font\stix={file:STIX-Regular.otf} at 10pt \font\stixit={name:STIXMath-Regular} at 10pt \font\stixsc={file:STIX-Regular.otf} at 7pt \font\stixscsc={file:STIX-Regular.otf} at 5pt \stix
\textfont0=\stix \textfont1=\stixit % Translates ',' into ';'. \scriptfont0=\stixsc \scriptscriptfont0=\stixscsc \scriptfont1=\stixsc \scriptscriptfont1=\stixscsc \textfont2=\stix \textfont3=\stix
Hello 𝑃, ±, $𝑥 = ±𝑦_𝑃$, $$𝑃_0, …, 𝑃_{𝑘 - 1} ⊢ 𝑃.$$
There is a luatex-math.tex file in the context distribution that you can look in .. basically you need to define the proper math character mapping (context ship swith a plain setup too). Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
On 16 Apr 2017, at 12:51, Hans Hagen
wrote: On 4/15/2017 10:42 AM, Hans Åberg wrote:
Since Luaotfload is extracted from ConTeXt, I figure people here will know this:
In the code below, math mode '.' and ',' are translated into ':'and ';', which seems to occur because that is what ASCII/Unicode has in those positions, unlike CMMI. So how to correct this?
The issue is really trying to find get texinfo.tex working with Unicode fonts using LuaTeX, as it probably does not work with ConTeXt. (Later versions of the former use LuaTeX UTF-8 directly without translations.)
There is a luatex-math.tex file in the context distribution that you can look in .. basically you need to define the proper math character mapping (context ship swith a plain setup too).
It works with texinfo: just include it, but it seems keeping luatex-math.lua in the directory speeds up compilation. I used the code below at the beginning of the .texi file. ---- \input luaotfload.sty \input luatex-math.tex \font\stix={file:STIX-Regular.otf} \input texinfo @c -*-texinfo-*- @textfont0=@stix @textfont1=@stix @scriptfont1=@stix @scriptscriptfont1=@stix ----
On 4/16/2017 3:06 PM, Hans Åberg wrote:
On 16 Apr 2017, at 12:51, Hans Hagen
wrote: On 4/15/2017 10:42 AM, Hans Åberg wrote:
Since Luaotfload is extracted from ConTeXt, I figure people here will know this:
In the code below, math mode '.' and ',' are translated into ':'and ';', which seems to occur because that is what ASCII/Unicode has in those positions, unlike CMMI. So how to correct this?
The issue is really trying to find get texinfo.tex working with Unicode fonts using LuaTeX, as it probably does not work with ConTeXt. (Later versions of the former use LuaTeX UTF-8 directly without translations.)
There is a luatex-math.tex file in the context distribution that you can look in .. basically you need to define the proper math character mapping (context ship swith a plain setup too).
It works with texinfo: just include it, but it seems keeping luatex-math.lua in the directory speeds up compilation. I used the code below at the beginning of the .texi file.
i don't understand the speed issue ... maybe you need to adapt the texinput path variable so that it can find the file in the tex tree
---- \input luaotfload.sty \input luatex-math.tex
\font\stix={file:STIX-Regular.otf}
Just look into the luatex-math.tex file to see how to properly define a math family set, you can create a \stix macro analogue to the \lucidabright and \latinmodern ones. fwiw, here i test plain with: mtxrun --script plain --make and mtxrun --script plain somefile Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
On 16 Apr 2017, at 15:49, Hans Hagen
wrote: On 4/16/2017 3:06 PM, Hans Åberg wrote:
It works with texinfo: just include it, but it seems keeping luatex-math.lua in the directory speeds up compilation. I used the code below at the beginning of the .texi file.
i don't understand the speed issue ... maybe you need to adapt the texinput path variable so that it can find the file in the tex tree
I have two LuaTeX, one is from texlive/2016, and the other from you site (on MacOS). The latter does not work on its own, so I must choose the former.
---- \input luaotfload.sty \input luatex-math.tex
\font\stix={file:STIX-Regular.otf}
Just look into the luatex-math.tex file to see how to properly define a math family set, you can create a \stix macro analogue to the \lucidabright and \latinmodern ones.
I may be beyond my programming abilities: The texinfo.tex file overrides the font, it seems, so I just hacked up something that works. :-)
On 16 Apr 2017, at 15:49, Hans Hagen
wrote: Just look into the luatex-math.tex file to see how to properly define a math family set, you can create a \stix macro analogue to the \lucidabright and \latinmodern ones.
This works in the test example, but not the texinfo file, perhaps because it changes the escape character.
On 4/16/2017 7:06 PM, Hans Åberg wrote:
On 16 Apr 2017, at 15:49, Hans Hagen
wrote: Just look into the luatex-math.tex file to see how to properly define a math family set, you can create a \stix macro analogue to the \lucidabright and \latinmodern ones.
This works in the test example, but not the texinfo file, perhaps because it changes the escape character.
maybe .. i never used texinfo myself .. maybe it's not that complex to make a context texinfo module that just has what is needed on top of a macro package (after all it has a syntax definition so parsing and mapping onto some configureable set of context commands is no biug deal) ... on the other hand,. i think it is meant as stand alone package so better try to get opentype fonts working in it basically you can do this: -- load a luatex plain -- load texinfo -- redefine some macros that deal with fonts -- load the source to be processed the texinfo code looks quite clean so overloading some should be doable (if you know what to overload) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
On 16 Apr 2017, at 19:41, Hans Hagen
wrote: On 4/16/2017 7:06 PM, Hans Åberg wrote:
On 16 Apr 2017, at 15:49, Hans Hagen
wrote: Just look into the luatex-math.tex file to see how to properly define a math family set, you can create a \stix macro analogue to the \lucidabright and \latinmodern ones.
This works in the test example, but not the texinfo file, perhaps because it changes the escape character.
maybe .. i never used texinfo myself .. maybe it's not that complex to make a context texinfo module that just has what is needed on top of a macro package (after all it has a syntax definition so parsing and mapping onto some configureable set of context commands is no biug deal) ... on the other hand,. i think it is meant as stand alone package so better try to get opentype fonts working in it
It is unclear what exact relation it might have to LuaTex and ConTeXt, but an interesting issue, though.
basically you can do this:
-- load a luatex plain -- load texinfo -- redefine some macros that deal with fonts
-- load the source to be processed
the texinfo code looks quite clean so overloading some should be doable (if you know what to overload)
Probably best to let the Texinfo people do it, as an important part is to be able to generate a host of different formats.
On 16 Apr 2017, at 19:41, Hans Hagen
wrote: basically you can do this:
-- load a luatex plain -- load texinfo -- redefine some macros that deal with fonts
-- load the source to be processed
the texinfo code looks quite clean so overloading some should be doable (if you know what to overload)
It probably must be integrated into the Texinfo setup, because though one can hack the .texi source file for LuaTeX, it fails in the generation of other formats. But it would be nice if one could run ConTeXt and have access to its typesetting capabilities.
On 16 Apr 2017, at 19:41, Hans Hagen
wrote: basically you can do this:
-- load a luatex plain -- load texinfo -- redefine some macros that deal with fonts
-- load the source to be processed
the texinfo code looks quite clean so overloading some should be doable (if you know what to overload)
Do you have any ideas on how to run .texi files with ConTeXt? The texinfo.tex file has already been hacked for LuaTeX, so it looks complicated to get around that, among other things.
participants (2)
-
Hans Hagen
-
Hans Åberg