Difference between revisions of "MkIV Differences"

From Wiki
Jump to navigation Jump to search
Line 9: Line 9:
 
Mark IV delegates an ever growing amount of the key-value processing to lua, and as a result you should always provide 'expanded' numbers in Mark IV:
 
Mark IV delegates an ever growing amount of the key-value processing to lua, and as a result you should always provide 'expanded' numbers in Mark IV:
  
   \setuplayout[width=\the\hize] % not just \hsize
+
   \setuplayout[width=\the\hsize] % not just \hsize
 
   \definetypeface [joke] [ss] [sans] [joke] [default] [rscale=0.9] % not just .9
 
   \definetypeface [joke] [ss] [sans] [joke] [default] [rscale=0.9] % not just .9
  

Revision as of 18:28, 15 February 2010

In Mark IV, much has changed. Most of the changes are not noticeable at the source document level, but there are in fact a few important differences. This page attempts to list the intentional as well as the unavoidable incompatibilities between Mark IV and Mark II (but not bugs).

Command line

You start Mark IV with the context command, and Mark II with texexec. The two programs are not the same, and even though they have mostly the same command line, there are some differences. Mostly, this is because context is still lacking a number of options of texexec like for example --passon (those will probably be implemented at some point in the future), but it also parses the command line different. You must remember to always give the full name of the options, and then the effects should be almost unnoticeable.

Parameter processing

Mark IV delegates an ever growing amount of the key-value processing to lua, and as a result you should always provide 'expanded' numbers in Mark IV:

 \setuplayout[width=\the\hsize] % not just \hsize
 \definetypeface [joke] [ss] [sans] [joke] [default] [rscale=0.9] % not just .9

The underlying reason is that the scanning via lua does not have the special behaviour of TeX itself.

Paragraph formatting

Mark IV extends the \definefontfeature to make full use of the lua opentype engine by adding mode=node, and various opentype tags features that you want on or off. In the distribution, there is only one case of this:

\definefontfeature
  [arabic]
  [mode=node,language=dflt,script=arab,ccmp=yes,
   init=yes,medi=yes,fina=yes,isol=yes,
   liga=yes,dlig=yes,rlig=yes,clig=yes,calt=yes,
   mark=yes,mkmk=yes,kern=yes,curs=yes]

It should come as no surprise that such a mode=node generates different effects, but even with a traditional font setup there are incompatibilies unless you use tfm-only fonts, because the metric information of fonts used in Mark IV (afm, ttf, otf) are often subtly different from the tfm metrics used by Mark II.

Actual font usage

If you have a font in both OpenType and traditional Type 1, then Mark IV will typically use one version and Mark II the other. There is no guarantee that both sets have the same metrics.

This is related to open type fonts metrics not having the limitations of traditional tfm metrics (and the fact that internally luatex has some limitations removed)

Interword spacing

TFM-based (Type 1) fonts, especially those generated by afmtotfm, tend to use heuristics to decide on the width of the interword space instead of looking at the actual value inside the font. In Mark IV, it is much more likely that the actual value from the font is used, because Mark IV prefers the actual AFM files over any existing TFM files. As this affects interword spacing, linebreaks in Mark IV can be quite different from the ones in Mark II.

Line spacing

TFM-based fonts often have to round heights and depths to allow for restrictions in the TFM format. This affects individual glyphs but more importantly, it can change the value of '1ex'. This can affect line spacing, because ConTeXt by default uses the value '2.8ex' for the setting of \baselineskip.

Languages and Regimes

Mark IV needs your input to be in UTF-8. Legacy documents using 8bit encodings have to be converted to utf-8 before they are usable.

Linebreaks can be different because full-blown UTF-8 hyphenation patterns are used.

HH: regimes still work so unless something is broken other encodings also should work but going utf8 is definitely wise

Fonts and Typescripts

Typescripts in Mark IV never specify any encoding at all (Unicode is mandatory)

Metapost

All inline metapost code in your document is executed in a large continuous run.

This means there are two things you have to watch out for:

  1. You should load the MP packages you need in \startMPinclusions..\stopMPinclusions; not inside a graphic.
  2. You have to make sure that you do not re-state equations that were already solved in a previous graphic.

These are in fact the exact same rules that you have to adhere to in mkii if \runMPgraphicsfalse is active.


Another difference is the way text is handled in mkiv. In particular, color (withcolor) is not applied to metapost text. For example,

draw thelabel(decimal i, (i, 0) scaled 1cm) withcolor red ;

currently does not work in mkiv. However,

label(textext("\color[red]"& decimal i), (i, 0) scaled 1cm) ;

does work. This second solution works both in mkiv and in mkii. (Note that \color[red] can be abbreviated \red.)

Indices and sorting

Sort orders can be different because of changes to the sort order lists.

Images

The official way of placing image in in mkiv:

\placefigure[middle,none]{}{...}

mkii way was

\placefigure[middle]{none}{...}

Logos

The logo commands (\definelogo c.s.) do not exist in mkiv; use layers instead.

Itemizations

Bare \item paragraphs (without enclosing list) are not allowed.

Nomarking/Select

\nomarking is currently broken and will likely be removed from mkiv; use \select instead:

\defineselector [caption] [max=2,n=2] % alternate {short}{long} caption

\starttext

\placefigure
        {\select{caption}
                {A cow}
                {This image represents a typical black and white milk cow.
                 In many regions of the world, cows may look quite different.}
        }
        {\externalfigure[cow]}

\setupselector [caption] [n=1]
\completelistoffigures

\stoptext