# Difference between revisions of "MkIV Differences"

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 differently. 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.

Even strange symbols can be directly used in your source code, your code may become more human readable. You can use this handy utf-8 list or use program like Gucharmap or kcharselect for copy/pasting some characters. If you're using Linux, you can also use ~/.XCompose file.

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]{}{...}


The 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


If you want to modify TOC you may find that level parameter has recently(02/2010) and probably for ever no effect in Mark IV. You may use \placelist[chapter,section] instead of \setupcombinedlist[content][level=2].

# Grid typesetting

The implementation in MkIV is completely new, and various details have changed. The most important difference seems to be that the new grid by default is less tolerant for superscripts, but it can be made so by using \setuplayout[grid=tolerant].

# External figures

There was a change in the default path search for external figures, but I don't know the exact details off-hand. IIRC, the main problem is that texmf tree images are now found before local images. To change this ordering, use the location key to \setupexternalfigures:

\setupexternalfigures[location={local,global,default}]


local: current directory + .. + ../..

global: paths set with directory=...

default: texmf tree

# Frames

The macro \setuplocalframed is no longer defined in Mark IV (08.2010). You can use the \getparameters macro as adequate substitute.

# Trialtypesetting

The macros for (de)activating trial typesetting (\trialtypesettingtrue and \trialtypesettingfalse) have been changed. They are no longer part of a \newif statement. The new names are

\settrialtypesetting

for activation and

\resettrialtypesetting

for deactivation.