Difference between revisions of "Mark IV"
(→Troubleshooting: more details from Taco) |
|||
(9 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
− | == Introducing Mark IV | + | == Introducing Mark IV == |
Mark IV is the name of the [[LuaTeX]]-aware part of ConTeXt; that is, when you use ConTeXt over the LuaTeX engine instead of PDFTeX or XeTeX. You run it with | Mark IV is the name of the [[LuaTeX]]-aware part of ConTeXt; that is, when you use ConTeXt over the LuaTeX engine instead of PDFTeX or XeTeX. You run it with | ||
− | + | ||
− | |||
context filename | context filename | ||
There are fundamental differences between Mark IV and Mark II that you should be aware of. Many parts of ConTeXt have been redesigned from scratch making extensive use of the Lua programming language. And that is besides the heavy use of LuaTeX-only features in MkIV. As a result, there are a few intentional incompatibilities between the two ConTeXt versions. See [[MkIV Differences]] for these details. | There are fundamental differences between Mark IV and Mark II that you should be aware of. Many parts of ConTeXt have been redesigned from scratch making extensive use of the Lua programming language. And that is besides the heavy use of LuaTeX-only features in MkIV. As a result, there are a few intentional incompatibilities between the two ConTeXt versions. See [[MkIV Differences]] for these details. | ||
− | The first public beta has been released on the 6th of August, 2007. Currently the easiest way to try it out is to install [[ConTeXt | + | The first public beta has been released on the 6th of August, 2007. Currently the easiest way to try it out is to install [[ConTeXt Standalone]]. |
It takes advantage of the amazing capabilities of LuaTeX and opens up a whole new world of possibilities, in particular with fonts. | It takes advantage of the amazing capabilities of LuaTeX and opens up a whole new world of possibilities, in particular with fonts. | ||
− | In the distribution the | + | In the distribution the MkIV files have suffix 'mkiv'. There are also files with suffix 'mkvi' and more will follow. The most significant difference is that these files use a different (and still somewhat experimental) syntax. |
+ | |||
+ | === Mark VI === | ||
+ | |||
+ | Mark VI is ''identical to Mark IV'' in every respect, except that when you define a new macro you can give parameters names instead of numbers. This make programming a great deal more pleasant. For example, instead of | ||
+ | |||
+ | <texcode> | ||
+ | \def\colortext[#1]#2% | ||
+ | {\color[#1]{#2}} | ||
+ | </texcode> | ||
+ | |||
+ | you can write | ||
+ | |||
+ | <texcode> | ||
+ | \def\colortext[#color]#text% | ||
+ | {\color[#color]{#text}} | ||
+ | </texcode> | ||
+ | |||
+ | To use Mark VI, add the comment {{code|1=% macros=mkvi}} as the first line of your file, or save the file with a {{code|.mkvi}} extension. | ||
== Installation and maintenance == | == Installation and maintenance == | ||
Line 54: | Line 71: | ||
</texcode> | </texcode> | ||
− | Note that the above works with any flavour of LuaTeX; nothing is actually ConTeXt-specific (except for | + | Note that the above works with any flavour of LuaTeX; nothing is actually ConTeXt-specific (except for {{cmd|ctxlua}} and {{cmd|startlua}}/{{cmd|stoplua}}). |
=== Fonts and typescripts === | === Fonts and typescripts === | ||
− | This is detailed in [[Fonts in LuaTeX]]. | + | This is detailed in [[Fonts/Fonts in LuaTeX]]. |
=== More sample code === | === More sample code === | ||
Line 64: | Line 81: | ||
Other examples of Lua(TeX) code are to be found on [[User:Luigi.scarso#Luatex_examples|Luigi's user page]] as well as [http://luatex.bluwiki.com/ http://luatex.bluwiki.com/] | Other examples of Lua(TeX) code are to be found on [[User:Luigi.scarso#Luatex_examples|Luigi's user page]] as well as [http://luatex.bluwiki.com/ http://luatex.bluwiki.com/] | ||
− | [[Category: | + | [[Category:Tools]] |
+ | [[Category:Programming and Databases]] |
Latest revision as of 20:16, 17 May 2024
Contents
Introducing Mark IV
Mark IV is the name of the LuaTeX-aware part of ConTeXt; that is, when you use ConTeXt over the LuaTeX engine instead of PDFTeX or XeTeX. You run it with
context filename
There are fundamental differences between Mark IV and Mark II that you should be aware of. Many parts of ConTeXt have been redesigned from scratch making extensive use of the Lua programming language. And that is besides the heavy use of LuaTeX-only features in MkIV. As a result, there are a few intentional incompatibilities between the two ConTeXt versions. See MkIV Differences for these details.
The first public beta has been released on the 6th of August, 2007. Currently the easiest way to try it out is to install ConTeXt Standalone.
It takes advantage of the amazing capabilities of LuaTeX and opens up a whole new world of possibilities, in particular with fonts.
In the distribution the MkIV files have suffix 'mkiv'. There are also files with suffix 'mkvi' and more will follow. The most significant difference is that these files use a different (and still somewhat experimental) syntax.
Mark VI
Mark VI is identical to Mark IV in every respect, except that when you define a new macro you can give parameters names instead of numbers. This make programming a great deal more pleasant. For example, instead of
\def\colortext[#1]#2% {\color[#1]{#2}}
you can write
\def\colortext[#color]#text% {\color[#color]{#text}}
To use Mark VI, add the comment % macros=mkvi
as the first line of your file, or save the file with a .mkvi
extension.
Installation and maintenance
The Mark IV code needs to be configured before it is usable. This page explains how to do that.
Troubleshooting
The environment variable TEXINPUTS has to be empty or unset. If not, you can get errors about "file/module/whatever not found".
TEXINPUTS can *always* be a problem and really should not be used at all any more. It is a historical environment variable from the nineties, and it overrules just about every path in a modern texmf tree.
If you need something special, use TEXMFLOCAL or TEXMFPROJECT instead.
Sample code
Here are some examples of cool stuff you can do with Mark IV.
Lua core
The first thing you will want to test are the lua functions. Try
\ctxlua{a = 1.5 ; b = 1.8 ; c = a*b ; tex.print(c) ;}
or the equivalent:
\startlua a = 1.5 b = 1.8 c = a*b tex.print(c) \stoplua
You can also do more elaborate calculations with the lua math
library:
\ctxlua{tex.print("$\string\\sqrt{2} = " .. math.sqrt(2) .. "$")}
Note that the above works with any flavour of LuaTeX; nothing is actually ConTeXt-specific (except for \ctxlua and \startlua/\stoplua).
Fonts and typescripts
This is detailed in Fonts/Fonts in LuaTeX.
More sample code
Other examples of Lua(TeX) code are to be found on Luigi's user page as well as http://luatex.bluwiki.com/