https://wiki.contextgarden.net/api.php?action=feedcontributions&user=MelmothX&feedformat=atomWiki - User contributions [en]2024-03-28T19:02:58ZUser contributionsMediaWiki 1.34.1https://wiki.contextgarden.net/index.php?title=Fonts_in_LuaTeX&diff=19471Fonts in LuaTeX2012-05-25T07:56:54Z<p>MelmothX: </p>
<hr />
<div>{{note|This page is not finished yet}}<br />
<br />
'''Please, someone, fill this page !'''<br />
<br />
'''This page is being regorganized'''<br />
<br />
Using [[LuaTeX]] as the processing engine in ConTeXt allows one to directly use fonts installed on the user's system. Instead of converting all fonts into the standard <code>.tfm</code> and <code>.vf</code> formats (as outlined in some [[My Way]] documents<ref>[http://dl.contextgarden.net/websitesarchive/atl/tex/OpenType.pdf OpenType in ConTeXt] by Adam Lindsay</ref><ref>[http://dl.contextgarden.net/myway/expertfonts.pdf Installing Expert Fonts: Minion Pro] by Idris Samawi Hamid</ref>), LuaTeX creates these metric files automatically at run-time. This greatly simplifies font installation in ConTeXt.<br />
<br />
= How LuaTeX handles system fonts =<br />
<br />
LuaTeX can use fonts in non-TeX format (e.g. OpenType, TrueType or Type1 format) directly. When ConTeXt processes a file that uses such non-traditional fonts, the actual fonts themselves are loaded in LuaTeX's embedded section of fontforge to extract their metric information. This removes the need for tfm and vf files on your disk, but it is also a somewhat lengthy and often memory-hungry process. Fortunately, the result of that internal preprocessing are also saved inside the texmf cache. Future runs using the same font (not just this file, but all files using that particular font) can then use the cached version of the metrics instead.<br />
<br />
Mac OS users should note that the current version of LuaTeX (0.60) has severe problems dealing with the new TrueType collection fonts in Snow Leopard (Mac OS 10.6). The older Mac OS .dfont format works fine nowadays.<br />
<br />
== Building the font database ==<br />
<br />
You need to specify where the fonts should be looked for, by setting the <code>OSFONTDIR</code> environment variable. On Windows, this might be achieved by running<br />
set OSFONTDIR=c:/windows/fonts/<br />
if the fonts should be found in <code>c:/windows/fonts/</code>. For Unix machines,<br />
export OSFONTDIR="/usr/local/share/fonts;$HOME/.fonts"<br />
indicate that the fonts should be found in both <code>/usr/local/share/fonts</code> and <code>$HOME/.fonts</code>.<br />
<br />
The font database will then be automatically generated in the next run of <code>context</code>. You can also generate it manually by typing <br />
mtxrun --script fonts --reload<br />
<br />
The output should look like<br />
MTXrun | fontnames: identifying tree font files with suffix otf<br />
MTXrun | fontnames: identifying tree font files with suffix OTF<br />
MTXrun | fontnames: 331 tree files identified, 332 hash entries added, runtime 7.653 seconds<br />
MTXrun | fontnames: identifying tree font files with suffix ttf<br />
MTXrun | fontnames: identifying tree font files with suffix TTF<br />
MTXrun | fontnames: 17 tree files identified, 14 hash entries added, runtime 4.645 seconds<br />
...<br />
MTXrun | fontnames: 94 system files identified, 94 hash entries added, runtime 0.554 seconds<br />
MTXrun | fontnames: 3837 files read, 3342 normal and 49 extra entries added, 5 rejected, 3386 valid<br />
<br />
If mtxrun has problem finding the mtx-fonts.lua file, it may be necessary to regenerate ConTeXt's file database:<br />
context --generate<br />
<br />
== Querying the font database ==<br />
<br />
The command<br />
mtxrun --script fonts --list --all --pattern=*<br />
will return the whole entries of the font database as a list, such as<br />
<br />
...<br />
warnockprobold WarnockPro-Bold E:/Fonts/Warnock Pro/WarnockPro-Bold.otf<br />
warnockproboldcapt WarnockPro-BoldCapt E:/Fonts/Warnock Pro/WarnockPro-BoldCapt.otf<br />
warnockprobolddisp WarnockPro-BoldDisp E:/Fonts/Warnock Pro/WarnockPro-BoldDisp.otf<br />
warnockproboldit WarnockPro-BoldIt E:/Fonts/Warnock Pro/WarnockPro-BoldIt.otf<br />
warnockprobolditcapt WarnockPro-BoldItCapt E:/Fonts/Warnock Pro/WarnockPro-BoldItCapt.otf<br />
warnockprobolditdisp WarnockPro-BoldItDisp E:/Fonts/Warnock Pro/WarnockPro-BoldItDisp.otf<br />
warnockprobolditsubh WarnockPro-BoldItSubh E:/Fonts/Warnock Pro/WarnockPro-BoldItSubh.otf<br />
warnockproboldsubh WarnockPro-BoldSubh E:/Fonts/Warnock Pro/WarnockPro-BoldSubh.otf<br />
...<br />
<br />
You can query the database against a particular pattern. For instance,<br />
mtxrun --script fonts --list --all --pattern=Delicious*<br />
will return<br />
deliciousbold Delicious-Bold /usr/local/share/fonts/d/delicious_bold.otf<br />
deliciousbolditalic Delicious-BoldItalic /usr/local/share/fonts/d/delicious_bolditalic.otf<br />
deliciousheavy Delicious-Heavy /usr/local/share/fonts/d/delicious_heavy.otf<br />
deliciousitalic Delicious-Italic /usr/local/share/fonts/d/delicious_italic.otf<br />
deliciousroman Delicious-Roman /usr/local/share/fonts/d/delicious_roman.otf<br />
delicioussmallcaps Delicious-SmallCaps /usr/local/share/fonts/d/delicious_smallcaps.otf<br />
<br />
You can get useful informations about your fonts by using the <code>--info</code> option. For instance,<br />
mtxrun --script fonts --list --info --pattern=Delicious*Roman<br />
will return<br />
MTXrun | fontname: deliciousroman<br />
MTXrun | fullname: Delicious-Roman<br />
MTXrun | filename: /usr/local/share/fonts/d/delicious_roman.otf<br />
MTXrun |<br />
MTXrun | gpos features:<br />
MTXrun |<br />
MTXrun | feature script languages<br />
MTXrun |<br />
MTXrun | kern latn dflt<br />
MTXrun |<br />
MTXrun | gsub features:<br />
MTXrun |<br />
MTXrun | feature script languages<br />
MTXrun |<br />
MTXrun | tlig all all<br />
MTXrun | trep all all<br />
<br />
== Installing new fonts ==<br />
<br />
After installing new fonts, the font database must be rebuilt for LuaTeX to access them.<br />
<br />
In current versions of Mark IV (earlier than July 2008) this is automatically done whenever a named font cannot be found.<br />
<br />
You only have to do the reload manually when you have installed updates to already installed fonts that cause the font and/or file names to change. <br />
This normally only happens for fonts that are still in development like [[TeX Gyre]] and [[Latin Modern]].<br />
<br />
You can rebuild the database manually, using the already-mentioned command<br />
mtxrun --script fonts --reload<br />
<br />
Alternatively, you can turn off the automatic rebuild of the database, by setting either of<br />
MTX.FONTS.AUTOLOAD<br />
MTX_FONTS_AUTOLOAD<br />
to "no".<br />
<br />
== Get a warning if the glyph is missing ==<br />
<br />
You need to add the command <code>\checkcharactersinfont</code> or<br />
(better) <code>\enabletrackers[fonts.missing]</code> in the preamble<br />
of your document.<br />
<br />
== References ==<br />
<br />
[http://context.aanhet.net/svn/contextman/context-reference/en/co-fonts.pdf The new manual chapter on fonts]<br />
<br />
= Using fonts =<br />
<br />
Handling fonts in LuaTeX can be done<br />
* in a simple but limited way, using the <code>simplefonts</code> module;<br />
* in the standard way, using [[TypeScripts]]<br />
<br />
== With the <code>simplefonts</code> module ==<br />
<br />
[http://www.ctan.org/tex-archive/macros/context/contrib/context-simplefonts simplefonts] is a third-party module written by Wolfgang Schuster.<br />
<br />
It simplifies the use of fonts in LuaTeX by<br />
* freeing the user from writing or using [[TypeScripts]];<br />
* offering an interface similar to the [http://www.ctan.org/tex-archive/macros/xetex/latex/fontspec/ fontspec package for XeTeX]<br />
<br />
For instance, assuming the [http://www.exljbris.com/delicious.html Delicious fonts] are properly installed and recognized by ConTeXt, you can simply write:<br />
<br />
<texcode><br />
\usemodule[simplefonts] % load the module.<br />
\setmainfont[Delicious] % set Delicious as main (serif) font<br />
% \setmonofont[mymonofont]<br />
% \setmathfont[mymathfont]<br />
% \setsansfont[mysansfont]<br />
<br />
\starttext<br />
\rm\tf roman \it italic \bf bold \bi bolditalic \sc smallcaps<br />
\stoptext<br />
</texcode><br />
<br />
=== Installing <code>simplefonts</code> ===<br />
<br />
* If you're using LuaTeX along with TeXlive 2009, <code>simplefonts</code> is already installed<br />
* If you're running [[ConTeXt Standalone]], <code>simplefonts</code> can be installed like [http://wiki.contextgarden.net/ConTeXt_Standalone#Installing_third_party_modules any third-party module]:<br />
first-setup.sh --modules="t-simplefonts"<br />
<br />
=== Handling special cases ===<br />
<br />
If the font in question has an unusual naming scheme and is missing some features, it may be necessary to specify the names to look for and the font features to implement. In [http://archive.contextgarden.net/message/20111017.113829.e2b20bf4.en.html this example] the font names do not end with *bold and *regular but with *fett and *nor (from the german words "fett" for bold and "normal" for regular). Also the font doesn't provide an italic font face, so it has to be emulated.<br />
<br />
Wolfgang Schuster proposed the following [http://archive.contextgarden.net/message/20111017.144952.1a72175c.en.html solutions]:<br />
<br />
<texcode><br />
\usemodule[simplefonts] <br />
<br />
\definefontfeature[fakeitalic][default][slant=.25] % for fake bold use “stretch=<number>” <br />
<br />
\setmainfont <br />
[telegrotesk] <br />
[regularfont=* nor, <br />
italicfont=* nor, <br />
boldfont=* fett, <br />
bolditalicfont=* fett, <br />
italicfeatures=fakeitalic, % just the name of a fontfeature <br />
bolditalicfeatures=fakeitalic]<br />
</texcode><br />
<br />
== The standard way: Typescripts ==<br />
<br />
=== Installing typescripts ===<br />
<br />
Installing typescripts consists in the following:<br />
<br />
1. Copy the typescript files into either <br />
<texcode>$TEXMF/tex/texmf-fonts/tex/context/user<br />
$TEXMF/tex/texmf-project/tex/context/user</texcode><br />
2. Run <code>context --generate</code><br />
<br />
By convention, typescript files are named like <code>type-(fontname|foundry).tex</code>. <br />
<br />
It may happen that some <code>type-xx.tex</code> typescript file depends on mkiv-specific code located in a matching <code>type-xx.mkiv</code> file. In this case, both files need to be installed.<br />
<br />
=== Loading typescripts ===<br />
<br />
A typescript file named <code>type-xx.tex</code> should be loaded using<br />
\usetypescriptfile[type-xx]<br />
<br />
An alternative way is<br />
\usetypefile[xx]<br />
where ConTeXt prepends <code>type-</code> when it loads the file; but <br />
<cmd>usetypescriptfile</cmd> is the preferred command because it takes care of the<br />
<cmd>starttypescriptcollection</cmd>/<cmd>stoptypescriptcollection</cmd> environments.<br />
<br />
=== Very simple example of typescript ===<br />
<br />
If you are new to typescript you might have a look at this [[Simple Typescript Example]] to get a first idea how to use it.<br />
<br />
=== Where to find existing typescripts ===<br />
<br />
Each of the typescripts below defines a keyword to use with <cmd>setupbodyfont</cmd>. Usually this is the same as the name of the typescript, but there is one exception (<code>antykwa-torunska</code>)<br />
<br />
* Latin Modern (typescript name: <code>modern</code>; this is the default font set)<br />
* Latin Modern variant (ts name: <code>modernvariable</code>; LM variable typewriter for serif)<br />
* Postscript (ts name: <code>postscript</code>; Termes for serif, Heros for sans, Cursor for mono)<br />
* Antykwa Toruńska (ts name: <code>antykwa-torunska</code>; only serif; defines <tt>antykwa</tt> as keyword for <cmd>setupbodyfont</cmd>)<br />
* Iwona (ts name: <code>iwona</code>; only sans serif)<br />
* Iwona Light, Medium and Heavy (ts names: <code>iwona-light</code>, <code>iwona-medium</code>, <code>iwona-heavy</code>; only sans; the medium variant is a small bit heavier than a "regular" one)<br />
* Pagella (ts name: <code>palatino</code>; only serif)<br />
* Termes (ts name: <code>times</code>; only serif, Heros for sans)<br />
<br />
=== Usage example ===<br />
<br />
<texcode><br />
\usetypescript[palatino]<br />
\setupbodyfont[palatino,18pt]<br />
<br />
\starttext<br />
Hello world, I'm Pagella!<br />
\stoptext<br />
</texcode><br />
<br />
The first line seems to order ConTeXt to "install" (for the current file) the given typescript (it accepts what I have earlier called a "typescript name"). The last one starts using it (you may omit the size if you are satisfied with the default).<br />
<br />
=== Combining predefined fonts in your own typescripts ===<br />
<br />
It is also possible to combine fonts from the TeX Gyre collection in your own typescripts. The example below combines Bonum (Bookman) roman, Adventor (AvantGarde) for sans serif, Cursor (Courier) for teletype, and Euler for math. The <code>rscale=...</code> option ensures that all fonts have the same x-height. (You can lookup the relative x-heigt of a font using fontforge.)<br />
<br />
<texcode><br />
\starttypescript [Bonum]<br />
\definetypeface [Bonum] [rm] [serif] [bonum] [default]<br />
\definetypeface [Bonum] [ss] [sans] [adventor] [default] [rscale=0.887]<br />
\definetypeface [Bonum] [tt] [mono] [cursor] [default] [rscale=1.163]<br />
\definetypeface [Bonum] [mm] [math] [euler] [default] [rscale=1.050]<br />
\stoptypescript<br />
<br />
\usetypescript[Bonum]<br />
\setupbodyfont[Bonum,12pt]<br />
<br />
\starttext<br />
Hello world, I'm Bonum!<br />
\stoptext<br />
</texcode><br />
<br />
= Old contents =<br />
<br />
* [[TrueType fonts in luaTeX]]<br />
<br />
==== Good ol' typescripts ====<br />
<br />
Of course, Mark IV allows you to use typescripts as you've always done; for example:<br />
<br />
<texcode><br />
\usetypescript[palatino]<br />
\setupbodyfont[palatino,12pt]<br />
effe fietsen 2: \input tufte $\sqrt{2}$ \eogonek<br />
<br />
\sc effe fietsen 2: \input tufte $\sqrt{2}$ \eogonek<br />
</texcode><br />
<br />
That's as simple as using a traditional ConTeXt typescript!<br />
<br />
But ... how is it any different, then? Well, the difference is that in Mark IV, we can use an Opentype font directly, so that what is done here: when we want to use Palatino, the [[TeX Gyre]] equivalent (“Pagella”) is called and we can use its Opentype “features”; read on.<br />
<br />
==== Opentype features ====<br />
<br />
A “feature”, in the Opentype jargon, is a set of rules describing changes in the appearance of the text. Hmm, that's not very precise. Let's show some examples. First of all, you have to know that features are referred to by 4-letter tags, and you will see this a lot. One of them is ‘smcp‘, for “small caps“. Let's consider the following Mark IV-only code:<br />
<br />
<texcode><br />
\definefontfeature[smallcaps][language=DFLT,script=latn,smcp=yes]<br />
\font\palasmallcaps=texgyrepagella-regular*smallcaps<br />
\palasmallcaps This is a text in small capitals.<br />
</texcode><br />
<br />
Here you basically define a (Mark IV) feature with the name ”smallcaps”, and associate it with the (Opentype) feature “smcp”. You have to specify which script you want to use it with; scripts in Opentype are also tagged with four letters, and “latn” is of course Latin.<br />
<br />
Then you define a TeX font with that feature.<br />
<br />
You can see what features are defined in a particular font with the following bit of code<br />
<br />
<texcode><br />
\ctxlua<br />
{<br />
fontname = 'texgyrepagella-regular.otf'<br />
<br />
--[[ First read the font data.<br />
This makes heavy use of some of the Mark IV code]]<br />
tfmdata = fonts.tfm.read_and_define("file:" .. fontname, 655360)<br />
font = tfmdata.shared.otfdata<br />
if font<br />
then<br />
gsubfeatures = fonts.otf.analyze_features(font.gsub)<br />
gposfeatures = fonts.otf.analyze_features(font.gpos)<br />
end<br />
<br />
if gsubfeatures then<br />
table.sort(gsubfeatures) % We want our list sorted alphabetically!<br />
tex.sprint("\\rm GSUB features: \\tt ") % Beware: you don't want \rm to be interpreted by lua (\rm would yield carriage return + letter m)!<br />
for _, feat in ipairs(gsubfeatures)<br />
do tex.sprint(feat) tex.sprint(' ')<br />
end<br />
else tex.sprint("\\rm No GSUB features")<br />
end<br />
tex.sprint("\\par")<br />
<br />
if gposfeatures then<br />
tex.sprint("\\rm GPOS features: \\tt ")<br />
table.sort(gposfeatures)<br />
for _, feat in ipairs(gposfeatures)<br />
do tex.sprint(feat) tex.sprint(' ')<br />
end<br />
else tex.sprint("\\rm No GPOS features")<br />
end<br />
}<br />
</texcode><br />
<br />
It prints the list on the page. You'll notice there are two sets of features, each one of them defined in a different table of the Opentype font: the <code>GSUB</code> table (for Glyph SUBstitution) gives rules for replacing glyphs in certains circumstances (think of ligatures: f + i -> fi); the <code>GPOS</code> table (Glyph POSititioning) gives rules for moving glyphs (think of kerning: A + V -> A <kerning> V).<br />
<br />
Incidentally, the above code gives some basic examples of LuaTeX programming, a mixture of both Lua and TeX programming with some special features (features in the general sense, not the Opentype one :-).<br />
<br />
==== A (Complete) Typescript Example ====<br />
<br />
<texcode><br />
\starttypescript [sans] [franklin]<br />
<br />
\definefontsynonym [FranklinBookRegular] [name:FranklinGothicBookITC-Regular] [features=default]<br />
\definefontsynonym [FranklinMediumRegular] [name:FranklinGothicMediumITC-Regular] [features=default]<br />
\definefontsynonym [FranklinDemiRegular] [name:FranklinGothicDemiITC-Regular] [features=default]<br />
\definefontsynonym [FranklinHeavyRegular] [name:FranklinGothicHeavyITC-Regular] [features=default]<br />
<br />
\definefontsynonym [FranklinBookItalic] [name:FranklinGothicBookITC-Italic] [features=default]<br />
\definefontsynonym [FranklinDemiItalic] [name:FranklinGothicMediumITC-Italic] [features=default]<br />
\definefontsynonym [FranklinHeavyItalic] [name:FranklinGothicDemiITC-Italic] [features=default]<br />
\definefontsynonym [FranklinMediumItalic] [name:FranklinGothicHeavyITC-Italic] [features=default]<br />
<br />
\stoptypescript<br />
<br />
\starttypescript [sans] [franklin]<br />
<br />
\definefontsynonym [Sans] [FranklinBookRegular] [features=default]<br />
\definefontsynonym [SansItalic] [FranklinBookItalic] [features=default]<br />
\definefontsynonym [SansBold] [FranklinDemiRegular] [features=default]<br />
\definefontsynonym [SansBoldItalic] [FranklinDemiItalic] [features=default]<br />
\definefontsynonym [SansSlanted] [SansItalic] [features=default]<br />
\definefontsynonym [SansBoldSlanted] [SansBoldItalic] [features=default]<br />
\definefontsynonym [SansCaps] [Sans] [features=smallcaps]<br />
<br />
\stoptypescript<br />
<br />
\definetypeface[franklin][rm][sans][franklin][default]<br />
\definetypeface[franklin][ss][sans][franklin][default]<br />
\definetypeface[franklin][tt][mono][modern] [default][rscale=1.12]<br />
\definetypeface[franklin][mm][math][iwona] [default][rscale=1.02]<br />
<br />
\setupbodyfont[franklin,ss,10pt]<br />
</texcode><br />
<br />
<br />
<br />
Just the simplest way to use an otf font — or any font that does appear in <tt>mtxrun --script font --list</tt> — in all the document.<br />
<br />
I’m stick here :<br />
<br />
\definefontfeature [myfontfeature] [method=node, kern=yes, OTHER_FEATURE_COMMA_SEPERATED]<br />
\definefontsynonym [MyFontRegular] [name:TheFontName-Regular][features=myfontfeature]<br />
\definedfont [MyFontRegular at 16pt]<br />
<br />
This doesn’t run for my title which use « \tfc », only for the body of the text.<br />
<br />
*\definefontfeature<br />
**[myfontfeature] : you can use the name you want. It will be use at the next line ;<br />
**the fonts feature can be found with <tt>otfinfo -f TheFontFile.otf</tt>.<br />
*\definefontsynonym :<br />
**[MyFontRegular] : you can use the name you want. It will be use at the next line ;<br />
**The name after <tt>name:</tt> is the name given by <tt>mtxrun --script font --list</tt><br />
**The « name: » part can be replaced by <tt>file:TheFontFile.otf</tt><br />
<br />
<br />
== Example ==<br />
<br />
<br />
Now to access, say the regular warnock font, the following are valid. And I ought to mention that Hans recommends the first http://article.gmane.org/gmane.comp.tex.context/43685.<br />
<br />
<texcode><br />
% Hans recommends this format;<br />
\definefontsynonym [WarnockPro-Regular] [name:warnockproregular] <br />
</texcode><br />
<br />
and<br />
<br />
<texcode><br />
\definefontsynonym [WarnockPro-Regular] [name:WarnockPro-Regular]<br />
</texcode><br />
<br />
An entire typescript would be defined as;<br />
<br />
<texcode><br />
\definefontfeature[latin-smallcaps][smallcaps][script=latn]<br />
<br />
\starttypescript [serif] [warnockpro]<br />
\setups[font:fallback:sans]<br />
\definefontsynonym [WarnockPro-Regular] [name:WarnockPro-Regular] <br />
\definefontsynonym [WarnockPro-Bold] [name:WarnockPro-Bold] <br />
\definefontsynonym [WarnockPro-Italic] [name:WarnockPro-It] <br />
\definefontsynonym [WarnockPro-BoldItalic] [name:WarnockPro-BoldIt] <br />
\stoptypescript<br />
<br />
\starttypescript [serif] [warnockpro]<br />
\definefontsynonym [Serif] [WarnockPro-Regular] [features=default]<br />
\definefontsynonym [SerifBold] [WarnockPro-Bold] [features=default]<br />
\definefontsynonym [SerifItalic] [WarnockPro-Italic] [features=default]<br />
\definefontsynonym [SerifBoldItalic] [WarnockPro-BoldItalic] [features=default]<br />
\definefontsynonym [SerifCaps] [Serif] [features=latin-smallcaps]<br />
\stoptypescript<br />
<br />
\definetypeface[adobe][rm][serif][warnockpro][default]<br />
\setupbodyfont[adobe,11pt]<br />
<br />
</texcode><br />
<br />
= References =<br />
<references/><br />
<br />
[[Category:Fonts]]<br />
[[Category:International]]<br />
[[Category:LuaTeX]]</div>MelmothXhttps://wiki.contextgarden.net/index.php?title=Fonts_in_LuaTeX&diff=19470Fonts in LuaTeX2012-05-25T07:53:10Z<p>MelmothX: </p>
<hr />
<div>{{note|This page is not finished yet}}<br />
<br />
'''Please, someone, fill this page !'''<br />
<br />
'''This page is being regorganized'''<br />
<br />
Using [[LuaTeX]] as the processing engine in ConTeXt allows one to directly use fonts installed on the user's system. Instead of converting all fonts into the standard <code>.tfm</code> and <code>.vf</code> formats (as outlined in some [[My Way]] documents<ref>[http://dl.contextgarden.net/websitesarchive/atl/tex/OpenType.pdf OpenType in ConTeXt] by Adam Lindsay</ref><ref>[http://dl.contextgarden.net/myway/expertfonts.pdf Installing Expert Fonts: Minion Pro] by Idris Samawi Hamid</ref>), LuaTeX creates these metric files automatically at run-time. This greatly simplifies font installation in ConTeXt.<br />
<br />
= How LuaTeX handles system fonts =<br />
<br />
LuaTeX can use fonts in non-TeX format (e.g. OpenType, TrueType or Type1 format) directly. When ConTeXt processes a file that uses such non-traditional fonts, the actual fonts themselves are loaded in LuaTeX's embedded section of fontforge to extract their metric information. This removes the need for tfm and vf files on your disk, but it is also a somewhat lengthy and often memory-hungry process. Fortunately, the result of that internal preprocessing are also saved inside the texmf cache. Future runs using the same font (not just this file, but all files using that particular font) can then use the cached version of the metrics instead.<br />
<br />
Mac OS users should note that the current version of LuaTeX (0.60) has severe problems dealing with the new TrueType collection fonts in Snow Leopard (Mac OS 10.6). The older Mac OS .dfont format works fine nowadays.<br />
<br />
== Building the font database ==<br />
<br />
You need to specify where the fonts should be looked for, by setting the <code>OSFONTDIR</code> environment variable. On Windows, this might be achieved by running<br />
set OSFONTDIR=c:/windows/fonts/<br />
if the fonts should be found in <code>c:/windows/fonts/</code>. For Unix machines,<br />
export OSFONTDIR="/usr/local/share/fonts;$HOME/.fonts"<br />
indicate that the fonts should be found in both <code>/usr/local/share/fonts</code> and <code>$HOME/.fonts</code>.<br />
<br />
The font database will then be automatically generated in the next run of <code>context</code>. You can also generate it manually by typing <br />
mtxrun --script fonts --reload<br />
<br />
The output should look like<br />
MTXrun | fontnames: identifying tree font files with suffix otf<br />
MTXrun | fontnames: identifying tree font files with suffix OTF<br />
MTXrun | fontnames: 331 tree files identified, 332 hash entries added, runtime 7.653 seconds<br />
MTXrun | fontnames: identifying tree font files with suffix ttf<br />
MTXrun | fontnames: identifying tree font files with suffix TTF<br />
MTXrun | fontnames: 17 tree files identified, 14 hash entries added, runtime 4.645 seconds<br />
...<br />
MTXrun | fontnames: 94 system files identified, 94 hash entries added, runtime 0.554 seconds<br />
MTXrun | fontnames: 3837 files read, 3342 normal and 49 extra entries added, 5 rejected, 3386 valid<br />
<br />
If mtxrun has problem finding the mtx-fonts.lua file, it may be necessary to regenerate ConTeXt's file database:<br />
context --generate<br />
<br />
== Querying the font database ==<br />
<br />
The command<br />
mtxrun --script fonts --list --all --pattern=*<br />
will return the whole entries of the font database as a list, such as<br />
<br />
...<br />
warnockprobold WarnockPro-Bold E:/Fonts/Warnock Pro/WarnockPro-Bold.otf<br />
warnockproboldcapt WarnockPro-BoldCapt E:/Fonts/Warnock Pro/WarnockPro-BoldCapt.otf<br />
warnockprobolddisp WarnockPro-BoldDisp E:/Fonts/Warnock Pro/WarnockPro-BoldDisp.otf<br />
warnockproboldit WarnockPro-BoldIt E:/Fonts/Warnock Pro/WarnockPro-BoldIt.otf<br />
warnockprobolditcapt WarnockPro-BoldItCapt E:/Fonts/Warnock Pro/WarnockPro-BoldItCapt.otf<br />
warnockprobolditdisp WarnockPro-BoldItDisp E:/Fonts/Warnock Pro/WarnockPro-BoldItDisp.otf<br />
warnockprobolditsubh WarnockPro-BoldItSubh E:/Fonts/Warnock Pro/WarnockPro-BoldItSubh.otf<br />
warnockproboldsubh WarnockPro-BoldSubh E:/Fonts/Warnock Pro/WarnockPro-BoldSubh.otf<br />
...<br />
<br />
You can query the database against a particular pattern. For instance,<br />
mtxrun --script fonts --list --all --pattern=Delicious*<br />
will return<br />
deliciousbold Delicious-Bold /usr/local/share/fonts/d/delicious_bold.otf<br />
deliciousbolditalic Delicious-BoldItalic /usr/local/share/fonts/d/delicious_bolditalic.otf<br />
deliciousheavy Delicious-Heavy /usr/local/share/fonts/d/delicious_heavy.otf<br />
deliciousitalic Delicious-Italic /usr/local/share/fonts/d/delicious_italic.otf<br />
deliciousroman Delicious-Roman /usr/local/share/fonts/d/delicious_roman.otf<br />
delicioussmallcaps Delicious-SmallCaps /usr/local/share/fonts/d/delicious_smallcaps.otf<br />
<br />
You can get useful informations about your fonts by using the <code>--info</code> option. For instance,<br />
mtxrun --script fonts --list --info --pattern=Delicious*Roman<br />
will return<br />
MTXrun | fontname: deliciousroman<br />
MTXrun | fullname: Delicious-Roman<br />
MTXrun | filename: /usr/local/share/fonts/d/delicious_roman.otf<br />
MTXrun |<br />
MTXrun | gpos features:<br />
MTXrun |<br />
MTXrun | feature script languages<br />
MTXrun |<br />
MTXrun | kern latn dflt<br />
MTXrun |<br />
MTXrun | gsub features:<br />
MTXrun |<br />
MTXrun | feature script languages<br />
MTXrun |<br />
MTXrun | tlig all all<br />
MTXrun | trep all all<br />
<br />
== Installing new fonts ==<br />
<br />
After installing new fonts, the font database must be rebuilt for LuaTeX to access them.<br />
<br />
In current versions of Mark IV (earlier than July 2008) this is automatically done whenever a named font cannot be found.<br />
<br />
You only have to do the reload manually when you have installed updates to already installed fonts that cause the font and/or file names to change. <br />
This normally only happens for fonts that are still in development like [[TeX Gyre]] and [[Latin Modern]].<br />
<br />
You can rebuild the database manually, using the already-mentioned command<br />
mtxrun --script fonts --reload<br />
<br />
Alternatively, you can turn off the automatic rebuild of the database, by setting either of<br />
MTX.FONTS.AUTOLOAD<br />
MTX_FONTS_AUTOLOAD<br />
to "no".<br />
<br />
== Get a warning if the glyph is missing ==<br />
<br />
You need to add the command <code>\checkcharactersinfont</code> in the<br />
preamble of your document.<br />
<br />
<br />
== References ==<br />
<br />
[http://context.aanhet.net/svn/contextman/context-reference/en/co-fonts.pdf The new manual chapter on fonts]<br />
<br />
= Using fonts =<br />
<br />
Handling fonts in LuaTeX can be done<br />
* in a simple but limited way, using the <code>simplefonts</code> module;<br />
* in the standard way, using [[TypeScripts]]<br />
<br />
== With the <code>simplefonts</code> module ==<br />
<br />
[http://www.ctan.org/tex-archive/macros/context/contrib/context-simplefonts simplefonts] is a third-party module written by Wolfgang Schuster.<br />
<br />
It simplifies the use of fonts in LuaTeX by<br />
* freeing the user from writing or using [[TypeScripts]];<br />
* offering an interface similar to the [http://www.ctan.org/tex-archive/macros/xetex/latex/fontspec/ fontspec package for XeTeX]<br />
<br />
For instance, assuming the [http://www.exljbris.com/delicious.html Delicious fonts] are properly installed and recognized by ConTeXt, you can simply write:<br />
<br />
<texcode><br />
\usemodule[simplefonts] % load the module.<br />
\setmainfont[Delicious] % set Delicious as main (serif) font<br />
% \setmonofont[mymonofont]<br />
% \setmathfont[mymathfont]<br />
% \setsansfont[mysansfont]<br />
<br />
\starttext<br />
\rm\tf roman \it italic \bf bold \bi bolditalic \sc smallcaps<br />
\stoptext<br />
</texcode><br />
<br />
=== Installing <code>simplefonts</code> ===<br />
<br />
* If you're using LuaTeX along with TeXlive 2009, <code>simplefonts</code> is already installed<br />
* If you're running [[ConTeXt Standalone]], <code>simplefonts</code> can be installed like [http://wiki.contextgarden.net/ConTeXt_Standalone#Installing_third_party_modules any third-party module]:<br />
first-setup.sh --modules="t-simplefonts"<br />
<br />
=== Handling special cases ===<br />
<br />
If the font in question has an unusual naming scheme and is missing some features, it may be necessary to specify the names to look for and the font features to implement. In [http://archive.contextgarden.net/message/20111017.113829.e2b20bf4.en.html this example] the font names do not end with *bold and *regular but with *fett and *nor (from the german words "fett" for bold and "normal" for regular). Also the font doesn't provide an italic font face, so it has to be emulated.<br />
<br />
Wolfgang Schuster proposed the following [http://archive.contextgarden.net/message/20111017.144952.1a72175c.en.html solutions]:<br />
<br />
<texcode><br />
\usemodule[simplefonts] <br />
<br />
\definefontfeature[fakeitalic][default][slant=.25] % for fake bold use “stretch=<number>” <br />
<br />
\setmainfont <br />
[telegrotesk] <br />
[regularfont=* nor, <br />
italicfont=* nor, <br />
boldfont=* fett, <br />
bolditalicfont=* fett, <br />
italicfeatures=fakeitalic, % just the name of a fontfeature <br />
bolditalicfeatures=fakeitalic]<br />
</texcode><br />
<br />
== The standard way: Typescripts ==<br />
<br />
=== Installing typescripts ===<br />
<br />
Installing typescripts consists in the following:<br />
<br />
1. Copy the typescript files into either <br />
<texcode>$TEXMF/tex/texmf-fonts/tex/context/user<br />
$TEXMF/tex/texmf-project/tex/context/user</texcode><br />
2. Run <code>context --generate</code><br />
<br />
By convention, typescript files are named like <code>type-(fontname|foundry).tex</code>. <br />
<br />
It may happen that some <code>type-xx.tex</code> typescript file depends on mkiv-specific code located in a matching <code>type-xx.mkiv</code> file. In this case, both files need to be installed.<br />
<br />
=== Loading typescripts ===<br />
<br />
A typescript file named <code>type-xx.tex</code> should be loaded using<br />
\usetypescriptfile[type-xx]<br />
<br />
An alternative way is<br />
\usetypefile[xx]<br />
where ConTeXt prepends <code>type-</code> when it loads the file; but <br />
<cmd>usetypescriptfile</cmd> is the preferred command because it takes care of the<br />
<cmd>starttypescriptcollection</cmd>/<cmd>stoptypescriptcollection</cmd> environments.<br />
<br />
=== Very simple example of typescript ===<br />
<br />
If you are new to typescript you might have a look at this [[Simple Typescript Example]] to get a first idea how to use it.<br />
<br />
=== Where to find existing typescripts ===<br />
<br />
Each of the typescripts below defines a keyword to use with <cmd>setupbodyfont</cmd>. Usually this is the same as the name of the typescript, but there is one exception (<code>antykwa-torunska</code>)<br />
<br />
* Latin Modern (typescript name: <code>modern</code>; this is the default font set)<br />
* Latin Modern variant (ts name: <code>modernvariable</code>; LM variable typewriter for serif)<br />
* Postscript (ts name: <code>postscript</code>; Termes for serif, Heros for sans, Cursor for mono)<br />
* Antykwa Toruńska (ts name: <code>antykwa-torunska</code>; only serif; defines <tt>antykwa</tt> as keyword for <cmd>setupbodyfont</cmd>)<br />
* Iwona (ts name: <code>iwona</code>; only sans serif)<br />
* Iwona Light, Medium and Heavy (ts names: <code>iwona-light</code>, <code>iwona-medium</code>, <code>iwona-heavy</code>; only sans; the medium variant is a small bit heavier than a "regular" one)<br />
* Pagella (ts name: <code>palatino</code>; only serif)<br />
* Termes (ts name: <code>times</code>; only serif, Heros for sans)<br />
<br />
=== Usage example ===<br />
<br />
<texcode><br />
\usetypescript[palatino]<br />
\setupbodyfont[palatino,18pt]<br />
<br />
\starttext<br />
Hello world, I'm Pagella!<br />
\stoptext<br />
</texcode><br />
<br />
The first line seems to order ConTeXt to "install" (for the current file) the given typescript (it accepts what I have earlier called a "typescript name"). The last one starts using it (you may omit the size if you are satisfied with the default).<br />
<br />
=== Combining predefined fonts in your own typescripts ===<br />
<br />
It is also possible to combine fonts from the TeX Gyre collection in your own typescripts. The example below combines Bonum (Bookman) roman, Adventor (AvantGarde) for sans serif, Cursor (Courier) for teletype, and Euler for math. The <code>rscale=...</code> option ensures that all fonts have the same x-height. (You can lookup the relative x-heigt of a font using fontforge.)<br />
<br />
<texcode><br />
\starttypescript [Bonum]<br />
\definetypeface [Bonum] [rm] [serif] [bonum] [default]<br />
\definetypeface [Bonum] [ss] [sans] [adventor] [default] [rscale=0.887]<br />
\definetypeface [Bonum] [tt] [mono] [cursor] [default] [rscale=1.163]<br />
\definetypeface [Bonum] [mm] [math] [euler] [default] [rscale=1.050]<br />
\stoptypescript<br />
<br />
\usetypescript[Bonum]<br />
\setupbodyfont[Bonum,12pt]<br />
<br />
\starttext<br />
Hello world, I'm Bonum!<br />
\stoptext<br />
</texcode><br />
<br />
= Old contents =<br />
<br />
* [[TrueType fonts in luaTeX]]<br />
<br />
==== Good ol' typescripts ====<br />
<br />
Of course, Mark IV allows you to use typescripts as you've always done; for example:<br />
<br />
<texcode><br />
\usetypescript[palatino]<br />
\setupbodyfont[palatino,12pt]<br />
effe fietsen 2: \input tufte $\sqrt{2}$ \eogonek<br />
<br />
\sc effe fietsen 2: \input tufte $\sqrt{2}$ \eogonek<br />
</texcode><br />
<br />
That's as simple as using a traditional ConTeXt typescript!<br />
<br />
But ... how is it any different, then? Well, the difference is that in Mark IV, we can use an Opentype font directly, so that what is done here: when we want to use Palatino, the [[TeX Gyre]] equivalent (“Pagella”) is called and we can use its Opentype “features”; read on.<br />
<br />
==== Opentype features ====<br />
<br />
A “feature”, in the Opentype jargon, is a set of rules describing changes in the appearance of the text. Hmm, that's not very precise. Let's show some examples. First of all, you have to know that features are referred to by 4-letter tags, and you will see this a lot. One of them is ‘smcp‘, for “small caps“. Let's consider the following Mark IV-only code:<br />
<br />
<texcode><br />
\definefontfeature[smallcaps][language=DFLT,script=latn,smcp=yes]<br />
\font\palasmallcaps=texgyrepagella-regular*smallcaps<br />
\palasmallcaps This is a text in small capitals.<br />
</texcode><br />
<br />
Here you basically define a (Mark IV) feature with the name ”smallcaps”, and associate it with the (Opentype) feature “smcp”. You have to specify which script you want to use it with; scripts in Opentype are also tagged with four letters, and “latn” is of course Latin.<br />
<br />
Then you define a TeX font with that feature.<br />
<br />
You can see what features are defined in a particular font with the following bit of code<br />
<br />
<texcode><br />
\ctxlua<br />
{<br />
fontname = 'texgyrepagella-regular.otf'<br />
<br />
--[[ First read the font data.<br />
This makes heavy use of some of the Mark IV code]]<br />
tfmdata = fonts.tfm.read_and_define("file:" .. fontname, 655360)<br />
font = tfmdata.shared.otfdata<br />
if font<br />
then<br />
gsubfeatures = fonts.otf.analyze_features(font.gsub)<br />
gposfeatures = fonts.otf.analyze_features(font.gpos)<br />
end<br />
<br />
if gsubfeatures then<br />
table.sort(gsubfeatures) % We want our list sorted alphabetically!<br />
tex.sprint("\\rm GSUB features: \\tt ") % Beware: you don't want \rm to be interpreted by lua (\rm would yield carriage return + letter m)!<br />
for _, feat in ipairs(gsubfeatures)<br />
do tex.sprint(feat) tex.sprint(' ')<br />
end<br />
else tex.sprint("\\rm No GSUB features")<br />
end<br />
tex.sprint("\\par")<br />
<br />
if gposfeatures then<br />
tex.sprint("\\rm GPOS features: \\tt ")<br />
table.sort(gposfeatures)<br />
for _, feat in ipairs(gposfeatures)<br />
do tex.sprint(feat) tex.sprint(' ')<br />
end<br />
else tex.sprint("\\rm No GPOS features")<br />
end<br />
}<br />
</texcode><br />
<br />
It prints the list on the page. You'll notice there are two sets of features, each one of them defined in a different table of the Opentype font: the <code>GSUB</code> table (for Glyph SUBstitution) gives rules for replacing glyphs in certains circumstances (think of ligatures: f + i -> fi); the <code>GPOS</code> table (Glyph POSititioning) gives rules for moving glyphs (think of kerning: A + V -> A <kerning> V).<br />
<br />
Incidentally, the above code gives some basic examples of LuaTeX programming, a mixture of both Lua and TeX programming with some special features (features in the general sense, not the Opentype one :-).<br />
<br />
==== A (Complete) Typescript Example ====<br />
<br />
<texcode><br />
\starttypescript [sans] [franklin]<br />
<br />
\definefontsynonym [FranklinBookRegular] [name:FranklinGothicBookITC-Regular] [features=default]<br />
\definefontsynonym [FranklinMediumRegular] [name:FranklinGothicMediumITC-Regular] [features=default]<br />
\definefontsynonym [FranklinDemiRegular] [name:FranklinGothicDemiITC-Regular] [features=default]<br />
\definefontsynonym [FranklinHeavyRegular] [name:FranklinGothicHeavyITC-Regular] [features=default]<br />
<br />
\definefontsynonym [FranklinBookItalic] [name:FranklinGothicBookITC-Italic] [features=default]<br />
\definefontsynonym [FranklinDemiItalic] [name:FranklinGothicMediumITC-Italic] [features=default]<br />
\definefontsynonym [FranklinHeavyItalic] [name:FranklinGothicDemiITC-Italic] [features=default]<br />
\definefontsynonym [FranklinMediumItalic] [name:FranklinGothicHeavyITC-Italic] [features=default]<br />
<br />
\stoptypescript<br />
<br />
\starttypescript [sans] [franklin]<br />
<br />
\definefontsynonym [Sans] [FranklinBookRegular] [features=default]<br />
\definefontsynonym [SansItalic] [FranklinBookItalic] [features=default]<br />
\definefontsynonym [SansBold] [FranklinDemiRegular] [features=default]<br />
\definefontsynonym [SansBoldItalic] [FranklinDemiItalic] [features=default]<br />
\definefontsynonym [SansSlanted] [SansItalic] [features=default]<br />
\definefontsynonym [SansBoldSlanted] [SansBoldItalic] [features=default]<br />
\definefontsynonym [SansCaps] [Sans] [features=smallcaps]<br />
<br />
\stoptypescript<br />
<br />
\definetypeface[franklin][rm][sans][franklin][default]<br />
\definetypeface[franklin][ss][sans][franklin][default]<br />
\definetypeface[franklin][tt][mono][modern] [default][rscale=1.12]<br />
\definetypeface[franklin][mm][math][iwona] [default][rscale=1.02]<br />
<br />
\setupbodyfont[franklin,ss,10pt]<br />
</texcode><br />
<br />
<br />
<br />
Just the simplest way to use an otf font — or any font that does appear in <tt>mtxrun --script font --list</tt> — in all the document.<br />
<br />
I’m stick here :<br />
<br />
\definefontfeature [myfontfeature] [method=node, kern=yes, OTHER_FEATURE_COMMA_SEPERATED]<br />
\definefontsynonym [MyFontRegular] [name:TheFontName-Regular][features=myfontfeature]<br />
\definedfont [MyFontRegular at 16pt]<br />
<br />
This doesn’t run for my title which use « \tfc », only for the body of the text.<br />
<br />
*\definefontfeature<br />
**[myfontfeature] : you can use the name you want. It will be use at the next line ;<br />
**the fonts feature can be found with <tt>otfinfo -f TheFontFile.otf</tt>.<br />
*\definefontsynonym :<br />
**[MyFontRegular] : you can use the name you want. It will be use at the next line ;<br />
**The name after <tt>name:</tt> is the name given by <tt>mtxrun --script font --list</tt><br />
**The « name: » part can be replaced by <tt>file:TheFontFile.otf</tt><br />
<br />
<br />
== Example ==<br />
<br />
<br />
Now to access, say the regular warnock font, the following are valid. And I ought to mention that Hans recommends the first http://article.gmane.org/gmane.comp.tex.context/43685.<br />
<br />
<texcode><br />
% Hans recommends this format;<br />
\definefontsynonym [WarnockPro-Regular] [name:warnockproregular] <br />
</texcode><br />
<br />
and<br />
<br />
<texcode><br />
\definefontsynonym [WarnockPro-Regular] [name:WarnockPro-Regular]<br />
</texcode><br />
<br />
An entire typescript would be defined as;<br />
<br />
<texcode><br />
\definefontfeature[latin-smallcaps][smallcaps][script=latn]<br />
<br />
\starttypescript [serif] [warnockpro]<br />
\setups[font:fallback:sans]<br />
\definefontsynonym [WarnockPro-Regular] [name:WarnockPro-Regular] <br />
\definefontsynonym [WarnockPro-Bold] [name:WarnockPro-Bold] <br />
\definefontsynonym [WarnockPro-Italic] [name:WarnockPro-It] <br />
\definefontsynonym [WarnockPro-BoldItalic] [name:WarnockPro-BoldIt] <br />
\stoptypescript<br />
<br />
\starttypescript [serif] [warnockpro]<br />
\definefontsynonym [Serif] [WarnockPro-Regular] [features=default]<br />
\definefontsynonym [SerifBold] [WarnockPro-Bold] [features=default]<br />
\definefontsynonym [SerifItalic] [WarnockPro-Italic] [features=default]<br />
\definefontsynonym [SerifBoldItalic] [WarnockPro-BoldItalic] [features=default]<br />
\definefontsynonym [SerifCaps] [Serif] [features=latin-smallcaps]<br />
\stoptypescript<br />
<br />
\definetypeface[adobe][rm][serif][warnockpro][default]<br />
\setupbodyfont[adobe,11pt]<br />
<br />
</texcode><br />
<br />
= References =<br />
<references/><br />
<br />
[[Category:Fonts]]<br />
[[Category:International]]<br />
[[Category:LuaTeX]]</div>MelmothXhttps://wiki.contextgarden.net/index.php?title=Comparison_between_ConTeXt_and_other_typesetting_programs&diff=13617Comparison between ConTeXt and other typesetting programs2012-02-29T19:42:03Z<p>MelmothX: </p>
<hr />
<div>From: http://permalink.gmane.org/gmane.comp.tex.context/74789<br />
<br />
With a graphical tool, one is limited to the automation which the developers are willing to build into the tool and sentenced to handling manually ''everything'' else, ''every'' time that there's a change, e.g., if you have a keyword block on your opening article pages aligned against the outside gutter and the layout program can't place it automatically and contextually, then ''every'' time the article changes from opening to a left to a right or vice-versa one has to make that change manually.<br />
<br />
I wrote up a longer comparison once upon a time --- Scribus isn't that much different from InDesign and Quark, so the criticism holds:<br />
<br />
While I'm no TeX wizard, I prefer it because it allows one to off-load some of the tedium and repetitiveness to the computer, as opposed to repeatedly solving variations of the same problems by hand time after time after time.<br />
<br />
So,<br />
<br />
* using Quark is like being chained to a an oar which is covered w/ splinters and mostly broken at the other end and which will randomly break due to being poorly carved (Quark has crashed on me 183 times this year) leaving one adrift or run aground, or sometimes returning the vessel to its starting point (a few of those crashes have resulted in unrecoverable document corruption --- my autobackup folder may contain 2 or 3 GBs of files for a given iteration of a particular project each month) --- the oar can be smoothed somewhat and reinforced (by purchasing or finding XTensions, using XTags &c.) and periodically one is required to purchase a new oar (sometimes just after the previous one has been customized adequately). For some tasks, one can impress any graphic designer as a galley slave to ease the effort for others, but while charts are available, there are no automagic navigation options and every journey must be manually piloted.<br />
<br />
* using InDesign is pretty much the same except the oar is smoother and stronger (it's crashed 29 times on me thus far this year), there aren't as many customization options and it's not quite as easy to find a candidate for impressment (though soon it'll be as easy as for Quark). Charts are available, but again, piloting is strictly manual.<br />
<br />
* using Plain TeX one has to craft the vessel's oar oneself (as well as the rest of the vessel unless one is typesetting a clone of ''The TeXbook''), but it's as sturdy and as nice a one as one's skills allow and can even be an engine which moves the vessel in and of itself --- it can be difficult or impossible to find people suitable to help w/ either carving the oar or using it though, but once a given journey is worked out, the oar becomes magical and rows for itself except for when one runs into an unplanned for obstacle (the navigation charts are old ones and not often up-dated, with a lot of “terra incognita”), allowing one an auto-pilot option for certain journeys, dependent upon one's skill.<br />
<br />
* using ePlain, an oar is provided, can be customized, and can be enchanted and the charts are okay, but have a lot of “terra incognita” on them.<br />
<br />
* using LaTeX, an oar is provided and there're lots of nifty customizations and improvements already available, and one can impress additional oars from CTAN, however on a semi-random basis, adding one oar will break other oars, sometimes leaving one adrift or run aground. One can enchant a set of oars to accomplish a given journey, easing the piloting requirement, and the navigation charts are decent and obstacles are fairly well-known.<br />
<br />
* using ConTeXt, a very nice oar is provided, which has lots of customization options, but the navigational charts aren't easily read by a traditionally trained navigator at first, although they are fairly compleat and most journey can be carefully worked out, but once one is, it is quite automatic and there's a good auto-pilot option.</div>MelmothXhttps://wiki.contextgarden.net/index.php?title=Comparison_between_ConTeXt_and_other_typesetting_programs&diff=13616Comparison between ConTeXt and other typesetting programs2012-02-29T19:41:40Z<p>MelmothX: </p>
<hr />
<div>gFrom: http://permalink.gmane.org/gmane.comp.tex.context/74789<br />
<br />
With a graphical tool, one is limited to the automation which the developers are willing to build into the tool and sentenced to handling manually ''everything'' else, ''every'' time that there's a change, e.g., if you have a keyword block on your opening article pages aligned against the outside gutter and the layout program can't place it automatically and contextually, then ''every'' time the article changes from opening to a left to a right or vice-versa one has to make that change manually.<br />
<br />
I wrote up a longer comparison once upon a time --- Scribus isn't that much different from InDesign and Quark, so the criticism holds:<br />
<br />
While I'm no TeX wizard, I prefer it because it allows one to off-load some of the tedium and repetitiveness to the computer, as opposed to repeatedly solving variations of the same problems by hand time after time after time.<br />
<br />
So,<br />
<br />
* using Quark is like being chained to a an oar which is covered w/ splinters and mostly broken at the other end and which will randomly break due to being poorly carved (Quark has crashed on me 183 times this year) leaving one adrift or run aground, or sometimes returning the vessel to its starting point (a few of those crashes have resulted in unrecoverable document corruption --- my autobackup folder may contain 2 or 3 GBs of files for a given iteration of a particular project each month) --- the oar can be smoothed somewhat and reinforced (by purchasing or finding XTensions, using XTags &c.) and periodically one is required to purchase a new oar (sometimes just after the previous one has been customized adequately). For some tasks, one can impress any graphic designer as a galley slave to ease the effort for others, but while charts are available, there are no automagic navigation options and every journey must be manually piloted.<br />
<br />
* using InDesign is pretty much the same except the oar is smoother and stronger (it's crashed 29 times on me thus far this year), there aren't as many customization options and it's not quite as easy to find a candidate for impressment (though soon it'll be as easy as for Quark). Charts are available, but again, piloting is strictly manual.<br />
<br />
* using Plain TeX one has to craft the vessel's oar oneself (as well as the rest of the vessel unless one is typesetting a clone of ''The TeXbook''), but it's as sturdy and as nice a one as one's skills allow and can even be an engine which moves the vessel in and of itself --- it can be difficult or impossible to find people suitable to help w/ either carving the oar or using it though, but once a given journey is worked out, the oar becomes magical and rows for itself except for when one runs into an unplanned for obstacle (the navigation charts are old ones and not often up-dated, with a lot of “terra incognita”), allowing one an auto-pilot option for certain journeys, dependent upon one's skill.<br />
<br />
* using ePlain, an oar is provided, can be customized, and can be enchanted and the charts are okay, but have a lot of “terra incognita” on them.<br />
<br />
* using LaTeX, an oar is provided and there're lots of nifty customizations and improvements already available, and one can impress additional oars from CTAN, however on a semi-random basis, adding one oar will break other oars, sometimes leaving one adrift or run aground. One can enchant a set of oars to accomplish a given journey, easing the piloting requirement, and the navigation charts are decent and obstacles are fairly well-known.<br />
<br />
* using ConTeXt, a very nice oar is provided, which has lots of customization options, but the navigational charts aren't easily read by a traditionally trained navigator at first, although they are fairly compleat and most journey can be carefully worked out, but once one is, it is quite automatic and there's a good auto-pilot option.</div>MelmothXhttps://wiki.contextgarden.net/index.php?title=Comparison_between_ConTeXt_and_other_typesetting_programs&diff=13615Comparison between ConTeXt and other typesetting programs2012-02-29T19:39:36Z<p>MelmothX: Created page with "From: http://permalink.gmane.org/gmane.comp.tex.context/74789 With a graphical tool, one is limited to the automation which the developers are willing to build into the tool and..."</p>
<hr />
<div>From: http://permalink.gmane.org/gmane.comp.tex.context/74789<br />
<br />
With a graphical tool, one is limited to the automation which the developers are willing to build into the tool and sentenced to handling manually ''everything'' else, ''every'' time that there's a change, e.g., if you have a keyword block on your opening article pages aligned against the outside gutter and the layout program can't place it automatically and contextually, then ''every'' time the article changes from opening to a left to a right or vice-versa one has to make that change manually.<br />
<br />
I wrote up a longer comparison once upon a time --- Scribus isn't that much different from InDesign and Quark, so the criticism holds:<br />
<br />
While I'm no TeX wizard, I prefer it because it allows one to off-load some of the tedium and repetitiveness to the computer, as opposed to repeatedly solving variations of the same problems by hand time after time after time.<br />
<br />
So,<br />
<br />
* using Quark is like being chained to a an oar which is covered w/ splinters and mostly broken at the other end and which will randomly break due to being poorly carved (Quark has crashed on me 183 times this year) leaving one adrift or run aground, or sometimes returning the vessel to its starting point (a few of those crashes have resulted in unrecoverable document corruption --- my autobackup folder may contain 2 or 3 GBs of files for a given iteration of a particular project each month) --- the oar can be smoothed somewhat and reinforced (by purchasing or finding XTensions, using XTags &c.) and periodically one is required to purchase a new oar (sometimes just after the previous one has been customized adequately). For some tasks, one can impress any graphic designer as a galley slave to ease the effort for others, but while charts are available, there are no automagic navigation options and every journey must be manually piloted.<br />
<br />
* using InDesign is pretty much the same except the oar is smoother and stronger (it's crashed 29 times on me thus far this year), there aren't as many customization options and it's not quite as easy to find a candidate for impressment (though soon it'll be as easy as for Quark). Charts are available, but again, piloting is strictly manual.<br />
<br />
* using Plain TeX one has to craft the vessel's oar oneself (as well as the rest of the vessel unless one is typesetting a clone of ''The TeXbook''), but it's as sturdy and as nice a one as one's skills allow and can even be an engine which moves the vessel in and of itself --- it can be difficult or impossible to find people suitable to help w/ either carving the oar or using it though, but once a given journey is worked out, the oar becomes magical and rows for itself except for when one runs into an unplanned for obstacle (the navigation charts are old ones and not often up-dated, with a lot of ``terra incognita''), allowing one an auto-pilot option for certain journeys, dependent upon one's skill.<br />
<br />
* using ePlain, an oar is provided, can be customized, and can be enchanted and the charts are okay, but have a lot of ``terra incognita'' on them.<br />
<br />
* using LaTeX, an oar is provided and there're lots of nifty customizations and improvements already available, and one can impress additional oars from CTAN, however on a semi-random basis, adding one oar will break other oars, sometimes leaving one adrift or run aground. One can enchant a set of oars to accomplish a given journey, easing the piloting requirement, and the navigation charts are decent and obstacles are fairly well-known.<br />
<br />
* using ConTeXt, a very nice oar is provided, which has lots of customization options, but the navigational charts aren't easily read by a traditionally trained navigator at first, although they are fairly compleat and most journey can be carefully worked out, but once one is, it is quite automatic and there's a good auto-pilot option.</div>MelmothXhttps://wiki.contextgarden.net/index.php?title=Cover_Pages&diff=13474Cover Pages2011-11-11T14:52:51Z<p>MelmothX: </p>
<hr />
<div>< [[Sample documents]] | [[MetaPost]] ><br />
<br />
<texcode><br />
\setupcolors[state=start]<br />
<br />
\startuseMPgraphic{cover}<br />
StartPage ;<br />
fill Page withcolor .5green ;<br />
path p ; p := unitcircle randomized .1 xsized(PaperWidth-1cm) ;<br />
fill p shifted -center p shifted center Page withcolor red ;<br />
StopPage ;<br />
\stopuseMPgraphic<br />
<br />
\defineoverlay[cover][\useMPgraphic{cover}]<br />
<br />
\starttext<br />
<br />
\setupbackgrounds[page][background=cover]<br />
<br />
\startstandardmakeup<br />
\raggedcenter<br />
\vfill \definedfont[SerifBold at 48pt]\setstrut \strut Penguins in Vietnam<br />
\blank[2*big] \definedfont[SerifBold at 24pt]\setstrut \strut A Very Short Story<br />
\vfill<br />
\stopstandardmakeup<br />
<br />
\setupbackgrounds[page][background=]<br />
<br />
\input tufte<br />
<br />
\stoptext<br />
</texcode><br />
<br />
<context><br />
\setuplayout[location=middle,scale=.2]<br />
\setupcolors[state=start]<br />
<br />
\startuseMPgraphic{cover}<br />
StartPage ;<br />
fill Page withcolor .5green ;<br />
path p ; p := unitcircle randomized .1 xsized(PaperWidth-1cm) ;<br />
fill p shifted -center p shifted center Page withcolor red ;<br />
StopPage ;<br />
\stopuseMPgraphic<br />
<br />
\defineoverlay[cover][\useMPgraphic{cover}]<br />
<br />
\starttext<br />
<br />
\setupbackgrounds[page][background=cover]<br />
<br />
\startstandardmakeup<br />
\raggedcenter<br />
\vfill \definedfont[SerifBold at 48pt]\setstrut \strut Penguins in Vietnam<br />
\blank[2*big] \definedfont[SerifBold at 24pt]\setstrut \strut A Very Short Story<br />
\vfill<br />
\stopstandardmakeup<br />
<br />
\stoptext <br />
</context><br />
<br />
[http://archive.contextgarden.net/message/20050223.145512.19d6450f.html Reference to mailing list]<br />
<br />
== Another title page ==<br />
<br />
<texcode><br />
\definetype[ytyp][color=yellow]<br />
<br />
\startbuffer[title]<br />
\type{/(}\ytyp{h}\type{*?)testexpr/io}\par<br />
\type{/t(}\ytyp{a}\type{*?)estexpr/io}\par<br />
\type{/te(}\ytyp{n}\type{*?)stexpr/io}\par<br />
\type{/tes(}\ytyp{s}\type{*?)texpr/io}\par<br />
\type{/test(}\ytyp{h}\type{*?)expr/io}\par<br />
\type{/teste(}\ytyp{a}\type{*?)xpr/io}\par<br />
\type{/testex(}\ytyp{g}\type{*?)pr/io}\par<br />
\type{/testexp(}\ytyp{e}\type{*?)r/io}\par<br />
\type{/testexpr(}\ytyp{n}\type{*?)/io}\par<br />
\stopbuffer<br />
<br />
\setupcolors[state=start]<br />
<br />
\definelayer<br />
[TitleGraphic]<br />
[width=\paperwidth,<br />
height=\paperheight]<br />
<br />
\setlayer<br />
[TitleGraphic]<br />
[preset=lefttop]<br />
{\scale<br />
[width=\paperwidth,<br />
height=\paperheight]<br />
{\framed<br />
[frame=off,<br />
offset=overlay,<br />
background=color,<br />
backgroundcolor=blue,<br />
foregroundcolor=red,<br />
align=normal]<br />
% {\setuptyping[before=,after=]\typebuffer[title]}}}<br />
{\getbuffer[title]}}}<br />
<br />
\setupbackgrounds[page][background=TitleGraphic]<br />
<br />
\starttext<br />
<br />
\startstandardmakeup<br />
<br />
\stopstandardmakeup<br />
<br />
\stoptext<br />
</texcode><br />
<br />
Guess who did this one :-) [http://archive.contextgarden.net/message/20050321.011152.0eb2d729.html Reference to mailing list]<br />
<br />
<context><br />
\setuplayout[location=middle,scale=.2]<br />
\definetype[ytyp][color=yellow]<br />
<br />
\startbuffer[title]<br />
\type{/(}\ytyp{h}\type{*?)testexpr/io}\par<br />
\type{/t(}\ytyp{a}\type{*?)estexpr/io}\par<br />
\type{/te(}\ytyp{n}\type{*?)stexpr/io}\par<br />
\type{/tes(}\ytyp{s}\type{*?)texpr/io}\par<br />
\type{/test(}\ytyp{h}\type{*?)expr/io}\par<br />
\type{/teste(}\ytyp{a}\type{*?)xpr/io}\par<br />
\type{/testex(}\ytyp{g}\type{*?)pr/io}\par<br />
\type{/testexp(}\ytyp{e}\type{*?)r/io}\par<br />
\type{/testexpr(}\ytyp{n}\type{*?)/io}\par<br />
\stopbuffer<br />
<br />
\setupcolors[state=start]<br />
<br />
\definelayer<br />
[TitleGraphic]<br />
[width=\paperwidth,<br />
height=\paperheight]<br />
<br />
\setlayer<br />
[TitleGraphic]<br />
[preset=lefttop]<br />
{\scale<br />
[width=\paperwidth,<br />
height=\paperheight]<br />
{\framed<br />
[frame=off,<br />
offset=overlay,<br />
background=color,<br />
backgroundcolor=blue,<br />
foregroundcolor=red,<br />
align=normal]<br />
{\getbuffer[title]}}}<br />
<br />
\setupbackgrounds[page][background=TitleGraphic]<br />
<br />
\starttext<br />
<br />
\startstandardmakeup<br />
<br />
\stopstandardmakeup<br />
<br />
\stoptext<br />
</context><br />
<br />
<br />
== A simple centered cover for a booklet ==<br />
<br />
<br />
<texcode><br />
<br />
\setuppapersize[A5][A5]<br />
\setuppagenumbering[alternative=doublesided]<br />
<br />
<br />
\starttext<br />
<br />
\startpagemakeup[align=center,doublesided=no,%<br />
pagestate=start]% we want to number this<br />
<br />
{\bfc This should be the long title, Andreas' solution\par}<br />
<br />
\stoppagemakeup<br />
<br />
This is the colofon<br />
<br />
\chapter{Start}<br />
<br />
\input knuth<br />
<br />
\stoptext<br />
<br />
</texcode><br />
<br />
Reference: http://www.ntg.nl/pipermail/ntg-context/2011/063030.html<br />
<br />
Or, another solution (which can be tuned at will), which relies on a<br />
new feature in MkIV: there is also a layout with the same name as the<br />
makeup environment and you can control the margins of your new title<br />
page environment with \setuplayout[makeupname][...].<br />
<br />
<texcode><br />
<br />
\setuppagenumbering[alternative=doublesided]<br />
<br />
%\showframe<br />
<br />
\setuppapersize[A5][A4,landscape]<br />
\setuparranging[2UP]<br />
<br />
<br />
\definemakeup[titlepage][pagestate=start,doublesided=no]<br />
\setuplayout[titlepage]<br />
[backspace=2cm,width=108mm] % 148mm is the width, 20 mm of backspace,<br />
% 20 mm of outer margin<br />
<br />
\starttext<br />
<br />
\starttitlepagemakeup<br />
\raggedcenter<br />
\bfc This should be the long, long, very long title\par<br />
\stoptitlepagemakeup<br />
<br />
This is the colofon<br />
<br />
\chapter{Start here on page 3}<br />
<br />
\dorecurse{20}{\input tufte\par}<br />
<br />
\stoptext<br />
<br />
</texcode><br />
<br />
<br />
<br />
[[Category:Sample documents]]<br />
[[Category:Graphics]]<br />
[[Category:Text elements]]</div>MelmothXhttps://wiki.contextgarden.net/index.php?title=Cover_Pages&diff=13473Cover Pages2011-11-11T14:41:29Z<p>MelmothX: minor fix</p>
<hr />
<div>< [[Sample documents]] | [[MetaPost]] ><br />
<br />
<texcode><br />
\setupcolors[state=start]<br />
<br />
\startuseMPgraphic{cover}<br />
StartPage ;<br />
fill Page withcolor .5green ;<br />
path p ; p := unitcircle randomized .1 xsized(PaperWidth-1cm) ;<br />
fill p shifted -center p shifted center Page withcolor red ;<br />
StopPage ;<br />
\stopuseMPgraphic<br />
<br />
\defineoverlay[cover][\useMPgraphic{cover}]<br />
<br />
\starttext<br />
<br />
\setupbackgrounds[page][background=cover]<br />
<br />
\startstandardmakeup<br />
\raggedcenter<br />
\vfill \definedfont[SerifBold at 48pt]\setstrut \strut Penguins in Vietnam<br />
\blank[2*big] \definedfont[SerifBold at 24pt]\setstrut \strut A Very Short Story<br />
\vfill<br />
\stopstandardmakeup<br />
<br />
\setupbackgrounds[page][background=]<br />
<br />
\input tufte<br />
<br />
\stoptext<br />
</texcode><br />
<br />
<context><br />
\setuplayout[location=middle,scale=.2]<br />
\setupcolors[state=start]<br />
<br />
\startuseMPgraphic{cover}<br />
StartPage ;<br />
fill Page withcolor .5green ;<br />
path p ; p := unitcircle randomized .1 xsized(PaperWidth-1cm) ;<br />
fill p shifted -center p shifted center Page withcolor red ;<br />
StopPage ;<br />
\stopuseMPgraphic<br />
<br />
\defineoverlay[cover][\useMPgraphic{cover}]<br />
<br />
\starttext<br />
<br />
\setupbackgrounds[page][background=cover]<br />
<br />
\startstandardmakeup<br />
\raggedcenter<br />
\vfill \definedfont[SerifBold at 48pt]\setstrut \strut Penguins in Vietnam<br />
\blank[2*big] \definedfont[SerifBold at 24pt]\setstrut \strut A Very Short Story<br />
\vfill<br />
\stopstandardmakeup<br />
<br />
\stoptext <br />
</context><br />
<br />
[http://archive.contextgarden.net/message/20050223.145512.19d6450f.html Reference to mailing list]<br />
<br />
== Another title page ==<br />
<br />
<texcode><br />
\definetype[ytyp][color=yellow]<br />
<br />
\startbuffer[title]<br />
\type{/(}\ytyp{h}\type{*?)testexpr/io}\par<br />
\type{/t(}\ytyp{a}\type{*?)estexpr/io}\par<br />
\type{/te(}\ytyp{n}\type{*?)stexpr/io}\par<br />
\type{/tes(}\ytyp{s}\type{*?)texpr/io}\par<br />
\type{/test(}\ytyp{h}\type{*?)expr/io}\par<br />
\type{/teste(}\ytyp{a}\type{*?)xpr/io}\par<br />
\type{/testex(}\ytyp{g}\type{*?)pr/io}\par<br />
\type{/testexp(}\ytyp{e}\type{*?)r/io}\par<br />
\type{/testexpr(}\ytyp{n}\type{*?)/io}\par<br />
\stopbuffer<br />
<br />
\setupcolors[state=start]<br />
<br />
\definelayer<br />
[TitleGraphic]<br />
[width=\paperwidth,<br />
height=\paperheight]<br />
<br />
\setlayer<br />
[TitleGraphic]<br />
[preset=lefttop]<br />
{\scale<br />
[width=\paperwidth,<br />
height=\paperheight]<br />
{\framed<br />
[frame=off,<br />
offset=overlay,<br />
background=color,<br />
backgroundcolor=blue,<br />
foregroundcolor=red,<br />
align=normal]<br />
% {\setuptyping[before=,after=]\typebuffer[title]}}}<br />
{\getbuffer[title]}}}<br />
<br />
\setupbackgrounds[page][background=TitleGraphic]<br />
<br />
\starttext<br />
<br />
\startstandardmakeup<br />
<br />
\stopstandardmakeup<br />
<br />
\stoptext<br />
</texcode><br />
<br />
Guess who did this one :-) [http://archive.contextgarden.net/message/20050321.011152.0eb2d729.html Reference to mailing list]<br />
<br />
<context><br />
\setuplayout[location=middle,scale=.2]<br />
\definetype[ytyp][color=yellow]<br />
<br />
\startbuffer[title]<br />
\type{/(}\ytyp{h}\type{*?)testexpr/io}\par<br />
\type{/t(}\ytyp{a}\type{*?)estexpr/io}\par<br />
\type{/te(}\ytyp{n}\type{*?)stexpr/io}\par<br />
\type{/tes(}\ytyp{s}\type{*?)texpr/io}\par<br />
\type{/test(}\ytyp{h}\type{*?)expr/io}\par<br />
\type{/teste(}\ytyp{a}\type{*?)xpr/io}\par<br />
\type{/testex(}\ytyp{g}\type{*?)pr/io}\par<br />
\type{/testexp(}\ytyp{e}\type{*?)r/io}\par<br />
\type{/testexpr(}\ytyp{n}\type{*?)/io}\par<br />
\stopbuffer<br />
<br />
\setupcolors[state=start]<br />
<br />
\definelayer<br />
[TitleGraphic]<br />
[width=\paperwidth,<br />
height=\paperheight]<br />
<br />
\setlayer<br />
[TitleGraphic]<br />
[preset=lefttop]<br />
{\scale<br />
[width=\paperwidth,<br />
height=\paperheight]<br />
{\framed<br />
[frame=off,<br />
offset=overlay,<br />
background=color,<br />
backgroundcolor=blue,<br />
foregroundcolor=red,<br />
align=normal]<br />
{\getbuffer[title]}}}<br />
<br />
\setupbackgrounds[page][background=TitleGraphic]<br />
<br />
\starttext<br />
<br />
\startstandardmakeup<br />
<br />
\stopstandardmakeup<br />
<br />
\stoptext<br />
</context><br />
<br />
<br />
== A simple centered cover for a booklet ==<br />
<br />
<br />
<texcode><br />
<br />
\setuppapersize[A5][A5]<br />
\setuppagenumbering[alternative=doublesided]<br />
<br />
<br />
\starttext<br />
<br />
\startpagemakeup[align=center,doublesided=no,%<br />
pagestate=start]% we want to number this<br />
<br />
{\bfc This should be the long title, Andreas' solution\par}<br />
<br />
\stoppagemakeup<br />
<br />
This is the colofon<br />
<br />
\chapter{Start}<br />
<br />
\input knuth<br />
<br />
\stoptext<br />
<br />
</texcode><br />
<br />
Reference: http://www.ntg.nl/pipermail/ntg-context/2011/063030.html<br />
<br />
Or, another solution (which can be tuned at will), which relies on a<br />
new feature in MkIV: there is also a layout with the same name as the<br />
makeup environment and you can control the margins of your new title<br />
page environment with \setuplayout[makeupname][...].<br />
<br />
<texcode><br />
<br />
\setuppagenumbering[alternative=doublesided]<br />
<br />
%\showframe<br />
<br />
\setuppapersize[A5][A4,landscape]<br />
\setuparranging[2UP]<br />
<br />
<br />
\definemakeup[titlepage]<br />
\setuplayout[titlepage]<br />
[backspace=2cm,width=108mm] % 148mm is the width, 20 mm of backspace,<br />
% 20 mm of outer margin<br />
<br />
\starttext<br />
<br />
\starttitlepagemakeup<br />
\raggedcenter<br />
\bfc This should be the long, long, very long title\par<br />
\stoptitlepagemakeup<br />
<br />
\dorecurse{20}{\input tufte\par}<br />
<br />
\stoptext<br />
<br />
</texcode><br />
<br />
<br />
<br />
[[Category:Sample documents]]<br />
[[Category:Graphics]]<br />
[[Category:Text elements]]</div>MelmothXhttps://wiki.contextgarden.net/index.php?title=Cover_Pages&diff=13472Cover Pages2011-11-11T14:40:37Z<p>MelmothX: Added an alternative</p>
<hr />
<div>< [[Sample documents]] | [[MetaPost]] ><br />
<br />
<texcode><br />
\setupcolors[state=start]<br />
<br />
\startuseMPgraphic{cover}<br />
StartPage ;<br />
fill Page withcolor .5green ;<br />
path p ; p := unitcircle randomized .1 xsized(PaperWidth-1cm) ;<br />
fill p shifted -center p shifted center Page withcolor red ;<br />
StopPage ;<br />
\stopuseMPgraphic<br />
<br />
\defineoverlay[cover][\useMPgraphic{cover}]<br />
<br />
\starttext<br />
<br />
\setupbackgrounds[page][background=cover]<br />
<br />
\startstandardmakeup<br />
\raggedcenter<br />
\vfill \definedfont[SerifBold at 48pt]\setstrut \strut Penguins in Vietnam<br />
\blank[2*big] \definedfont[SerifBold at 24pt]\setstrut \strut A Very Short Story<br />
\vfill<br />
\stopstandardmakeup<br />
<br />
\setupbackgrounds[page][background=]<br />
<br />
\input tufte<br />
<br />
\stoptext<br />
</texcode><br />
<br />
<context><br />
\setuplayout[location=middle,scale=.2]<br />
\setupcolors[state=start]<br />
<br />
\startuseMPgraphic{cover}<br />
StartPage ;<br />
fill Page withcolor .5green ;<br />
path p ; p := unitcircle randomized .1 xsized(PaperWidth-1cm) ;<br />
fill p shifted -center p shifted center Page withcolor red ;<br />
StopPage ;<br />
\stopuseMPgraphic<br />
<br />
\defineoverlay[cover][\useMPgraphic{cover}]<br />
<br />
\starttext<br />
<br />
\setupbackgrounds[page][background=cover]<br />
<br />
\startstandardmakeup<br />
\raggedcenter<br />
\vfill \definedfont[SerifBold at 48pt]\setstrut \strut Penguins in Vietnam<br />
\blank[2*big] \definedfont[SerifBold at 24pt]\setstrut \strut A Very Short Story<br />
\vfill<br />
\stopstandardmakeup<br />
<br />
\stoptext <br />
</context><br />
<br />
[http://archive.contextgarden.net/message/20050223.145512.19d6450f.html Reference to mailing list]<br />
<br />
== Another title page ==<br />
<br />
<texcode><br />
\definetype[ytyp][color=yellow]<br />
<br />
\startbuffer[title]<br />
\type{/(}\ytyp{h}\type{*?)testexpr/io}\par<br />
\type{/t(}\ytyp{a}\type{*?)estexpr/io}\par<br />
\type{/te(}\ytyp{n}\type{*?)stexpr/io}\par<br />
\type{/tes(}\ytyp{s}\type{*?)texpr/io}\par<br />
\type{/test(}\ytyp{h}\type{*?)expr/io}\par<br />
\type{/teste(}\ytyp{a}\type{*?)xpr/io}\par<br />
\type{/testex(}\ytyp{g}\type{*?)pr/io}\par<br />
\type{/testexp(}\ytyp{e}\type{*?)r/io}\par<br />
\type{/testexpr(}\ytyp{n}\type{*?)/io}\par<br />
\stopbuffer<br />
<br />
\setupcolors[state=start]<br />
<br />
\definelayer<br />
[TitleGraphic]<br />
[width=\paperwidth,<br />
height=\paperheight]<br />
<br />
\setlayer<br />
[TitleGraphic]<br />
[preset=lefttop]<br />
{\scale<br />
[width=\paperwidth,<br />
height=\paperheight]<br />
{\framed<br />
[frame=off,<br />
offset=overlay,<br />
background=color,<br />
backgroundcolor=blue,<br />
foregroundcolor=red,<br />
align=normal]<br />
% {\setuptyping[before=,after=]\typebuffer[title]}}}<br />
{\getbuffer[title]}}}<br />
<br />
\setupbackgrounds[page][background=TitleGraphic]<br />
<br />
\starttext<br />
<br />
\startstandardmakeup<br />
<br />
\stopstandardmakeup<br />
<br />
\stoptext<br />
</texcode><br />
<br />
Guess who did this one :-) [http://archive.contextgarden.net/message/20050321.011152.0eb2d729.html Reference to mailing list]<br />
<br />
<context><br />
\setuplayout[location=middle,scale=.2]<br />
\definetype[ytyp][color=yellow]<br />
<br />
\startbuffer[title]<br />
\type{/(}\ytyp{h}\type{*?)testexpr/io}\par<br />
\type{/t(}\ytyp{a}\type{*?)estexpr/io}\par<br />
\type{/te(}\ytyp{n}\type{*?)stexpr/io}\par<br />
\type{/tes(}\ytyp{s}\type{*?)texpr/io}\par<br />
\type{/test(}\ytyp{h}\type{*?)expr/io}\par<br />
\type{/teste(}\ytyp{a}\type{*?)xpr/io}\par<br />
\type{/testex(}\ytyp{g}\type{*?)pr/io}\par<br />
\type{/testexp(}\ytyp{e}\type{*?)r/io}\par<br />
\type{/testexpr(}\ytyp{n}\type{*?)/io}\par<br />
\stopbuffer<br />
<br />
\setupcolors[state=start]<br />
<br />
\definelayer<br />
[TitleGraphic]<br />
[width=\paperwidth,<br />
height=\paperheight]<br />
<br />
\setlayer<br />
[TitleGraphic]<br />
[preset=lefttop]<br />
{\scale<br />
[width=\paperwidth,<br />
height=\paperheight]<br />
{\framed<br />
[frame=off,<br />
offset=overlay,<br />
background=color,<br />
backgroundcolor=blue,<br />
foregroundcolor=red,<br />
align=normal]<br />
{\getbuffer[title]}}}<br />
<br />
\setupbackgrounds[page][background=TitleGraphic]<br />
<br />
\starttext<br />
<br />
\startstandardmakeup<br />
<br />
\stopstandardmakeup<br />
<br />
\stoptext<br />
</context><br />
<br />
<br />
== A simple centered cover for a booklet ==<br />
<br />
<br />
<texcode><br />
<br />
\starttext<br />
<br />
\setuppapersize[A5][A5]<br />
\setuppagenumbering[alternative=doublesided]<br />
<br />
\startpagemakeup[align=center,doublesided=no,%<br />
pagestate=start]% we want to number this<br />
<br />
{\bfc This should be the long title, Andreas' solution\par}<br />
<br />
\stoppagemakeup<br />
<br />
This is the colofon<br />
<br />
\chapter{Start}<br />
<br />
\input knuth<br />
<br />
\stoptext<br />
<br />
</texcode><br />
<br />
Reference: http://www.ntg.nl/pipermail/ntg-context/2011/063030.html<br />
<br />
Or, another solution (which can be tuned as will), which relies on a<br />
new feature in MkIV: there is also a layout with the same name as the<br />
makeup environment and you can control the margins of your new title<br />
page environment with \setuplayout[makeupname][...].<br />
<br />
<texcode><br />
<br />
\setuppagenumbering[alternative=doublesided]<br />
<br />
%\showframe<br />
<br />
\setuppapersize[A5][A4,landscape]<br />
\setuparranging[2UP]<br />
<br />
<br />
\definemakeup[titlepage]<br />
\setuplayout[titlepage]<br />
[backspace=2cm,width=108mm] % 148mm is the width, 20 mm of backspace,<br />
% 20 mm of outer margin<br />
<br />
\starttext<br />
<br />
\starttitlepagemakeup<br />
\raggedcenter<br />
\bfc This should be the long, long, very long title\par<br />
\stoptitlepagemakeup<br />
<br />
\dorecurse{20}{\input tufte\par}<br />
<br />
\stoptext<br />
<br />
</texcode><br />
<br />
<br />
<br />
[[Category:Sample documents]]<br />
[[Category:Graphics]]<br />
[[Category:Text elements]]</div>MelmothXhttps://wiki.contextgarden.net/index.php?title=Cover_Pages&diff=13471Cover Pages2011-11-11T13:33:12Z<p>MelmothX: Added a simple example</p>
<hr />
<div>< [[Sample documents]] | [[MetaPost]] ><br />
<br />
<texcode><br />
\setupcolors[state=start]<br />
<br />
\startuseMPgraphic{cover}<br />
StartPage ;<br />
fill Page withcolor .5green ;<br />
path p ; p := unitcircle randomized .1 xsized(PaperWidth-1cm) ;<br />
fill p shifted -center p shifted center Page withcolor red ;<br />
StopPage ;<br />
\stopuseMPgraphic<br />
<br />
\defineoverlay[cover][\useMPgraphic{cover}]<br />
<br />
\starttext<br />
<br />
\setupbackgrounds[page][background=cover]<br />
<br />
\startstandardmakeup<br />
\raggedcenter<br />
\vfill \definedfont[SerifBold at 48pt]\setstrut \strut Penguins in Vietnam<br />
\blank[2*big] \definedfont[SerifBold at 24pt]\setstrut \strut A Very Short Story<br />
\vfill<br />
\stopstandardmakeup<br />
<br />
\setupbackgrounds[page][background=]<br />
<br />
\input tufte<br />
<br />
\stoptext<br />
</texcode><br />
<br />
<context><br />
\setuplayout[location=middle,scale=.2]<br />
\setupcolors[state=start]<br />
<br />
\startuseMPgraphic{cover}<br />
StartPage ;<br />
fill Page withcolor .5green ;<br />
path p ; p := unitcircle randomized .1 xsized(PaperWidth-1cm) ;<br />
fill p shifted -center p shifted center Page withcolor red ;<br />
StopPage ;<br />
\stopuseMPgraphic<br />
<br />
\defineoverlay[cover][\useMPgraphic{cover}]<br />
<br />
\starttext<br />
<br />
\setupbackgrounds[page][background=cover]<br />
<br />
\startstandardmakeup<br />
\raggedcenter<br />
\vfill \definedfont[SerifBold at 48pt]\setstrut \strut Penguins in Vietnam<br />
\blank[2*big] \definedfont[SerifBold at 24pt]\setstrut \strut A Very Short Story<br />
\vfill<br />
\stopstandardmakeup<br />
<br />
\stoptext <br />
</context><br />
<br />
[http://archive.contextgarden.net/message/20050223.145512.19d6450f.html Reference to mailing list]<br />
<br />
== Another title page ==<br />
<br />
<texcode><br />
\definetype[ytyp][color=yellow]<br />
<br />
\startbuffer[title]<br />
\type{/(}\ytyp{h}\type{*?)testexpr/io}\par<br />
\type{/t(}\ytyp{a}\type{*?)estexpr/io}\par<br />
\type{/te(}\ytyp{n}\type{*?)stexpr/io}\par<br />
\type{/tes(}\ytyp{s}\type{*?)texpr/io}\par<br />
\type{/test(}\ytyp{h}\type{*?)expr/io}\par<br />
\type{/teste(}\ytyp{a}\type{*?)xpr/io}\par<br />
\type{/testex(}\ytyp{g}\type{*?)pr/io}\par<br />
\type{/testexp(}\ytyp{e}\type{*?)r/io}\par<br />
\type{/testexpr(}\ytyp{n}\type{*?)/io}\par<br />
\stopbuffer<br />
<br />
\setupcolors[state=start]<br />
<br />
\definelayer<br />
[TitleGraphic]<br />
[width=\paperwidth,<br />
height=\paperheight]<br />
<br />
\setlayer<br />
[TitleGraphic]<br />
[preset=lefttop]<br />
{\scale<br />
[width=\paperwidth,<br />
height=\paperheight]<br />
{\framed<br />
[frame=off,<br />
offset=overlay,<br />
background=color,<br />
backgroundcolor=blue,<br />
foregroundcolor=red,<br />
align=normal]<br />
% {\setuptyping[before=,after=]\typebuffer[title]}}}<br />
{\getbuffer[title]}}}<br />
<br />
\setupbackgrounds[page][background=TitleGraphic]<br />
<br />
\starttext<br />
<br />
\startstandardmakeup<br />
<br />
\stopstandardmakeup<br />
<br />
\stoptext<br />
</texcode><br />
<br />
Guess who did this one :-) [http://archive.contextgarden.net/message/20050321.011152.0eb2d729.html Reference to mailing list]<br />
<br />
<context><br />
\setuplayout[location=middle,scale=.2]<br />
\definetype[ytyp][color=yellow]<br />
<br />
\startbuffer[title]<br />
\type{/(}\ytyp{h}\type{*?)testexpr/io}\par<br />
\type{/t(}\ytyp{a}\type{*?)estexpr/io}\par<br />
\type{/te(}\ytyp{n}\type{*?)stexpr/io}\par<br />
\type{/tes(}\ytyp{s}\type{*?)texpr/io}\par<br />
\type{/test(}\ytyp{h}\type{*?)expr/io}\par<br />
\type{/teste(}\ytyp{a}\type{*?)xpr/io}\par<br />
\type{/testex(}\ytyp{g}\type{*?)pr/io}\par<br />
\type{/testexp(}\ytyp{e}\type{*?)r/io}\par<br />
\type{/testexpr(}\ytyp{n}\type{*?)/io}\par<br />
\stopbuffer<br />
<br />
\setupcolors[state=start]<br />
<br />
\definelayer<br />
[TitleGraphic]<br />
[width=\paperwidth,<br />
height=\paperheight]<br />
<br />
\setlayer<br />
[TitleGraphic]<br />
[preset=lefttop]<br />
{\scale<br />
[width=\paperwidth,<br />
height=\paperheight]<br />
{\framed<br />
[frame=off,<br />
offset=overlay,<br />
background=color,<br />
backgroundcolor=blue,<br />
foregroundcolor=red,<br />
align=normal]<br />
{\getbuffer[title]}}}<br />
<br />
\setupbackgrounds[page][background=TitleGraphic]<br />
<br />
\starttext<br />
<br />
\startstandardmakeup<br />
<br />
\stopstandardmakeup<br />
<br />
\stoptext<br />
</context><br />
<br />
<br />
== A simple centered cover for a booklet ==<br />
<br />
<br />
<texcode><br />
<br />
\starttext<br />
<br />
\setuppapersize[A5][A5]<br />
\setuppagenumbering[alternative=doublesided]<br />
<br />
\startpagemakeup[align=center,doublesided=no,%<br />
pagestate=start]% we want to number this<br />
<br />
{\bfc This should be the long title, Andreas' solution\par}<br />
<br />
\stoppagemakeup<br />
<br />
This is the colofon<br />
<br />
\chapter{Start}<br />
<br />
\input knuth<br />
<br />
\stoptext<br />
<br />
<br />
</texcode><br />
<br />
Reference: http://www.ntg.nl/pipermail/ntg-context/2011/063030.html<br />
<br />
<br />
<br />
[[Category:Sample documents]]<br />
[[Category:Graphics]]<br />
[[Category:Text elements]]</div>MelmothXhttps://wiki.contextgarden.net/index.php?title=Paratype_typescript_for_mkiv&diff=13353Paratype typescript for mkiv2011-09-09T09:33:45Z<p>MelmothX: </p>
<hr />
<div><br />
<br />
<texcode><br />
<br />
<br />
\definefontfeature<br />
[ptfeatures]<br />
[mode=node,liga=yes,kern=yes,tlig=yes,trep=yes,<br />
ccmp=yes,language=dflt,script=cyrl,<br />
protrusion=quality,<br />
expansion=quality]<br />
<br />
<br />
\starttypescript [sans] [paratype]<br />
\definefontsynonym[PTSans-Regular] [file:PTS55F]<br />
\definefontsynonym[PTSans-Bold] [file:PTS75F]<br />
\definefontsynonym[PTSans-BoldItalic] [file:PTS76F]<br />
\definefontsynonym[PTSans-Italic] [file:PTS56F]<br />
\stoptypescript<br />
<br />
\starttypescript [serif] [paratype]<br />
\definefontsynonym[PTSerif-Regular] [file:PTF55F] <br />
\definefontsynonym[PTSerif-Bold] [file:PTF75F] <br />
\definefontsynonym[PTSerif-BoldItalic] [file:PTF76F] <br />
\definefontsynonym[PTSerif-Italic] [file:PTF56F] <br />
\stoptypescript<br />
<br />
\starttypescript [sans] [paratype] [name]<br />
\definefontsynonym [Sans] [PTSans-Regular] [features=ptfeatures]<br />
\definefontsynonym [SansItalic] [PTSans-Italic] [features=ptfeatures]<br />
\definefontsynonym [SansSlanted] [PTSans-Italic] [features=ptfeatures]<br />
\definefontsynonym [SansBold] [PTSans-Bold] [features=ptfeatures]<br />
\definefontsynonym [SansBoldItalic] [PTSans-BoldItalic] [features=ptfeatures]<br />
\definefontsynonym [SansBoldSlanted][PTSans-BoldItalic] [features=ptfeatures]<br />
\definefontsynonym [SansCaps] [PTSans-Regular] [features=ptfeatures]<br />
\stoptypescript<br />
<br />
\starttypescript [serif] [paratype] [name]<br />
\definefontsynonym [Serif] [PTSerif-Regular] [features=ptfeatures]<br />
\definefontsynonym [SerifItalic] [PTSerif-Italic] [features=ptfeatures]<br />
\definefontsynonym [SerifSlanted] [PTSerif-Italic] [features=ptfeatures]<br />
\definefontsynonym [SerifBold] [PTSerif-Bold] [features=ptfeatures]<br />
\definefontsynonym [SerifBoldItalic] [PTSerif-BoldItalic] [features=ptfeatures]<br />
\definefontsynonym [SerifBoldSlanted][PTSerif-BoldItalic] [features=ptfeatures]<br />
\definefontsynonym [SerifCaps] [PTSerif-Regular] [features=ptfeatures]<br />
\stoptypescript<br />
<br />
\starttypescript [paratype]<br />
\definetypeface [paratype] [rm] [serif] [paratype] [default]<br />
\definetypeface [paratype] [ss] [sans] [paratype] [default]<br />
\definetypeface [paratype] [tt] [mono] [default] [default]<br />
\definetypeface [paratype] [mm] [math] [default] [default]<br />
\stoptypescript<br />
<br />
\setupbodyfont[paratype,11pt]<br />
\setupalign[hz,hanging]<br />
<br />
\starttext<br />
<br />
\mainlanguage[ru]<br />
<br />
\startlines<br />
<br />
табак<br />
Возможно ль? вместо роз, Амуром<br />
насажденных,<br />
Тюльпанов, гордо наклоненных,<br />
Душистых ландышей, ясминов и лилей,<br />
Которых ты всегда любила<br />
И прежде всякий день носила<br />
На мраморной груди твоей--<br />
Возможно ль, милая Климена?<br />
Какая странная во вкусе перемена! . .<br />
Ты любишь обонять не утренний цветок,<br />
А вредную траву зелену,<br />
Искусством превращену<br />
В пушистый порошок!<br />
Пускай уже седой профессор Геттингена,<br />
На старой кафедре согнувшися дугой,<br />
Вперив в латинщину глубокий разум свой,<br />
Раскашлявшись, табак толченый<br />
Пихает в длинный нос иссохшею рукой.<br />
Пускай младой драгун усатый<br />
Поутру, сидя у окна,<br />
Стаканы сушит все до дна,<br />
С остатком утреннего сна<br />
Из трубки пенковой дым гонит сероватый.<br />
Пускай красавица шестидесяти лет,<br />
У граций в отпуску, и у любви в отставке<br />
У коей держится вся прелесть на подставке,<br />
У коей без морщин на теле места нет,<br />
Чаек в прикуску попивает,<br />
И с верным табаком печали забывает,<br />
Злословит, молится, зевает.<br />
А ты, прелестная! . . но если уж табак<br />
Так нравится тебе--о пыл воображенья!<br />
Ах! если, превращенный в прах,<br />
И в табакерке, в заточеньи,<br />
Я в персты нежные твои попасться мог,<br />
Тогда б в сердечном восхищеньи<br />
Рассыпался на грудь под шалевый платок<br />
И даже, может быть. . о сладость<br />
вожделенья<br />
...До тайных прелестей, которых сам<br />
Эрот<br />
Запрятал за леса и горы,<br />
Чтоб не могли нескромны взоры<br />
Открыть вместилище божественных<br />
красот.<br />
Но что! мечта, мечта пустая.<br />
Не будет этого никак.<br />
Судьба завистливая злая!<br />
Ах, отчего я не табак! . . <br />
<br />
\stoplines<br />
<br />
<br />
\setupbodyfont[paratype,ss,11pt]<br />
<br />
\startlines<br />
<br />
табак<br />
Возможно ль? вместо роз, Амуром<br />
насажденных,<br />
Тюльпанов, гордо наклоненных,<br />
Душистых ландышей, ясминов и лилей,<br />
Которых ты всегда любила<br />
И прежде всякий день носила<br />
На мраморной груди твоей--<br />
Возможно ль, милая Климена?<br />
Какая странная во вкусе перемена! . .<br />
Ты любишь обонять не утренний цветок,<br />
А вредную траву зелену,<br />
Искусством превращену<br />
В пушистый порошок!<br />
Пускай уже седой профессор Геттингена,<br />
На старой кафедре согнувшися дугой,<br />
Вперив в латинщину глубокий разум свой,<br />
Раскашлявшись, табак толченый<br />
Пихает в длинный нос иссохшею рукой.<br />
Пускай младой драгун усатый<br />
Поутру, сидя у окна,<br />
Стаканы сушит все до дна,<br />
С остатком утреннего сна<br />
Из трубки пенковой дым гонит сероватый.<br />
Пускай красавица шестидесяти лет,<br />
У граций в отпуску, и у любви в отставке<br />
У коей держится вся прелесть на подставке,<br />
У коей без морщин на теле места нет,<br />
Чаек в прикуску попивает,<br />
И с верным табаком печали забывает,<br />
Злословит, молится, зевает.<br />
А ты, прелестная! . . но если уж табак<br />
Так нравится тебе--о пыл воображенья!<br />
Ах! если, превращенный в прах,<br />
И в табакерке, в заточеньи,<br />
Я в персты нежные твои попасться мог,<br />
Тогда б в сердечном восхищеньи<br />
Рассыпался на грудь под шалевый платок<br />
И даже, может быть. . о сладость<br />
вожделенья<br />
...До тайных прелестей, которых сам<br />
Эрот<br />
Запрятал за леса и горы,<br />
Чтоб не могли нескромны взоры<br />
Открыть вместилище божественных<br />
красот.<br />
Но что! мечта, мечта пустая.<br />
Не будет этого никак.<br />
Судьба завистливая злая!<br />
Ах, отчего я не табак! . . <br />
<br />
<br />
\stoplines<br />
<br />
\stoptext<br />
<br />
</texcode></div>MelmothXhttps://wiki.contextgarden.net/index.php?title=Paratype_typescript_for_mkiv&diff=13352Paratype typescript for mkiv2011-09-09T09:32:20Z<p>MelmothX: Created page with " <code> \definefontfeature [ptfeatures] [mode=node,liga=yes,kern=yes,tlig=yes,trep=yes, ccmp=yes,language=dflt,script=cyrl, protrusion=quality, expansion=quality] \st..."</p>
<hr />
<div><br />
<br />
<br />
<code><br />
<br />
<br />
\definefontfeature<br />
[ptfeatures]<br />
[mode=node,liga=yes,kern=yes,tlig=yes,trep=yes,<br />
ccmp=yes,language=dflt,script=cyrl,<br />
protrusion=quality,<br />
expansion=quality]<br />
<br />
<br />
\starttypescript [sans] [paratype]<br />
\definefontsynonym[PTSans-Regular] [file:PTS55F]<br />
\definefontsynonym[PTSans-Bold] [file:PTS75F]<br />
\definefontsynonym[PTSans-BoldItalic] [file:PTS76F]<br />
\definefontsynonym[PTSans-Italic] [file:PTS56F]<br />
\stoptypescript<br />
<br />
\starttypescript [serif] [paratype]<br />
\definefontsynonym[PTSerif-Regular] [file:PTF55F] <br />
\definefontsynonym[PTSerif-Bold] [file:PTF75F] <br />
\definefontsynonym[PTSerif-BoldItalic] [file:PTF76F] <br />
\definefontsynonym[PTSerif-Italic] [file:PTF56F] <br />
\stoptypescript<br />
<br />
\starttypescript [sans] [paratype] [name]<br />
\definefontsynonym [Sans] [PTSans-Regular] [features=ptfeatures]<br />
\definefontsynonym [SansItalic] [PTSans-Italic] [features=ptfeatures]<br />
\definefontsynonym [SansSlanted] [PTSans-Italic] [features=ptfeatures]<br />
\definefontsynonym [SansBold] [PTSans-Bold] [features=ptfeatures]<br />
\definefontsynonym [SansBoldItalic] [PTSans-BoldItalic] [features=ptfeatures]<br />
\definefontsynonym [SansBoldSlanted][PTSans-BoldItalic] [features=ptfeatures]<br />
\definefontsynonym [SansCaps] [PTSans-Regular] [features=ptfeatures]<br />
\stoptypescript<br />
<br />
\starttypescript [serif] [paratype] [name]<br />
\definefontsynonym [Serif] [PTSerif-Regular] [features=ptfeatures]<br />
\definefontsynonym [SerifItalic] [PTSerif-Italic] [features=ptfeatures]<br />
\definefontsynonym [SerifSlanted] [PTSerif-Italic] [features=ptfeatures]<br />
\definefontsynonym [SerifBold] [PTSerif-Bold] [features=ptfeatures]<br />
\definefontsynonym [SerifBoldItalic] [PTSerif-BoldItalic] [features=ptfeatures]<br />
\definefontsynonym [SerifBoldSlanted][PTSerif-BoldItalic] [features=ptfeatures]<br />
\definefontsynonym [SerifCaps] [PTSerif-Regular] [features=ptfeatures]<br />
\stoptypescript<br />
<br />
\starttypescript [paratype]<br />
\definetypeface [paratype] [rm] [serif] [paratype] [default]<br />
\definetypeface [paratype] [ss] [sans] [paratype] [default]<br />
\definetypeface [paratype] [tt] [mono] [default] [default]<br />
\definetypeface [paratype] [mm] [math] [default] [default]<br />
\stoptypescript<br />
<br />
\setupbodyfont[paratype,11pt]<br />
\setupalign[hz,hanging]<br />
<br />
\starttext<br />
<br />
\mainlanguage[ru]<br />
<br />
\startlines<br />
<br />
табак<br />
Возможно ль? вместо роз, Амуром<br />
насажденных,<br />
Тюльпанов, гордо наклоненных,<br />
Душистых ландышей, ясминов и лилей,<br />
Которых ты всегда любила<br />
И прежде всякий день носила<br />
На мраморной груди твоей--<br />
Возможно ль, милая Климена?<br />
Какая странная во вкусе перемена! . .<br />
Ты любишь обонять не утренний цветок,<br />
А вредную траву зелену,<br />
Искусством превращену<br />
В пушистый порошок!<br />
Пускай уже седой профессор Геттингена,<br />
На старой кафедре согнувшися дугой,<br />
Вперив в латинщину глубокий разум свой,<br />
Раскашлявшись, табак толченый<br />
Пихает в длинный нос иссохшею рукой.<br />
Пускай младой драгун усатый<br />
Поутру, сидя у окна,<br />
Стаканы сушит все до дна,<br />
С остатком утреннего сна<br />
Из трубки пенковой дым гонит сероватый.<br />
Пускай красавица шестидесяти лет,<br />
У граций в отпуску, и у любви в отставке<br />
У коей держится вся прелесть на подставке,<br />
У коей без морщин на теле места нет,<br />
Чаек в прикуску попивает,<br />
И с верным табаком печали забывает,<br />
Злословит, молится, зевает.<br />
А ты, прелестная! . . но если уж табак<br />
Так нравится тебе--о пыл воображенья!<br />
Ах! если, превращенный в прах,<br />
И в табакерке, в заточеньи,<br />
Я в персты нежные твои попасться мог,<br />
Тогда б в сердечном восхищеньи<br />
Рассыпался на грудь под шалевый платок<br />
И даже, может быть. . о сладость<br />
вожделенья<br />
...До тайных прелестей, которых сам<br />
Эрот<br />
Запрятал за леса и горы,<br />
Чтоб не могли нескромны взоры<br />
Открыть вместилище божественных<br />
красот.<br />
Но что! мечта, мечта пустая.<br />
Не будет этого никак.<br />
Судьба завистливая злая!<br />
Ах, отчего я не табак! . . <br />
<br />
\stoplines<br />
<br />
<br />
\setupbodyfont[paratype,ss,11pt]<br />
<br />
\startlines<br />
<br />
табак<br />
Возможно ль? вместо роз, Амуром<br />
насажденных,<br />
Тюльпанов, гордо наклоненных,<br />
Душистых ландышей, ясминов и лилей,<br />
Которых ты всегда любила<br />
И прежде всякий день носила<br />
На мраморной груди твоей--<br />
Возможно ль, милая Климена?<br />
Какая странная во вкусе перемена! . .<br />
Ты любишь обонять не утренний цветок,<br />
А вредную траву зелену,<br />
Искусством превращену<br />
В пушистый порошок!<br />
Пускай уже седой профессор Геттингена,<br />
На старой кафедре согнувшися дугой,<br />
Вперив в латинщину глубокий разум свой,<br />
Раскашлявшись, табак толченый<br />
Пихает в длинный нос иссохшею рукой.<br />
Пускай младой драгун усатый<br />
Поутру, сидя у окна,<br />
Стаканы сушит все до дна,<br />
С остатком утреннего сна<br />
Из трубки пенковой дым гонит сероватый.<br />
Пускай красавица шестидесяти лет,<br />
У граций в отпуску, и у любви в отставке<br />
У коей держится вся прелесть на подставке,<br />
У коей без морщин на теле места нет,<br />
Чаек в прикуску попивает,<br />
И с верным табаком печали забывает,<br />
Злословит, молится, зевает.<br />
А ты, прелестная! . . но если уж табак<br />
Так нравится тебе--о пыл воображенья!<br />
Ах! если, превращенный в прах,<br />
И в табакерке, в заточеньи,<br />
Я в персты нежные твои попасться мог,<br />
Тогда б в сердечном восхищеньи<br />
Рассыпался на грудь под шалевый платок<br />
И даже, может быть. . о сладость<br />
вожделенья<br />
...До тайных прелестей, которых сам<br />
Эрот<br />
Запрятал за леса и горы,<br />
Чтоб не могли нескромны взоры<br />
Открыть вместилище божественных<br />
красот.<br />
Но что! мечта, мечта пустая.<br />
Не будет этого никак.<br />
Судьба завистливая злая!<br />
Ах, отчего я не табак! . . <br />
<br />
<br />
\stoplines<br />
<br />
\stoptext<br />
<br />
</code></div>MelmothXhttps://wiki.contextgarden.net/index.php?title=Fonts_-_Old_Content&diff=13351Fonts - Old Content2011-09-09T09:27:31Z<p>MelmothX: /* Available Free Fonts */</p>
<hr />
<div>< [[Visuals]] | [[Symbols]] ><br />
<br />
= Where to find fonts =<br />
<br />
== Available Free Fonts ==<br />
* [http://ctan.tug.org/tex-archive/info/Free_Math_Font_Survey/survey.html Free Math Fonts] : overview of different free Math fonts; [http://www.geocities.com/hartke01/ links to other free fonts]<br />
* [http://greekfontsociety.gr/ GFS Didot] : Latin, full set of polytonik Greek, small caps, oldstyle figures, full f-ligatures ([http://modules.contextgarden.net/gfsdidot Module for ConTeXt])<br />
* [[TeX Gyre]] : a set of great text fonts by our GUST friends, based on URW's free PostScript standard fonts for GhostScript.<br />
* [http://www.janusz.nowacki.strefa.pl/kurier.html Foto Alfa] : some TeX related fonts from Poland (Antykwa Toruńska. Antykwa Półtawskiego, Kurier, Iwona...)<br />
* [http://linuxlibertine.sourceforge.net Libertine Open Fonts Project]: GPL/OFL serif font [[Linux Libertine on mkiv|sample]]<br />
* [http://scripts.sil.org SIL International] : great Unicode fonts for scholars by SIL (Gentium, Doulos, Charis, etc.)<br />
* [http://ist-socrates.berkeley.edu/~pinax/greekkeys/GreekKeys.html GreekKeys] : links to polytonic Greek fonts<br />
* [http://scholarsfonts.net Scholar's Fonts] : Font for Scholars (Latin, Germanic languages, Greek, Hebrew and Linguistics)<br />
* [http://www.engl.virginia.edu/OE/junicode/junicode.html Junicode] : Junius-Unicode, a font for medievalists<br />
* [http://www.freelang.net/fonts/index.html FreeLang fonts] : fonts for exotic languages<br />
* [http://www.blambot.com Blambot] : Comic fonts<br />
* [http://www.chank.com/freefonts.php Chank] : some free Chank fonts<br />
* [http://www.fontface.com/fonts/ FontFace] : free fonts<br />
* [http://www.dafont.com DaFont] : more free fonts<br />
* [http://fonts.tom7.com/fonts98.html Divide by Zero] : more fonts<br />
* [http://moorstation.org/typoasis/typoasis1.htm TypOasis] : lots of nice fonts, but a bit hard to find (have a look at designers Apostrophic Lab, Manfred Klein and Dieter Steffmann)<br />
* [http://kadyellebee.com/fonts/ Kristine's Font Organization] : find a font in a sorted directory<br />
* [http://www.fontlover.com FontLover] : font news portal site<br />
* [http://www.stormtype.com/typefaces-fonts-shop/free.php Lido] : OpenType and TrueType typeface by Storm Type Foundry, free for non-commercial use. [http://modules.contextgarden.net/stormfontsupport Support].<br />
* [http://www.alanwood.net/unicode/fontsbyrange.html Alan Wood’s Unicode Resources] : find fonts by Unicode character range<br />
* [http://www.josbuivenga.demon.nl/ exljbris] Free Quality Font Foundry by Jos Buivenga<br />
* [http://www.stixfonts.org/ STIX Fonts] Beta download of the STIX-Fonts<br />
* [http://www.fontsquirrel.com/ Font Squirrel] Handpicked free fonts for graphic designers with commercial-use licenses<br />
* [http://www.theleagueofmoveabletype.com/ The league of Moveable Type] : a collection of open source fonts<br />
* [http://www.1stwebdesigner.com/resources/65-popular-and-professional-free-fonts-for-creative-typography/ 65 Popular And Professional Free Fonts For Creative Typography] and [http://www.1stwebdesigner.com/resources/52-really-high-quality-free-fonts-for-modern-and-cool-design/ 52 Really High Quality Free Fonts For Modern And Cool Design]<br />
* [http://www.paratype.com/public/]: Public fonts for minority languages of Russia [[Paratype typescript for mkiv|sample]]<br />
* ''... many more to be added ...''<br />
<br />
= How to use fonts in ConTeXt =<br />
'''The ConTeXt way of handling fonts are [[TypeScripts]].''' It’s a system of abstraction and aliases, which may seem “strange” at first for new users of ConTeXt.<br />
* There is now a [http://context.aanhet.net/svn/contextman/context-reference/en/co-fonts.pdf manual chapter on fonts].<br />
* If you happen to use [[XeTeX]] then you can forget almost all the magic and start using your system fonts (see [[Fonts_in_XeTeX]]).<br />
* If you use [[LuaTeX]], see [[Fonts_in_LuaTeX]]<br />
* If you want to keep using [[pdfTeX]], read on.<br />
<br />
= Font support & configuration =<br />
== Type 1 fonts ==<br />
<br />
Type 1 fonts come in multiple files. The various components are:<br />
<br />
* '''.pfb''': "Printer Font, Binary".<br />
* '''.pfa''': "Printer Font, ASCII".<br />
* '''.pfm''': "Printer Font Metrics", binary.<br />
* '''.afm''': "Adobe Font Metrics".<br />
<br />
Typically each font will have a set of outlines in a pfb or pfa file, and a set of metrics in a pfm or afm file.<br />
<br />
Which file variations are preferred depends on platform. Linux prefers pfa and afm (the ASCII versions). Windows prefers pfb and pfm (the binary versions). Mac OS X prefers pfm and afm.<br />
<br />
On the Mac, you may encounter old-style PostScript Type 1 fonts which have an extensionless file containing the font outlines. These are a relic from the days when bitmaps were used to display fonts on screen, and the PostScript was downloaded to the printer. Your best bet is to throw them away and get an up-to-date OpenType version, or use a font editing utility such as fontforge to convert them.<br />
<br />
On Windows 7, the OS will identify only the .pfm file as the actual font. However, when you install the font, Windows invisibly locates the matching .pfb file from the same directory, and copies them both to the C:\Windows\Fonts directory.<br />
<br />
* Using [[psnfss]] metrics in ConTeXt<br />
* Matt Gushee's introduction to [http://havenrock.com/textips/bookfonts.html virtual fonts], especially for getting expert fonts to work.<br />
* [[URW Garamond]]<br />
* [[Lucida]] : large font family designed by Bigelow & Holmes; suitable e.g. for presentations<br />
* [http://dl.contextgarden.net/myway/expertfonts.pdf Installing Expert Fonts: Minion Pro] by Idris Samawi Hamid; contains step-by-step instructions, from preinstallation to writing typescripts<br />
* [http://www.stormtype.com Storm Type Foundry] : [http://modules.contextgarden.net/stormfontsupport support] of selected fonts<br />
<br />
== True Type fonts ==<br />
* [http://tug.org/pracjourn/2005-2/schmitz/schmitz.pdf Integrating TrueType Fonts into ConTeXt] by Thomas A. Schmitz (PracTeX Journal)<br />
* [[Installing a TrueType font, step by step]]. If you just need to install a TrueType font, this may be what you are looking for.<br />
* [[Palatino Linotype under MKIV]].<br />
<br />
== OpenType fonts ==<br />
* [[otfinstall|otfinst - a script for using OpenType fonts in ConTeXt]]<br />
<br />
== Basic Hints ==<br />
<br />
How to change to Palatino for text with Euler for math: [[Palatino with Euler for Math]]<br />
<br />
''Some hints by Taco from the mailing list on 2005-11-20:''<br />
<br />
Q: How up to date or out of date is the information in [http://www.pragma-ade.com/general/manuals/mfonts.pdf mfonts manual]?<br />
<br />
A: It looks like it is still quite up-to-date, but some of the examples it gives may no longer be the very best and latest way of doing things, and possibly there are some new developments that do not get as much attention as desired (like [http://www.pragma-ade.com/general/manuals/mtexfont.pdf texfont], and the issues arising from font map files). Overall, the document appears accurate, though.<br />
<br />
An important thing to remember is this:<br />
<br />
'''ConTeXt does not share font metric conventions with LaTeX.'''<br />
<br />
(at one point it started doing so, like supporting the ''Karl Berry naming scheme'' and the ''PSNFSS'' style font family names, but that has since been abandoned).<br />
<br />
Another important thing is that it also does not share font map files with LaTeX and, specifically,<br />
<br />
'''ConTeXt does not make pdfetex read <tt>pdftex.map</tt>.'''<br />
<br />
(this is at the root of a great many problems reported by users only familiar with PSNFSS)<br />
<br />
The preferred format for metric files in ConTeXt is<br />
<br />
<tt><vendor>/<familyname>/<encoding>-<fontname>.tfm</tt><br />
<br />
for metrics and<br />
<br />
<tt><encoding>-<vendor>-<familyname>.map</tt><br />
<br />
for the mapping files.<br />
<br />
* <fontname> is usually derived from the font source (afm or ttf),<br />
* <encoding> is a 'controlled' list, (see [[Encodings and Regimes]])<br />
* <vendor> and <familyname> are user-supplied (at install time).<br />
<br />
There are ways to trick ConTeXt into using different conventions, but if you do that you are likely to run into trouble.<br />
<br />
== Hints by Language ==<br />
* general: [[Encodings and Regimes]]<br />
* [[Arabic and Hebrew]] (Idris? other ArabTeX specialists?)<br />
* [[Chinese]]<br />
* [[Czech]]<br />
* [[Greek]]<br />
* [[Russian]]<br />
* [[Vietnamese]]<br />
<br />
= Unsorted links =<br />
<br />
* [http://www.pragma-ade.com/general/manuals/mtexfont.pdf font installation with texfont] by Pragma<br />
* [http://www.pragma-ade.com/general/manuals/mfonts.pdf ConTeXt's font mechanism in detail] by Pragma<br />
* [http://tug.org/TUGboat/Articles/tb28-2/tb89mahajan.pdf ConTeXt basics for users: Font styles] by Aditya Mahajan (2007)<br />
* [http://www.pragma-ade.com/general/manuals/mmakempy.pdf making outlines] by Pragma<br />
* [http://pragma-ade.com/specials/fonts/fontspecial-p.pdf Here] you can try out several TeX fonts online (PDF interface!)<br />
* Troubleshooting: solving [[TeXfont]] problems.<br />
* Character [[Protrusion]] (also known as hanging or font handling) is a more subtle typographic effect.<br />
* [[Font Handling Internals]]<br />
* [http://watershade.net/wmcclain/context-help.html Bill McClain's ConTeXt beginners page] has also a lot about fonts<br />
* [[Pseudo Small Caps]] by Vit Zyka<br />
* [[Understanding how fonts work in ConTeXt]]<br />
* Fonts rely on [[Encodings and Regimes]], and it helps to know what happens underneath the hood, from time to time.<br />
* In newer distributions, map files belong in <tt>&hellip;/fonts/map/pdftex/context</tt>!<br />
* Don't forget to look at [[cont-sys.tex]]!<br />
<br />
<br />
[[Category:Fonts]]</div>MelmothXhttps://wiki.contextgarden.net/index.php?title=Imposition&diff=12762Imposition2011-01-16T11:41:42Z<p>MelmothX: /* Imposition by signatures */</p>
<hr />
<div>< [[Structurals]] | [[Visuals]] ><br />
<br />
==What is Imposition?==<br />
<br />
To impose means to order pages on a bigger sheet in a way, that you get a booklet (or something similar) with correct page order after folding.<br />
In the simplest case you impose four A5 pages on both sides of an A4 sheet.<br />
<br />
In a print shop it could be that you've to place 64 inner pages of a book on one printing sheet. For private use you could want to zigzag-fold an A4 sheet as a brochure that fits nicely in a business envelope. You could make two pages with three columns each, or you could make six pages and impose them.<br />
<br />
Another "style" of imposition is to place several identical templates on one sheet, e.g. labels.<br />
<br />
==Imposition schemas==<br />
<br />
===Default schemas===<br />
<br />
ConTeXt has some built-in imposition schemas (see "arranging pages" in the manual):<br />
<br />
* 2UP : 2 pages next to each other, n sheets arranged for a single booklet<br />
* 2DOWN : 2 pages above each other, n sheets arranged for a single booklet<br />
* 2SIDE : 2 pages per form, side by side in pagination order, single sided only (no real imposition, only paper saving)<br />
* 2TOP : 2 pages above each other, single sided only<br />
* 2TOPSIDE: 2 odd pages on one side, two even pages verso, above each other<br />
* 2*2 : section: one sheet 2 x 2 pages = 4 pages (2 pages per form, for single sheets with front and back)<br />
* 2**2 : section: one sheet 2 x 2 pages = 4 pages (2 pages per form, for book ordering)<br />
* 2*4 : section: one sheet 2 x 4 pages = 8 pages (4 pages per form, 2x2 pages head to head)<br />
* 2*8 : section: one sheet 2 x 8 pages = 16 pages<br />
* 2*16 : section: one sheet 2 x 16 pages = 32 pages<br />
* 2*4*2 : section of 16 pages: 2 sheets, 4 pages front and backside<br />
* 2*2*4 : section of 16 pages: 4 sheets, 2 pages front and backside<br />
* XY : one sheet with x rows and y columns, you can control the number with [[cmd:setuppaper|\setuppaper]][nx=...,ny=...,dx=...,dy=...]<br />
<br />
"form" means "one side of a sheet".<br />
<br />
You can access this feature via<br />
* <cmd>setuparranging</cmd><br />
* <tt>texexec --pdfarrange=...</tt><br />
* [http://www.ntg.nl:8061/impose.pdf online interface]<br />
<br />
{{todo|some graphical examples}}<br />
<br />
===Additional schemas===<br />
<br />
Hraban needed a "3SIDE" schema to fit three "filius" planner pages on one A4 sheet. Willi wrote it:<br />
<texcode><br />
\unprotect<br />
% New page imposition scheme 3SIDE by Willi Egger 2003-07-21<br />
<br />
\installpagearrangement 3SIDE<br />
{\dosetuparrangement{3}{1}{6}{4}{2}%<br />
\pusharrangedpageTHREESIDE\poparrangedpagesAB\relax}<br />
<br />
\def\pusharrangedpageTHREESIDE#1% Willi's approach<br />
{\doglobal\increment\arrangedpageN<br />
\reportarrangedpage\arrangedpageN<br />
\ifcase\arrangedpageN<br />
\or \handlearrangedpageXandY{#1}000\arrangedpageA % 1<br />
\or \handlearrangedpageXandY{#1}010\arrangedpageA % 2<br />
\or \handlearrangedpageXandY{#1}020\arrangedpageA % 3<br />
\or \handlearrangedpageXandY{#1}000\arrangedpageB % 4<br />
\or \handlearrangedpageXandY{#1}010\arrangedpageB % 5<br />
\or \handlearrangedpageXandY{#1}020\arrangedpageB % 6<br />
\poparrangedpages<br />
\fi}<br />
<br />
\protect<br />
</texcode><br />
You can use this code simply in your environment file. The other schemas are in <tt>page-imp.tex</tt>.<br />
<br />
Use it like this:<br />
<texcode><br />
\definepapersize [filius][width=92mm, height=172mm]<br />
\setuppapersize [filius][A4,landscape]<br />
\setuparranging [3SIDE]<br />
\setuplayout [location=middle,<br />
alternative=singlesided,<br />
grid=no, marking=on,<br />
leftmargin=10mm, leftmargindistance=0mm,<br />
topspace=2mm, header=4mm, footer=0mm,<br />
width=77mm, height=166mm]<br />
</texcode><br />
<br />
<br />
ConTeXt is also handy when you need to '''rearrange an existing pdf''' into a booklet. This is a trial-and-error solution by Mari for rearranging an A4 pdf file into 2*8 spreads on A3 sheet (-> A6 pages when printed and cut). The texexec.tex file that was created by the first tries with <tt>texexec --pdfarrange</tt> (which didn't seem to have enough options) was a great help while working towards this solution.<br />
Not sure about the margins on the final A6 pages (the original has equal left and right margins, some extra inside margin might be a good thing), but at least otherwise this seems to do the trick:<br />
<br />
<texcode><br />
\setuppapersize[A6][A3] %individual page A6 size, print size A3<br />
\setuparranging[2*8,rotated] %makes an 8 page gathering when folded (duplex printing!)<br />
\setupoutput[pdf]<br />
\setuplayout<br />
[backspace=0pt,<br />
topspace=0pt,<br />
width=middle,<br />
height=middle,<br />
location=middle,<br />
header=0pt,<br />
footer=0pt]<br />
\setuppagenumbering[alternative=doublesided]<br />
<br />
\starttext<br />
<br />
\insertpages<br />
[original_file.pdf][width=0pt]<br />
<br />
\stoptext<br />
<br />
</texcode><br />
<br />
===Testing schemas===<br />
<br />
Here's a convenient test file to help choose a schema or write a new one:<br />
<br />
<texcode><br />
\setupbodyfont[ss,10pt]<br />
\setuppapersize [A7][A4] <br />
\setuparranging [2*2*4,doublesided] %% the schema you want to test<br />
\setuppagenumbering [alternative=doublesided,location=footer]<br />
\setuplayout [margin=0pt,width=fit] <br />
\setupbackgrounds [text][text][background=screen,backgroundscreen=0.7] <br />
\setupcolors [state=start] <br />
\setuplayout [location=middle,marking=on]<br />
\setuptolerance [tolerant] <br />
<br />
\def\Style{[2*2*4,doublesided]}<br />
<br />
<br />
\startbuffer[Fakepage]<br />
\strut<br />
\blank<br />
\midaligned{\Style}<br />
\vfill<br />
\midaligned{This is page \recurselevel}<br />
\vfill<br />
\stopbuffer<br />
<br />
\setupheadertexts[\CONTEXT\ imposition test document]<br />
<br />
\starttext<br />
% \showframe<br />
\dorecurse{16}{\getbuffer[Fakepage]\page}<br />
<br />
\stoptext</texcode><br />
<br />
== Cut marks ==<br />
<br />
ConTeXt also allows to place cut marks. This can be controlled using the <tt>marking</tt> option of [[cmd:setuplayout|\setuplayout]]; possible values are:<br />
<br />
* '''on''' show cut marks and page number<br />
* '''screen''' ditto, but also print a grey-scale colour bar<br />
* '''colour''' ditto, but also print a colour bar<br />
* '''text''' print a text, defaults to `empty`<br />
<br />
The default settings are<br />
<br />
<texcode><br />
\def\pagecutmarksymbol {\the\realpageno}<br />
\def\pagecutmarklength {.5cm}<br />
\let\pagecutmarktoptext \empty<br />
\let\pagecutmarkbottomtext \empty<br />
</texcode><br />
<br />
To obtain register marks (or also called registration marks) you can use the small [http://archive.contextgarden.net/message/20070417.212628.76134ff7.en.html <tt>crop</tt> module] which was posted to the mailing list.<br />
<br />
== Caveat: common troubles ==<br />
<br />
Note that some features (e.g. table of content, internal references) are always disabled in imposition mode. So, they will not be included in the pdf if you ask for imposition.<br />
To get rid of this you can use the "arrange" key for texexec. <br />
<br />
<texcode><br />
texexec --arrange yourFilename<br />
</texcode><br />
<br />
This will run the document at first without page arrangement and impose the pages in a separate run after table of contents etc are created.<br />
<br />
In '''SciTe/WinConTeXt''' you can run this command by choosing ''Process and Arrange'' in the ''Tools'' menu in SciTe.<br />
<br />
== Getting the last page of a Booklet ==<br />
<br />
When you use imposition to print a booklet you want to put something on the very last page, the <code>quadruple</code> pagebreak did not always fill the remaining pages untill you get a quadruple number of pages.<br />
<br />
<texcode><br />
\unprotect<br />
<br />
\startvariables all<br />
nextquadruple: nextquadruple<br />
\stopvariables<br />
<br />
\installpagebreakhandler \v!nextquadruple<br />
{\ifdoublesided<br />
\!!counta\realpageno<br />
\!!countb\realpageno<br />
\advance\!!counta 4<br />
\divide\!!counta 4<br />
\multiply\!!counta 4<br />
\advance\!!countb 1<br />
\advance\!!counta-\!!countb<br />
\executepagebreakhandler\v!yes<br />
\dorecurse\!!counta{\executepagebreakhandler\v!empty}%<br />
\fi}<br />
<br />
\protect<br />
<br />
\setuppapersize[A5][A4]<br />
\setuparranging[2UP,rotated,doublesided]<br />
\setuppagenumbering[alternative=doublesided]<br />
<br />
\starttext<br />
<br />
\subject{Front Cover}<br />
<br />
\dorecurse{10}{\input tufte \par}<br />
<br />
\page[nextquadruple]<br />
<br />
Back Cover<br />
<br />
\stoptext<br />
</texcode><br />
<br />
== Getting to the Back Cover of a Booklet ==<br />
<br />
When using imposition to print an a5 booklet (a4 folded in half) John Devereux wanted to specify content for the back cover, independently of the actual number of pages in the booklet. Here is a way that worked (thanks to Wolfgang Schuster on the mailing list). \page[beforequadruple] gets to the inside back cover. Another \page gets to the outside back cover.<br />
<br />
<texcode><br />
\unprotect<br />
<br />
\startvariables all<br />
beforequadruple: beforequadruple<br />
\stopvariables<br />
<br />
\installpagebreakhandler \v!beforequadruple<br />
{\ifdoublesided<br />
\!!counta\realpageno<br />
\!!countb\realpageno<br />
\advance\!!counta 5<br />
\divide\!!counta 4<br />
\multiply\!!counta 4<br />
\advance\!!countb 2<br />
\advance\!!counta-\!!countb<br />
\executepagebreakhandler\v!yes<br />
\dorecurse\!!counta{\executepagebreakhandler\v!empty}%<br />
\fi}<br />
<br />
\protect<br />
<br />
\setuppapersize[A5][A4]<br />
\setuparranging[2UP,rotated,doublesided]<br />
\setuppagenumbering[alternative=doublesided]<br />
<br />
\starttext<br />
<br />
\subject Front Cover<br />
<br />
\dorecurse{10}{\input tufte \par}<br />
<br />
\page[beforequadruple]<br />
<br />
Imprint<br />
<br />
\page<br />
<br />
Back Cover<br />
<br />
\stoptext<br />
</texcode><br />
<br />
== Imposition by signatures ==<br />
<br />
Sometimes you want a booklet, but the pages are too many to be folded together. This is true especially when the number of pages rises above 80. So you need to pass the output PDF to an imposer, like pdfjam or psbook or pdfpages. The problem is that you need to get the "right" number of pages. <br />
<br />
E.g., if the original pages are 128, no problem, the signature is 64 and you can impose it without problems.<br />
<br />
But, if the original pages are 129, the optimal signature is 44, so<br />
you need to add 3 pages during the PDF compiling.<br />
<br />
First, create the following imposer.lua file<br />
<br />
<pre><br />
-- translated from perl to lua. Original code is in<br />
-- http://theanarchistlibrary.org/docs/altools-6.6.tar.gz<br />
<br />
local maxsignature = 80 -- define the maximum of the signature<br />
local minsignature = 20 -- define the minimum of the signature<br />
function optimize_signature(pages)<br />
local originalpages = pages<br />
-- be sure we don't mess up<br />
assert(numberpage ~= 0, "I can't work with 0 pages")<br />
<br />
--set needed pages to and and signature to 0<br />
local neededpages, signature = 0,0<br />
<br />
-- this means that we have to work with n*4, if not, add them to<br />
-- needed pages <br />
local modulo = pages % 4<br />
if modulo==0 then<br />
signature=pages<br />
else<br />
neededpages = 4 - modulo<br />
end<br />
<br />
-- add the needed pages to pages<br />
pages = pages + neededpages<br />
<br />
-- give a try with the signature<br />
signature = find_signature(pages)<br />
<br />
-- if the pages, are more than the max signature, find the right one<br />
if pages>maxsignature then<br />
while signature<minsignature do<br />
pages = pages + 4<br />
neededpages = 4 + neededpages<br />
signature = find_signature(pages)<br />
end<br />
end<br />
<br />
print("ImposerMessage:: Original pages: " .. originalpages .. "; " .. <br />
"Signature is " .. signature .. ", " ..<br />
neededpages .. " pages are needed, " .. <br />
pages .. " of output")<br />
-- let's do it<br />
tex.print("\\dorecurse{" .. neededpages .. "}{\\page[empty]}")<br />
<br />
end<br />
<br />
function find_signature(number)<br />
assert(number ~= 0, "I can't find the signature for 0 pages")<br />
assert((number % 4) == 0, "I suppose something is wrong, not a n*4")<br />
local i = maxsignature<br />
while i>0 do<br />
if (number % i) == 0 then<br />
return i<br />
end<br />
i = i - 4<br />
end<br />
end<br />
<br />
</pre><br />
<br />
The ImposerMessage is important if you want to pass the output of the ConTeXt run to a script to do the imposing.<br />
<br />
Then the master file<br />
<br />
<texcode><br />
\def\fillthesignature#1{<br />
\directlua{dofile("imposer.lua") <br />
optimize_signature(#1)}}<br />
\starttext<br />
<br />
\dorecurse{53}{<br />
\chapter{test}<br />
\input tufte<br />
\section{\the\realpageno}}<br />
<br />
<br />
\page[yes] % reset the page<br />
\fillthesignature{\the\realpageno}<br />
<br />
And this is the last page (the backcover)<br />
<br />
\stoptext<br />
<br />
</texcode><br />
<br />
You can find a complete script to emulate psbook (which needs a conversion from pdf to ps and back to pdf) and pdfbook (which use the latex package pdfpages) at http://gitorious.org/the-anarchist-library-tools/the-anarchist-library-tools/trees/master/context-imposition and consists of a perl script (with --help included), a ConTeXt module and an example.</div>MelmothXhttps://wiki.contextgarden.net/index.php?title=Compound_words&diff=12679Compound words2010-12-22T12:06:29Z<p>MelmothX: /* Enabling hyphenation on hyphens for composed words globally */</p>
<hr />
<div>Words consisting of two separate words are often separated by an intra word dash, as in x-axis.<br />
This dash can be placed between two | characters, for example |-|.<br />
<br />
When || is typed, the default intra word dash is used, which is <context>||</context>. You can configure this with <cmd>setuphyphenmark</cmd>.<br />
<br />
Valid values are <code>normal</code> and <code>wide</code>.<br />
<br />
The default sign is a combination of two hyphens:<br />
<br />
<context source="yes"><br />
\setuphyphenmark[sign=wide]<br />
<br />
intra||word<br />
</context><br />
<br />
To get a normal sign you could set this with the <code>normal</code> value (ConTeXt 2008.09.16 or later).<br />
<br />
<context source="yes"><br />
\setuphyphenmark[sign=normal]<br />
intra||word<br />
</context><br />
<br />
The || is also used in word combinations like (intra)word, which is typed as (intra|)|word.<br />
The mechanism is not foolproof but it serves most purposes. In case the hyphenation is<br />
incorrect you can hyphenate the first word of the composed one by hand: (in\-tra|)|word.<br />
<br />
Another use of || is the processing of subsentences. The symbol that surrounds a subsentence varies <br />
depending on the current language settings, as controlled by <cmd>setuplanguage</cmd>. When you use |<| and |>| to indicate the subsentence, the proper symbol will be used automatically.<br />
<br />
<context source="yes"><br />
a |<|as explained below|>| conflirtaneous \unknown<br />
</context><br />
<br />
The main reason behind this mechanism is that TeX doesn’t really know how to hyphenate<br />
composed words and how to handle subsentences. TeX know a lot about math, but far less<br />
about normal texts. Using this command not only serves consistency, but also makes sure that<br />
TeX can break compound words at the right places. It also keeps boundary characters at the<br />
right place when a breakpoint is inserted.<br />
<br />
The table below is an extended version of the table in the "big manual". In the third<br />
column, you see what the possible line breaks in the word would be, and the output<br />
that would come from that. <br />
<br />
<context><br />
\def\ShowComposed #1<br />
{\handletokens#1\with\type\VL#1\VL\hyphenatedword{#1}}<br />
\starttable[|l|l|l|]<br />
\HL<br />
\VL \bf input \VL \bf normal \VL \bf hyphenated \VL\SR<br />
\HL<br />
\VL \ShowComposed intra||word \VL\FR<br />
\VL \ShowComposed intra|-|word \VL\MR<br />
\VL \ShowComposed intra|(|word) \VL\MR<br />
\VL \ShowComposed (intra|)|word \VL\MR<br />
\VL \ShowComposed intra|--|word \VL\MR<br />
\VL \ShowComposed intra|~|word \VL\LR<br />
\VL \ShowComposed intra|_|word \VL\LR<br />
\VL \ShowComposed intra|=|word \VL\LR<br />
\VL \ShowComposed intra|'|word \VL\LR<br />
\VL \ShowComposed intra|*|word \VL\LR<br />
\HL<br />
\stoptable<br />
</context><br />
<br />
== Enabling hyphenation on hyphens for composed words globally ==<br />
<br />
For mkiv just add to the preamble:<br />
<br />
<texcode><br />
\setbreakpoints[compound]<br />
</texcode><br />
<br />
(which does the same thing as typing for each composed word <code>intra|-|word</code>)<br />
It will set also the characters "+" "/" (typed verbatim, '''not''' as <code>\slash</code> or <code>\textslash</code> ) "(" ")" as good breakpoints inside composed words. E.g the following line will be correctly broken at the /<br />
<br />
<texcode><br />
% mkiv only<br />
\setbreakpoints[compound]<br />
<br />
\starttext<br />
<br />
love/hate/play/run/love/hate/play/run/love/hate/play/run/love/hate/play/run/love/hate/play/run/love/hate/play/run/<br />
<br />
love(hate(play(run(love(hate(play(run(love(hate(play(run(love(hate(play(run(love(hate(play(run(love(hate(play(run(<br />
<br />
love-hate-play-run-love-hate-play-run-love-hate-play-run-love-hate-play-run-love-hate-play-run-love-hate-play-run-<br />
<br />
love+hate+play+run+love+hate+play+run+love+hate+play+run+love+hate+play+run+love+hate+play+run+love+hate+play+run+<br />
<br />
love)hate)play)run)love)hate)play)run)love)hate)play)run)love)hate)play)run)love)hate)play)run)love)hate)play)run)<br />
\stoptext<br />
</texcode><br />
<br />
[[Category:International]]</div>MelmothXhttps://wiki.contextgarden.net/index.php?title=Compound_words&diff=12678Compound words2010-12-22T11:58:07Z<p>MelmothX: /* Enabling hyphenation on hyphens for composed words globally */</p>
<hr />
<div>Words consisting of two separate words are often separated by an intra word dash, as in x-axis.<br />
This dash can be placed between two | characters, for example |-|.<br />
<br />
When || is typed, the default intra word dash is used, which is <context>||</context>. You can configure this with <cmd>setuphyphenmark</cmd>.<br />
<br />
Valid values are <code>normal</code> and <code>wide</code>.<br />
<br />
The default sign is a combination of two hyphens:<br />
<br />
<context source="yes"><br />
\setuphyphenmark[sign=wide]<br />
<br />
intra||word<br />
</context><br />
<br />
To get a normal sign you could set this with the <code>normal</code> value (ConTeXt 2008.09.16 or later).<br />
<br />
<context source="yes"><br />
\setuphyphenmark[sign=normal]<br />
intra||word<br />
</context><br />
<br />
The || is also used in word combinations like (intra)word, which is typed as (intra|)|word.<br />
The mechanism is not foolproof but it serves most purposes. In case the hyphenation is<br />
incorrect you can hyphenate the first word of the composed one by hand: (in\-tra|)|word.<br />
<br />
Another use of || is the processing of subsentences. The symbol that surrounds a subsentence varies <br />
depending on the current language settings, as controlled by <cmd>setuplanguage</cmd>. When you use |<| and |>| to indicate the subsentence, the proper symbol will be used automatically.<br />
<br />
<context source="yes"><br />
a |<|as explained below|>| conflirtaneous \unknown<br />
</context><br />
<br />
The main reason behind this mechanism is that TeX doesn’t really know how to hyphenate<br />
composed words and how to handle subsentences. TeX know a lot about math, but far less<br />
about normal texts. Using this command not only serves consistency, but also makes sure that<br />
TeX can break compound words at the right places. It also keeps boundary characters at the<br />
right place when a breakpoint is inserted.<br />
<br />
The table below is an extended version of the table in the "big manual". In the third<br />
column, you see what the possible line breaks in the word would be, and the output<br />
that would come from that. <br />
<br />
<context><br />
\def\ShowComposed #1<br />
{\handletokens#1\with\type\VL#1\VL\hyphenatedword{#1}}<br />
\starttable[|l|l|l|]<br />
\HL<br />
\VL \bf input \VL \bf normal \VL \bf hyphenated \VL\SR<br />
\HL<br />
\VL \ShowComposed intra||word \VL\FR<br />
\VL \ShowComposed intra|-|word \VL\MR<br />
\VL \ShowComposed intra|(|word) \VL\MR<br />
\VL \ShowComposed (intra|)|word \VL\MR<br />
\VL \ShowComposed intra|--|word \VL\MR<br />
\VL \ShowComposed intra|~|word \VL\LR<br />
\VL \ShowComposed intra|_|word \VL\LR<br />
\VL \ShowComposed intra|=|word \VL\LR<br />
\VL \ShowComposed intra|'|word \VL\LR<br />
\VL \ShowComposed intra|*|word \VL\LR<br />
\HL<br />
\stoptable<br />
</context><br />
<br />
== Enabling hyphenation on hyphens for composed words globally ==<br />
<br />
For mkiv just add to the preamble:<br />
<br />
<texcode><br />
\setbreakpoints[compound]<br />
</texcode><br />
<br />
(which does the same thing as typing for each composed word <code>intra|-|word</code>)<br />
It will set also the characters "+" "/" (typed verbatim, '''not''' as <code>\slash</code> or <code>\textslash</code> ) "(" ")" as good breakpoints inside composed words. E.g the following line will be correctly broken at the /<br />
<br />
<texcode><br />
\setbreakpoints[compound]<br />
<br />
\starttext<br />
<br />
love/hate/play/run/love/hate/play/run/love/hate/play/run/love/hate/play/run/love/hate/play/run/love/hate/play/run/<br />
<br />
\stoptext<br />
<br />
</texcode><br />
<br />
<br />
<br />
[[Category:International]]</div>MelmothXhttps://wiki.contextgarden.net/index.php?title=Commands_with_optional_arguments&diff=12556Commands with optional arguments2010-12-15T23:29:32Z<p>MelmothX: </p>
<hr />
<div>< [[Inside ConTeXt]] | [[Commands with KeyVal arguments]] ><br />
<br />
In LaTeX you define a new command with an optional argument with "newcommand":<br />
<br />
<texcode><br />
\newcommand{\MyCommand}[2][World]{{#2Hello #1!}}<br />
\MyCommand{\bfseries}<br />
\MyCommand[Hans]{\scshape}<br />
</texcode><br />
<br />
<context><br />
{\bf Hello World!}<br />
{\sc Hello Hans!}<br />
</context><br />
<br />
In ConTeXt, the optional argument processing is handled as a two-step process. First, we write the command for the end-user as a wrapper command, which calls <cmd>dodoubleempty</cmd> (from [http://source.contextgarden.net/tex/context/base/syst-gen.tex syst-gen.tex]) to handle the arguments properly -- including the optional ones -- and then calls a "private" command that contains the internals of the macro. Note that this function call does not explicitly refer to the arguments at all.<br />
<br />
<texcode><br />
\def\MyCommand{\dodoubleempty\doMyCommand}<br />
</texcode><br />
<br />
We then create the "private" macro (<tt>\doMacroName</tt> is the traditional ConTeXt name for these), with all the arguments defined as nonoptional. Default values for the arguments need to be handled somewhat more explicitly than with LaTeX; macros such as <cmd>ifsecondargument</cmd> are used to determine whether the given argument was specified, as follows:<br />
<br />
<texcode><br />
\def\doMyCommand[#1][#2]{#1Hello<br />
\ifsecondargument<br />
#2%<br />
\else<br />
World%<br />
\fi<br />
!}<br />
</texcode><br />
<br />
Note that this makes both arguments optional -- something that is much more difficult to do in LaTeX ([http://www.tex.ac.uk/cgi-bin/texfaq2html?label=twooptarg but can be done]). This also means that we should reverse the order of arguments, since if the user specifies only one argument it will be treated as the first argument.<br />
<br />
(Also, note that <tt>\MyCommand</tt> without the second argument ends up gobbling the following spaces, so we need to explicitly include one with "<tt>\ </tt>".)<br />
<br />
<texcode><br />
\MyCommand[\bf]\ %<br />
\MyCommand[\sc][Hans]<br />
</texcode><br />
<br />
<context><br />
\def\MyCommand{\dodoubleempty\doMyCommand}<br />
\def\doMyCommand[#1][#2]{#1Hello<br />
\ifsecondargument<br />
#2%<br />
\else<br />
World%<br />
\fi<br />
!}<br />
\MyCommand[\bf]\ %<br />
\MyCommand[\sc][Hans]<br />
</context><br />
<br />
If you ''don't'' want any optional arguments, but still want your arguments enclosed in <tt>[]</tt> with appropriate handling for spaces (or line breaks) between the square brackets, use <cmd>dodoubleargument</cmd> instead of <cmd>dodoubleempty</cmd>. There are of course versions for other numbers of arguments, found by replacing <tt>double</tt> with <tt>single</tt> through <tt>seventuple</tt>; see [http://source.contextgarden.net/tex/context/base/syst-gen.mkii syst-gen.tex] for the exact names.<br />
<br />
=== Examples ===<br />
<br />
To define <tt>\mycommand[.1.][.2.]{.3.}</tt>, i.e., with curly braces around a non-optional third argument, you just define<br />
<br />
<texcode><br />
\def\mycommand{\dodoubleempty\doMycommand}<br />
\def\doMycommand[#1][#2]#3{whatever}<br />
</texcode><br />
<br />
<br />
<br />
<br />
To define <code>\mycommand[optional]{text}</code>, do the following<br />
<br />
<texcode><br />
<br />
\def\mynewcommand{\dosingleempty\doMyNewCommand}<br />
\def\doMyNewCommand[#1]#2{%<br />
\iffirstargument<br />
There is an optional parameter: {\bf #1}\par<br />
\else<br />
No optional parameter\par<br />
\fi<br />
This is the mandatory text: {\em #2}<br />
}<br />
<br />
\starttext<br />
\mynewcommand[opt]{Hello People}<br />
<br />
\mynewcommand{Hello People}<br />
\stoptext<br />
</texcode><br />
<br />
<context><br />
<br />
\def\mynewcommand{\dosingleempty\doMyNewCommand}<br />
\def\doMyNewCommand[#1]#2{%<br />
\iffirstargument<br />
There is an optional parameter: {\bf #1}\par<br />
\else<br />
No optional parameter\par<br />
\fi<br />
This is the mandatory text: {\em #2}<br />
}<br />
<br />
\starttext<br />
\mynewcommand[opt]{Hello People}<br />
\blank<br />
\mynewcommand{Hello People}<br />
\stoptext<br />
</context><br />
<br />
=== Pitfalls ===<br />
<br />
Please keep in mind that <code>\iffirstargument</code> will always return true if you put before it a command which itself has an argument. See the following example:<br />
<br />
<context source="yes" text="produces"><br />
\def\mynewcommand{\dosingleempty\doMyNewCommand}<br />
\def\doMyNewCommand[#1]#2{%<br />
\startalignment[center]<br />
\iffirstargument<br />
There is an optional parameter: {\bf #1}\par<br />
\else<br />
No optional parameter\par<br />
\fi<br />
This is the mandatory text: {\em #2}<br />
\stopalignment<br />
}<br />
\starttext<br />
\mynewcommand[opt]{Hello People}<br />
\blank<br />
\mynewcommand{Hello People}<br />
\stoptext<br />
</context><br />
<br />
Use <code>\doifsomethingelse</code> instead:<br />
<br />
<context source="yes" text="this time is correct:"><br />
\def\mynewcommand{\dosingleempty\doMyNewCommand}<br />
\def\doMyNewCommand[#1]#2{%<br />
\startalignment[center]<br />
\doifsomethingelse{#1}<br />
{There is an optional parameter: {\bf #1}\par}<br />
{No optional parameter\par}<br />
This is the mandatory text: {\em #2}<br />
\stopalignment<br />
}<br />
\starttext<br />
\mynewcommand[opt]{Hello People}<br />
\blank<br />
\mynewcommand{Hello People}<br />
\stoptext<br />
</context><br />
<br />
Reference: <br />
http://archive.contextgarden.net/message/20101215.225603.cc903e62.en.html<br />
<br />
[[Category:Inside ConTeXt]]</div>MelmothXhttps://wiki.contextgarden.net/index.php?title=Commands_with_optional_arguments&diff=12555Commands with optional arguments2010-12-15T23:23:37Z<p>MelmothX: /* Examples */</p>
<hr />
<div>< [[Inside ConTeXt]] | [[Commands with KeyVal arguments]] ><br />
<br />
In LaTeX you define a new command with an optional argument with "newcommand":<br />
<br />
<texcode><br />
\newcommand{\MyCommand}[2][World]{{#2Hello #1!}}<br />
\MyCommand{\bfseries}<br />
\MyCommand[Hans]{\scshape}<br />
</texcode><br />
<br />
<context><br />
{\bf Hello World!}<br />
{\sc Hello Hans!}<br />
</context><br />
<br />
In ConTeXt, the optional argument processing is handled as a two-step process. First, we write the command for the end-user as a wrapper command, which calls <cmd>dodoubleempty</cmd> (from [http://source.contextgarden.net/tex/context/base/syst-gen.tex syst-gen.tex]) to handle the arguments properly -- including the optional ones -- and then calls a "private" command that contains the internals of the macro. Note that this function call does not explicitly refer to the arguments at all.<br />
<br />
<texcode><br />
\def\MyCommand{\dodoubleempty\doMyCommand}<br />
</texcode><br />
<br />
We then create the "private" macro (<tt>\doMacroName</tt> is the traditional ConTeXt name for these), with all the arguments defined as nonoptional. Default values for the arguments need to be handled somewhat more explicitly than with LaTeX; macros such as <cmd>ifsecondargument</cmd> are used to determine whether the given argument was specified, as follows:<br />
<br />
<texcode><br />
\def\doMyCommand[#1][#2]{#1Hello<br />
\ifsecondargument<br />
#2%<br />
\else<br />
World%<br />
\fi<br />
!}<br />
</texcode><br />
<br />
Note that this makes both arguments optional -- something that is much more difficult to do in LaTeX ([http://www.tex.ac.uk/cgi-bin/texfaq2html?label=twooptarg but can be done]). This also means that we should reverse the order of arguments, since if the user specifies only one argument it will be treated as the first argument.<br />
<br />
(Also, note that <tt>\MyCommand</tt> without the second argument ends up gobbling the following spaces, so we need to explicitly include one with "<tt>\ </tt>".)<br />
<br />
<texcode><br />
\MyCommand[\bf]\ %<br />
\MyCommand[\sc][Hans]<br />
</texcode><br />
<br />
<context><br />
\def\MyCommand{\dodoubleempty\doMyCommand}<br />
\def\doMyCommand[#1][#2]{#1Hello<br />
\ifsecondargument<br />
#2%<br />
\else<br />
World%<br />
\fi<br />
!}<br />
\MyCommand[\bf]\ %<br />
\MyCommand[\sc][Hans]<br />
</context><br />
<br />
If you ''don't'' want any optional arguments, but still want your arguments enclosed in <tt>[]</tt> with appropriate handling for spaces (or line breaks) between the square brackets, use <cmd>dodoubleargument</cmd> instead of <cmd>dodoubleempty</cmd>. There are of course versions for other numbers of arguments, found by replacing <tt>double</tt> with <tt>single</tt> through <tt>seventuple</tt>; see [http://source.contextgarden.net/tex/context/base/syst-gen.mkii syst-gen.tex] for the exact names.<br />
<br />
=== Examples ===<br />
<br />
To define <tt>\mycommand[.1.][.2.]{.3.}</tt>, i.e., with curly braces around a non-optional third argument, you just define<br />
<br />
<texcode><br />
\def\mycommand{\dodoubleempty\doMycommand}<br />
\def\doMycommand[#1][#2]#3{whatever}<br />
</texcode><br />
<br />
<br />
<br />
<br />
To define <code>\mycommand[optional]{text}</code>, do the following<br />
<br />
<texcode><br />
<br />
\def\mynewcommand{\dosingleempty\doMyNewCommand}<br />
\def\doMyNewCommand[#1]#2{%<br />
\iffirstargument<br />
There is an optional parameter: {\bf #1}\par<br />
\else<br />
No optional parameter\par<br />
\fi<br />
This is the mandatory text: {\em #2}<br />
}<br />
<br />
\starttext<br />
\mynewcommand[opt]{Hello People}<br />
<br />
\mynewcommand{Hello People}<br />
\stoptext<br />
</texcode><br />
<br />
<context><br />
<br />
\def\mynewcommand{\dosingleempty\doMyNewCommand}<br />
\def\doMyNewCommand[#1]#2{%<br />
\iffirstargument<br />
There is an optional parameter: {\bf #1}\par<br />
\else<br />
No optional parameter\par<br />
\fi<br />
This is the mandatory text: {\em #2}<br />
}<br />
<br />
\starttext<br />
\mynewcommand[opt]{Hello People}<br />
\blank<br />
\mynewcommand{Hello People}<br />
\stoptext<br />
</context><br />
<br />
=== Pitfalls ===<br />
<br />
Please keep in mind that <code>\iffirstargument</code> will always return true if you put before it a command which itself has an argument. See the following example:<br />
<br />
<context source="yes" text="produces"><br />
\def\mynewcommand{\dosingleempty\doMyNewCommand}<br />
\def\doMyNewCommand[#1]#2{%<br />
\startalignment[center]<br />
\iffirstargument<br />
There is an optional parameter: {\bf #1}\par<br />
\else<br />
No optional parameter\par<br />
\fi<br />
This is the mandatory text: {\em #2}<br />
\stopalignment<br />
}<br />
\starttext<br />
\mynewcommand[opt]{Hello People}<br />
\blank<br />
\mynewcommand{Hello People}<br />
\stoptext<br />
</context><br />
<br />
Use <code>\doifsomethingelse</code> instead:<br />
<br />
<context source="yes" text="this time is correct:"><br />
\def\mynewcommand{\dosingleempty\doMyNewCommand}<br />
\def\doMyNewCommand[#1]#2{%<br />
\startalignment[center]<br />
\doifsomethingelse{#1}<br />
{There is an optional parameter: {\bf #1}\par}<br />
{No optional parameter\par}<br />
This is the mandatory text: {\em #2}<br />
\stopalignment<br />
}<br />
\starttext<br />
\mynewcommand[opt]{Hello People}<br />
\blank<br />
\mynewcommand{Hello People}<br />
\stoptext<br />
</context><br />
<br />
<br />
<br />
[[Category:Inside ConTeXt]]</div>MelmothXhttps://wiki.contextgarden.net/index.php?title=ConTeXt_Standalone&diff=12395ConTeXt Standalone2010-11-29T14:55:51Z<p>MelmothX: Added portable linux installation</p>
<hr />
<div>< [[Installation]] | [[ConTeXt Minimals/FAQ|Minimals/FAQ]] | '''[[ConTeXt Minimals/Tree|Minimals/Tree]]''' | [[ConTeXt Minimals/Structure|Minimals/Structure]] | [[ConTeXt Minimals/Implementation|Minimals/Implementation]] | [[ConTeXt Minimals/TODO|Minimals/TODO]] | [[ConTeXt Minimals/Contents|Minimals/Contents]] | [[ConTeXt Minimals/TeX Live|Minimals/TeX Live]] ><br />
<br />
The '''ConTeXt Minimal''' is a complete, up-to-date ConTeXt distribution which can be upgraded efficiently. It can be used to install either the stable or the beta version of ConTeXt. It can also be used in parallel with existing TeX installtions such as MikTeX, TeXLive, or older minimal installation. It is aimed towards ConTeXt users, so it does not include LaTeX specific packages and binaries. <br />
<br />
{{Note | ConTeXt develops at a fast pace, and sometimes beta releases have serious bugs. ConTeXt minimals allow you to test the latest ConTeXt release without having to worry if an upgrade will mess an critical project. You can have two (or multiple) parallel ConTeXt minimals, and freeze one for your critical projects, and use the other one for experimenting.}}<br />
<br />
<br />
{{TOClimit|limit=1}}<br />
<br />
= General Information =<br />
<br />
== Supported platforms ==<br />
<br />
{| style="border:1px solid #DDDDDD;"<br />
|- align="left" <br />
! Platform<br />
! Short name<br />
! Binaries by<br />
! Notes<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! Windows<br />
| mswin<br />
| Akira Kakuto (W32TeX)<br />
|<br />
|- align="left"<br />
! Linux<br />
| linux<br />
| Hans Hagen<br />
| compiled with glibc 2.3.6<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! Linux, 64-bit<br />
| linux-64<br />
| Peter Münster<br />
| might be renamed to linux-amd64<br />
|- align="left"<br />
! Linux, PowerPC<br />
| linux-ppc<br />
| Piotr Kopszak<br />
|<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! Mac OS X, Intel (32-bit)<br />
| osx-intel<br />
| Mojca Miklavec<br />
|<br />
|- align="left"<br />
! Mac OS X, Intel (64-bit)<br />
| osx-64<br />
| Mojca Miklavec<br />
|<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! Mac OS X, PowerPC<br />
| osx-ppc<br />
| Mojca Miklavec<br />
|<br />
|- align="left""<br />
! Mac OS X, Universal Binaries<br />
| osx-universal<br />
| Mojca Miklavec<br />
| not used<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! FreeBSD<br />
| freebsd<br />
| Yue Wang, Diego Depaoli<br />
| might be renamed to freebsd-intel<br />
|- align="left"<br />
! FreeBSD, 64-bit<br />
| freebsd-amd64<br />
| Michael Krauß<br />
| <br />
|- align="left" style="background-color:#EEEEEE;"<br />
! kFreeBSD<br />
| kfreebsd-i386<br />
| Alan Braslau<br />
| FreeBSD + glibc (Debian)<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! kFreeBSD, 64-bit<br />
| kfreebsd-amd64<br />
| Alan Braslau<br />
| FreeBSD + glibc (Debian)<br />
|- align="left"<br />
! Solaris, Intel<br />
| solaris-intel<br />
| Marco Patzer<br />
|<br />
|- align="left" style="background-color:#EEEEEE;"<br />
! Solaris, Sparc<br />
| solaris-sparc<br />
| Vladimir Volovich<br />
| compiled on solaris 8, not maintaned<br />
|}<br />
<br />
We need volunteers for providing binaries for other platforms. If you want to support a platform, please write to [[ConTeXt Mailing Lists]]<br />
<br />
== Dependencies ==<br />
* [http://www.ruby-lang.org Ruby] 1.8 or newer (used for MKII)<br />
* Rsync (The windows binary of rsync is distributed within the minimals)<br />
<br />
== Disc space required ==<br />
ConTeXt macro files are small (less than 10MB), but the minimals comes with various free fonts which considerably increase the size of the distribution to around 200MB).<br />
<br />
== Installation tree ==<br />
Browse the [http://minimals.contextgarden.net installation tree]<br />
<br />
= Simple instructions for installing on Unix like system (Linux/Mac OSX/FreeBSD/Solaris) =<br />
<br />
If you do not use LaTeX and want to install the minimals in your home directory, follow these instructions. Otherwise, read the more detailed instructions in the next section.<br />
<br />
* Open a new terminal. You're in your home folder (<code>~</code>) now. <br />
<br />
* Type the boxed sections. End every line with [Return]. Leave out the <code>$</code>, that's your shell prompt!<br />
<br />
* Create the context folder and change into it:<br />
<br />
$ mkdir context<br />
$ cd context<br />
<br />
* Download <code>first-setup.sh</code>:<br />
<br />
$ rsync -av rsync://contextgarden.net/minimals/setup/first-setup.sh .<br />
<br />
* Run it and go make tea:<br />
<br />
$ sh ./first-setup.sh<br />
<br />
* Run the ''path setup'':<br />
<br />
$ source ./tex/setuptex<br />
<br />
ConTeXt should work now (i.e. at this moment in this terminal); you need to run the path setup with every new terminal window; to automate that, you can add the <tt>setuptex</tt> command to your "profile", that's a script that gets called with every new terminal. If you are using ''bash'' you can do.<br />
<br />
$ cd<br />
$ echo '. ~/context/tex/setuptex' >> .bash_profile<br />
<br />
For other shells, replace <code>.bash_profile</code> by the corresponding file for your shell.<br />
<br />
{{Note | The ConTeXt minimals can happily coexist with other TeX installations such as one already distributed with your system or one installed from TeX Live. However, having the minimals automatically included in your PATH may lead to some subtle conflicts. As an example, the running of <code>lualatex</code> (not included in the minimals) will find an installed version, however running <code>bibtex</code> or <code>mpost</code> (both included in the minimals) may not use the right tree, that is the one distributed with your system or installed from TeX Live.}} <br />
<br />
That's it.<br />
<br />
= Detailed information on installation and use on Unix-like platforms (Linux/MacOS X/FreeBSD/Solaris) =<br />
<br />
<br />
== Single user installation ==<br />
<br />
Select a folder where you want to install ConTeXt. We recommend that you can use your <code>$HOME/context</code> directory. Create this folder. Then download <br />
[http://minimals.contextgarden.net/setup/first-setup.sh first-setup.sh] and place it in <code>$HOME/context</code> directory. Open a terminal, then:<br />
<br />
cd context<br />
<br />
Then make <code>first-setup.sh</code> executable and run it to download the whole distribution and make formats:<br />
<br />
chmod +x first-setup.sh<br />
sh ./first-setup.sh<br />
<br />
This takes a long time, so go have a coffee.<br />
<br />
By default, the minimals installs ConTeXt beta. If you want the stable version of ConTeXt, you can use<br />
<br />
sh ./first-setup.sh --context=current<br />
<br />
== System-wide installation ==<br />
<br />
A system wide installation is only recommeded for users who are comfortable with the command line. Only the location of installing ConTeXt is different for a system wide installation.<br />
In Linux you can use <code>/opt/context</code>; on MacOS X you can use <code>/Applications/ConTeXt</code><br />
<br />
Note that, at present, while ''using'' MkIV, you need to have write permissions<ref>Actually, you only need write permission for <code>$TEXMFCACHE</code>.</ref> in the installation directory.<ref>This effectively means that only one user will be able to generate the formats</ref> So, if you are installing the minimals in <code>/opt/context</code> or <code>/Applications/ConTeXt</code>, run<br />
<br />
chown `whoami` -R /opt/context <br />
<br />
or <br />
<br />
chown `whoami` -R /Applications/ConTeXt<br />
<br />
(<code>`whoami`</code> outputs your user name, you can type that directly, of course.)<br />
<br />
In order to install the minimals, open a terminal, go to the installation directory and download [http://minimals.contextgarden.net/setup/first-setup.sh first-setup.sh]:<br />
<br />
$ rsync -av rsync://contextgarden.net/minimals/setup/first-setup.sh .<br />
<br />
Then run that script to download the whole distribution and make formats:<br />
<br />
sh ./first-setup.sh<br />
<br />
This takes a long time, so go have a coffee.<br />
<br />
By default, the minimals installs ConTeXt beta. If you want the stable version of ConTeXt, you can use<br />
<br />
sh ./first-setup.sh --context=current<br />
<br />
===Cache===<br />
<br />
Normaly you do not want to allow access in e.g. /opt. but you like to allow it in /var/cache/*. In ConTeXt you have two ways of setting up the directory for the cache:<br />
# Uncomment the TEXMFCACHE setting in ./tex/setuptex and change the value to the directory you want or<br />
# Change in the file ./tex/texmf/web2c/texmfcnf.lua the value of TEXMFCACHE to the directory you want.<br />
<br />
First ConTeXt looks for the environment variable TEXMFCACHE. If this variable does not exist ConTeXt looks for the value of TEXMFCACHE inside the file texmfcnf.lua. <br />
<br />
My personal suggestion is to edit the setuptex.<br />
<br />
== The funtoo way ==<br />
<br />
If you are using [http://funtoo.org funtoo] there are ebuilds that will make an installation as easy as installing any other package from portage. Take a look at the [[ConTeXt Minimals Funtoo]] Howto. This might also work for [http://www.gentoo.org gentoo], but is untested right now.<br />
<br />
== Proxy settings ==<br />
<br />
The installation script uses <code>rsync</code> to fetch the required files. So, if you are behind a proxy server, you need to tell the details to rsync. The easiest way to set this is to set <code>RSYNC_PROXY</code> variable in the terminal or your startup script (<code>.bashrc</code> or the corresponding file for your shell). Replace username, password, proxyhost and proxyport with the correct information<br />
<br />
export RSYNC_PROXY=username:password@proxyhost:proxyport<br />
<br />
Sometimes, when behind a firewall, port 873 may be closed for outgoing TCP connections. If port 22 is open for ssh connections, a trick that can be used is to connect to a computer located somewhere outside of the firewall and to tunnel port 873 (using the program <code>nc</code>).<br />
<br />
export RSYNC_CONNECT_PROG='ssh tunnelhost nc %H 873'<br />
<br />
where <code>tunnelhost</code> is the machine outside of the firewall on which you have <code>ssh</code> access. Of course, this machine must have <code>nc</code> and port 873 open for outgoing TCP connections.<br />
<br />
== Usage ==<br />
<br />
ConTeXt minimals works in a non-interfering manner because it does not put anything in your <code>$PATH</code> and does not set any system variables. This in turn means that in order to use it, you need to do some initialization. An intialization script called <code>setuptex</code> is provided in <code>installation-dir/tex/</code>. <br />
<br />
If you run context from a terminal, source <code>setuptex</code> before running ConTeXt. This depends on the shell that you are using.<br />
<br />
* '''bash''' users can use<br />
source /installation-dir/tex/setuptex<br />
<br />
* '''zsh''' users can use<br />
. /installation-dir/tex/setuptex<br />
<br />
* '''(t)csh''' users can use <br />
source /installation-dir/tex/setuptex.csh<br />
<br />
If you do not know which shell you are using, open a terminal and type <br />
echo $SHELL<br />
<br />
== Exclusive usage ==<br />
<br />
The above method means that you always have to type <code>source /installation-dir/tex/setuptex</code> in a terminal before you can use typeset. If you always use ConTeXt minimals and never use LaTeX or plain TeX provided by another TeX distribution, you can add the above intialization line to the startup script of your shell. For bash, this means <code>$HOME/.bashrc</code>; for zsh, this means <code>$HOME/.zshrc</code>; for (t)csh, this means <code>$HOME/.cshrc</code> or <code>$HOME/.tcshrc</code>. Then, <code>setuptex</code> will always be sourced in your terminal. <br />
<br />
== Integrating with an editor ==<br />
<br />
If you run ConTeXt from an editor, you need to source <code>setuptex</code> in a terminal and then open your editor from the same terminal. I.e. if you run your editor from the shell.<br />
<br />
Depending on how your editor intializes, you may still need to source it in order to run ConTeXt directly from your editor, <br />
In theory, it is sufficient to add <code>/installation-dir/tex/texmf-<platform>/bin</code> to your PATH in order to use the minimals. You can try to add this to the paths that your editor searches.<br />
<br />
For information about configuring [http://smultron.sourceforge.net/ Smultron] and [http://www.uoregon.edu/~koch/texshop/obtaining.html TeXShop] (which are popular TeX editors on Mac) see [[ConTeXt Minimals/Mac Installation]]. If you don't mind investing a bit of money (abt eur 50), [http://macromates.com/ TextMate] with (the not yet officially released) [[ConTeXt Bundle for TextMate]] is an easy-to-install option.<br />
<br />
== Updating ==<br />
<br />
For updating the ConTeXt minimals, just run <code>first-setup.sh</code> again.<br />
<br />
Or better: first update <code>first-setup.sh</code>, then run it. You could<br />
also create an alias or a little script “ctx-update”<br />
with the following example contents:<br />
<pre><br />
cd /opt/context<br />
rsync -ptv rsync://contextgarden.net/minimals/setup/first-setup.sh .<br />
./first-setup.sh --extras=all<br />
</pre><br />
<br />
== Uninstalling ==<br />
<br />
ConTeXt minimals does not touch anything outside its installation folder. So to uninstall it, you can simply remove the installation folder.<br />
<br />
== Remaking formats ==<br />
<br />
Normally, the update script should create the formats for you. If for some reason you need to recreate the formats, you can do the following:<br />
<br />
* For making MKII format.<br />
<br />
mktexlsr<br />
texexec --make --all <br />
<br />
* For making XeTeX format<br />
<br />
mktexlsr<br />
texexec --make --xtx --all <br />
<br />
* For making MKIV format<br />
<br />
mtxrun --selfupdate<br />
luatools --generate<br />
context --make<br />
<br />
= Installation and use on Windows =<br />
<br />
If you want to use ConTeXt minimals alongside MikTeX/TeXLive (needed if you also run LaTeX), follow the command-line installation method. Otherwise, you can follow either the command line or GUI installation method.<br />
<br />
== Installation ==<br />
<br />
=== Command line method ===<br />
Download [http://minimals.contextgarden.net/setup/context-setup-mswin.zip context-setup-mswin.zip] and unzip to a directory where you want to install ConTeXt. It is recommended that you choose a directory that does not have a space in its full path. Then open <code>cmd.exe</code>, go to the installation directory and run<br />
<br />
first-setup.bat<br />
<br />
This takes a long time, so go have a coffee. <br />
<br />
By default, the minimals installs ConTeXt beta. If you want the stable version of ConTeXt, you can use <br />
<br />
first-setup.bat --context=current<br />
<br />
=== GUI Installer ===<br />
<br />
There is also a [http://minimals.contextgarden.net/setup/context-installer/ContextMinimalInstall.exe GUI installer] made by Vyatcheslav Yatskovsky. Download and run the installer and it will ask you where to install the minimals, which distribution to use (stable or beta) and whether or not you want to make formats. <br />
<br />
{{note| The GUI installer asks if you want to set environmental variables globally. Click this only if you do '''not''' use MikTeX or TeXLive and do '''not''' plan to use LaTeX}}<br />
<br />
You should also see the [http://meeting.contextgarden.net/2008/talks/2008-08-21-vyatcheslav-win-installer/windows_installer.pdf slides] giving details about the GUI installer.<br />
<br />
== Proxy settings ==<br />
<br />
The installation script uses <code>rsync</code> to fetch the required files. So, if you are behind a proxy server, you need to tell the details to rsync. The easiest way to set this is to set <code>RSYNC_PROXY</code> variable in the terminal as (replace username, password, proxyhost and proxyport with the correct information)<br />
<br />
set RSYNC_PROXY=username:password@proxyhost:proxyport<br />
<br />
or set the variable permanently as a Windows environment variable.<br />
<br />
Sometimes, when behind a firewall, port 873 may be closed for outgoing TCP connections. If port 22 is open for ssh connections, a trick that can be used is to connect to a computer located somewhere outside of the firewall and to tunnel port 873 (using the program <code>nc</code>).<br />
<br />
export RSYNC_CONNECT_PROG='ssh tunnelhost nc %H 873'<br />
<br />
where <code>tunnelhost</code> is the machine outside of the firewall on which you have <code>ssh</code> access. Of course, this machine must have <code>nc</code> and port 873 open for outgoing TCP connections.<br />
<br />
== Usage ==<br />
<br />
If you used the GUI installer and said yes to setting the evironmental variables globally, then you can run ConTeXt from anywhere. Otherwise, before running ConTeXt, you need to run <code>setuptex.bat</code> which is provided in <code>installation-dir\tex\</code>. This can be done by typing<br />
<br />
installation-dir\tex\setuptex.bat<br />
<br />
on cmd.exe before you run ConTeXt. To avoid always having to type this, you can create a shortcut to cmd.exe and edit the command line to read (assuming you installed the minimals in <code>C:\Programs</code>; otherwise replace <code>C:\Programs\</code> with your installation directory)<br />
<br />
C:\WINDOWS\System32\cmd.exe /k C:\Programs\context\tex\setuptex.bat<br />
<br />
This starts up a new command shell with the environment pre-loaded.<br />
<br />
=== Use ConTeXt with Cygwin ===<br />
After installing the ConTeXt minimals, you can run it under Cygwin. With Cygwin, you may use gmake and other Unix tools for your automated workflow.<br />
<br />
# Run <code>setuptex.bat</code> in DOS command prompt<br />
# In the same DOS prompt, enter Cygwin by running <code>cygwin.bat</code> (in your Cygwin installation directory)<br />
# Under Cygwin prompt, run <code> context.cmd test.tex </code>. Note that the <code>.cmd</code> extension is needed under Cygwin.<br />
<br />
== Updating ==<br />
<br />
If you used the command line method, just run <code>first-setup.bat</code> again to update the minimals. If you have third party modules installed, you should use<br />
first-setup.bat --keep<br />
to upgrade. See [[ConTeXt_Minimals#Installint_third_party_modules| Installing third party modules]] for details.<br />
<br />
If you used the GUI installer, just run the installer again.<br />
<br />
== Uninstallation ==<br />
<br />
If you used the command-line installer, you can just delete the installation directory to uninstall the minimals.<br />
<br />
If you used the GUI installer, you can use standard windows tools for uninstallation.<br />
<br />
<br />
== Troubleshooting ==<br />
<br />
* rsync sometimes has problems with paths with uppercase letters (like <code>c:\Temp</code> or <code>C:\Documents and Settings</code>). Installing into all-lowercase paths without spaces sometimes helps.<br />
* Directory-name length may also have an effect, due to Windows's 8.3 filename conventions. An indicator is if running "texexec --lua" on a file produces missing-file warnings containing Windows-created 8-character directory names, such as "C:\CONTEX~1\tex", where your ConTeXt directory is really "C:\context_minimals\tex". Be conservative and choose a short name like "C:\ctm\tex". Also, this may even work when an 8-character-or-less directory name like "C:\ctexmin\tex" doesn't.<br />
* If you're behind firewall and rsync times out, you need to open port 873 for outgoing TCP connections.<br />
<br />
= Installing third party modules =<br />
<br />
The ConTeXt Minimals only come with Taco's [[Bibliography|t-bib]] module. If you want to install [http://modules.contextgarden.net/ a new module], say Wolfgang's [[Letter|t-letter]] module, you can use<br />
first-setup.sh --extras="t-letter"<br />
<br />
If you want to install more than one extra module, you can separate them by commas. So, to install the t-letter and t-mathsets module, do<br />
sh ./first-setup.sh --extras="t-letter,t-mathsets"<br />
<br />
If you want to install all extra modules at once, do<br />
sh ./first-setup.sh --extras=all<br />
<br />
= Reverting to an older installation =<br />
<br />
If, for some reason, you want to revert to an older installation, you can do that by<br />
<br />
sh ./first-setup.sh --context=date<br />
<br />
where <code>date</code> is the date of one of the stable releases of ConTeXt. The complete list of old releases that are available is [http://minimals.contextgarden.net/current/context/ here].<br />
<br />
<br />
= Moving the installation tree around (linux) = <br />
<br />
According to this post, http://archive.contextgarden.net/message/20101129.144331.d721372f.en.html it's safe to move the installation tree across directory or machines (say you don't have broadband access). You just have to clean and regenerate the cache (./tex/texmf-cache/luatex-cache) with <br />
mtxrun --generate<br />
<br />
= Notes =<br />
<references/><br />
<br />
[[Category:Installation]]<br />
[[Category:Minimals]]</div>MelmothXhttps://wiki.contextgarden.net/index.php?title=Compound_words&diff=12391Compound words2010-11-27T16:36:38Z<p>MelmothX: </p>
<hr />
<div>Words consisting of two separate words are often separated by an intra word dash, as in x-axis.<br />
This dash can be placed between two | characters, for example |-|.<br />
<br />
When || is typed, the default intra word dash is used, which is <context>||</context>. You can configure this with <cmd>setuphyphenmark</cmd>.<br />
<br />
Valid values are <code>normal</code> and <code>wide</code>.<br />
<br />
The default sign is a combination of two hyphens:<br />
<br />
<context source="yes"><br />
\setuphyphenmark[sign=wide]<br />
<br />
intra||word<br />
</context><br />
<br />
To get a normal sign you could set this with the <code>normal</code> value (ConTeXt 2008.09.16 or later).<br />
<br />
<context source="yes"><br />
\setuphyphenmark[sign=normal]<br />
intra||word<br />
</context><br />
<br />
The || is also used in word combinations like (intra)word, which is typed as (intra|)|word.<br />
The mechanism is not foolproof but it serves most purposes. In case the hyphenation is<br />
incorrect you can hyphenate the first word of the composed one by hand: (in\-tra|)|word.<br />
<br />
Another use of || is the processing of subsentences. The symbol that surrounds a subsentence varies <br />
depending on the current language settings, as controlled by <cmd>setuplanguage</cmd>. When you use |<| and |>| to indicate the subsentence, the proper symbol will be used automatically.<br />
<br />
<context source="yes"><br />
a |<|as explained below|>| conflirtaneous \unknown<br />
</context><br />
<br />
The main reason behind this mechanism is that TeX doesn’t really know how to hyphenate<br />
composed words and how to handle subsentences. TeX know a lot about math, but far less<br />
about normal texts. Using this command not only serves consistency, but also makes sure that<br />
TeX can break compound words at the right places. It also keeps boundary characters at the<br />
right place when a breakpoint is inserted.<br />
<br />
The table below is an extended version of the table in the "big manual". In the third<br />
column, you see what the possible line breaks in the word would be, and the output<br />
that would come from that. <br />
<br />
<context><br />
\def\ShowComposed #1<br />
{\handletokens#1\with\type\VL#1\VL\hyphenatedword{#1}}<br />
\starttable[|l|l|l|]<br />
\HL<br />
\VL \bf input \VL \bf normal \VL \bf hyphenated \VL\SR<br />
\HL<br />
\VL \ShowComposed intra||word \VL\FR<br />
\VL \ShowComposed intra|-|word \VL\MR<br />
\VL \ShowComposed intra|(|word) \VL\MR<br />
\VL \ShowComposed (intra|)|word \VL\MR<br />
\VL \ShowComposed intra|--|word \VL\MR<br />
\VL \ShowComposed intra|~|word \VL\LR<br />
\VL \ShowComposed intra|_|word \VL\LR<br />
\VL \ShowComposed intra|=|word \VL\LR<br />
\VL \ShowComposed intra|'|word \VL\LR<br />
\VL \ShowComposed intra|*|word \VL\LR<br />
\HL<br />
\stoptable<br />
</context><br />
<br />
== Enabling hyphenation on hyphens for composed words globally ==<br />
<br />
For mkiv just add to the preamble:<br />
<br />
<texcode><br />
\setbreakpoints[compound]<br />
</texcode><br />
<br />
(which does the same thing as typing for each composed word <code>intra|-|word</code>)<br />
<br />
[[Category:International]]</div>MelmothXhttps://wiki.contextgarden.net/index.php?title=Compound_words&diff=12390Compound words2010-11-27T16:33:35Z<p>MelmothX: </p>
<hr />
<div>Words consisting of two separate words are often separated by an intra word dash, as in x-axis.<br />
This dash can be placed between two | characters, for example |-|.<br />
<br />
When || is typed, the default intra word dash is used, which is <context>||</context>. You can configure this with <cmd>setuphyphenmark</cmd>.<br />
<br />
Valid values are <code>normal</code> and <code>wide</code>.<br />
<br />
The default sign is a combination of two hyphens:<br />
<br />
<context source="yes"><br />
\setuphyphenmark[sign=wide]<br />
<br />
intra||word<br />
</context><br />
<br />
To get a normal sign you could set this with the <code>normal</code> value (ConTeXt 2008.09.16 or later).<br />
<br />
<context source="yes"><br />
\setuphyphenmark[sign=normal]<br />
intra||word<br />
</context><br />
<br />
The || is also used in word combinations like (intra)word, which is typed as (intra|)|word.<br />
The mechanism is not foolproof but it serves most purposes. In case the hyphenation is<br />
incorrect you can hyphenate the first word of the composed one by hand: (in\-tra|)|word.<br />
<br />
Another use of || is the processing of subsentences. The symbol that surrounds a subsentence varies <br />
depending on the current language settings, as controlled by <cmd>setuplanguage</cmd>. When you use |<| and |>| to indicate the subsentence, the proper symbol will be used automatically.<br />
<br />
<context source="yes"><br />
a |<|as explained below|>| conflirtaneous \unknown<br />
</context><br />
<br />
The main reason behind this mechanism is that TeX doesn’t really know how to hyphenate<br />
composed words and how to handle subsentences. TeX know a lot about math, but far less<br />
about normal texts. Using this command not only serves consistency, but also makes sure that<br />
TeX can break compound words at the right places. It also keeps boundary characters at the<br />
right place when a breakpoint is inserted.<br />
<br />
The table below is an extended version of the table in the "big manual". In the third<br />
column, you see what the possible line breaks in the word would be, and the output<br />
that would come from that. <br />
<br />
<context><br />
\def\ShowComposed #1<br />
{\handletokens#1\with\type\VL#1\VL\hyphenatedword{#1}}<br />
\starttable[|l|l|l|]<br />
\HL<br />
\VL \bf input \VL \bf normal \VL \bf hyphenated \VL\SR<br />
\HL<br />
\VL \ShowComposed intra||word \VL\FR<br />
\VL \ShowComposed intra|-|word \VL\MR<br />
\VL \ShowComposed intra|(|word) \VL\MR<br />
\VL \ShowComposed (intra|)|word \VL\MR<br />
\VL \ShowComposed intra|--|word \VL\MR<br />
\VL \ShowComposed intra|~|word \VL\LR<br />
\VL \ShowComposed intra|_|word \VL\LR<br />
\VL \ShowComposed intra|=|word \VL\LR<br />
\VL \ShowComposed intra|'|word \VL\LR<br />
\VL \ShowComposed intra|*|word \VL\LR<br />
\HL<br />
\stoptable<br />
</context><br />
<br />
== Enabling hyphenation on hyphens for composed words globally ==<br />
<br />
Just add to the preamble:<br />
<br />
<texcode><br />
\setbreakpoints[compound]<br />
</texcode><br />
<br />
(which does the same thing as typing for each composed word <code>intra|-|word</code>)<br />
<br />
[[Category:International]]</div>MelmothXhttps://wiki.contextgarden.net/index.php?title=Commands_with_optional_arguments&diff=12337Commands with optional arguments2010-11-12T16:14:41Z<p>MelmothX: Added example for \command[optional]{text}</p>
<hr />
<div>< [[Inside ConTeXt]] | [[Commands with KeyVal arguments]] ><br />
<br />
In LaTeX you define a new command with an optional argument with "newcommand":<br />
<br />
<texcode><br />
\newcommand{\MyCommand}[2][World]{{#2Hello #1!}}<br />
\MyCommand{\bfseries}<br />
\MyCommand[Hans]{\scshape}<br />
</texcode><br />
<br />
<context><br />
{\bf Hello World!}<br />
{\sc Hello Hans!}<br />
</context><br />
<br />
In ConTeXt, the optional argument processing is handled as a two-step process. First, we write the command for the end-user as a wrapper command, which calls <cmd>dodoubleempty</cmd> (from [http://source.contextgarden.net/tex/context/base/syst-gen.tex syst-gen.tex]) to handle the arguments properly -- including the optional ones -- and then calls a "private" command that contains the internals of the macro. Note that this function call does not explicitly refer to the arguments at all.<br />
<br />
<texcode><br />
\def\MyCommand{\dodoubleempty\doMyCommand}<br />
</texcode><br />
<br />
We then create the "private" macro (<tt>\doMacroName</tt> is the traditional ConTeXt name for these), with all the arguments defined as nonoptional. Default values for the arguments need to be handled somewhat more explicitly than with LaTeX; macros such as <cmd>ifsecondargument</cmd> are used to determine whether the given argument was specified, as follows:<br />
<br />
<texcode><br />
\def\doMyCommand[#1][#2]{#1Hello<br />
\ifsecondargument<br />
#2%<br />
\else<br />
World%<br />
\fi<br />
!}<br />
</texcode><br />
<br />
Note that this makes both arguments optional -- something that is much more difficult to do in LaTeX ([http://www.tex.ac.uk/cgi-bin/texfaq2html?label=twooptarg but can be done]). This also means that we should reverse the order of arguments, since if the user specifies only one argument it will be treated as the first argument.<br />
<br />
(Also, note that <tt>\MyCommand</tt> without the second argument ends up gobbling the following spaces, so we need to explicitly include one with "<tt>\ </tt>".)<br />
<br />
<texcode><br />
\MyCommand[\bf]\ %<br />
\MyCommand[\sc][Hans]<br />
</texcode><br />
<br />
<context><br />
\def\MyCommand{\dodoubleempty\doMyCommand}<br />
\def\doMyCommand[#1][#2]{#1Hello<br />
\ifsecondargument<br />
#2%<br />
\else<br />
World%<br />
\fi<br />
!}<br />
\MyCommand[\bf]\ %<br />
\MyCommand[\sc][Hans]<br />
</context><br />
<br />
If you ''don't'' want any optional arguments, but still want your arguments enclosed in <tt>[]</tt> with appropriate handling for spaces (or line breaks) between the square brackets, use <cmd>dodoubleargument</cmd> instead of <cmd>dodoubleempty</cmd>. There are of course versions for other numbers of arguments, found by replacing <tt>double</tt> with <tt>single</tt> through <tt>seventuple</tt>; see [http://source.contextgarden.net/tex/context/base/syst-gen.mkii syst-gen.tex] for the exact names.<br />
<br />
=== Examples ===<br />
<br />
To define <tt>\mycommand[.1.][.2.]{.3.}</tt>, i.e., with curly braces around a non-optional third argument, you just define<br />
<br />
<texcode><br />
\def\mycommand{\dodoubleempty\doMycommand}<br />
\def\doMycommand[#1][#2]#3{whatever}<br />
</texcode><br />
<br />
<br />
<br />
<br />
To define <code>\mycommand[optional]{text}</code>, do the following<br />
<br />
<texcode><br />
<br />
\def\mynewcommand{\dosingleempty\doMyNewCommand}<br />
\def\doMyNewCommand[#1]#2{%<br />
\iffirstargument<br />
There is an optional parameter: {\bf #1}\par<br />
\else<br />
No optional parameter\par<br />
\fi<br />
This is the mandatory text: {\em #2}<br />
}<br />
<br />
\starttext<br />
\mynewcommand[opt]{Hello People}<br />
<br />
\mynewcommand{Hello People}<br />
\stoptext<br />
</texcode><br />
<br />
<context><br />
<br />
\def\mynewcommand{\dosingleempty\doMyNewCommand}<br />
\def\doMyNewCommand[#1]#2{%<br />
\iffirstargument<br />
There is an optional parameter: {\bf #1}\par<br />
\else<br />
No optional parameter\par<br />
\fi<br />
This is the mandatory text: {\em #2}<br />
}<br />
<br />
\starttext<br />
\mynewcommand[opt]{Hello People}<br />
\blank<br />
\mynewcommand{Hello People}<br />
\stoptext<br />
</context><br />
<br />
<br />
[[Category:Inside ConTeXt]]</div>MelmothXhttps://wiki.contextgarden.net/index.php?title=Linux_Libertine_on_mkiv&diff=12305Linux Libertine on mkiv2010-11-09T00:03:08Z<p>MelmothX: </p>
<hr />
<div>Starting from Context 2010.05.21 there is the libertine typescript already defined. It points to the fonts shipped with TeXlive2010 (they have a different name than the upstream). You have to define <code>script=latn</code> if you want the ligatures in the Bold Italic font (until the upstream doesn't set a default script). See <br />
http://archive.contextgarden.net/thread/20101108.150757.a6a9040d.en.html<br />
<br />
<texcode><br />
% use microtypography<br />
\definefontfeature[default][default][protrusion=quality,expansion=quality,script=latn]<br />
\usetypescript[libertine]<br />
\setupalign[hz,hanging]<br />
<br />
\setupbodyfont[libertine,10pt]<br />
<br />
\starttext<br />
\input tufte<br />
\stoptext<br />
<br />
</texcode><br />
<br />
The complete code, which should work for ConTeXt shipped with TeXlive 2010 is:<br />
<br />
<texcode><br />
<br />
\definefontfeature[default][default]<br />
[protrusion=quality,<br />
expansion=quality,<br />
script=latn] <br />
<br />
\starttypescriptcollection[linuxlibertine]<br />
<br />
\starttypescript [serif] [linuxlibertine]<br />
\definefontsynonym [Libertine-Regular] [file:fxlr.otf]<br />
\definefontsynonym [Libertine-Italic] [file:fxlri.otf]<br />
\definefontsynonym [Libertine-Bold] [file:fxlb.otf]<br />
\definefontsynonym [Libertine-BoldItalic] [file:fxlbi.otf]<br />
\stoptypescript<br />
<br />
\starttypescript [serif] [linuxlibertine] [name]<br />
\setups[font:fallback:serif]<br />
\definefontsynonym [Serif] [Libertine-Regular] [features=default]<br />
\definefontsynonym [SerifItalic] [Libertine-Italic] [features=default]<br />
\definefontsynonym [SerifBold] [Libertine-Bold] [features=default]<br />
\definefontsynonym [SerifBoldItalic] [Libertine-BoldItalic] [features=default]<br />
\definefontsynonym [SerifCaps] [Libertine-Regular] [features=smallcaps]<br />
\stoptypescript<br />
<br />
\starttypescript [sans] [biolinum]<br />
\setups[font:fallback:sans]<br />
\definefontsynonym [Biolinum-Regular] [file:fxbr.otf]<br />
\definefontsynonym [Biolinum-Bold] [file:fxbb.otf]<br />
\definefontsynonym [Biolinum-Italic] [file:fxbri.otf]<br />
\definefontsynonym [Biolinum-Slanted] [file:fxbro.otf]<br />
\definefontsynonym [Biolinum-BoldItalic] [file:fxbbo.otf]<br />
\stoptypescript<br />
<br />
\starttypescript [sans] [biolinum] [name]<br />
\setups[font:fallback:sans]<br />
\definefontsynonym [Sans] [Biolinum-Regular] [features=default]<br />
\definefontsynonym [SansBold] [Biolinum-Bold] [features=default]<br />
\definefontsynonym [SansItalic] [Biolinum-Italic] [features=default]<br />
\definefontsynonym [SansSlanted] [Biolinum-Slanted] [features=default]<br />
\definefontsynonym [SansBoldItalic] [Biolinum-BoldItalic] [features=default]<br />
\definefontsynonym [SansCaps] [Biolinum-Regular] [features=smallcaps]<br />
\stoptypescript<br />
<br />
\starttypescript [linuxlibertine]<br />
\definetypeface [linuxlibertine] [rm] [serif] [linuxlibertine] [default]<br />
\definetypeface [linuxlibertine] [ss] [sans] [biolinum] [default]<br />
\definetypeface [linuxlibertine] [tt] [mono] [default] [default]<br />
%definetypeface [libertine] [mm] [math] [times] [default]<br />
\quittypescriptscanning<br />
\stoptypescript<br />
<br />
\stoptypescriptcollection<br />
<br />
\usetypescript[linuxlibertine]<br />
\setupbodyfont[linuxlibertine,10pt]<br />
% use the microtype<br />
\setupalign[hz,hanging]<br />
<br />
\starttext<br />
\input tufte<br />
\stoptext<br />
<br />
<br />
</texcode></div>MelmothXhttps://wiki.contextgarden.net/index.php?title=Linux_Libertine_on_mkiv&diff=12304Linux Libertine on mkiv2010-11-08T15:58:59Z<p>MelmothX: </p>
<hr />
<div>Starting from Context 2010.05.21 there is the libertine typescript already defined. It points to the fonts shipped with TeXlive2010 (they have a different name than the upstream). You have to define <code>script=latn</code> if you want the ligatures in the Bold Italic font (until the upstream doesn't set a default script). See <br />
http://archive.contextgarden.net/thread/20101108.150757.a6a9040d.en.html<br />
<br />
<texcode><br />
% use microtypography<br />
\definefontfeature[default][default][protrusion=quality,expansion=quality,script=latn]<br />
\usetypescript[libertine]<br />
\setupalign[hz,hanging]<br />
<br />
\setupbodyfont[libertine,10pt]<br />
<br />
\starttext<br />
\input tufte<br />
\stoptext<br />
<br />
</texcode></div>MelmothXhttps://wiki.contextgarden.net/index.php?title=Linux_Libertine_on_mkiv&diff=12303Linux Libertine on mkiv2010-11-08T15:57:05Z<p>MelmothX: Template for Linux Libertine and mkiv</p>
<hr />
<div>Starting from Context 2010.05.21 there is the libertine typescript already defined. It points to the fonts shipped with TeXlive2010 (they have a different name than the upstream). You have to define <code>script=latn</code> if you want the ligatures in the Bold Italic font (until the upstream doesn't set a default script). See <br />
http://archive.contextgarden.net/thread/20101108.150757.a6a9040d.en.html<br />
<br />
<texcode><br />
% use microtypography<br />
\definefontfeature[default][default][protrusion=quality,expansion=quality,script=latn]<br />
\usetypescript[libertine]<br />
\setupalign[hz,hanging]<br />
<br />
\setupbodyfont[libertine,10pt]<br />
<br />
\startext<br />
\input tufte<br />
\stoptext<br />
<br />
</texcode></div>MelmothXhttps://wiki.contextgarden.net/index.php?title=Fonts_-_Old_Content&diff=12302Fonts - Old Content2010-11-08T15:51:21Z<p>MelmothX: /* Available Free Fonts */</p>
<hr />
<div>< [[Visuals]] | [[Symbols]] ><br />
<br />
= Where to find fonts =<br />
<br />
== Available Free Fonts ==<br />
* [http://ctan.tug.org/tex-archive/info/Free_Math_Font_Survey/survey.html Free Math Fonts] : overview of different free Math fonts; [http://www.geocities.com/hartke01/ links to other free fonts]<br />
* [http://greekfontsociety.gr/ GFS Didot] : Latin, full set of polytonik Greek, small caps, oldstyle figures, full f-ligatures ([http://modules.contextgarden.net/gfsdidot Module for ConTeXt])<br />
* [[TeX Gyre]] : a set of great text fonts by our GUST friends, based on URW's free PostScript standard fonts for GhostScript.<br />
* [http://www.janusz.nowacki.strefa.pl/kurier.html Foto Alfa] : some TeX related fonts from Poland (Antykwa Toruńska. Antykwa Półtawskiego, Kurier, Iwona...)<br />
* [http://linuxlibertine.sourceforge.net Libertine Open Fonts Project]: GPL/OFL serif font [[Linux Libertine on mkiv|sample]]<br />
* [http://scripts.sil.org SIL International] : great Unicode fonts for scholars by SIL (Gentium, Doulos, Charis, etc.)<br />
* [http://ist-socrates.berkeley.edu/~pinax/greekkeys/GreekKeys.html GreekKeys] : links to polytonic Greek fonts<br />
* [http://scholarsfonts.net Scholar's Fonts] : Font for Scholars (Latin, Germanic languages, Greek, Hebrew and Linguistics)<br />
* [http://www.engl.virginia.edu/OE/junicode/junicode.html Junicode] : Junius-Unicode, a font for medievalists<br />
* [http://www.freelang.net/fonts/index.html FreeLang fonts] : fonts for exotic languages<br />
* [http://www.blambot.com Blambot] : Comic fonts<br />
* [http://www.chank.com/freefonts.php Chank] : some free Chank fonts<br />
* [http://www.fontface.com/fonts/ FontFace] : free fonts<br />
* [http://www.dafont.com DaFont] : more free fonts<br />
* [http://fonts.tom7.com/fonts98.html Divide by Zero] : more fonts<br />
* [http://moorstation.org/typoasis/typoasis1.htm TypOasis] : lots of nice fonts, but a bit hard to find (have a look at designers Apostrophic Lab, Manfred Klein and Dieter Steffmann)<br />
* [http://kadyellebee.com/fonts/ Kristine's Font Organization] : find a font in a sorted directory<br />
* [http://www.fontlover.com FontLover] : font news portal site<br />
* [http://www.stormtype.com/typefaces-fonts-shop/free.php Lido] : OpenType and TrueType typeface by Storm Type Foundry, free for non-commercial use. [http://modules.contextgarden.net/stormfontsupport Support].<br />
* [http://www.alanwood.net/unicode/fontsbyrange.html Alan Wood’s Unicode Resources] : find fonts by Unicode character range<br />
* [http://www.josbuivenga.demon.nl/ exljbris] Free Quality Font Foundry by Jos Buivenga<br />
* [http://www.stixfonts.org/ STIX Fonts] Beta download of the STIX-Fonts<br />
* [http://www.fontsquirrel.com/ Font Squirrel] Handpicked free fonts for graphic designers with commercial-use licenses<br />
* [http://www.theleagueofmoveabletype.com/ The league of Moveable Type] : a collection of open source fonts<br />
* [http://www.1stwebdesigner.com/resources/65-popular-and-professional-free-fonts-for-creative-typography/ 65 Popular And Professional Free Fonts For Creative Typography] and [http://www.1stwebdesigner.com/resources/52-really-high-quality-free-fonts-for-modern-and-cool-design/ 52 Really High Quality Free Fonts For Modern And Cool Design]<br />
* ''... many more to be added ...''<br />
<br />
= How to use fonts in ConTeXt =<br />
'''The ConTeXt way of handling fonts are [[TypeScripts]].''' It’s a system of abstraction and aliases, which may seem “strange” at first for new users of ConTeXt.<br />
* There is now a [http://context.aanhet.net/svn/contextman/context-reference/en/co-fonts.pdf manual chapter on fonts].<br />
* If you happen to use [[XeTeX]] then you can forget almost all the magic and start using your system fonts (see [[Fonts_in_XeTeX]]).<br />
* If you use [[LuaTeX]], see [[Fonts_in_LuaTeX]]<br />
* If you want to keep using [[pdfTeX]], read on.<br />
<br />
= Font support & configuration =<br />
== Type 1 fonts ==<br />
* Using [[psnfss]] metrics in ConTeXt<br />
* Matt Gushee's introduction to [http://havenrock.com/textips/bookfonts.html virtual fonts], especially for getting expert fonts to work.<br />
* [[URW Garamond]]<br />
* [[Lucida]] : large font family designed by Bigelow & Holmes; suitable e.g. for presentations<br />
* [http://dl.contextgarden.net/myway/expertfonts.pdf Installing Expert Fonts: Minion Pro] by Idris Samawi Hamid; contains step-by-step instructions, from preinstallation to writing typescripts<br />
* [http://www.stormtype.com Storm Type Foundry] : [http://modules.contextgarden.net/stormfontsupport support] of selected fonts<br />
<br />
== True Type fonts ==<br />
* [http://tug.org/pracjourn/2005-2/schmitz/schmitz.pdf Integrating TrueType Fonts into ConTeXt] by Thomas A. Schmitz (PracTeX Journal)<br />
* [[Installing a TrueType font, step by step]]. If you just need to install a TrueType font, this may be what you are looking for.<br />
* [[Palatino Linotype under MKIV]].<br />
<br />
== OpenType fonts ==<br />
* [[otfinstall|otfinst - a script for using OpenType fonts in ConTeXt]]<br />
<br />
== Basic Hints ==<br />
<br />
How to change to Palatino for text with Euler for math: [[Palatino with Euler for Math]]<br />
<br />
''Some hints by Taco from the mailing list on 2005-11-20:''<br />
<br />
Q: How up to date or out of date is the information in [http://www.pragma-ade.com/general/manuals/mfonts.pdf mfonts manual]?<br />
<br />
A: It looks like it is still quite up-to-date, but some of the examples it gives may no longer be the very best and latest way of doing things, and possibly there are some new developments that do not get as much attention as desired (like [http://www.pragma-ade.com/general/manuals/mtexfont.pdf texfont], and the issues arising from font map files). Overall, the document appears accurate, though.<br />
<br />
An important thing to remember is this:<br />
<br />
'''ConTeXt does not share font metric conventions with LaTeX.'''<br />
<br />
(at one point it started doing so, like supporting the ''Karl Berry naming scheme'' and the ''PSNFSS'' style font family names, but that has since been abandoned).<br />
<br />
Another important thing is that it also does not share font map files with LaTeX and, specifically,<br />
<br />
'''ConTeXt does not make pdfetex read <tt>pdftex.map</tt>.'''<br />
<br />
(this is at the root of a great many problems reported by users only familiar with PSNFSS)<br />
<br />
The preferred format for metric files in ConTeXt is<br />
<br />
<tt><vendor>/<familyname>/<encoding>-<fontname>.tfm</tt><br />
<br />
for metrics and<br />
<br />
<tt><encoding>-<vendor>-<familyname>.map</tt><br />
<br />
for the mapping files.<br />
<br />
* <fontname> is usually derived from the font source (afm or ttf),<br />
* <encoding> is a 'controlled' list, (see [[Encodings and Regimes]])<br />
* <vendor> and <familyname> are user-supplied (at install time).<br />
<br />
There are ways to trick ConTeXt into using different conventions, but if you do that you are likely to run into trouble.<br />
<br />
== Hints by Language ==<br />
* general: [[Encodings and Regimes]]<br />
* [[Arabic and Hebrew]] (Idris? other ArabTeX specialists?)<br />
* [[Chinese]]<br />
* [[Czech]]<br />
* [[Greek]]<br />
* [[Russian]]<br />
* [[Vietnamese]]<br />
<br />
= Unsorted links =<br />
<br />
* [http://www.pragma-ade.com/general/manuals/mtexfont.pdf font installation with texfont] by Pragma<br />
* [http://www.pragma-ade.com/general/manuals/mfonts.pdf ConTeXt's font mechanism in detail] by Pragma<br />
* [http://tug.org/TUGboat/Articles/tb28-2/tb89mahajan.pdf ConTeXt basics for users: Font styles] by Aditya Mahajan (2007)<br />
* [http://www.pragma-ade.com/general/manuals/mmakempy.pdf making outlines] by Pragma<br />
* [http://pragma-ade.com/specials/fonts/fontspecial-p.pdf Here] you can try out several TeX fonts online (PDF interface!)<br />
* Troubleshooting: solving [[TeXfont]] problems.<br />
* Character [[Protrusion]] (also known as hanging or font handling) is a more subtle typographic effect.<br />
* [[Font Handling Internals]]<br />
* [http://watershade.net/wmcclain/context-help.html Bill McClain's ConTeXt beginners page] has also a lot about fonts<br />
* [[Pseudo Small Caps]] by Vit Zyka<br />
* [[Understanding how fonts work in ConTeXt]]<br />
* Fonts rely on [[Encodings and Regimes]], and it helps to know what happens underneath the hood, from time to time.<br />
* In newer distributions, map files belong in <tt>&hellip;/fonts/map/pdftex/context</tt>!<br />
* Don't forget to look at [[cont-sys.tex]]!<br />
<br />
<br />
[[Category:Fonts]]</div>MelmothXhttps://wiki.contextgarden.net/index.php?title=Fonts_-_Old_Content&diff=12301Fonts - Old Content2010-11-08T15:50:13Z<p>MelmothX: /* Available Free Fonts */</p>
<hr />
<div>< [[Visuals]] | [[Symbols]] ><br />
<br />
= Where to find fonts =<br />
<br />
== Available Free Fonts ==<br />
* [http://ctan.tug.org/tex-archive/info/Free_Math_Font_Survey/survey.html Free Math Fonts] : overview of different free Math fonts; [http://www.geocities.com/hartke01/ links to other free fonts]<br />
* [http://greekfontsociety.gr/ GFS Didot] : Latin, full set of polytonik Greek, small caps, oldstyle figures, full f-ligatures ([http://modules.contextgarden.net/gfsdidot Module for ConTeXt])<br />
* [[TeX Gyre]] : a set of great text fonts by our GUST friends, based on URW's free PostScript standard fonts for GhostScript.<br />
* [http://www.janusz.nowacki.strefa.pl/kurier.html Foto Alfa] : some TeX related fonts from Poland (Antykwa Toruńska. Antykwa Półtawskiego, Kurier, Iwona...)<br />
* [http://linuxlibertine.sourceforge.net Libertine Open Fonts Project]: GPL/OFL serif font [[Linux Libertine on mkiv]]<br />
* [http://scripts.sil.org SIL International] : great Unicode fonts for scholars by SIL (Gentium, Doulos, Charis, etc.)<br />
* [http://ist-socrates.berkeley.edu/~pinax/greekkeys/GreekKeys.html GreekKeys] : links to polytonic Greek fonts<br />
* [http://scholarsfonts.net Scholar's Fonts] : Font for Scholars (Latin, Germanic languages, Greek, Hebrew and Linguistics)<br />
* [http://www.engl.virginia.edu/OE/junicode/junicode.html Junicode] : Junius-Unicode, a font for medievalists<br />
* [http://www.freelang.net/fonts/index.html FreeLang fonts] : fonts for exotic languages<br />
* [http://www.blambot.com Blambot] : Comic fonts<br />
* [http://www.chank.com/freefonts.php Chank] : some free Chank fonts<br />
* [http://www.fontface.com/fonts/ FontFace] : free fonts<br />
* [http://www.dafont.com DaFont] : more free fonts<br />
* [http://fonts.tom7.com/fonts98.html Divide by Zero] : more fonts<br />
* [http://moorstation.org/typoasis/typoasis1.htm TypOasis] : lots of nice fonts, but a bit hard to find (have a look at designers Apostrophic Lab, Manfred Klein and Dieter Steffmann)<br />
* [http://kadyellebee.com/fonts/ Kristine's Font Organization] : find a font in a sorted directory<br />
* [http://www.fontlover.com FontLover] : font news portal site<br />
* [http://www.stormtype.com/typefaces-fonts-shop/free.php Lido] : OpenType and TrueType typeface by Storm Type Foundry, free for non-commercial use. [http://modules.contextgarden.net/stormfontsupport Support].<br />
* [http://www.alanwood.net/unicode/fontsbyrange.html Alan Wood’s Unicode Resources] : find fonts by Unicode character range<br />
* [http://www.josbuivenga.demon.nl/ exljbris] Free Quality Font Foundry by Jos Buivenga<br />
* [http://www.stixfonts.org/ STIX Fonts] Beta download of the STIX-Fonts<br />
* [http://www.fontsquirrel.com/ Font Squirrel] Handpicked free fonts for graphic designers with commercial-use licenses<br />
* [http://www.theleagueofmoveabletype.com/ The league of Moveable Type] : a collection of open source fonts<br />
* [http://www.1stwebdesigner.com/resources/65-popular-and-professional-free-fonts-for-creative-typography/ 65 Popular And Professional Free Fonts For Creative Typography] and [http://www.1stwebdesigner.com/resources/52-really-high-quality-free-fonts-for-modern-and-cool-design/ 52 Really High Quality Free Fonts For Modern And Cool Design]<br />
* ''... many more to be added ...''<br />
<br />
= How to use fonts in ConTeXt =<br />
'''The ConTeXt way of handling fonts are [[TypeScripts]].''' It’s a system of abstraction and aliases, which may seem “strange” at first for new users of ConTeXt.<br />
* There is now a [http://context.aanhet.net/svn/contextman/context-reference/en/co-fonts.pdf manual chapter on fonts].<br />
* If you happen to use [[XeTeX]] then you can forget almost all the magic and start using your system fonts (see [[Fonts_in_XeTeX]]).<br />
* If you use [[LuaTeX]], see [[Fonts_in_LuaTeX]]<br />
* If you want to keep using [[pdfTeX]], read on.<br />
<br />
= Font support & configuration =<br />
== Type 1 fonts ==<br />
* Using [[psnfss]] metrics in ConTeXt<br />
* Matt Gushee's introduction to [http://havenrock.com/textips/bookfonts.html virtual fonts], especially for getting expert fonts to work.<br />
* [[URW Garamond]]<br />
* [[Lucida]] : large font family designed by Bigelow & Holmes; suitable e.g. for presentations<br />
* [http://dl.contextgarden.net/myway/expertfonts.pdf Installing Expert Fonts: Minion Pro] by Idris Samawi Hamid; contains step-by-step instructions, from preinstallation to writing typescripts<br />
* [http://www.stormtype.com Storm Type Foundry] : [http://modules.contextgarden.net/stormfontsupport support] of selected fonts<br />
<br />
== True Type fonts ==<br />
* [http://tug.org/pracjourn/2005-2/schmitz/schmitz.pdf Integrating TrueType Fonts into ConTeXt] by Thomas A. Schmitz (PracTeX Journal)<br />
* [[Installing a TrueType font, step by step]]. If you just need to install a TrueType font, this may be what you are looking for.<br />
* [[Palatino Linotype under MKIV]].<br />
<br />
== OpenType fonts ==<br />
* [[otfinstall|otfinst - a script for using OpenType fonts in ConTeXt]]<br />
<br />
== Basic Hints ==<br />
<br />
How to change to Palatino for text with Euler for math: [[Palatino with Euler for Math]]<br />
<br />
''Some hints by Taco from the mailing list on 2005-11-20:''<br />
<br />
Q: How up to date or out of date is the information in [http://www.pragma-ade.com/general/manuals/mfonts.pdf mfonts manual]?<br />
<br />
A: It looks like it is still quite up-to-date, but some of the examples it gives may no longer be the very best and latest way of doing things, and possibly there are some new developments that do not get as much attention as desired (like [http://www.pragma-ade.com/general/manuals/mtexfont.pdf texfont], and the issues arising from font map files). Overall, the document appears accurate, though.<br />
<br />
An important thing to remember is this:<br />
<br />
'''ConTeXt does not share font metric conventions with LaTeX.'''<br />
<br />
(at one point it started doing so, like supporting the ''Karl Berry naming scheme'' and the ''PSNFSS'' style font family names, but that has since been abandoned).<br />
<br />
Another important thing is that it also does not share font map files with LaTeX and, specifically,<br />
<br />
'''ConTeXt does not make pdfetex read <tt>pdftex.map</tt>.'''<br />
<br />
(this is at the root of a great many problems reported by users only familiar with PSNFSS)<br />
<br />
The preferred format for metric files in ConTeXt is<br />
<br />
<tt><vendor>/<familyname>/<encoding>-<fontname>.tfm</tt><br />
<br />
for metrics and<br />
<br />
<tt><encoding>-<vendor>-<familyname>.map</tt><br />
<br />
for the mapping files.<br />
<br />
* <fontname> is usually derived from the font source (afm or ttf),<br />
* <encoding> is a 'controlled' list, (see [[Encodings and Regimes]])<br />
* <vendor> and <familyname> are user-supplied (at install time).<br />
<br />
There are ways to trick ConTeXt into using different conventions, but if you do that you are likely to run into trouble.<br />
<br />
== Hints by Language ==<br />
* general: [[Encodings and Regimes]]<br />
* [[Arabic and Hebrew]] (Idris? other ArabTeX specialists?)<br />
* [[Chinese]]<br />
* [[Czech]]<br />
* [[Greek]]<br />
* [[Russian]]<br />
* [[Vietnamese]]<br />
<br />
= Unsorted links =<br />
<br />
* [http://www.pragma-ade.com/general/manuals/mtexfont.pdf font installation with texfont] by Pragma<br />
* [http://www.pragma-ade.com/general/manuals/mfonts.pdf ConTeXt's font mechanism in detail] by Pragma<br />
* [http://tug.org/TUGboat/Articles/tb28-2/tb89mahajan.pdf ConTeXt basics for users: Font styles] by Aditya Mahajan (2007)<br />
* [http://www.pragma-ade.com/general/manuals/mmakempy.pdf making outlines] by Pragma<br />
* [http://pragma-ade.com/specials/fonts/fontspecial-p.pdf Here] you can try out several TeX fonts online (PDF interface!)<br />
* Troubleshooting: solving [[TeXfont]] problems.<br />
* Character [[Protrusion]] (also known as hanging or font handling) is a more subtle typographic effect.<br />
* [[Font Handling Internals]]<br />
* [http://watershade.net/wmcclain/context-help.html Bill McClain's ConTeXt beginners page] has also a lot about fonts<br />
* [[Pseudo Small Caps]] by Vit Zyka<br />
* [[Understanding how fonts work in ConTeXt]]<br />
* Fonts rely on [[Encodings and Regimes]], and it helps to know what happens underneath the hood, from time to time.<br />
* In newer distributions, map files belong in <tt>&hellip;/fonts/map/pdftex/context</tt>!<br />
* Don't forget to look at [[cont-sys.tex]]!<br />
<br />
<br />
[[Category:Fonts]]</div>MelmothXhttps://wiki.contextgarden.net/index.php?title=Imposition&diff=12276Imposition2010-11-03T17:55:51Z<p>MelmothX: /* Imposition by signatures */ Added references</p>
<hr />
<div>< [[Structurals]] | [[Visuals]] ><br />
<br />
==What is Imposition?==<br />
<br />
To impose means to order pages on a bigger sheet in a way, that you get a booklet (or something similar) with correct page order after folding.<br />
In the simplest case you impose four A5 pages on both sides of an A4 sheet.<br />
<br />
In a print shop it could be that you've to place 64 inner pages of a book on one printing sheet. For private use you could want to zigzag-fold an A4 sheet as a brochure that fits nicely in a business envelope. You could make two pages with three columns each, or you could make six pages and impose them.<br />
<br />
Another "style" of imposition is to place several identical templates on one sheet, e.g. labels.<br />
<br />
==Imposition schemas==<br />
<br />
===Default schemas===<br />
<br />
ConTeXt has some built-in imposition schemas (see "arranging pages" in the manual):<br />
<br />
* 2UP : 2 pages next to each other, n sheets arranged for a single booklet<br />
* 2DOWN : 2 pages above each other, n sheets arranged for a single booklet<br />
* 2SIDE : 2 pages per form, side by side in pagination order, single sided only (no real imposition, only paper saving)<br />
* 2TOP : 2 pages above each other, single sided only<br />
* 2TOPSIDE: 2 odd pages on one side, two even pages verso, above each other<br />
* 2*2 : section: one sheet 2 x 2 pages = 4 pages (2 pages per form, for single sheets with front and back)<br />
* 2**2 : section: one sheet 2 x 2 pages = 4 pages (2 pages per form, for book ordering)<br />
* 2*4 : section: one sheet 2 x 4 pages = 8 pages (4 pages per form, 2x2 pages head to head)<br />
* 2*8 : section: one sheet 2 x 8 pages = 16 pages<br />
* 2*16 : section: one sheet 2 x 16 pages = 32 pages<br />
* 2*4*2 : section of 16 pages: 2 sheets, 4 pages front and backside<br />
* 2*2*4 : section of 16 pages: 4 sheets, 2 pages front and backside<br />
* XY : one sheet with x rows and y columns, you can control the number with [[cmd:setuppaper|\setuppaper]][nx=...,ny=...,dx=...,dy=...]<br />
<br />
"form" means "one side of a sheet".<br />
<br />
You can access this feature via<br />
* <cmd>setuparranging</cmd><br />
* <tt>texexec --pdfarrange=...</tt><br />
* [http://www.ntg.nl:8061/impose.pdf online interface]<br />
<br />
{{todo|some graphical examples}}<br />
<br />
===Additional schemas===<br />
<br />
Hraban needed a "3SIDE" schema to fit three "filius" planner pages on one A4 sheet. Willi wrote it:<br />
<texcode><br />
\unprotect<br />
% New page imposition scheme 3SIDE by Willi Egger 2003-07-21<br />
<br />
\installpagearrangement 3SIDE<br />
{\dosetuparrangement{3}{1}{6}{4}{2}%<br />
\pusharrangedpageTHREESIDE\poparrangedpagesAB\relax}<br />
<br />
\def\pusharrangedpageTHREESIDE#1% Willi's approach<br />
{\doglobal\increment\arrangedpageN<br />
\reportarrangedpage\arrangedpageN<br />
\ifcase\arrangedpageN<br />
\or \handlearrangedpageXandY{#1}000\arrangedpageA % 1<br />
\or \handlearrangedpageXandY{#1}010\arrangedpageA % 2<br />
\or \handlearrangedpageXandY{#1}020\arrangedpageA % 3<br />
\or \handlearrangedpageXandY{#1}000\arrangedpageB % 4<br />
\or \handlearrangedpageXandY{#1}010\arrangedpageB % 5<br />
\or \handlearrangedpageXandY{#1}020\arrangedpageB % 6<br />
\poparrangedpages<br />
\fi}<br />
<br />
\protect<br />
</texcode><br />
You can use this code simply in your environment file. The other schemas are in <tt>page-imp.tex</tt>.<br />
<br />
Use it like this:<br />
<texcode><br />
\definepapersize [filius][width=92mm, height=172mm]<br />
\setuppapersize [filius][A4,landscape]<br />
\setuparranging [3SIDE]<br />
\setuplayout [location=middle,<br />
alternative=singlesided,<br />
grid=no, marking=on,<br />
leftmargin=10mm, leftmargindistance=0mm,<br />
topspace=2mm, header=4mm, footer=0mm,<br />
width=77mm, height=166mm]<br />
</texcode><br />
<br />
<br />
ConTeXt is also handy when you need to '''rearrange an existing pdf''' into a booklet. This is a trial-and-error solution by Mari for rearranging an A4 pdf file into 2*8 spreads on A3 sheet (-> A6 pages when printed and cut). The texexec.tex file that was created by the first tries with <tt>texexec --pdfarrange</tt> (which didn't seem to have enough options) was a great help while working towards this solution.<br />
Not sure about the margins on the final A6 pages (the original has equal left and right margins, some extra inside margin might be a good thing), but at least otherwise this seems to do the trick:<br />
<br />
<texcode><br />
\setuppapersize[A6][A3] %individual page A6 size, print size A3<br />
\setuparranging[2*8,rotated] %makes an 8 page gathering when folded (duplex printing!)<br />
\setupoutput[pdf]<br />
\setuplayout<br />
[backspace=0pt,<br />
topspace=0pt,<br />
width=middle,<br />
height=middle,<br />
location=middle,<br />
header=0pt,<br />
footer=0pt]<br />
\setuppagenumbering[alternative=doublesided]<br />
<br />
\starttext<br />
<br />
\insertpages<br />
[original_file.pdf][width=0pt]<br />
<br />
\stoptext<br />
<br />
</texcode><br />
<br />
===Testing schemas===<br />
<br />
Here's a convenient test file to help choose a schema or write a new one:<br />
<br />
<texcode><br />
\setupbodyfont[ss,10pt]<br />
\setuppapersize [A7][A4] <br />
\setuparranging [2*2*4,doublesided] %% the schema you want to test<br />
\setuppagenumbering [alternative=doublesided,location=footer]<br />
\setuplayout [margin=0pt,width=fit] <br />
\setupbackgrounds [text][text][background=screen,backgroundscreen=0.7] <br />
\setupcolors [state=start] <br />
\setuplayout [location=middle,marking=on]<br />
\setuptolerance [tolerant] <br />
<br />
\def\Style{[2*2*4,doublesided]}<br />
<br />
<br />
\startbuffer[Fakepage]<br />
\strut<br />
\blank<br />
\midaligned{\Style}<br />
\vfill<br />
\midaligned{This is page \recurselevel}<br />
\vfill<br />
\stopbuffer<br />
<br />
\setupheadertexts[\CONTEXT\ imposition test document]<br />
<br />
\starttext<br />
% \showframe<br />
\dorecurse{16}{\getbuffer[Fakepage]\page}<br />
<br />
\stoptext</texcode><br />
<br />
== Cut marks ==<br />
<br />
ConTeXt also allows to place cut marks. This can be controlled using the <tt>marking</tt> option of [[cmd:setuplayout|\setuplayout]]; possible values are:<br />
<br />
* '''on''' show cut marks and page number<br />
* '''screen''' ditto, but also print a grey-scale colour bar<br />
* '''colour''' ditto, but also print a colour bar<br />
* '''text''' print a text, defaults to `empty`<br />
<br />
The default settings are<br />
<br />
<texcode><br />
\def\pagecutmarksymbol {\the\realpageno}<br />
\def\pagecutmarklength {.5cm}<br />
\let\pagecutmarktoptext \empty<br />
\let\pagecutmarkbottomtext \empty<br />
</texcode><br />
<br />
To obtain register marks (or also called registration marks) you can use the small [http://archive.contextgarden.net/message/20070417.212628.76134ff7.en.html <tt>crop</tt> module] which was posted to the mailing list.<br />
<br />
== Caveat: common troubles ==<br />
<br />
Note that some features (e.g. table of content, internal references) are always disabled in imposition mode. So, they will not be included in the pdf if you ask for imposition.<br />
To get rid of this you can use the "arrange" key for texexec. <br />
<br />
<texcode><br />
texexec --arrange yourFilename<br />
</texcode><br />
<br />
This will run the document at first without page arrangement and impose the pages in a separate run after table of contents etc are created.<br />
<br />
In '''SciTe/WinConTeXt''' you can run this command by choosing ''Process and Arrange'' in the ''Tools'' menu in SciTe.<br />
<br />
== Getting the last page of a Booklet ==<br />
<br />
When you use imposition to print a booklet you want to put something on the very last page, the <code>quadruple</code> pagebreak did not always fill the remaining pages untill you get a quadruple number of pages.<br />
<br />
<texcode><br />
\unprotect<br />
<br />
\startvariables all<br />
nextquadruple: nextquadruple<br />
\stopvariables<br />
<br />
\installpagebreakhandler \v!nextquadruple<br />
{\ifdoublesided<br />
\!!counta\realpageno<br />
\!!countb\realpageno<br />
\advance\!!counta 4<br />
\divide\!!counta 4<br />
\multiply\!!counta 4<br />
\advance\!!countb 1<br />
\advance\!!counta-\!!countb<br />
\executepagebreakhandler\v!yes<br />
\dorecurse\!!counta{\executepagebreakhandler\v!empty}%<br />
\fi}<br />
<br />
\protect<br />
<br />
\setuppapersize[A5][A4]<br />
\setuparranging[2UP,rotated,doublesided]<br />
\setuppagenumbering[alternative=doublesided]<br />
<br />
\starttext<br />
<br />
\subject{Front Cover}<br />
<br />
\dorecurse{10}{\input tufte \par}<br />
<br />
\page[nextquadruple]<br />
<br />
Back Cover<br />
<br />
\stoptext<br />
</texcode><br />
<br />
== Getting to the Back Cover of a Booklet ==<br />
<br />
When using imposition to print an a5 booklet (a4 folded in half) John Devereux wanted to specify content for the back cover, independently of the actual number of pages in the booklet. Here is a way that worked (thanks to Wolfgang Schuster on the mailing list). \page[beforequadruple] gets to the inside back cover. Another \page gets to the outside back cover.<br />
<br />
<texcode><br />
\unprotect<br />
<br />
\startvariables all<br />
beforequadruple: beforequadruple<br />
\stopvariables<br />
<br />
\installpagebreakhandler \v!beforequadruple<br />
{\ifdoublesided<br />
\!!counta\realpageno<br />
\!!countb\realpageno<br />
\advance\!!counta 5<br />
\divide\!!counta 4<br />
\multiply\!!counta 4<br />
\advance\!!countb 2<br />
\advance\!!counta-\!!countb<br />
\executepagebreakhandler\v!yes<br />
\dorecurse\!!counta{\executepagebreakhandler\v!empty}%<br />
\fi}<br />
<br />
\protect<br />
<br />
\setuppapersize[A5][A4]<br />
\setuparranging[2UP,rotated,doublesided]<br />
\setuppagenumbering[alternative=doublesided]<br />
<br />
\starttext<br />
<br />
\subject Front Cover<br />
<br />
\dorecurse{10}{\input tufte \par}<br />
<br />
\page[beforequadruple]<br />
<br />
Imprint<br />
<br />
\page<br />
<br />
Back Cover<br />
<br />
\stoptext<br />
</texcode><br />
<br />
== Imposition by signatures ==<br />
<br />
Sometimes you want a booklet, but the pages are too many to be folded together. This is true especially when the number of pages rises above 80. So you need to pass the output PDF to an imposer, like pdfjam or psbook or pdfpages. The problem is that you need to get the "right" number of pages. <br />
<br />
E.g., if the original pages are 128, no problem, the signature is 64 and you can impose it without problems.<br />
<br />
But, if the original pages are 129, the optimal signature is 44, so<br />
you need to add 3 pages during the PDF compiling.<br />
<br />
First, create the following imposer.lua file<br />
<br />
<pre><br />
-- translated from perl to lua. Original code is in<br />
-- http://theanarchistlibrary.org/docs/altools-6.6.tar.gz<br />
<br />
local maxsignature = 80 -- define the maximum of the signature<br />
local minsignature = 20 -- define the minimum of the signature<br />
function optimize_signature(pages)<br />
local originalpages = pages<br />
-- be sure we don't mess up<br />
assert(numberpage ~= 0, "I can't work with 0 pages")<br />
<br />
--set needed pages to and and signature to 0<br />
local neededpages, signature = 0,0<br />
<br />
-- this means that we have to work with n*4, if not, add them to<br />
-- needed pages <br />
local modulo = pages % 4<br />
if modulo==0 then<br />
signature=pages<br />
else<br />
neededpages = 4 - modulo<br />
end<br />
<br />
-- add the needed pages to pages<br />
pages = pages + neededpages<br />
<br />
-- give a try with the signature<br />
signature = find_signature(pages)<br />
<br />
-- if the pages, are more than the max signature, find the right one<br />
if pages>maxsignature then<br />
while signature<minsignature do<br />
pages = pages + 4<br />
neededpages = 4 + neededpages<br />
signature = find_signature(pages)<br />
end<br />
end<br />
<br />
print("ImposerMessage:: Original pages: " .. originalpages .. "; " .. <br />
"Signature is " .. signature .. ", " ..<br />
neededpages .. " pages are needed, " .. <br />
pages .. " of output")<br />
-- let's do it<br />
tex.print("\\dorecurse{" .. neededpages .. "}{\\page[empty]}")<br />
<br />
end<br />
<br />
function find_signature(number)<br />
assert(number ~= 0, "I can't find the signature for 0 pages")<br />
assert((number % 4) == 0, "I suppose something is wrong, not a n*4")<br />
local i = maxsignature<br />
while i>0 do<br />
if (number % i) == 0 then<br />
return i<br />
end<br />
i = i - 4<br />
end<br />
end<br />
<br />
</pre><br />
<br />
The ImposerMessage is important if you want to pass the output of the ConTeXt run to a script to do the imposing.<br />
<br />
Then the master file<br />
<br />
<texcode><br />
\def\fillthesignature#1{<br />
\directlua{dofile("imposer.lua") <br />
optimize_signature(#1)}}<br />
\starttext<br />
<br />
\dorecurse{53}{<br />
\chapter{test}<br />
\input tufte<br />
\section{\the\realpageno}}<br />
<br />
<br />
\page[yes] % reset the page<br />
\fillthesignature{\the\realpageno}<br />
<br />
And this is the last page (the backcover)<br />
<br />
\stoptext<br />
<br />
</texcode></div>MelmothXhttps://wiki.contextgarden.net/index.php?title=User:MelmothX&diff=12275User:MelmothX2010-11-03T10:16:34Z<p>MelmothX: New page: melmothx AT gmail DOT com</p>
<hr />
<div>melmothx AT gmail DOT com</div>MelmothXhttps://wiki.contextgarden.net/index.php?title=Imposition&diff=12274Imposition2010-11-03T10:13:00Z<p>MelmothX: /* Imposition by signatures */</p>
<hr />
<div>< [[Structurals]] | [[Visuals]] ><br />
<br />
==What is Imposition?==<br />
<br />
To impose means to order pages on a bigger sheet in a way, that you get a booklet (or something similar) with correct page order after folding.<br />
In the simplest case you impose four A5 pages on both sides of an A4 sheet.<br />
<br />
In a print shop it could be that you've to place 64 inner pages of a book on one printing sheet. For private use you could want to zigzag-fold an A4 sheet as a brochure that fits nicely in a business envelope. You could make two pages with three columns each, or you could make six pages and impose them.<br />
<br />
Another "style" of imposition is to place several identical templates on one sheet, e.g. labels.<br />
<br />
==Imposition schemas==<br />
<br />
===Default schemas===<br />
<br />
ConTeXt has some built-in imposition schemas (see "arranging pages" in the manual):<br />
<br />
* 2UP : 2 pages next to each other, n sheets arranged for a single booklet<br />
* 2DOWN : 2 pages above each other, n sheets arranged for a single booklet<br />
* 2SIDE : 2 pages per form, side by side in pagination order, single sided only (no real imposition, only paper saving)<br />
* 2TOP : 2 pages above each other, single sided only<br />
* 2TOPSIDE: 2 odd pages on one side, two even pages verso, above each other<br />
* 2*2 : section: one sheet 2 x 2 pages = 4 pages (2 pages per form, for single sheets with front and back)<br />
* 2**2 : section: one sheet 2 x 2 pages = 4 pages (2 pages per form, for book ordering)<br />
* 2*4 : section: one sheet 2 x 4 pages = 8 pages (4 pages per form, 2x2 pages head to head)<br />
* 2*8 : section: one sheet 2 x 8 pages = 16 pages<br />
* 2*16 : section: one sheet 2 x 16 pages = 32 pages<br />
* 2*4*2 : section of 16 pages: 2 sheets, 4 pages front and backside<br />
* 2*2*4 : section of 16 pages: 4 sheets, 2 pages front and backside<br />
* XY : one sheet with x rows and y columns, you can control the number with [[cmd:setuppaper|\setuppaper]][nx=...,ny=...,dx=...,dy=...]<br />
<br />
"form" means "one side of a sheet".<br />
<br />
You can access this feature via<br />
* <cmd>setuparranging</cmd><br />
* <tt>texexec --pdfarrange=...</tt><br />
* [http://www.ntg.nl:8061/impose.pdf online interface]<br />
<br />
{{todo|some graphical examples}}<br />
<br />
===Additional schemas===<br />
<br />
Hraban needed a "3SIDE" schema to fit three "filius" planner pages on one A4 sheet. Willi wrote it:<br />
<texcode><br />
\unprotect<br />
% New page imposition scheme 3SIDE by Willi Egger 2003-07-21<br />
<br />
\installpagearrangement 3SIDE<br />
{\dosetuparrangement{3}{1}{6}{4}{2}%<br />
\pusharrangedpageTHREESIDE\poparrangedpagesAB\relax}<br />
<br />
\def\pusharrangedpageTHREESIDE#1% Willi's approach<br />
{\doglobal\increment\arrangedpageN<br />
\reportarrangedpage\arrangedpageN<br />
\ifcase\arrangedpageN<br />
\or \handlearrangedpageXandY{#1}000\arrangedpageA % 1<br />
\or \handlearrangedpageXandY{#1}010\arrangedpageA % 2<br />
\or \handlearrangedpageXandY{#1}020\arrangedpageA % 3<br />
\or \handlearrangedpageXandY{#1}000\arrangedpageB % 4<br />
\or \handlearrangedpageXandY{#1}010\arrangedpageB % 5<br />
\or \handlearrangedpageXandY{#1}020\arrangedpageB % 6<br />
\poparrangedpages<br />
\fi}<br />
<br />
\protect<br />
</texcode><br />
You can use this code simply in your environment file. The other schemas are in <tt>page-imp.tex</tt>.<br />
<br />
Use it like this:<br />
<texcode><br />
\definepapersize [filius][width=92mm, height=172mm]<br />
\setuppapersize [filius][A4,landscape]<br />
\setuparranging [3SIDE]<br />
\setuplayout [location=middle,<br />
alternative=singlesided,<br />
grid=no, marking=on,<br />
leftmargin=10mm, leftmargindistance=0mm,<br />
topspace=2mm, header=4mm, footer=0mm,<br />
width=77mm, height=166mm]<br />
</texcode><br />
<br />
<br />
ConTeXt is also handy when you need to '''rearrange an existing pdf''' into a booklet. This is a trial-and-error solution by Mari for rearranging an A4 pdf file into 2*8 spreads on A3 sheet (-> A6 pages when printed and cut). The texexec.tex file that was created by the first tries with <tt>texexec --pdfarrange</tt> (which didn't seem to have enough options) was a great help while working towards this solution.<br />
Not sure about the margins on the final A6 pages (the original has equal left and right margins, some extra inside margin might be a good thing), but at least otherwise this seems to do the trick:<br />
<br />
<texcode><br />
\setuppapersize[A6][A3] %individual page A6 size, print size A3<br />
\setuparranging[2*8,rotated] %makes an 8 page gathering when folded (duplex printing!)<br />
\setupoutput[pdf]<br />
\setuplayout<br />
[backspace=0pt,<br />
topspace=0pt,<br />
width=middle,<br />
height=middle,<br />
location=middle,<br />
header=0pt,<br />
footer=0pt]<br />
\setuppagenumbering[alternative=doublesided]<br />
<br />
\starttext<br />
<br />
\insertpages<br />
[original_file.pdf][width=0pt]<br />
<br />
\stoptext<br />
<br />
</texcode><br />
<br />
===Testing schemas===<br />
<br />
Here's a convenient test file to help choose a schema or write a new one:<br />
<br />
<texcode><br />
\setupbodyfont[ss,10pt]<br />
\setuppapersize [A7][A4] <br />
\setuparranging [2*2*4,doublesided] %% the schema you want to test<br />
\setuppagenumbering [alternative=doublesided,location=footer]<br />
\setuplayout [margin=0pt,width=fit] <br />
\setupbackgrounds [text][text][background=screen,backgroundscreen=0.7] <br />
\setupcolors [state=start] <br />
\setuplayout [location=middle,marking=on]<br />
\setuptolerance [tolerant] <br />
<br />
\def\Style{[2*2*4,doublesided]}<br />
<br />
<br />
\startbuffer[Fakepage]<br />
\strut<br />
\blank<br />
\midaligned{\Style}<br />
\vfill<br />
\midaligned{This is page \recurselevel}<br />
\vfill<br />
\stopbuffer<br />
<br />
\setupheadertexts[\CONTEXT\ imposition test document]<br />
<br />
\starttext<br />
% \showframe<br />
\dorecurse{16}{\getbuffer[Fakepage]\page}<br />
<br />
\stoptext</texcode><br />
<br />
== Cut marks ==<br />
<br />
ConTeXt also allows to place cut marks. This can be controlled using the <tt>marking</tt> option of [[cmd:setuplayout|\setuplayout]]; possible values are:<br />
<br />
* '''on''' show cut marks and page number<br />
* '''screen''' ditto, but also print a grey-scale colour bar<br />
* '''colour''' ditto, but also print a colour bar<br />
* '''text''' print a text, defaults to `empty`<br />
<br />
The default settings are<br />
<br />
<texcode><br />
\def\pagecutmarksymbol {\the\realpageno}<br />
\def\pagecutmarklength {.5cm}<br />
\let\pagecutmarktoptext \empty<br />
\let\pagecutmarkbottomtext \empty<br />
</texcode><br />
<br />
To obtain register marks (or also called registration marks) you can use the small [http://archive.contextgarden.net/message/20070417.212628.76134ff7.en.html <tt>crop</tt> module] which was posted to the mailing list.<br />
<br />
== Caveat: common troubles ==<br />
<br />
Note that some features (e.g. table of content, internal references) are always disabled in imposition mode. So, they will not be included in the pdf if you ask for imposition.<br />
To get rid of this you can use the "arrange" key for texexec. <br />
<br />
<texcode><br />
texexec --arrange yourFilename<br />
</texcode><br />
<br />
This will run the document at first without page arrangement and impose the pages in a separate run after table of contents etc are created.<br />
<br />
In '''SciTe/WinConTeXt''' you can run this command by choosing ''Process and Arrange'' in the ''Tools'' menu in SciTe.<br />
<br />
== Getting the last page of a Booklet ==<br />
<br />
When you use imposition to print a booklet you want to put something on the very last page, the <code>quadruple</code> pagebreak did not always fill the remaining pages untill you get a quadruple number of pages.<br />
<br />
<texcode><br />
\unprotect<br />
<br />
\startvariables all<br />
nextquadruple: nextquadruple<br />
\stopvariables<br />
<br />
\installpagebreakhandler \v!nextquadruple<br />
{\ifdoublesided<br />
\!!counta\realpageno<br />
\!!countb\realpageno<br />
\advance\!!counta 4<br />
\divide\!!counta 4<br />
\multiply\!!counta 4<br />
\advance\!!countb 1<br />
\advance\!!counta-\!!countb<br />
\executepagebreakhandler\v!yes<br />
\dorecurse\!!counta{\executepagebreakhandler\v!empty}%<br />
\fi}<br />
<br />
\protect<br />
<br />
\setuppapersize[A5][A4]<br />
\setuparranging[2UP,rotated,doublesided]<br />
\setuppagenumbering[alternative=doublesided]<br />
<br />
\starttext<br />
<br />
\subject{Front Cover}<br />
<br />
\dorecurse{10}{\input tufte \par}<br />
<br />
\page[nextquadruple]<br />
<br />
Back Cover<br />
<br />
\stoptext<br />
</texcode><br />
<br />
== Getting to the Back Cover of a Booklet ==<br />
<br />
When using imposition to print an a5 booklet (a4 folded in half) John Devereux wanted to specify content for the back cover, independently of the actual number of pages in the booklet. Here is a way that worked (thanks to Wolfgang Schuster on the mailing list). \page[beforequadruple] gets to the inside back cover. Another \page gets to the outside back cover.<br />
<br />
<texcode><br />
\unprotect<br />
<br />
\startvariables all<br />
beforequadruple: beforequadruple<br />
\stopvariables<br />
<br />
\installpagebreakhandler \v!beforequadruple<br />
{\ifdoublesided<br />
\!!counta\realpageno<br />
\!!countb\realpageno<br />
\advance\!!counta 5<br />
\divide\!!counta 4<br />
\multiply\!!counta 4<br />
\advance\!!countb 2<br />
\advance\!!counta-\!!countb<br />
\executepagebreakhandler\v!yes<br />
\dorecurse\!!counta{\executepagebreakhandler\v!empty}%<br />
\fi}<br />
<br />
\protect<br />
<br />
\setuppapersize[A5][A4]<br />
\setuparranging[2UP,rotated,doublesided]<br />
\setuppagenumbering[alternative=doublesided]<br />
<br />
\starttext<br />
<br />
\subject Front Cover<br />
<br />
\dorecurse{10}{\input tufte \par}<br />
<br />
\page[beforequadruple]<br />
<br />
Imprint<br />
<br />
\page<br />
<br />
Back Cover<br />
<br />
\stoptext<br />
</texcode><br />
<br />
== Imposition by signatures ==<br />
<br />
Sometimes you want a booklet, but the pages are too many to be folded together. This is true especially when the number of pages rises above 80. So you need to pass the output PDF to an imposer, like pdfjam or psbook or pdfpages. The problem is that you need to get the "right" number of pages. <br />
<br />
E.g., if the original pages are 128, no problem, the signature is 64 and you can impose it without problems.<br />
<br />
But, if the original pages are 129, the optimal signature is 44, so<br />
you need to add 3 pages during the PDF compiling.<br />
<br />
First, create the following imposer.lua file<br />
<br />
<pre><br />
<br />
local maxsignature = 80 -- define the maximum of the signature<br />
local minsignature = 20 -- define the minimum of the signature<br />
function optimize_signature(pages)<br />
local originalpages = pages<br />
-- be sure we don't mess up<br />
assert(numberpage ~= 0, "I can't work with 0 pages")<br />
<br />
--set needed pages to and and signature to 0<br />
local neededpages, signature = 0,0<br />
<br />
-- this means that we have to work with n*4, if not, add them to<br />
-- needed pages <br />
local modulo = pages % 4<br />
if modulo==0 then<br />
signature=pages<br />
else<br />
neededpages = 4 - modulo<br />
end<br />
<br />
-- add the needed pages to pages<br />
pages = pages + neededpages<br />
<br />
-- give a try with the signature<br />
signature = find_signature(pages)<br />
<br />
-- if the pages, are more than the max signature, find the right one<br />
if pages>maxsignature then<br />
while signature<minsignature do<br />
pages = pages + 4<br />
neededpages = 4 + neededpages<br />
signature = find_signature(pages)<br />
end<br />
end<br />
<br />
print("ImposerMessage:: Original pages: " .. originalpages .. "; " .. <br />
"Signature is " .. signature .. ", " ..<br />
neededpages .. " pages are needed, " .. <br />
pages .. " of output")<br />
-- let's do it<br />
tex.print("\\dorecurse{" .. neededpages .. "}{\\page[empty]}")<br />
<br />
end<br />
<br />
function find_signature(number)<br />
assert(number ~= 0, "I can't find the signature for 0 pages")<br />
assert((number % 4) == 0, "I suppose something is wrong, not a n*4")<br />
local i = maxsignature<br />
while i>0 do<br />
if (number % i) == 0 then<br />
return i<br />
end<br />
i = i - 4<br />
end<br />
end<br />
<br />
</pre><br />
<br />
The ImposerMessage is important if you want to pass the output of the ConTeXt run to a script to do the imposing.<br />
<br />
Then the master file<br />
<br />
<texcode><br />
\def\fillthesignature#1{<br />
\directlua{dofile("imposer.lua") <br />
optimize_signature(#1)}}<br />
\starttext<br />
<br />
\dorecurse{53}{<br />
\chapter{test}<br />
\input tufte<br />
\section{\the\realpageno}}<br />
<br />
<br />
\page[yes] % reset the page<br />
\fillthesignature{\the\realpageno}<br />
<br />
And this is the last page (the backcover)<br />
<br />
\stoptext<br />
<br />
</texcode></div>MelmothXhttps://wiki.contextgarden.net/index.php?title=Imposition&diff=12273Imposition2010-11-03T09:57:55Z<p>MelmothX: /* Getting to the Back Cover of a Booklet */</p>
<hr />
<div>< [[Structurals]] | [[Visuals]] ><br />
<br />
==What is Imposition?==<br />
<br />
To impose means to order pages on a bigger sheet in a way, that you get a booklet (or something similar) with correct page order after folding.<br />
In the simplest case you impose four A5 pages on both sides of an A4 sheet.<br />
<br />
In a print shop it could be that you've to place 64 inner pages of a book on one printing sheet. For private use you could want to zigzag-fold an A4 sheet as a brochure that fits nicely in a business envelope. You could make two pages with three columns each, or you could make six pages and impose them.<br />
<br />
Another "style" of imposition is to place several identical templates on one sheet, e.g. labels.<br />
<br />
==Imposition schemas==<br />
<br />
===Default schemas===<br />
<br />
ConTeXt has some built-in imposition schemas (see "arranging pages" in the manual):<br />
<br />
* 2UP : 2 pages next to each other, n sheets arranged for a single booklet<br />
* 2DOWN : 2 pages above each other, n sheets arranged for a single booklet<br />
* 2SIDE : 2 pages per form, side by side in pagination order, single sided only (no real imposition, only paper saving)<br />
* 2TOP : 2 pages above each other, single sided only<br />
* 2TOPSIDE: 2 odd pages on one side, two even pages verso, above each other<br />
* 2*2 : section: one sheet 2 x 2 pages = 4 pages (2 pages per form, for single sheets with front and back)<br />
* 2**2 : section: one sheet 2 x 2 pages = 4 pages (2 pages per form, for book ordering)<br />
* 2*4 : section: one sheet 2 x 4 pages = 8 pages (4 pages per form, 2x2 pages head to head)<br />
* 2*8 : section: one sheet 2 x 8 pages = 16 pages<br />
* 2*16 : section: one sheet 2 x 16 pages = 32 pages<br />
* 2*4*2 : section of 16 pages: 2 sheets, 4 pages front and backside<br />
* 2*2*4 : section of 16 pages: 4 sheets, 2 pages front and backside<br />
* XY : one sheet with x rows and y columns, you can control the number with [[cmd:setuppaper|\setuppaper]][nx=...,ny=...,dx=...,dy=...]<br />
<br />
"form" means "one side of a sheet".<br />
<br />
You can access this feature via<br />
* <cmd>setuparranging</cmd><br />
* <tt>texexec --pdfarrange=...</tt><br />
* [http://www.ntg.nl:8061/impose.pdf online interface]<br />
<br />
{{todo|some graphical examples}}<br />
<br />
===Additional schemas===<br />
<br />
Hraban needed a "3SIDE" schema to fit three "filius" planner pages on one A4 sheet. Willi wrote it:<br />
<texcode><br />
\unprotect<br />
% New page imposition scheme 3SIDE by Willi Egger 2003-07-21<br />
<br />
\installpagearrangement 3SIDE<br />
{\dosetuparrangement{3}{1}{6}{4}{2}%<br />
\pusharrangedpageTHREESIDE\poparrangedpagesAB\relax}<br />
<br />
\def\pusharrangedpageTHREESIDE#1% Willi's approach<br />
{\doglobal\increment\arrangedpageN<br />
\reportarrangedpage\arrangedpageN<br />
\ifcase\arrangedpageN<br />
\or \handlearrangedpageXandY{#1}000\arrangedpageA % 1<br />
\or \handlearrangedpageXandY{#1}010\arrangedpageA % 2<br />
\or \handlearrangedpageXandY{#1}020\arrangedpageA % 3<br />
\or \handlearrangedpageXandY{#1}000\arrangedpageB % 4<br />
\or \handlearrangedpageXandY{#1}010\arrangedpageB % 5<br />
\or \handlearrangedpageXandY{#1}020\arrangedpageB % 6<br />
\poparrangedpages<br />
\fi}<br />
<br />
\protect<br />
</texcode><br />
You can use this code simply in your environment file. The other schemas are in <tt>page-imp.tex</tt>.<br />
<br />
Use it like this:<br />
<texcode><br />
\definepapersize [filius][width=92mm, height=172mm]<br />
\setuppapersize [filius][A4,landscape]<br />
\setuparranging [3SIDE]<br />
\setuplayout [location=middle,<br />
alternative=singlesided,<br />
grid=no, marking=on,<br />
leftmargin=10mm, leftmargindistance=0mm,<br />
topspace=2mm, header=4mm, footer=0mm,<br />
width=77mm, height=166mm]<br />
</texcode><br />
<br />
<br />
ConTeXt is also handy when you need to '''rearrange an existing pdf''' into a booklet. This is a trial-and-error solution by Mari for rearranging an A4 pdf file into 2*8 spreads on A3 sheet (-> A6 pages when printed and cut). The texexec.tex file that was created by the first tries with <tt>texexec --pdfarrange</tt> (which didn't seem to have enough options) was a great help while working towards this solution.<br />
Not sure about the margins on the final A6 pages (the original has equal left and right margins, some extra inside margin might be a good thing), but at least otherwise this seems to do the trick:<br />
<br />
<texcode><br />
\setuppapersize[A6][A3] %individual page A6 size, print size A3<br />
\setuparranging[2*8,rotated] %makes an 8 page gathering when folded (duplex printing!)<br />
\setupoutput[pdf]<br />
\setuplayout<br />
[backspace=0pt,<br />
topspace=0pt,<br />
width=middle,<br />
height=middle,<br />
location=middle,<br />
header=0pt,<br />
footer=0pt]<br />
\setuppagenumbering[alternative=doublesided]<br />
<br />
\starttext<br />
<br />
\insertpages<br />
[original_file.pdf][width=0pt]<br />
<br />
\stoptext<br />
<br />
</texcode><br />
<br />
===Testing schemas===<br />
<br />
Here's a convenient test file to help choose a schema or write a new one:<br />
<br />
<texcode><br />
\setupbodyfont[ss,10pt]<br />
\setuppapersize [A7][A4] <br />
\setuparranging [2*2*4,doublesided] %% the schema you want to test<br />
\setuppagenumbering [alternative=doublesided,location=footer]<br />
\setuplayout [margin=0pt,width=fit] <br />
\setupbackgrounds [text][text][background=screen,backgroundscreen=0.7] <br />
\setupcolors [state=start] <br />
\setuplayout [location=middle,marking=on]<br />
\setuptolerance [tolerant] <br />
<br />
\def\Style{[2*2*4,doublesided]}<br />
<br />
<br />
\startbuffer[Fakepage]<br />
\strut<br />
\blank<br />
\midaligned{\Style}<br />
\vfill<br />
\midaligned{This is page \recurselevel}<br />
\vfill<br />
\stopbuffer<br />
<br />
\setupheadertexts[\CONTEXT\ imposition test document]<br />
<br />
\starttext<br />
% \showframe<br />
\dorecurse{16}{\getbuffer[Fakepage]\page}<br />
<br />
\stoptext</texcode><br />
<br />
== Cut marks ==<br />
<br />
ConTeXt also allows to place cut marks. This can be controlled using the <tt>marking</tt> option of [[cmd:setuplayout|\setuplayout]]; possible values are:<br />
<br />
* '''on''' show cut marks and page number<br />
* '''screen''' ditto, but also print a grey-scale colour bar<br />
* '''colour''' ditto, but also print a colour bar<br />
* '''text''' print a text, defaults to `empty`<br />
<br />
The default settings are<br />
<br />
<texcode><br />
\def\pagecutmarksymbol {\the\realpageno}<br />
\def\pagecutmarklength {.5cm}<br />
\let\pagecutmarktoptext \empty<br />
\let\pagecutmarkbottomtext \empty<br />
</texcode><br />
<br />
To obtain register marks (or also called registration marks) you can use the small [http://archive.contextgarden.net/message/20070417.212628.76134ff7.en.html <tt>crop</tt> module] which was posted to the mailing list.<br />
<br />
== Caveat: common troubles ==<br />
<br />
Note that some features (e.g. table of content, internal references) are always disabled in imposition mode. So, they will not be included in the pdf if you ask for imposition.<br />
To get rid of this you can use the "arrange" key for texexec. <br />
<br />
<texcode><br />
texexec --arrange yourFilename<br />
</texcode><br />
<br />
This will run the document at first without page arrangement and impose the pages in a separate run after table of contents etc are created.<br />
<br />
In '''SciTe/WinConTeXt''' you can run this command by choosing ''Process and Arrange'' in the ''Tools'' menu in SciTe.<br />
<br />
== Getting the last page of a Booklet ==<br />
<br />
When you use imposition to print a booklet you want to put something on the very last page, the <code>quadruple</code> pagebreak did not always fill the remaining pages untill you get a quadruple number of pages.<br />
<br />
<texcode><br />
\unprotect<br />
<br />
\startvariables all<br />
nextquadruple: nextquadruple<br />
\stopvariables<br />
<br />
\installpagebreakhandler \v!nextquadruple<br />
{\ifdoublesided<br />
\!!counta\realpageno<br />
\!!countb\realpageno<br />
\advance\!!counta 4<br />
\divide\!!counta 4<br />
\multiply\!!counta 4<br />
\advance\!!countb 1<br />
\advance\!!counta-\!!countb<br />
\executepagebreakhandler\v!yes<br />
\dorecurse\!!counta{\executepagebreakhandler\v!empty}%<br />
\fi}<br />
<br />
\protect<br />
<br />
\setuppapersize[A5][A4]<br />
\setuparranging[2UP,rotated,doublesided]<br />
\setuppagenumbering[alternative=doublesided]<br />
<br />
\starttext<br />
<br />
\subject{Front Cover}<br />
<br />
\dorecurse{10}{\input tufte \par}<br />
<br />
\page[nextquadruple]<br />
<br />
Back Cover<br />
<br />
\stoptext<br />
</texcode><br />
<br />
== Getting to the Back Cover of a Booklet ==<br />
<br />
When using imposition to print an a5 booklet (a4 folded in half) John Devereux wanted to specify content for the back cover, independently of the actual number of pages in the booklet. Here is a way that worked (thanks to Wolfgang Schuster on the mailing list). \page[beforequadruple] gets to the inside back cover. Another \page gets to the outside back cover.<br />
<br />
<texcode><br />
\unprotect<br />
<br />
\startvariables all<br />
beforequadruple: beforequadruple<br />
\stopvariables<br />
<br />
\installpagebreakhandler \v!beforequadruple<br />
{\ifdoublesided<br />
\!!counta\realpageno<br />
\!!countb\realpageno<br />
\advance\!!counta 5<br />
\divide\!!counta 4<br />
\multiply\!!counta 4<br />
\advance\!!countb 2<br />
\advance\!!counta-\!!countb<br />
\executepagebreakhandler\v!yes<br />
\dorecurse\!!counta{\executepagebreakhandler\v!empty}%<br />
\fi}<br />
<br />
\protect<br />
<br />
\setuppapersize[A5][A4]<br />
\setuparranging[2UP,rotated,doublesided]<br />
\setuppagenumbering[alternative=doublesided]<br />
<br />
\starttext<br />
<br />
\subject Front Cover<br />
<br />
\dorecurse{10}{\input tufte \par}<br />
<br />
\page[beforequadruple]<br />
<br />
Imprint<br />
<br />
\page<br />
<br />
Back Cover<br />
<br />
\stoptext<br />
</texcode><br />
<br />
== Imposition by signatures ==</div>MelmothX