https://wiki.contextgarden.net/api.php?action=feedcontributions&user=Hagen&feedformat=atomWiki - User contributions [en]2024-03-28T14:18:21ZUser contributionsMediaWiki 1.34.1https://wiki.contextgarden.net/index.php?title=French_spacing&diff=21421French spacing2013-02-11T17:33:49Z<p>Hagen: </p>
<hr />
<div>In English, the space after some punctuation (most notably after period) is wider than a usual one; this is a standard behaviour of ConTeXt when typesetting in English. If you want to disable it, in plain TeX or LaTeX you would call <code>\frenchspacing</code>. In ConTeXt, you may say <texcode>\setuplanguage[en][spacing=packed]</texcode> instead.<br />
<br />
Here is a nice tweak: <br />
<br />
<texcode><br />
\enabledirectives[characters.spaceafteruppercase=normal]<br />
<br />
\vbox{\hsize 5em x. X\par x.\ X\par X. X\par X.\ X\par}<br />
</texcode><br />
<br />
By default space after uppercase followed by punctuation is set to <code>traditional</code> which enables a somewhat special hard coded hack in the tex engine where characters with sfcodes 999 nil a following spacecode setting, even when it's triggered by a <code>\ </code>.</div>Hagenhttps://wiki.contextgarden.net/index.php?title=Running_Mark_IV&diff=21376Running Mark IV2013-01-13T22:34:53Z<p>Hagen: </p>
<hr />
<div>== Introduction ==<br />
<br />
ConTeXt [[Mark IV]] does not use the kpathsea library to find files and configuration settings. It follows that running mktexlsr or fmtutil has no effect. This page explains the details of <br />
setting up and maintaining [[Mark IV]].<br />
<br />
== History ==<br />
<br />
The most important original motivation for this page was that the [[TeX Live]] 2008 edition contained Mark IV, but it was only copied to the installed system, no post-install setup took place at all. For the Tex Live 2008 release, the post-install setup had to be done manually. TeX Live 2009 did not come with a usable Mark IV at all because the luatex on the 2009 editions was too old compared to the ConTeXt version. Instructions on how to deal with TeX Live 2009 were needed then. TeX Live 2010 has a working Context Mark IV out of the box: you can just run 'context' directly. At most, you could run `luatools --generate; context --make` to deal with any tlmgr updates you may have performed since installing TeX Live. <br />
<br />
In TeX Live 2011, not even that is needed and you only have to run `mtxrun --generate` when files are installed manually ''outside'' of tlmgr. If you are running tl 2011, this page is just background information, there should be no need to take actual actions.<br />
<br />
=== Special notes (TL 2008/2009): ===<br />
<br />
* '''Windows''': Running Mark IV under Windows is the same as on Unix, but see [[Running_Mark_IV#In_case_of_trouble|below]] for a installation hints for the 'spaces in names' problem that seem to affect Windows users more often than other platforms.<br />
<br />
* '''Debian''': Mark IV suggests the tex-gyre package ([[TeX Gyre]]), not distributed currently under Debian due to licensing issues (see [[Debian installation]] )<br />
<br />
=== Special notes (TL 2010): ===<br />
<br />
* '''[[MacTeX]]''': You need to [[Running_Mark_IV#Updating_ConTeXt|update]] ConTeXt first.<br />
<br />
== Quickstart ==<br />
<br />
If you have trouble following these instructions, please direct you questions or complaints on the [http://www.ntg.nl/mailman/listinfo/ntg-context ntg-context mailing list], '''not''' the tex-live list.<br />
<br />
Just for the extremely impatient unix user that knows how to deal with a web2c-based TeX distribution and has a simple, private (single-user) installation, this is the only absolutely required extra knowledge:<br />
<br />
luatools --generate # 2010 and earlier<br />
or <br />
mtxrun --generate # 2011<br />
<br />
is the Mark IV replacement for mktexlsr.<br />
<br />
context --make<br />
<br />
is the Mark IV replacement for fmtutil.<br />
<br />
context myfile.tex<br />
<br />
typesets a file.<br />
<br />
Everybody else should read on.<br />
<br />
'''A note for windows users: (tl2008/2009)''' the luatex executable does not accept filenames with spaces in their name. This means that if you are on windows you will at least have to set up a texmfcnf.lua as explained below, and you likely will even have to reinstall texlive, because the default texlive installation directory itself contains spaces. [[Running_Mark_IV#File_not_found | Details]].<br />
<br />
== Generating and updating formats ==<br />
<br />
Before first use and after each update to either the [[context]] distribution or the [[luatex]] executable you will have to regenerate the formats. The manual command for that is:<br />
<br />
context --make cont-en<br />
<br />
This will generate a new Mark IV format with the English interface. Without an explicit format argument, it will generate four formats: Mark IV cont-en, Matk IV cont-nl, luatex+mptopdf, and luatex+plain.<br />
<br />
Starting with 2011, formats are automatically (re)generated by `context myfile.tex` when it believes it is necessary to do so. Specifically: assuming the format already exists, automatic regeneration takes places whenever the ConTeXt version of the luatex version do not match the ones in the pre-existing format. Manual patches of the core files still require manual regeneration of the formats.<br />
<br />
The generated formats are stored inside the texmf cache.<br />
<br />
== Experimental speedup ==<br />
<br />
In addition to standard [[luatex]] we provide [[luajittex]] which uses just in time compilation to speed up processing. The speedup is mostly due to the faster virtual machine. The exact speedup depends on the tex/lua ratio and we measured speedups between 10% and 40%. You force this engine with <br />
<br />
context --jit ....<br />
<br />
Alternatively you can put <br />
<br />
<texcode><br />
% engine=luajittex<br />
</texcode><br />
<br />
on top of your main document source. <br />
<br />
== Using fonts ==<br />
<br />
The <code>OSFONTDIR</code> environment variable should contain the paths where the system fonts must be looked for.<br />
<br />
See [[Fonts in LuaTex#Getting access to the system fonts]]<br />
<br />
== Downloaded files ==<br />
<br />
If you have the program 'curl' installed, then your input file can contain e.g.<br />
<br />
<texcode><br />
\externalfigure<br />
[http://www.pragma-ade.com/show-gra.pdf]<br />
</texcode><br />
<br />
and the referenced file will be downloaded automatically and placed in the 'texmf cache' if is not found in the cache already.<br />
<br />
== In case of trouble ==<br />
<br />
=== File not found (TL 2008/2009) ===<br />
<br />
* You may get errors like<br />
I can't find file `C:/Program.tex'.<br />
This is likely caused by the luatex executable not handling filename quoting properly yet. If filenames with spaces work at all, you are just lucky.<br />
<br />
This problem is most likely to happen on Windows. There two steps to deal with it:<br />
* You must put the main texmf tree in path without spaces. If you're installing Mark IV via TeXLive 2008, then simply change the top installation path at install time.<br />
* If you're running XP or Server 2003 (and not Vista or Server 2008), you must also set the TeX user home and the Lua cache to paths without spaces. <code>C:/tlhome</code> is a good candidate.<br />
** In <code>texmf.cnf</code> set TEXMFHOME to <code>C:/tlhome/$USERNAME</code> or to something similar of your liking. Using $USERNAME in the path will still give a per-user directory, just not under "Documents and Settings". This assumes that the user name doesn't have spaces of course...<br />
** As mentioned above, create/edit <code>texmfcnf.lua</code> and put a line like <code>return { TEXMFCACHE = 'C:/tlhome/$USERNAME/.texlive2008/texmf-var' }</code>, which sets each user's cache inside his space-free TeX home path.<br />
<br />
== Cache internals ==<br />
<br />
(this paragraph is for developers and power-users only)<br />
<br />
If you look at the folder that TEXMFCACHE points to, you will see a folder named luatex-cache. Inside that, there is the folder context. Inside the context folder, there usually is a single subfolder with a hexadecimal name. This is the md5sum of the name of the 'tex root' location (to be precise, it is the md5sum of the full path expansion of the context lua equivalent of the TEXMFCNF variable). <br />
<br />
Below this, there are currently four folders:<br />
<br />
* '''curl''' contains downloaded files. The url is converted to something that can be represented on disk by replacing problematic characters by dashes<br />
* '''fonts''' contains the file data/names.tma, this is the 'font name database' (and the derived names.tmc, tmc files are byte-compiled lua code for faster loading). There are also subdirectories containing the preprocessed metrics for non-tex fonts, one folder for each font type. <br />
* '''formats''' contains the Mark IV format file<br />
* '''trees''' has a small set of files with hexadecimal names, one for each of the top-level constituents of TEXMF (containing the filename database for that tree), and one for each of the found texmf.cnf files (containing in preprocessed form all the variables defined by that file). The filenames are md5sums of the contained directory or filename.<br />
<br />
<br />
[[Category:Installation]]</div>Hagenhttps://wiki.contextgarden.net/index.php?title=Modes&diff=13543Modes2012-01-20T21:52:56Z<p>Hagen: </p>
<hr />
<div>< [[The ConTeXt Way]] | [[Inside ConTeXt]] | [[Project structure]] ><br />
<br />
Very often, you want to generate multiple versions of the same document:<br />
one version for printing and one for viewing on the screen, one version for<br />
students and one version for the instructor, and so on. You can do this in a<br />
simple but naive way: create different files set up for the different versions and<br />
<code>\input</code> the common material, or create some new conditional flags using<br />
<code>\newif</code> and set them appropriately for conditional processing. Or you<br />
could use <em>modes</em>&mdash;the ConTeXt way of doing conditional processing.<br />
<br />
= Introduction =<br />
<br />
A mode is similar to a conditional flag, but with a few advantages: new modes<br />
need not be explicitly defined (no need for something like <code>\newif</code>),<br />
multiple modes can be simultaneously enabled or disabled, and the status of multiple<br />
modes can be checked easily. Moreover, modes can be set from a command line<br />
switch. As a result, multiple versions of a document can be generated without changing<br />
the source file.<br />
<br />
The name or identifier of a mode can be any combination of letters, digits, or<br />
spaces. Names starting with <code>*</code> are reserved for system modes. <br />
<br />
In this article I explain how to activate a mode and how to check if a mode is<br />
active or not. <br />
<br />
= Setting modes =<br />
<br />
ConTeXt has three commands for setting modes:<br />
<br />
* <code><cmd>enablemode </cmd>[...]</code><br />
* <code><cmd>disablemode</cmd>[...]</code><br />
* <code><cmd>preventmode</cmd>[...]</code><br />
<br />
The names are self-descriptive. <cmd>enablemode</cmd> activates a mode,<br />
<cmd>disablemode</cmd> deactivates a mode, and <cmd>preventmode</cmd> permanently<br />
deactivates a mode. All three commands take a list of modes as an argument. For<br />
example, you can activate modes named <code>screen</code> and <code>solution</code> with<br />
<texcode><br />
\enablemode[screen,solution]<br />
</texcode><br />
<br />
Modes can also be activated by a command line switch <code>--modes</code> to<br />
<code>texexec</code> or <code>context</code>. For example, another way to activate the <code>screen</code> and<br />
<code>solution</code> modes, to run ConTeXt using one of:<br />
<br />
texexec --mode=screen,solution ...<br />
context --mode=screen,solution ...<br />
<br />
<br />
<br />
= Conditional processing based on modes =<br />
<br />
You may want to process or ignore a chunk of code if a particular mode is enabled<br />
or disabled. Such a chunk of code is specified using <code>\startmode</code> and<br />
<code>\startnotmode</code> environments. Their use is best explained by an example.<br />
<br />
Suppose you want to change the paper size of a document depending on whether it<br />
is for print or screen. This can be done in multiple ways. You could set<br />
the default paper size for print and change it in screen mode:<br />
<texcode><br />
\setuppapersize[letter][letter]<br />
\startmode[screen]<br />
\setuppapersize[S6][S6]<br />
\stopmode<br />
</texcode><br />
(S6 is one of the screen-optimized paper sizes in ConTeXt; the paper size has a<br />
4:3 aspect ratio and a width equal to the width of A4 paper.)<br />
<br />
Alternatively, you<br />
could set a default paper size for the screen and change it if screen mode is<br />
not enabled:<br />
<texcode><br />
\setuppapersize[S6][S6]<br />
\startnotmode[screen]<br />
\setuppapersize[letter][letter]<br />
\stopnotmode<br />
</texcode><br />
<br />
<code>\startmode</code> (and <code>\startnotmode</code>) checks the value of the mode '''at the time it is executed'''. This is important when you are setting the modes using <code>\enablemode</code> or <code>\disablemode</code>. For example,<br />
<texcode><br />
\enablemode[foo]<br />
\startmode[foo]<br />
...<br />
\stopmode<br />
</texcode><br />
the contents of the mode environment are executed because <code>foo</code> is enabled when <code>\startmode</code> is encountered. However, in<br />
<texcode><br />
\startmode[foo]<br />
...<br />
\stopmode<br />
\enablemode[foo]<br />
</texcode><br />
the contents of the mode environment are not execited because <code>foo</code> is not enabled when <code>\startmode</code> is encountered. <br />
<br />
<br />
== Checking for multiple modes ==<br />
<code>\startmode</code> and <code>\startnotmode</code> can check for multiple modes,<br />
by giving a list of modes as their arguments. <code>\startmode</code><br />
processes its contents (everything until the next<br />
<code>\stopmode</code>, thus <code>\startmode</code> cannot be<br />
nested.) if any of the modes are enabled, otherwise (i.e., when all<br />
the modes are disabled) <code>\startmode</code> ignores its<br />
contents. The opposite is <code>\startnotmode</code>: it processes its<br />
contents (everything until the next <code>\stopnotmode</code>) if any of the<br />
modes are disabled, otherwise&mdash;when all the modes are enabled&mdash;the contents are ignored.<br />
<br />
<code>\startmode</code> and <code>\startnotmode</code> are "<em>or</em>" environments. They<br />
process their contents if any of the modes satisfy the required condition. Their<br />
"<em>and</em>" counterparts are also available: <code>\startallmodes</code> and <code>\startnotallmodes</code><br />
process their contents only if all the given modes satisfy the required<br />
condition. For example, suppose you want to enable interaction (e.g., hyperlinks)<br />
only when both <code>screen</code> and <code>solution</code> modes are enabled. Then you can<br />
use:<br />
<texcode><br />
\startallmodes[screen,solution]<br />
\setupinteraction[state=start]<br />
\stopallmodes<br />
</texcode><br />
<br />
To summarize, the four start-stop environments for checking modes are:<br />
<texcode><br />
\startmode[mode1, mode2, ...]<br />
% Processed if any of the modes is enabled<br />
\stopmode<br />
<br />
\startnotmode[mode1, mode2, ...]<br />
% Processed if any of the modes is disabled<br />
\stopnotmode<br />
<br />
\startallmodes[mode1, mode2, ...]<br />
% Processed if all the modes are enabled<br />
\stopallmodes<br />
<br />
\startnotallmodes[mode1, mode2, ...]<br />
% Processed if all the modes are disabled<br />
\stopnotallmodes<br />
</texcode><br />
<br />
These environments have <code>\doif...</code> alternatives that are useful for short<br />
setups. Also, they can be nested.<br />
<br />
<texcode><br />
\doifmode {modes} {content}<br />
\doifnotmode {modes} {content}<br />
\doifallmodes {modes} {content}<br />
\doifnotallmodes {modes} {content}<br />
</texcode><br />
The logic for determining when the content is processed is exactly the same as<br />
for the <code>start</code>-<code>stop</code> commands.<br />
<br />
These <code>\doif</code> commands each have a variant to process alternative code if<br />
the conditions are not satisfied (like the <code>\else</code> branch of <code>\if</code>).<br />
<texcode><br />
\doifmodeelse {modes} {content} {alt}<br />
\doifnotmodeelse {modes} {content} {alt}<br />
\doifallmodeselse {modes} {content} {alt}<br />
\doifnotallmodeselse{modes} {content} {alt}<br />
</texcode><br />
<br />
== Checking modes in Lua ==<br />
<br />
In MkIV, the state of any mode is accessible at the Lua end as <code>tex.modes</code> table. Specifically,<br />
<br />
<texcode><br />
tex.modes["screen"]<br />
</texcode><br />
<br />
returns <code>true</code> if mode <code>screen</code> is enabled and <code>false</code> otherwise. Thus, specific combinations of modes can be checked using boolean expressions. For example<br />
<texcode><br />
if (tex.modes["mode1"] and tex.modes["mode2"]) then<br />
...<br />
end<br />
</texcode><br />
checks if both <code>mode1</code> and <code>mode2</code> are enabled.<br />
<br />
'''Note''': This table was added in 2010.10.14 beta and is not available in earlier releases.<br />
<br />
= System modes =<br />
<br />
Besides allowing user-definable modes, ConTeXt provides some system<br />
modes. These modes start with a <code>*</code> character. Here <br />
only the more commonly used system modes are explained; see the ConTeXt [http://pragma-ade.com/general/manuals/mmodes.pdf modes manual]<br />
for a complete list.<br />
<br />
<br />
{|cellpadding="5" style="border-collapse: collapse;border-width: 1px; border-style: solid;"<br />
|'''*mkii'''<br />
| Enabled when running [[MkII]] <br />
|-<br />
| '''*mkiv''' <br />
| Enabled when running [[MkIV]]<br />
|} <br />
<br />
<br />
Perhaps the most useful system modes are <code>*mkii</code> and <code>*mkiv</code> which<br />
determine whether MKII or MKIV is being used. These modes are handy when you<br />
want different setups for MKII and MKIV.<br />
<br />
Other modes are useful for very specific situations. Some of these are described<br />
below.<br />
<br />
{|cellpadding="5" style="border-collapse: collapse;border-width: 1px; border-style: solid;"<br />
| '''*first'''<br />
| Enabled during the first compile run<br />
|}<br />
<br />
A document must be run multiple times to get the cross referencing,<br />
table of contents, etc.<br />
right. However, sometimes you need to do some external processing (e.g., graphic<br />
conversion) that only needs to be done once. In such cases, the<br />
<code>*first</code> mode is handy&mdash;it is active only on the first run of the<br />
document.<br />
<br />
{|cellpadding="5" style="border-collapse: collapse;border-width: 1px; border-style: solid;"<br />
|'''*project'''<br />
| Enabled when inside <code>\startproject</code> ... <code>\stopproject</code><br />
|-<br />
|'''*component'''<br />
| Enabled when inside <code>\startcomponent</code>...<code>\stopcomponent</code><br />
|-<br />
| '''*environment'''<br />
| Enabled when inside <code>\startenvironment</code> ... <code>\stopenvironment</code><br />
|-<br />
| '''*text'''<br />
| Enabled when inside <code>\starttext</code> ... <code>\stoptext</code>.<br />
|}<br />
<br />
You can use the project-product-component structure for managing large projects<br />
like a book series. See [[Project structure]]<br />
for details of this approach. A product or its components may be compiled<br />
separately, and you may want to do something different when a product is<br />
compiled or when a component is compiled. To do so, you need to check for<br />
modes <code>*project</code>, <code>*product</code>, <code>*component</code>, and<br />
<code>*environment</code>; these modes are set when the corresponding structure file<br />
is processed. For example, the <code>*product</code> mode is set whenever a<br />
product file is read; more specifically, when <code>\startproduct</code> is<br />
encountered. Similarly, a mode <code>*text</code> is enabled when<br />
<code>\starttext</code> is encountered, and likewise for the others.<br />
<br />
{|cellpadding="5" style="border-collapse: collapse;border-width: 1px; border-style: solid;"<br />
|'''*frontpart''' <br />
| Enabled when inside <code>\startfrontmatter</code> ... <code>\stopforntmatter</code><br />
|-<br />
| '''*bodypart'''<br />
| Enabled when inside <code>\startbodymatter</code> ... <code>\stopbodymatter</code><br />
|-<br />
| '''*backpart'''<br />
| Enabled when inside <code>\startbackmatter</code> ... <code>\stopbackmatter</code><br />
|}<br />
<br />
A large document is typically broken down into different section blocks:<br />
frontmatter, bodymatter, appendices, and backmatter. Internally, these section<br />
blocks are referred to as <code>frontpart</code>, <code>bodypart</code>, <code>appendix</code>, and<br />
<code>backpart</code>. Each section block sets a system mode with the same name. So,<br />
if you want macros that work differently in different section blocks, you can<br />
check for modes <code>*frontpart</code>, <code>*bodypart</code>, and so on.<br />
<br />
{|cellpadding="5" style="border-collapse: collapse;border-width: 1px; border-style: solid;"<br />
|'''*list'''<br />
| Enabled inside a list entry<br />
|-<br />
|'''*marking'''<br />
| Enabled inside a marking<br />
|-<br />
|'''*register'''<br />
| Enabled inside a register<br />
|-<br />
|'''*chapter''', '''*section''', etc.<br />
| Enabled inside the corresponding section head.<br />
|}<br />
<br />
<br />
Sometimes you want a macro to behave differently if it is part of a section head, a section number, a list, a marking, or a register. For section heads, you can check for modes <code>*chapter</code>, <code>*section</code>, <code>*subsection</code>, etc. Similarly, <code>*list<code> is enabled inside a list, <code>*marking</code> is enabled inside a marking, and <code>*register</code> is enabled inside a register.<br />
<br />
{|cellpadding="5" style="border-collapse: collapse;border-width: 1px; border-style: solid;"<br />
|'''*en-us''', '''*nl''', etc.<br />
| Enabled when the current <code>\language</code> is <code>en-us</code>, <code>nl</code>, etc.<br />
|-<br />
|'''**en-us''', '''**nl''', etc.<br />
| Enabled when the <code>\mainlanguage</code> is <code>en-us</code>, <code>nl</code>, etc.<br />
|}<br />
<br />
ConTeXt provides support for multiple languages. Languages are recognized by<br />
their IETF language tags, like <code>en-us</code> for US<br />
English, <code>en-gb</code><br />
for British English, <code>nl</code> for Dutch, <code>de</code> for German, etc. A document<br />
has a main language, set with the command <code>\mainlanguage[...]</code>,<br />
that is used for<br />
translated labels like <em>chapter</em> and <em>figure</em>. You can also switch the<br />
current language using <code>\language[...]</code> to change the hyphenation rules.<br />
Whenever a language is chosen, its identifier is set as a mode. The mode for the main<br />
language starts with two <code>*</code>. For example, when the main language<br />
is US<br />
English and the current language is Dutch, the modes <code>**en-us</code> and<br />
<code>*nl</code> are set (notice the extra <code>*</code> in <code>**en-us</code>). <br />
<br />
{|cellpadding="5" style="border-collapse: collapse;border-width: 1px; border-style: solid;"<br />
|'''*figure'''<br />
| Enabled when a graphic is found<br />
|-<br />
|'''*interaction'''<br />
| Enabled when interaction is enabled<br />
|-<br />
|'''*grid'''<br />
| Enabled when grid typesetting is enabled<br />
|}<br />
<br />
{|cellpadding="5" style="border-collapse: collapse;border-width: 1px; border-style: solid;"<br />
|'''*pdf'''<br />
| Enabled when the main output is pdf<br />
|-<br />
|'''*dvi'''<br />
| Enabled when the main output is dvi<br />
|}<br />
<br />
Other system modes: <code>*figure</code> is set when a graphic is found,<br />
<code>*interaction</code> is set when interaction is enabled, <code>*grid</code><br />
is set when grid typesetting is enabled, and <code>*pdf</code> and <code>*dvi</code> <br />
are set when the output is PDF or DVI. Others<br />
are too esoteric to describe here. If you are interested, see the <br />
modes manual mentioned earlier.<br />
<br />
= Specific Examples =<br />
<br />
== Different fonts ==<br />
<br />
Suppose you want to generate two versions of a document, one with times font and one with palatino. One way to do this is as follows:<br />
<br />
<texcode><br />
\startmode[palatino]<br />
\setupbodyfont[palatino,12pt]<br />
\stopmode<br />
<br />
\startmode[times]<br />
\setupbodyfont[postscript,12pt]<br />
\stopmode<br />
<br />
\starttext<br />
\input knuth<br />
\stoptext<br />
</texcode><br />
and run with one of the following:<br />
<br />
context --mode=palatino filename<br />
context --mode=times filename<br />
<br />
== Running external commands once ==<br />
<br />
Suppose you want to run some external program, say to generate a figure. Unfortunately, the program only generates postscript figure. So you want to convert it to pdf. This can be done as follows:<br />
<texcode><br />
\startmode[*first]<br />
% external program which creates a file fig-1.ps<br />
\executesystemcommand{some_external_program ...}<br />
% convert PS into PDF<br />
\executesystemcommand{texmfstart pstopdf fig-1.ps}<br />
\stopmode<br />
<br />
% include the resulting PDF<br />
\externalfigure[fig-1]<br />
</texcode><br />
<br />
== Handling multiple modes in a row ==<br />
<br />
Sometimes you have to choose between a couple of modes. One way to do this is <br />
the following: <br />
<br />
<texcode><br />
\doifmodeelse {one} { <br />
... <br />
} { <br />
\doifmodeelse {two} { <br />
...<br />
} { <br />
\doifmodeelse { three} { <br />
... etc ...<br />
} <br />
} <br />
} <br />
</texcode><br />
<br />
A more readable but also more efficient way is to use a modeset:<br />
<br />
<texcode><br />
\startmodeset<br />
[one] {1}<br />
[two] {2}<br />
[two] {2}<br />
[three] {3}<br />
[default] {?}<br />
\stopmodeset<br />
<br />
\startmodeset<br />
[one] {1}<br />
[three] {3}<br />
[default] {?}<br />
\stopmodeset<br />
<br />
\startmodeset<br />
[one] {<br />
\input tufte<br />
} <br />
[two] {<br />
\startmodeset<br />
[one] {A}<br />
[two] {B}<br />
[two] {B}<br />
[three] {C}<br />
[default] {!}<br />
\stopmodeset<br />
}<br />
[three,four] {<br />
\input zapf<br />
}<br />
[default] {<br />
\input ward<br />
}<br />
\stopmodeset<br />
</texcode><br />
<br />
The syntax is somewhat special but suits the purpose. It's a sort of<br />
case statement. There can be multiple references to the same mode and <br />
each match is honored. Of course the default only is used when no match <br />
has taken place. <br />
<br />
[[Category:ConTeXt programming]]</div>Hagenhttps://wiki.contextgarden.net/index.php?title=Scite&diff=13467Scite2011-11-09T18:32:54Z<p>Hagen: </p>
<hr />
<div>< [[Text Editors]] ><br />
<br />
=Nota bene=<br />
<br />
This page is outdated and describes the old installation and set of files. There<br />
is an updated manual: [http://www.pragma-ade.com/general/manuals/scite-context-readme.pdf scite-context-readme.pdf]. This file as well as all files needed are also part of the ConTeXt distribution.<br />
<br />
=Introduction=<br />
<br />
[http://www.scintilla.org/SciTE.html SciTE] is a [http://www.scintilla.org/ Scintilla] based text editor for Linux and Windows. Originally built to demonstrate Scintilla, it has grown to be a generally useful editor with facilities for building and running programs. The ConTeXt distribution includes files which can be used to configure SciTE for editing and building ConTeXt documents.<br />
<br />
See also the [http://www.pragma-ade.com/general/manuals/mscite-s.pdf manual mcite.pdf] for details of ConTeXt support. A non-native MacOS X version of SciTE is available via [http://www.macports.org/ MacPorts].<br />
<br />
=Installing SciTE for ConTeXt=<br />
<br />
==Installing on Windows==<br />
<br />
''Note. If you are installing ConTeXt and SciTe simultaneously and do not have any other TeX related systems on your Windows, you may prefer to follow the [[Simple Windows Installation]] instructions instead.''<br />
<br />
The following procedure has been found to work, assuming that the current ConTeXt distribution is installed in the folder C:\tools\context.<br />
<br />
* Download the SciTE Windows binaries from [http://www.scintilla.org/SciTEDownload.html SciTEDownload] to a suitable location on the target machine, e.g. C:\Tools\scite.<br />
<br />
* Copy the contents of C:\tools\context\texmf-context\context\data\scite to C:\tools\scite\wscite.<br />
<br />
* Create a batch file C:\Tools\scite\cscite.bat for use with SciTE. This runs setuptex.bat before launching SciTE. The contents of this batch file should be:<br />
<pre><br />
rem Use to start SciTE for ConTeXt<br />
@echo off<br />
c:<br />
cd \tools\context<br />
call setuptex<br />
cd \tools\scite\wscite<br />
start scite.exe %1%<br />
</pre><br />
<br />
* After initial installation, add the following to the SciTEGlobal.properties.<br />
<pre>import context</pre><br />
<br />
* Local settings are defined in SciTEUser.properties.<br />
<br />
Building a ConTeXt document is as simple as opening it in the editor and pressing [F7].<br />
<br />
<br />
==Configuring SciTe with ConTeXt on Windows==<br />
<br />
<br />
=== Building ConTeXt documents using MKII ===<br />
SciTE builds pdf using MKIV (luatex) by default, to change to MKII (pdftex) alter<br />
the file context.properties as follows:<br />
Replace the line<br />
<pre><br />
name.context.texexec=$(name.context.mtxrun) --script context $(name.texexec.flag.pdfopen)<br />
</pre><br />
with the line<br />
<pre><br />
name.context.texexec=$(name.context.mtxrun) --usekpse texexec $(name.texexec.flag.pdfopen)<br />
</pre><br />
<br />
=== Using [Cntrl-2] (Change PDF viewer) ===<br />
The default behaviour for [Cntrl-2] is to open a PDF using GhostView, to get it to use Acrobat Reader, proceed as follows:<br />
* Edit the file context.properties to include the line:<br />
<pre>name.context.acrobat=acrord32.exe</pre><br />
then edit the lines beginning "command.2" as follows:<br />
<pre><br />
command.2.$(file.patterns.context)=$(name.context.acrobat) $(FileDir)\$(FileName).pdf<br />
command.2.$(file.patterns.metafun)=<br />
command.2.$(file.patterns.example)=$(name.context.acrobat) $(FileDir)\$(FileName).pdf<br />
</pre><br />
* Make sure that the PATH environment variable includes the directory of the Acrobat executable (e.g. C:\Program Files\Adobe\Reader 8.0\Reader).<br />
<br />
=== Spell checking ===<br />
The spell checker can be configured as follows.<br />
<br />
* First, construct a word list, which is just a file containing all the valid words in your language! For English, a suitable word list can be constructed from files at [http://wordlist.sourceforge.net/ wordlist.sourceforge.net], e.g. concatenating all the files starting with english* and british* up to level 70 from the Scowl-6 group is one option.<br />
* Copy this new file to a suitable location, e.g. C:\tools\spell\spell-uk.txt<br />
* The automatic language detection does not seem to work, so edit scite-ctx.properties, replace the line:<br />
<pre><br />
ctx.spellcheck.language=auto<br />
</pre><br />
with this one<br />
<pre><br />
ctx.spellcheck.language=uk<br />
</pre><br />
* Add the environment variable CTXSPELLPATH and make it point to the location of the word lists (e.g. C:\tools\spell).<br />
* Restart SciTE, open a .tex file and press [Cntrl-B] to spell check the file. New words can be added to the word list, but you need to restart SciTE after each change.<br />
<br />
=== Using Latin Modern fixed-width font as SciTE display font ===<br />
<br />
The default font in SciTE is a variable-width sansserif (Arial or similar). If you prefer to use a fixed-width font while coding, the minimal distribution comes with a neat Latin Modern font for this purpose. You can find the font at<br />
''\yourcontextmainfolder''\texmf-context\fonts\truetype\hoekwater\lm\lmtypewriter10-regular.ttf<br />
<br />
The only thing you need to do is to install the font as you'd install any TrueType font in your Windows. If you SciTE is otherwise correctly set up, it'll automatically start using the new font.<br />
<br />
NB. It seems that this font doesn't have any Cyrillic, so add the font only if using just Roman letters.<br />
<br />
=== Forcing SciTE to use UTF-8 as default encoding ===<br />
<br />
If you plan to use SciTE only for ConTeXt or if all your files are in UTF-8 anyway, you can make UTF-8 as your default encoding. Especially if you start "from scratch", this is recommended!<br />
<br />
To change the encoding setting, open SciTE and go to ''Options'' and there to ''Open Global Properties''. Find ''Internationalisation'' in the settings file:<br />
<pre># Internationalisation<br />
# Japanese input code page 932 and ShiftJIS character set 128<br />
#code.page=932<br />
#character.set=128<br />
# Unicode<br />
#code.page=65001<br />
code.page=0<br />
#character.set=204</pre><br />
<br />
Now '''uncomment <tt>#code.page=65001</tt>''' (i.e. remove the hash sign) and '''comment <tt>code.page=0</tt>''' (i.e. add a hash in front of the line. Now your internationalisation settings should look like this:<br />
<pre><br />
# Internationalisation<br />
# Japanese input code page 932 and ShiftJIS character set 128<br />
#code.page=932<br />
#character.set=128<br />
# Unicode<br />
code.page=65001<br />
#code.page=0<br />
#character.set=204<br />
</pre><br />
Now save the settings file, close it, then close SciTE. When you restart SciTE, UTF-8 should be the default encoding.<br />
<br />
==Installing on Unix==<br />
Assuming you installed SciTE successfully and followed the instruction in the [http://www.pragma-ade.com/general/manuals/mscite-s.pdf manual] in order to enable ConTeXt support, there may be a problem in correctly using the Tools (like compiling and building from within SciTE). The launcher inside your Applications menu may be unaware of your $PATH variable, which might lead to an error like<br />
<br />
<pre><br />
>mtxrun --autogenerate --script context --pdf myfile.tex<br />
sh: mtxrun: not found<br />
>Exit code: 127<br />
</pre><br />
<br />
To correct this you need to create your own launcher, which executes a script (call it runscite) running SciTE whilst ensuring the $PATH variable is correctly set. You can achieve this by following the code<br />
<br />
<pre><br />
cat <<'EOF' > /tmp/runscite <br />
#!/bin/bash <br />
export PATH=/usr/local/texlive/2010/bin/x86_64-linux:$PATH<br />
exec scite $@ <br />
EOF<br />
<br />
chmod +x /tmp/runscite<br />
<br />
sudo cp /tmp/runscite /usr/local/bin<br />
</pre><br />
<br />
where the PATH needs to point to your mtxrun (and context) scripts. Then you can have your launcher use the command /usr/local/bin/runscite and then you should be able to build your *.tex files from within SciTE by pressing [F7].<br />
<br />
[[Category: Text Editors]]</div>Hagenhttps://wiki.contextgarden.net/index.php?title=Scite&diff=13466Scite2011-11-09T18:32:00Z<p>Hagen: </p>
<hr />
<div>< [[Text Editors]] ><br />
<br />
=Nota bene=<br />
<br />
This page is outdated and describes the old installation and set of files. There<br />
is an updated manual: [http://www.pragma-ade.com/general/manuals/scite-context-readme.pdf scite-context-readme.pdf]. <br />
<br />
=Introduction=<br />
<br />
[http://www.scintilla.org/SciTE.html SciTE] is a [http://www.scintilla.org/ Scintilla] based text editor for Linux and Windows. Originally built to demonstrate Scintilla, it has grown to be a generally useful editor with facilities for building and running programs. The ConTeXt distribution includes files which can be used to configure SciTE for editing and building ConTeXt documents.<br />
<br />
See also the [http://www.pragma-ade.com/general/manuals/mscite-s.pdf manual mcite.pdf] for details of ConTeXt support. A non-native MacOS X version of SciTE is available via [http://www.macports.org/ MacPorts].<br />
<br />
=Installing SciTE for ConTeXt=<br />
<br />
==Installing on Windows==<br />
<br />
''Note. If you are installing ConTeXt and SciTe simultaneously and do not have any other TeX related systems on your Windows, you may prefer to follow the [[Simple Windows Installation]] instructions instead.''<br />
<br />
The following procedure has been found to work, assuming that the current ConTeXt distribution is installed in the folder C:\tools\context.<br />
<br />
* Download the SciTE Windows binaries from [http://www.scintilla.org/SciTEDownload.html SciTEDownload] to a suitable location on the target machine, e.g. C:\Tools\scite.<br />
<br />
* Copy the contents of C:\tools\context\texmf-context\context\data\scite to C:\tools\scite\wscite.<br />
<br />
* Create a batch file C:\Tools\scite\cscite.bat for use with SciTE. This runs setuptex.bat before launching SciTE. The contents of this batch file should be:<br />
<pre><br />
rem Use to start SciTE for ConTeXt<br />
@echo off<br />
c:<br />
cd \tools\context<br />
call setuptex<br />
cd \tools\scite\wscite<br />
start scite.exe %1%<br />
</pre><br />
<br />
* After initial installation, add the following to the SciTEGlobal.properties.<br />
<pre>import context</pre><br />
<br />
* Local settings are defined in SciTEUser.properties.<br />
<br />
Building a ConTeXt document is as simple as opening it in the editor and pressing [F7].<br />
<br />
<br />
==Configuring SciTe with ConTeXt on Windows==<br />
<br />
<br />
=== Building ConTeXt documents using MKII ===<br />
SciTE builds pdf using MKIV (luatex) by default, to change to MKII (pdftex) alter<br />
the file context.properties as follows:<br />
Replace the line<br />
<pre><br />
name.context.texexec=$(name.context.mtxrun) --script context $(name.texexec.flag.pdfopen)<br />
</pre><br />
with the line<br />
<pre><br />
name.context.texexec=$(name.context.mtxrun) --usekpse texexec $(name.texexec.flag.pdfopen)<br />
</pre><br />
<br />
=== Using [Cntrl-2] (Change PDF viewer) ===<br />
The default behaviour for [Cntrl-2] is to open a PDF using GhostView, to get it to use Acrobat Reader, proceed as follows:<br />
* Edit the file context.properties to include the line:<br />
<pre>name.context.acrobat=acrord32.exe</pre><br />
then edit the lines beginning "command.2" as follows:<br />
<pre><br />
command.2.$(file.patterns.context)=$(name.context.acrobat) $(FileDir)\$(FileName).pdf<br />
command.2.$(file.patterns.metafun)=<br />
command.2.$(file.patterns.example)=$(name.context.acrobat) $(FileDir)\$(FileName).pdf<br />
</pre><br />
* Make sure that the PATH environment variable includes the directory of the Acrobat executable (e.g. C:\Program Files\Adobe\Reader 8.0\Reader).<br />
<br />
=== Spell checking ===<br />
The spell checker can be configured as follows.<br />
<br />
* First, construct a word list, which is just a file containing all the valid words in your language! For English, a suitable word list can be constructed from files at [http://wordlist.sourceforge.net/ wordlist.sourceforge.net], e.g. concatenating all the files starting with english* and british* up to level 70 from the Scowl-6 group is one option.<br />
* Copy this new file to a suitable location, e.g. C:\tools\spell\spell-uk.txt<br />
* The automatic language detection does not seem to work, so edit scite-ctx.properties, replace the line:<br />
<pre><br />
ctx.spellcheck.language=auto<br />
</pre><br />
with this one<br />
<pre><br />
ctx.spellcheck.language=uk<br />
</pre><br />
* Add the environment variable CTXSPELLPATH and make it point to the location of the word lists (e.g. C:\tools\spell).<br />
* Restart SciTE, open a .tex file and press [Cntrl-B] to spell check the file. New words can be added to the word list, but you need to restart SciTE after each change.<br />
<br />
=== Using Latin Modern fixed-width font as SciTE display font ===<br />
<br />
The default font in SciTE is a variable-width sansserif (Arial or similar). If you prefer to use a fixed-width font while coding, the minimal distribution comes with a neat Latin Modern font for this purpose. You can find the font at<br />
''\yourcontextmainfolder''\texmf-context\fonts\truetype\hoekwater\lm\lmtypewriter10-regular.ttf<br />
<br />
The only thing you need to do is to install the font as you'd install any TrueType font in your Windows. If you SciTE is otherwise correctly set up, it'll automatically start using the new font.<br />
<br />
NB. It seems that this font doesn't have any Cyrillic, so add the font only if using just Roman letters.<br />
<br />
=== Forcing SciTE to use UTF-8 as default encoding ===<br />
<br />
If you plan to use SciTE only for ConTeXt or if all your files are in UTF-8 anyway, you can make UTF-8 as your default encoding. Especially if you start "from scratch", this is recommended!<br />
<br />
To change the encoding setting, open SciTE and go to ''Options'' and there to ''Open Global Properties''. Find ''Internationalisation'' in the settings file:<br />
<pre># Internationalisation<br />
# Japanese input code page 932 and ShiftJIS character set 128<br />
#code.page=932<br />
#character.set=128<br />
# Unicode<br />
#code.page=65001<br />
code.page=0<br />
#character.set=204</pre><br />
<br />
Now '''uncomment <tt>#code.page=65001</tt>''' (i.e. remove the hash sign) and '''comment <tt>code.page=0</tt>''' (i.e. add a hash in front of the line. Now your internationalisation settings should look like this:<br />
<pre><br />
# Internationalisation<br />
# Japanese input code page 932 and ShiftJIS character set 128<br />
#code.page=932<br />
#character.set=128<br />
# Unicode<br />
code.page=65001<br />
#code.page=0<br />
#character.set=204<br />
</pre><br />
Now save the settings file, close it, then close SciTE. When you restart SciTE, UTF-8 should be the default encoding.<br />
<br />
==Installing on Unix==<br />
Assuming you installed SciTE successfully and followed the instruction in the [http://www.pragma-ade.com/general/manuals/mscite-s.pdf manual] in order to enable ConTeXt support, there may be a problem in correctly using the Tools (like compiling and building from within SciTE). The launcher inside your Applications menu may be unaware of your $PATH variable, which might lead to an error like<br />
<br />
<pre><br />
>mtxrun --autogenerate --script context --pdf myfile.tex<br />
sh: mtxrun: not found<br />
>Exit code: 127<br />
</pre><br />
<br />
To correct this you need to create your own launcher, which executes a script (call it runscite) running SciTE whilst ensuring the $PATH variable is correctly set. You can achieve this by following the code<br />
<br />
<pre><br />
cat <<'EOF' > /tmp/runscite <br />
#!/bin/bash <br />
export PATH=/usr/local/texlive/2010/bin/x86_64-linux:$PATH<br />
exec scite $@ <br />
EOF<br />
<br />
chmod +x /tmp/runscite<br />
<br />
sudo cp /tmp/runscite /usr/local/bin<br />
</pre><br />
<br />
where the PATH needs to point to your mtxrun (and context) scripts. Then you can have your launcher use the command /usr/local/bin/runscite and then you should be able to build your *.tex files from within SciTE by pressing [F7].<br />
<br />
[[Category: Text Editors]]</div>Hagenhttps://wiki.contextgarden.net/index.php?title=Project_structure&diff=13186Project structure2011-07-07T13:59:31Z<p>Hagen: </p>
<hr />
<div>< [[The ConTeXt Way]] | [[Structurals]] ><br />
<br />
ConTeXt knows no document classes (as LaTeX does). You can define your [[Layout|layout]] yourself. If you use the same layout for several products, save it as an '''environment''' file.<br />
<br />
How to split up a large project, say a book, in several handy parts? – Use ConTeXt's project management facilities.<br />
<br />
* a '''project''' links one or more '''products''' to their environment<br />
* a '''product''' contains several '''component'''s<br />
* an '''environment''' defines the common layout (etc.) of a project<br />
<br />
The environment could also contain [[Modes|different versions]] of the layout, e.g. print and screen (like Pragma's manuals) or final and correction etc.<br />
<br />
Example 1: Magazine<br />
* project: magazine<br />
* product: one volume of the magazine<br />
* component: a single article<br />
<br />
Example 2: Book<br />
* project: a series of books<br />
* product: one book<br />
* component: part or chapter<br />
<br />
[[Image:Project-structure.png]]<br />
<br />
If you tex (compile) one single component (e.g. a chapter of a book) or product (e.g. one volume of a magazine), the environment file of the project is used.<br />
<br />
In addition, you have to keep in mind that when compiling a product or component file, ConTeXt goes "up" to the project file and compiles everything it finds in there that is not a <cmd>product</cmd> (e.g. table of content, sectioning commands, text, <cmd>component</cmd> etc.). So all the things on project level have to be put inside a <cmd>product</cmd>, otherwise they will show up in the individual components (or products), too. That also makes it problematic to use <cmd>component</cmd> directly inside a project file, i.e. you have to use <cmd>product</cmd>, you can't skip it.<br />
<br />
[[User:Hraban|Hraban]] uses and suggests the following naming conventions<br />
* project_foo<br />
* prd_foo<br />
* c_foo<br />
* env_foo<br />
<br />
'''Project'''<br />
<texcode><br />
\startproject project_mymag<br />
\environment env_mymag % only mentioned here!<br />
<br />
\product prd_year2004-01<br />
\product prd_year2004-02<br />
\product prd_year2004-03<br />
\product prd_year2004-04<br />
<br />
\product tableofcontent<br />
<br />
\stopproject<br />
</texcode><br />
<br />
'''Environment'''<br />
<texcode><br />
\startenvironment env_mymag<br />
<br />
\setuplayout[...]<br />
% all setups...<br />
<br />
\stopenvironment<br />
</texcode><br />
<br />
'''Product'''<br />
<texcode><br />
\startproduct prd_year2004-01<br />
\project project_mymag<br />
<br />
\component c_editorial<br />
\component c_article01<br />
\component c_article_by_me<br />
% ...<br />
<br />
\stopproduct<br />
</texcode><br />
<br />
'''Component'''<br />
<texcode><br />
\startcomponent c_editorial<br />
\product prd_year2004-01 % but you can use it in other products anyway<br />
\project project_mymag<br />
<br />
\title{Editorial}<br />
<br />
Dear reader...<br />
<br />
\stopcomponent<br />
</texcode><br />
<br />
There's a Python script <tt>contextproject.py</tt> at Hraban's [http://github.com/fiee/tools/blob/master/contextproject.py github repository] to help creating the files (.ini files can be used for initial content). This functionality would be nice to be integrated in any editor supporting ConTeXt...<br />
<br />
'''Summary (for MkIV)'''<br />
<br />
Depending on the (start-stop) environment a command will either load a file once, or many times or not at all. The following table specifies what happens when: <br />
<br />
{|<br />
| || <cmd>project</cmd> || <cmd>environment</cmd> || <cmd>product</cmd> || <cmd>component</cmd> <br />
|-<br />
| <cmd>starttext</cmd> || once || once || once || many <br />
|-<br />
| <cmd>startproject</cmd> || once || none || once || none <br />
|-<br />
| <cmd>startenvironment</cmd> || once || none || once || none <br />
|-<br />
| <cmd>startproduct</cmd> || once || once || once || none <br />
|-<br />
| <cmd>startcomponent</cmd> || once || once || once || none <br />
|}</div>Hagenhttps://wiki.contextgarden.net/index.php?title=Units&diff=13185Units2011-07-07T13:45:41Z<p>Hagen: /* Using the built-in command */</p>
<hr />
<div>< [[Math]] [[Physics]] ><br />
<br />
The units module comes with ConTeXt's default distribution, and can be accessed via <cmd>usemodule</cmd>[units].<br />
<br />
However, in MkIV we have integrated an upgrade to this mechanism so if you're using that version you might want to skip this first part. <br />
<br />
The following is copied from the source file [[source:m-units.tex|m-units.tex]] and only slightly modified:<br />
<br />
----<br />
<br />
* Scientific units can be typeset in math mode pretty well, but occasionally one has to take care of spacing.<br />
Furthermore, entering these units is not that natural as wanted. Therefore this module presents a more natural way of doing things, like:<br />
<br />
<context source="yes"><br />
\usemodule[units]<br />
1.23 \Cubic \Meter \Per \Second<br />
</context><br />
<br />
This example shows that we use the order in which we say things, instead of typeset things. There is no dedicated manual for this module, but an article (in dutch) <br />
has been published in [[http://www.ntg.nl/maps/pdf/21_16.pdf Maps#21]], the journal of the NTG.<br />
<br />
<br />
* This runtime loadable module implements a way of defining units. The core macro is <cmd>dimension</cmd>, a rather clever one that is able to cooperate with some other dimension related macros. As said, this module enables user to enter:<br />
<br />
<context source="yes"><br />
\usemodule[units]<br />
Some 10 \Square \Meter \Per \Second\ or more.<br />
</context><br />
<br />
(Note that the space after <cmd>Second</cmd> needs to be explicitly specified; otherwise, it will get eaten.)<br />
<br />
<br />
* Units act upon signals that they insert in the text, in case no quantity is given you need to start the unit sequence using <cmd>Unit</cmd><br />
<br />
<context source="yes"><br />
\usemodule[units]<br />
Units of measurement is \Unit \Milli \Meter<br />
</context><br />
<br />
The units itself are implemented as synonyms.<br />
<br />
<texcode><br />
\definesynonyms [unit] [units] [\unitmeaning]<br />
\setupsynonyms [unit] [textstyle=\dimension]<br />
</texcode><br />
<br />
This definition means that we can ask for the meaning of a unit using <cmd>unitmeaning</cmd> and get a list of used units by saying <cmd>placelistofunits</cmd>.<br />
<br />
We have to use the command <cmd>unitmeaning</cmd> instead of <cmd>meaning</cmd>, simply because the latter is a TeX primitive we don't want to lose. We use the label text mechanism for translations.<br />
<br />
----<br />
<br />
===Macros defined in units===<br />
<br />
External link: <br />
[[http://www.unc.edu/~rowlett/units/index.html How Many? A Dictionary of Units of Measurement]]<br />
<br />
* Prefixes: <cmd>Atto</cmd> a, <cmd>Femto</cmd> f, <cmd>Pico</cmd> p, <cmd>Nano</cmd> n, <cmd>Micro</cmd> μ, <cmd>Milli</cmd> m, <cmd>Centi</cmd> c, <cmd>Deci</cmd> d, <cmd>Hecto</cmd> h, <cmd>Kilo</cmd> k, <cmd>Mega</cmd> M, <cmd>Giga</cmd> G, <cmd>Tera</cmd> T, <cmd>Peta</cmd> P, <cmd>Exa</cmd> E (missing: <cmd>Zetta</cmd> Z, <cmd>Yotta</cmd> Y, <cmd>Zepto</cmd> z, <cmd>Yocto</cmd> y)<br />
* Suffixes: <cmd>Linear</cmd> <sup>1</sup>, <cmd>Square</cmd> <sup>2</sup>, <cmd>Cubic</cmd> <sup>3</sup>, <cmd>Inverse</cmd> or <cmd>ILinear</cmd> <sup>-1</sup>, <cmd>ISquare</cmd> <sup>-2</sup>, <cmd>ICubic</cmd> <sup>-3</sup><br />
* Fraction: <cmd>Per</cmd>, <cmd>Percent</cmd>, <cmd>Permille</cmd>, <cmd>Promille</cmd><br />
* Time: <cmd>Second</cmd>, <cmd>Minute</cmd>, <cmd>Hour</cmd>, <cmd>Day</cmd>, <cmd>Month</cmd>, <cmd>Year</cmd><br />
* Length, Area, Volume: <cmd>Meter</cmd>, <cmd>Angstrom</cmd>, <cmd>Foot</cmd>, <cmd>Inch</cmd>, <cmd>Liter</cmd><br />
* Mass, Force and Pressure: <cmd>Gram</cmd>, <cmd>Atom</cmd>, <cmd>Newton</cmd>, <cmd>Pascal</cmd>, <cmd>Mol</cmd>, <cmd>At</cmd>, <cmd>Atm</cmd>, <cmd>Bar</cmd>, <cmd>Force</cmd><br />
* Energy, Electricity and Magnetism: <cmd>Joule</cmd>, <cmd>Watt</cmd>, <cmd>Cal</cmd>, <cmd>Farad</cmd>, <cmd>Henry</cmd>, <cmd>Ohm</cmd>, <cmd>Siemens</cmd>, <cmd>Ampere</cmd>, <cmd>Coulomb</cmd>, <cmd>Volt</cmd>, <cmd>Tesla</cmd>, <cmd>Gauss</cmd>, <cmd>VoltAC</cmd>, <cmd>VoltDC</cmd>, <cmd>EVolt</cmd>, <cmd>Weber</cmd><br />
* Temperature: <cmd>Degrees</cmd>, <cmd>Kelvin</cmd>, <cmd>Celsius</cmd>, <cmd>Fahrenheit</cmd><br />
* Angle: <cmd>Rad</cmd>, <cmd>Deg</cmd>, <cmd>Sterant</cmd><br />
* Frequency, Optics and Acoustics: <cmd>Hertz</cmd>, <cmd>RevPerSec</cmd>, <cmd>RevPerMin</cmd>, <cmd>Candela</cmd>, <cmd>Lux</cmd>, <cmd>Bell</cmd><br />
* Chemistry and Radiation: <cmd>Atom</cmd>, <cmd>Mol</cmd>, <cmd>Molair</cmd>, <cmd>Equivalent</cmd>, <cmd>Bequerel</cmd>, <cmd>Sievert</cmd>, <cmd>Gray</cmd><br />
* Informatics: <cmd>Baud</cmd>, <cmd>Bit</cmd>, <cmd>Byte</cmd><br />
* some old dutch (not listed)<br />
<br />
===Using the built-in command===<br />
<br />
In MkIV you can use the built-in <cmd>unit</cmd> command. This time we don't use commands, if only because it is somewhat cumbersome. Let's give a few examples: <br />
<br />
<texcode><br />
10 \unit{km/h}<br />
\unit{10 km/h}<br />
\unit{~1 km/h}<br />
\unit{KiloMeter/Hour}<br />
\unit{10 cubic meter / second}<br />
\unit{kilo pascal square meter / second}<br />
\unit{kilo pascal square meter / kelvin second }$<br />
\unit{10 AC}<br />
$\frac{10 \unit{m/s}}{20 \unit{m/s}}$<br />
{\ss 30 \unit{kilo pascal square meter / second kelvin}}<br />
\unit{123.22^-3 km/s}<br />
\unit{123.22e-3 km/s}<br />
</texcode><br />
<br />
The command works in text as well as in math mode and spaces are normally ignored. You can define your own command: <br />
<br />
<texcode><br />
\defineunits[un][alternative=text,separator=medium]<br />
</texcode><br />
<br />
Valid separators are <code>cdot</code>, <code>big</code>, <code>medium</code>, and <code>space</code> with the first being the default. You can later tune the rendering with <br />
<br />
<texcode><br />
\setupunits[un][separator=cdot]<br />
</texcode><br />
<br />
In due time there will be a few more options. Numbers are formatted cf the digits mechanism (not discussed here). <br />
<br />
[[Category:Math]]<br />
[[Category:Physics]]<br />
[[Category:Modules]]</div>Hagenhttps://wiki.contextgarden.net/index.php?title=Units&diff=13184Units2011-07-07T13:45:06Z<p>Hagen: </p>
<hr />
<div>< [[Math]] [[Physics]] ><br />
<br />
The units module comes with ConTeXt's default distribution, and can be accessed via <cmd>usemodule</cmd>[units].<br />
<br />
However, in MkIV we have integrated an upgrade to this mechanism so if you're using that version you might want to skip this first part. <br />
<br />
The following is copied from the source file [[source:m-units.tex|m-units.tex]] and only slightly modified:<br />
<br />
----<br />
<br />
* Scientific units can be typeset in math mode pretty well, but occasionally one has to take care of spacing.<br />
Furthermore, entering these units is not that natural as wanted. Therefore this module presents a more natural way of doing things, like:<br />
<br />
<context source="yes"><br />
\usemodule[units]<br />
1.23 \Cubic \Meter \Per \Second<br />
</context><br />
<br />
This example shows that we use the order in which we say things, instead of typeset things. There is no dedicated manual for this module, but an article (in dutch) <br />
has been published in [[http://www.ntg.nl/maps/pdf/21_16.pdf Maps#21]], the journal of the NTG.<br />
<br />
<br />
* This runtime loadable module implements a way of defining units. The core macro is <cmd>dimension</cmd>, a rather clever one that is able to cooperate with some other dimension related macros. As said, this module enables user to enter:<br />
<br />
<context source="yes"><br />
\usemodule[units]<br />
Some 10 \Square \Meter \Per \Second\ or more.<br />
</context><br />
<br />
(Note that the space after <cmd>Second</cmd> needs to be explicitly specified; otherwise, it will get eaten.)<br />
<br />
<br />
* Units act upon signals that they insert in the text, in case no quantity is given you need to start the unit sequence using <cmd>Unit</cmd><br />
<br />
<context source="yes"><br />
\usemodule[units]<br />
Units of measurement is \Unit \Milli \Meter<br />
</context><br />
<br />
The units itself are implemented as synonyms.<br />
<br />
<texcode><br />
\definesynonyms [unit] [units] [\unitmeaning]<br />
\setupsynonyms [unit] [textstyle=\dimension]<br />
</texcode><br />
<br />
This definition means that we can ask for the meaning of a unit using <cmd>unitmeaning</cmd> and get a list of used units by saying <cmd>placelistofunits</cmd>.<br />
<br />
We have to use the command <cmd>unitmeaning</cmd> instead of <cmd>meaning</cmd>, simply because the latter is a TeX primitive we don't want to lose. We use the label text mechanism for translations.<br />
<br />
----<br />
<br />
===Macros defined in units===<br />
<br />
External link: <br />
[[http://www.unc.edu/~rowlett/units/index.html How Many? A Dictionary of Units of Measurement]]<br />
<br />
* Prefixes: <cmd>Atto</cmd> a, <cmd>Femto</cmd> f, <cmd>Pico</cmd> p, <cmd>Nano</cmd> n, <cmd>Micro</cmd> μ, <cmd>Milli</cmd> m, <cmd>Centi</cmd> c, <cmd>Deci</cmd> d, <cmd>Hecto</cmd> h, <cmd>Kilo</cmd> k, <cmd>Mega</cmd> M, <cmd>Giga</cmd> G, <cmd>Tera</cmd> T, <cmd>Peta</cmd> P, <cmd>Exa</cmd> E (missing: <cmd>Zetta</cmd> Z, <cmd>Yotta</cmd> Y, <cmd>Zepto</cmd> z, <cmd>Yocto</cmd> y)<br />
* Suffixes: <cmd>Linear</cmd> <sup>1</sup>, <cmd>Square</cmd> <sup>2</sup>, <cmd>Cubic</cmd> <sup>3</sup>, <cmd>Inverse</cmd> or <cmd>ILinear</cmd> <sup>-1</sup>, <cmd>ISquare</cmd> <sup>-2</sup>, <cmd>ICubic</cmd> <sup>-3</sup><br />
* Fraction: <cmd>Per</cmd>, <cmd>Percent</cmd>, <cmd>Permille</cmd>, <cmd>Promille</cmd><br />
* Time: <cmd>Second</cmd>, <cmd>Minute</cmd>, <cmd>Hour</cmd>, <cmd>Day</cmd>, <cmd>Month</cmd>, <cmd>Year</cmd><br />
* Length, Area, Volume: <cmd>Meter</cmd>, <cmd>Angstrom</cmd>, <cmd>Foot</cmd>, <cmd>Inch</cmd>, <cmd>Liter</cmd><br />
* Mass, Force and Pressure: <cmd>Gram</cmd>, <cmd>Atom</cmd>, <cmd>Newton</cmd>, <cmd>Pascal</cmd>, <cmd>Mol</cmd>, <cmd>At</cmd>, <cmd>Atm</cmd>, <cmd>Bar</cmd>, <cmd>Force</cmd><br />
* Energy, Electricity and Magnetism: <cmd>Joule</cmd>, <cmd>Watt</cmd>, <cmd>Cal</cmd>, <cmd>Farad</cmd>, <cmd>Henry</cmd>, <cmd>Ohm</cmd>, <cmd>Siemens</cmd>, <cmd>Ampere</cmd>, <cmd>Coulomb</cmd>, <cmd>Volt</cmd>, <cmd>Tesla</cmd>, <cmd>Gauss</cmd>, <cmd>VoltAC</cmd>, <cmd>VoltDC</cmd>, <cmd>EVolt</cmd>, <cmd>Weber</cmd><br />
* Temperature: <cmd>Degrees</cmd>, <cmd>Kelvin</cmd>, <cmd>Celsius</cmd>, <cmd>Fahrenheit</cmd><br />
* Angle: <cmd>Rad</cmd>, <cmd>Deg</cmd>, <cmd>Sterant</cmd><br />
* Frequency, Optics and Acoustics: <cmd>Hertz</cmd>, <cmd>RevPerSec</cmd>, <cmd>RevPerMin</cmd>, <cmd>Candela</cmd>, <cmd>Lux</cmd>, <cmd>Bell</cmd><br />
* Chemistry and Radiation: <cmd>Atom</cmd>, <cmd>Mol</cmd>, <cmd>Molair</cmd>, <cmd>Equivalent</cmd>, <cmd>Bequerel</cmd>, <cmd>Sievert</cmd>, <cmd>Gray</cmd><br />
* Informatics: <cmd>Baud</cmd>, <cmd>Bit</cmd>, <cmd>Byte</cmd><br />
* some old dutch (not listed)<br />
<br />
===Using the built-in command===<br />
<br />
In MkIV you can use the built-in <cmd>unit</cmd> command. This time we don't use commands, if only because it is somewhat cumbersome. Let's give a few examples: <br />
<br />
<texcode><br />
10 \unit{km/h}<br />
\unit{10 km/h}<br />
\unit{~1 km/h}<br />
\unit{KiloMeter/Hour}<br />
\unit{10 cubic meter / second}<br />
\unit{kilo pascal square meter / second}<br />
\unit{kilo pascal square meter / kelvin second }$<br />
\unit{10 AC}<br />
$\frac{10 \unit{m/s}}{20 \unit{m/s}}$<br />
{\ss 30 \unit{kilo pascal square meter / second kelvin}}<br />
\unit{123.22^-3 km/s}<br />
\unit{123.22e-3 km/s}<br />
</texcode><br />
<br />
The command works in text as well as in math mode and spaces are normally ignored. You can define your own command: <br />
<br />
<texcode><br />
\defineunits[un][alternative=text,separator=medium]<br />
</texcode><br />
<br />
Valid separators are <code>cdot</code>, <code>big</code>, <code>medium</code>, and <code>space</code> with the first being the default. You can later tune the rendering with <br />
<br />
<texcode><br />
\setupunits[un][separator=cdot]<br />
</texcode><br />
<br />
In due time there will be a few more options. Numbers are formatted cf the digits mechanism (not discussed here). <br />
<br />
[[Category:Math]]<br />
[[Category:Modules]]</div>Hagenhttps://wiki.contextgarden.net/index.php?title=Epub&diff=13155Epub2011-06-24T23:35:09Z<p>Hagen: /* Additional tagging */</p>
<hr />
<div>ConTeXt has preliminary [http://en.wikipedia.org/wiki/EPUB epub] support starting from [[Context 2011.05.18 | current 2011.05.18]].<br />
<br />
<br />
In order to make an epub (archive) from your ConTeXt source files, you need to:<br />
<br />
# enable the export backend in your <code>.tex</code> file or environment file (see [[Project structure]])<br />
# call the appropriate <code>mtxrun</code> command (with the epub script) shown in the output of a context run or in the log file<br />
<br />
<br />
'''Note:''' There is no support for graphics yet, that will be included in a later version.<br />
<br />
== Export ==<br />
<br />
To enable the export backend, depending on your needs, one of the following lines has to be included at the beginning of the document (before <cmd>starttext</cmd>).<br />
<br />
<texcode><br />
\setupbackend[export=yes]<br />
\setupbackend[export=yes,xhtml=yes]<br />
\setupbackend[export=yes,xhtml=whatever.xhtml]<br />
\setupbackend[export=yes,css={whatever.css,somemore.css}]<br />
</texcode><br />
<br />
The backend can export into:<br />
<br />
* xml<br />
* xhtml<br />
* xhtml+css<br />
<br />
''For making an epub, you need an xhtml export.''<br />
<br />
When using a css file, images are supported using an extra css file <code>*-images.css</code>. Images with suffix <code>pdf</code> are remapped to <code>svg</code> but <code>png</code> and <code>jpg</code> are passed on.<br />
<br />
You can add metadata using the following command:<br />
<br />
<texcode><br />
\settaggedmetadata<br />
[title=My Document,<br />
author=By Me,<br />
version=1.0]<br />
</texcode><br />
<br />
You are free to choose keys. Metadata is flushed as child of the next element.<br />
<br />
== The example file ==<br />
<br />
It is also possible to hook css into the output, see thread: [http://www.ntg.nl/pipermail/ntg-context/2011/058907.html ntg-context]. The distribution has a test file <code>export-example.tex</code>. This file exports conforming: <br />
<br />
<texcode><br />
\setupbackend<br />
[export=export-example.xml,<br />
xhtml=export-example.xhtml,<br />
css=export-example.css]<br />
</texcode><br />
<br />
This file shows some of the possibilities. You will notice that it is a rather normal context file. When the file is processed, you can create an epub file with: <br />
<br />
<texcode><br />
mtxrun --script epub --make export-example<br />
</texcode><br />
<br />
== Additional tagging == <br />
<br />
You can mark sections that don't need to be exported: <br />
<br />
<texcode><br />
\startelement[ignore]<br />
<br />
titlepage makeup <br />
<br />
\stopelement<br />
</texcode><br />
<br />
You can also add data: <br />
<br />
<texcode><br />
\settaggedmetadata[name=Me]<br />
<br />
\startchapter[title=...]<br />
....<br />
\stopchapter<br />
</texcode><br />
<br />
In this case the data will be injected just after the start of the chapter tag. So, if you want to have document level metadata, you need to put the set command before <cmd>starttext</cmd>.<br />
<br />
== Document styling == <br />
<br />
Some style elements are exported to an additional css file and a reference to that file is automatically added. You can exercise some control over the general document rendering: <br />
<br />
<texcode><br />
\setupexport<br />
[bodyfont=12pt,<br />
width=600pt,<br />
%align=flushleft,<br />
hyphen=yes]<br />
</texcode><br />
<br />
The last option makes sure that the export has enough information to do a reasonable hyohenation. Future versions of the exported might provide some more control.<br />
<br />
== Mtxrun ==<br />
<br />
The actual generation of the epub can be triggered with the <code>mtxrun</code> command shown in the output.<br />
<br />
Example log entry:<br />
<br />
...<br />
backend > export > saving xml data in 'oeps.export<br />
backend > export > saving css template in 'oeps.template<br />
backend > export > saving xhtml variant in 'oeps.xhtml<br />
backend > export > saving specification in 'oeps.specification' (mtxrun --script epub --make oeps.specification)<br />
...<br />
<br />
The "oeps" will be replaced with the appropriate name given to the export backend.<br />
<br />
Therefore, execute:<br />
<br />
mtxrun --script epub --make oeps.specification<br />
<br />
This will create an ''oeps.tree'' folder with an ''oeps.epub'' inside it. When pdf images are used and no suitable svg alternative is present inkscape will be used to create the svg file. <br />
<br />
More on this on the mailing list, thread starts at: [http://www.ntg.nl/pipermail/ntg-context/2011/058996.html ntg-context].<br />
<br />
== Minimal Example ==<br />
<br />
<texcode><br />
\setupbackend[export=yes,xhtml=test.xhtml]<br />
\starttext<br />
Hello world!<br />
\stoptext<br />
</texcode><br />
<br />
== Tools ==<br />
<br />
Viewer:<br />
* [http://calibre-ebook.com/ calibre]<br />
* [http://www.epubread.com/ EPUBReader for Firefox] (also does mathml) <br />
* [http://www.fbreader.org/ FBReader]<br />
* ''[http://www.adobe.com/products/digitaleditions/ Adobe Digital Editions]''<br />
<br />
Online:<br />
* [http://bookworm.oreilly.com/ bookworm]<br />
<br />
Editor:<br />
* [http://code.google.com/p/sigil/ sigil]<br />
<br />
Validation:<br />
* [http://code.google.com/p/epubcheck/ EpubCheck]<br />
* [http://www.amazon.com/gp/feature.html?docId=1000234621 KindleGen]<br />
<br />
Specification:<br />
* [http://idpf.org/epub epub 2/3]<br />
<br />
== Current Issues ==<br />
<br />
As of 08:41, 16 June 2011 (CEST):<br />
<br />
<table><br />
<tr style="background:#cccccc;"><br />
<td>tool</td><br />
<td>description</td><br />
<td>error</td><br />
</tr><br />
<tr><br />
<td><code>[https://gist.github.com/1013262 mtx-epub.lua]</code></td><br />
<td>OPF 2.0.1</td><br />
<td>amazoncover, bookid, id & ncx fix</td><br />
</tr><br />
<tr><br />
<td style="border-top: 1px solid black">epubcheck-1.2</td><br />
<td style="border-top: 1px solid black">OPS 2.0.1</td><br />
<td style="border-top: 1px solid black"><code>test.xhtml</code>: <code><document></code><br />elements from namespace "" are not allowed<br />xhtml DOCTYPE missing, html + body elements</td><br />
</tr><br />
<tr><br />
<td>epubreader</td><br />
<td>OPS 2.0.1</td><br />
<td>This XML file does not appear to have any style information associated with it.</td><br />
</tr><br />
<tr><br />
<td>kindlegen</td><br />
<td>OPS 2.0.1</td><br />
<td>No BODY tag found in content file.</td><br />
</tr><br />
</table><br />
<br />
<br />
<table><br />
<tr style="background:#cccccc;"><br />
<td>feature</td><br />
<td>description</td><br />
</tr><br />
<tr><br />
<td>metadata</td><br />
<td>add author and title to local:package and local:navigation (mtx-epub.lua)</td><br />
</tr><br />
<tr><br />
<td>cover</td><br />
<td>add [http://code.google.com/p/epubcheck/issues/detail?id=74 cover element], 600×800 (min. 500) for amazon</td><br />
</tr><br />
<tr><br />
<td>toc</td><br />
<td>table of contents is missing</td><br />
</tr><br />
<tr><br />
<td>chapter break</td><br />
<td>new title element → new xhtml</td><br />
</tr><br />
</table></div>Hagenhttps://wiki.contextgarden.net/index.php?title=Epub&diff=13116Epub2011-06-17T15:01:04Z<p>Hagen: /* The example file */</p>
<hr />
<div>ConTeXt has preliminary [http://en.wikipedia.org/wiki/EPUB epub] support starting from [[Context 2011.05.18 | current 2011.05.18]].<br />
<br />
<br />
In order to make an epub (archive) from your ConTeXt source files, you need to:<br />
<br />
# enable the export backend in your <code>.tex</code> file or environment file (see [[Project structure]])<br />
# call the appropriate <code>mtxrun</code> command (with the epub script) shown in the output of a context run or in the log file<br />
<br />
<br />
'''Note:''' There is no support for graphics yet, that will be included in a later version.<br />
<br />
== Export ==<br />
<br />
To enable the export backend, depending on your needs, one of the following lines has to be included at the beginning of the document (before <cmd>starttext</cmd>).<br />
<br />
<texcode><br />
\setupbackend[export=yes]<br />
\setupbackend[export=yes,xhtml=yes]<br />
\setupbackend[export=yes,xhtml=whatever.xhtml]<br />
\setupbackend[export=yes,css={whatever.css,somemore.css}]<br />
</texcode><br />
<br />
The backend can export into:<br />
<br />
* xml<br />
* xhtml<br />
* xhtml+css<br />
<br />
''For making an epub, you need an xhtml export.''<br />
<br />
When using a css file, images are supported using an extra css file <code>*-images.css</code>. Images with suffix <code>pdf</code> are remapped to <code>svg</code> but <code>png</code> and <code>jpg</code> are passed on.<br />
<br />
You can add metadata using the following command:<br />
<br />
<texcode><br />
\settaggedmetadata<br />
[title=My Document,<br />
author=By Me,<br />
version=1.0]<br />
</texcode><br />
<br />
You are free to choose keys. Metadata is flushed as child of the next element.<br />
<br />
== The example file ==<br />
<br />
It is also possible to hook css into the output, see thread: [http://www.ntg.nl/pipermail/ntg-context/2011/058907.html ntg-context]. The distribution has a test file <code>export-example.tex</code>. This file exports conforming: <br />
<br />
<texcode><br />
\setupbackend<br />
[export=export-example.xml,<br />
xhtml=export-example.xhtml,<br />
css=export-example.css]<br />
</texcode><br />
<br />
This file shows some of the possibilities. You will notice that it is a rather normal context file. When the file is processed, you can create an epub file with: <br />
<br />
<texcode><br />
mtxrun --script epub --make export-example<br />
</texcode><br />
<br />
== Additional tagging == <br />
<br />
You can mark sections that don't need to be exported: <br />
<br />
<texcode><br />
\startelement[ignore]<br />
<br />
titlepage makeup <br />
<br />
\stopelement<br />
</texcode><br />
<br />
You can also add data: <br />
<br />
<texcode><br />
\settaggedmetadata[name=Me]<br />
<br />
\startchapter[title=...]<br />
....<br />
\stopchapter<br />
<br />
</texcode><br />
<br />
In this case the data will be injected just after the start of the chapter tag. So, if you want to have document level metadata, you need to put the set command before <cmd>starttext</cmd>.<br />
<br />
== Mtxrun ==<br />
<br />
The actual generation of the epub can be triggered with the <code>mtxrun</code> command shown in the output.<br />
<br />
Example log entry:<br />
<br />
...<br />
backend > export > saving xml data in 'oeps.export<br />
backend > export > saving css template in 'oeps.template<br />
backend > export > saving xhtml variant in 'oeps.xhtml<br />
backend > export > saving specification in 'oeps.specification' (mtxrun --script epub --make oeps.specification)<br />
...<br />
<br />
The "oeps" will be replaced with the appropriate name given to the export backend.<br />
<br />
Therefore, execute:<br />
<br />
mtxrun --script epub --make oeps.specification<br />
<br />
This will create an ''oeps.tree'' folder with an ''oeps.epub'' inside it. When pdf images are used and no suitable svg alternative is present inkscape will be used to create the svg file. <br />
<br />
More on this on the mailing list, thread starts at: [http://www.ntg.nl/pipermail/ntg-context/2011/058996.html ntg-context].<br />
<br />
== Minimal Example ==<br />
<br />
<texcode><br />
\setupbackend[export=yes,xhtml=test.xhtml]<br />
\starttext<br />
Hello world!<br />
\stoptext<br />
</texcode><br />
<br />
== Tools ==<br />
<br />
Viewer:<br />
* [http://calibre-ebook.com/ calibre]<br />
* [http://www.epubread.com/ EPUBReader for Firefox] (also does mathml) <br />
* [http://www.fbreader.org/ FBReader]<br />
* ''[http://www.adobe.com/products/digitaleditions/ Adobe Digital Editions]''<br />
<br />
Online:<br />
* [http://bookworm.oreilly.com/ bookworm]<br />
<br />
Editor:<br />
* [http://code.google.com/p/sigil/ sigil]<br />
<br />
Validation:<br />
* [http://code.google.com/p/epubcheck/ EpubCheck]<br />
* [http://www.amazon.com/gp/feature.html?docId=1000234621 KindleGen]<br />
<br />
Specification:<br />
* [http://idpf.org/epub epub 2/3]<br />
<br />
== Current Issues ==<br />
<br />
As of 08:41, 16 June 2011 (CEST):<br />
<br />
<table><br />
<tr style="background:#cccccc;"><br />
<td>tool</td><br />
<td>description</td><br />
<td>error</td><br />
</tr><br />
<tr><br />
<td><code>[https://gist.github.com/1013262 mtx-epub.lua]</code></td><br />
<td>OPF 2.0.1</td><br />
<td>amazoncover, bookid, id & ncx fix</td><br />
</tr><br />
<tr><br />
<td style="border-top: 1px solid black">epubcheck-1.2</td><br />
<td style="border-top: 1px solid black">OPS 2.0.1</td><br />
<td style="border-top: 1px solid black"><code>test.xhtml</code>: <code><document></code><br />elements from namespace "" are not allowed<br />xhtml DOCTYPE missing, html + body elements</td><br />
</tr><br />
<tr><br />
<td>epubreader</td><br />
<td>OPS 2.0.1</td><br />
<td>This XML file does not appear to have any style information associated with it.</td><br />
</tr><br />
<tr><br />
<td>kindlegen</td><br />
<td>OPS 2.0.1</td><br />
<td>No BODY tag found in content file.</td><br />
</tr><br />
</table><br />
<br />
<br />
<table><br />
<tr style="background:#cccccc;"><br />
<td>feature</td><br />
<td>description</td><br />
</tr><br />
<tr><br />
<td>metadata</td><br />
<td>add author and title to local:package and local:navigation (mtx-epub.lua)</td><br />
</tr><br />
<tr><br />
<td>cover</td><br />
<td>add [http://code.google.com/p/epubcheck/issues/detail?id=74 cover element], 600×800 (min. 500) for amazon</td><br />
</tr><br />
<tr><br />
<td>toc</td><br />
<td>table of contents is missing</td><br />
</tr><br />
<tr><br />
<td>chapter break</td><br />
<td>new title element → new xhtml</td><br />
</tr><br />
</table></div>Hagenhttps://wiki.contextgarden.net/index.php?title=Epub&diff=13115Epub2011-06-17T14:59:52Z<p>Hagen: /* Mtxrun */</p>
<hr />
<div>ConTeXt has preliminary [http://en.wikipedia.org/wiki/EPUB epub] support starting from [[Context 2011.05.18 | current 2011.05.18]].<br />
<br />
<br />
In order to make an epub (archive) from your ConTeXt source files, you need to:<br />
<br />
# enable the export backend in your <code>.tex</code> file or environment file (see [[Project structure]])<br />
# call the appropriate <code>mtxrun</code> command (with the epub script) shown in the output of a context run or in the log file<br />
<br />
<br />
'''Note:''' There is no support for graphics yet, that will be included in a later version.<br />
<br />
== Export ==<br />
<br />
To enable the export backend, depending on your needs, one of the following lines has to be included at the beginning of the document (before <cmd>starttext</cmd>).<br />
<br />
<texcode><br />
\setupbackend[export=yes]<br />
\setupbackend[export=yes,xhtml=yes]<br />
\setupbackend[export=yes,xhtml=whatever.xhtml]<br />
\setupbackend[export=yes,css={whatever.css,somemore.css}]<br />
</texcode><br />
<br />
The backend can export into:<br />
<br />
* xml<br />
* xhtml<br />
* xhtml+css<br />
<br />
''For making an epub, you need an xhtml export.''<br />
<br />
When using a css file, images are supported using an extra css file <code>*-images.css</code>. Images with suffix <code>pdf</code> are remapped to <code>svg</code> but <code>png</code> and <code>jpg</code> are passed on.<br />
<br />
You can add metadata using the following command:<br />
<br />
<texcode><br />
\settaggedmetadata<br />
[title=My Document,<br />
author=By Me,<br />
version=1.0]<br />
</texcode><br />
<br />
You are free to choose keys. Metadata is flushed as child of the next element.<br />
<br />
== The example file ==<br />
<br />
It is also possible to hook css into the output, see thread: [http://www.ntg.nl/pipermail/ntg-context/2011/058907.html ntg-context]. The distribution has a test file <code>export-example.tex</code>. This file exports conforming: <br />
<br />
<texcode><br />
\setupbackend<br />
[export=export-example.xml,<br />
xhtml=export-example.xhtml,<br />
css=export-example.css]<br />
</texcode><br />
<br />
This file shows some of the possibilities. You will notice that it is a rather normal context file. When the file is processed, you can create an epub file with: <br />
<br />
<texcode><br />
mtxrun --script epub export-example<br />
</texcode><br />
<br />
== Additional tagging == <br />
<br />
You can mark sections that don't need to be exported: <br />
<br />
<texcode><br />
\startelement[ignore]<br />
<br />
titlepage makeup <br />
<br />
\stopelement<br />
</texcode><br />
<br />
You can also add data: <br />
<br />
<texcode><br />
\settaggedmetadata[name=Me]<br />
<br />
\startchapter[title=...]<br />
....<br />
\stopchapter<br />
<br />
</texcode><br />
<br />
In this case the data will be injected just after the start of the chapter tag. So, if you want to have document level metadata, you need to put the set command before <cmd>starttext</cmd>.<br />
<br />
== Mtxrun ==<br />
<br />
The actual generation of the epub can be triggered with the <code>mtxrun</code> command shown in the output.<br />
<br />
Example log entry:<br />
<br />
...<br />
backend > export > saving xml data in 'oeps.export<br />
backend > export > saving css template in 'oeps.template<br />
backend > export > saving xhtml variant in 'oeps.xhtml<br />
backend > export > saving specification in 'oeps.specification' (mtxrun --script epub --make oeps.specification)<br />
...<br />
<br />
The "oeps" will be replaced with the appropriate name given to the export backend.<br />
<br />
Therefore, execute:<br />
<br />
mtxrun --script epub --make oeps.specification<br />
<br />
This will create an ''oeps.tree'' folder with an ''oeps.epub'' inside it. When pdf images are used and no suitable svg alternative is present inkscape will be used to create the svg file. <br />
<br />
More on this on the mailing list, thread starts at: [http://www.ntg.nl/pipermail/ntg-context/2011/058996.html ntg-context].<br />
<br />
== Minimal Example ==<br />
<br />
<texcode><br />
\setupbackend[export=yes,xhtml=test.xhtml]<br />
\starttext<br />
Hello world!<br />
\stoptext<br />
</texcode><br />
<br />
== Tools ==<br />
<br />
Viewer:<br />
* [http://calibre-ebook.com/ calibre]<br />
* [http://www.epubread.com/ EPUBReader for Firefox] (also does mathml) <br />
* [http://www.fbreader.org/ FBReader]<br />
* ''[http://www.adobe.com/products/digitaleditions/ Adobe Digital Editions]''<br />
<br />
Online:<br />
* [http://bookworm.oreilly.com/ bookworm]<br />
<br />
Editor:<br />
* [http://code.google.com/p/sigil/ sigil]<br />
<br />
Validation:<br />
* [http://code.google.com/p/epubcheck/ EpubCheck]<br />
* [http://www.amazon.com/gp/feature.html?docId=1000234621 KindleGen]<br />
<br />
Specification:<br />
* [http://idpf.org/epub epub 2/3]<br />
<br />
== Current Issues ==<br />
<br />
As of 08:41, 16 June 2011 (CEST):<br />
<br />
<table><br />
<tr style="background:#cccccc;"><br />
<td>tool</td><br />
<td>description</td><br />
<td>error</td><br />
</tr><br />
<tr><br />
<td><code>[https://gist.github.com/1013262 mtx-epub.lua]</code></td><br />
<td>OPF 2.0.1</td><br />
<td>amazoncover, bookid, id & ncx fix</td><br />
</tr><br />
<tr><br />
<td style="border-top: 1px solid black">epubcheck-1.2</td><br />
<td style="border-top: 1px solid black">OPS 2.0.1</td><br />
<td style="border-top: 1px solid black"><code>test.xhtml</code>: <code><document></code><br />elements from namespace "" are not allowed<br />xhtml DOCTYPE missing, html + body elements</td><br />
</tr><br />
<tr><br />
<td>epubreader</td><br />
<td>OPS 2.0.1</td><br />
<td>This XML file does not appear to have any style information associated with it.</td><br />
</tr><br />
<tr><br />
<td>kindlegen</td><br />
<td>OPS 2.0.1</td><br />
<td>No BODY tag found in content file.</td><br />
</tr><br />
</table><br />
<br />
<br />
<table><br />
<tr style="background:#cccccc;"><br />
<td>feature</td><br />
<td>description</td><br />
</tr><br />
<tr><br />
<td>metadata</td><br />
<td>add author and title to local:package and local:navigation (mtx-epub.lua)</td><br />
</tr><br />
<tr><br />
<td>cover</td><br />
<td>add [http://code.google.com/p/epubcheck/issues/detail?id=74 cover element], 600×800 (min. 500) for amazon</td><br />
</tr><br />
<tr><br />
<td>toc</td><br />
<td>table of contents is missing</td><br />
</tr><br />
<tr><br />
<td>chapter break</td><br />
<td>new title element → new xhtml</td><br />
</tr><br />
</table></div>Hagenhttps://wiki.contextgarden.net/index.php?title=Epub&diff=13114Epub2011-06-17T14:59:37Z<p>Hagen: /* additional tagging */</p>
<hr />
<div>ConTeXt has preliminary [http://en.wikipedia.org/wiki/EPUB epub] support starting from [[Context 2011.05.18 | current 2011.05.18]].<br />
<br />
<br />
In order to make an epub (archive) from your ConTeXt source files, you need to:<br />
<br />
# enable the export backend in your <code>.tex</code> file or environment file (see [[Project structure]])<br />
# call the appropriate <code>mtxrun</code> command (with the epub script) shown in the output of a context run or in the log file<br />
<br />
<br />
'''Note:''' There is no support for graphics yet, that will be included in a later version.<br />
<br />
== Export ==<br />
<br />
To enable the export backend, depending on your needs, one of the following lines has to be included at the beginning of the document (before <cmd>starttext</cmd>).<br />
<br />
<texcode><br />
\setupbackend[export=yes]<br />
\setupbackend[export=yes,xhtml=yes]<br />
\setupbackend[export=yes,xhtml=whatever.xhtml]<br />
\setupbackend[export=yes,css={whatever.css,somemore.css}]<br />
</texcode><br />
<br />
The backend can export into:<br />
<br />
* xml<br />
* xhtml<br />
* xhtml+css<br />
<br />
''For making an epub, you need an xhtml export.''<br />
<br />
When using a css file, images are supported using an extra css file <code>*-images.css</code>. Images with suffix <code>pdf</code> are remapped to <code>svg</code> but <code>png</code> and <code>jpg</code> are passed on.<br />
<br />
You can add metadata using the following command:<br />
<br />
<texcode><br />
\settaggedmetadata<br />
[title=My Document,<br />
author=By Me,<br />
version=1.0]<br />
</texcode><br />
<br />
You are free to choose keys. Metadata is flushed as child of the next element.<br />
<br />
== The example file ==<br />
<br />
It is also possible to hook css into the output, see thread: [http://www.ntg.nl/pipermail/ntg-context/2011/058907.html ntg-context]. The distribution has a test file <code>export-example.tex</code>. This file exports conforming: <br />
<br />
<texcode><br />
\setupbackend<br />
[export=export-example.xml,<br />
xhtml=export-example.xhtml,<br />
css=export-example.css]<br />
</texcode><br />
<br />
This file shows some of the possibilities. You will notice that it is a rather normal context file. When the file is processed, you can create an epub file with: <br />
<br />
<texcode><br />
mtxrun --script epub export-example<br />
</texcode><br />
<br />
== Additional tagging == <br />
<br />
You can mark sections that don't need to be exported: <br />
<br />
<texcode><br />
\startelement[ignore]<br />
<br />
titlepage makeup <br />
<br />
\stopelement<br />
</texcode><br />
<br />
You can also add data: <br />
<br />
<texcode><br />
\settaggedmetadata[name=Me]<br />
<br />
\startchapter[title=...]<br />
....<br />
\stopchapter<br />
<br />
</texcode><br />
<br />
In this case the data will be injected just after the start of the chapter tag. So, if you want to have document level metadata, you need to put the set command before <cmd>starttext</cmd>.<br />
<br />
== Mtxrun ==<br />
<br />
The actual generation of the epub can be triggered with the <code>mtxrun</code> command shown in the output.<br />
<br />
<br />
Example log entry:<br />
<br />
...<br />
backend > export > saving xml data in 'oeps.export<br />
backend > export > saving css template in 'oeps.template<br />
backend > export > saving xhtml variant in 'oeps.xhtml<br />
backend > export > saving specification in 'oeps.specification' (mtxrun --script epub --make oeps.specification)<br />
...<br />
<br />
The "oeps" will be replaced with the appropriate name given to the export backend.<br />
<br />
<br />
Therefore, execute:<br />
<br />
mtxrun --script epub --make oeps.specification<br />
<br />
This will create an ''oeps.tree'' folder with an ''oeps.epub'' inside it. When pdf images are used and no suitable svg alternative is present inkscape will be used to create the svg file. <br />
<br />
More on this on the mailing list, thread starts at: [http://www.ntg.nl/pipermail/ntg-context/2011/058996.html ntg-context].<br />
<br />
== Minimal Example ==<br />
<br />
<texcode><br />
\setupbackend[export=yes,xhtml=test.xhtml]<br />
\starttext<br />
Hello world!<br />
\stoptext<br />
</texcode><br />
<br />
== Tools ==<br />
<br />
Viewer:<br />
* [http://calibre-ebook.com/ calibre]<br />
* [http://www.epubread.com/ EPUBReader for Firefox] (also does mathml) <br />
* [http://www.fbreader.org/ FBReader]<br />
* ''[http://www.adobe.com/products/digitaleditions/ Adobe Digital Editions]''<br />
<br />
Online:<br />
* [http://bookworm.oreilly.com/ bookworm]<br />
<br />
Editor:<br />
* [http://code.google.com/p/sigil/ sigil]<br />
<br />
Validation:<br />
* [http://code.google.com/p/epubcheck/ EpubCheck]<br />
* [http://www.amazon.com/gp/feature.html?docId=1000234621 KindleGen]<br />
<br />
Specification:<br />
* [http://idpf.org/epub epub 2/3]<br />
<br />
== Current Issues ==<br />
<br />
As of 08:41, 16 June 2011 (CEST):<br />
<br />
<table><br />
<tr style="background:#cccccc;"><br />
<td>tool</td><br />
<td>description</td><br />
<td>error</td><br />
</tr><br />
<tr><br />
<td><code>[https://gist.github.com/1013262 mtx-epub.lua]</code></td><br />
<td>OPF 2.0.1</td><br />
<td>amazoncover, bookid, id & ncx fix</td><br />
</tr><br />
<tr><br />
<td style="border-top: 1px solid black">epubcheck-1.2</td><br />
<td style="border-top: 1px solid black">OPS 2.0.1</td><br />
<td style="border-top: 1px solid black"><code>test.xhtml</code>: <code><document></code><br />elements from namespace "" are not allowed<br />xhtml DOCTYPE missing, html + body elements</td><br />
</tr><br />
<tr><br />
<td>epubreader</td><br />
<td>OPS 2.0.1</td><br />
<td>This XML file does not appear to have any style information associated with it.</td><br />
</tr><br />
<tr><br />
<td>kindlegen</td><br />
<td>OPS 2.0.1</td><br />
<td>No BODY tag found in content file.</td><br />
</tr><br />
</table><br />
<br />
<br />
<table><br />
<tr style="background:#cccccc;"><br />
<td>feature</td><br />
<td>description</td><br />
</tr><br />
<tr><br />
<td>metadata</td><br />
<td>add author and title to local:package and local:navigation (mtx-epub.lua)</td><br />
</tr><br />
<tr><br />
<td>cover</td><br />
<td>add [http://code.google.com/p/epubcheck/issues/detail?id=74 cover element], 600×800 (min. 500) for amazon</td><br />
</tr><br />
<tr><br />
<td>toc</td><br />
<td>table of contents is missing</td><br />
</tr><br />
<tr><br />
<td>chapter break</td><br />
<td>new title element → new xhtml</td><br />
</tr><br />
</table></div>Hagenhttps://wiki.contextgarden.net/index.php?title=Epub&diff=13113Epub2011-06-17T14:59:27Z<p>Hagen: /* the example file */</p>
<hr />
<div>ConTeXt has preliminary [http://en.wikipedia.org/wiki/EPUB epub] support starting from [[Context 2011.05.18 | current 2011.05.18]].<br />
<br />
<br />
In order to make an epub (archive) from your ConTeXt source files, you need to:<br />
<br />
# enable the export backend in your <code>.tex</code> file or environment file (see [[Project structure]])<br />
# call the appropriate <code>mtxrun</code> command (with the epub script) shown in the output of a context run or in the log file<br />
<br />
<br />
'''Note:''' There is no support for graphics yet, that will be included in a later version.<br />
<br />
== Export ==<br />
<br />
To enable the export backend, depending on your needs, one of the following lines has to be included at the beginning of the document (before <cmd>starttext</cmd>).<br />
<br />
<texcode><br />
\setupbackend[export=yes]<br />
\setupbackend[export=yes,xhtml=yes]<br />
\setupbackend[export=yes,xhtml=whatever.xhtml]<br />
\setupbackend[export=yes,css={whatever.css,somemore.css}]<br />
</texcode><br />
<br />
The backend can export into:<br />
<br />
* xml<br />
* xhtml<br />
* xhtml+css<br />
<br />
''For making an epub, you need an xhtml export.''<br />
<br />
When using a css file, images are supported using an extra css file <code>*-images.css</code>. Images with suffix <code>pdf</code> are remapped to <code>svg</code> but <code>png</code> and <code>jpg</code> are passed on.<br />
<br />
You can add metadata using the following command:<br />
<br />
<texcode><br />
\settaggedmetadata<br />
[title=My Document,<br />
author=By Me,<br />
version=1.0]<br />
</texcode><br />
<br />
You are free to choose keys. Metadata is flushed as child of the next element.<br />
<br />
== The example file ==<br />
<br />
It is also possible to hook css into the output, see thread: [http://www.ntg.nl/pipermail/ntg-context/2011/058907.html ntg-context]. The distribution has a test file <code>export-example.tex</code>. This file exports conforming: <br />
<br />
<texcode><br />
\setupbackend<br />
[export=export-example.xml,<br />
xhtml=export-example.xhtml,<br />
css=export-example.css]<br />
</texcode><br />
<br />
This file shows some of the possibilities. You will notice that it is a rather normal context file. When the file is processed, you can create an epub file with: <br />
<br />
<texcode><br />
mtxrun --script epub export-example<br />
</texcode><br />
<br />
== additional tagging == <br />
<br />
You can mark sections that don't need to be exported: <br />
<br />
<texcode><br />
\startelement[ignore]<br />
<br />
titlepage makeup <br />
<br />
\stopelement<br />
</texcode><br />
<br />
You can also add data: <br />
<br />
<texcode><br />
\settaggedmetadata[name=Me]<br />
<br />
\startchapter[title=...]<br />
....<br />
\stopchapter<br />
<br />
</texcode><br />
<br />
In this case the data will be injected just after the start of the chapter tag. So, if you want to have document level metadata, you need to put the set command before <cmd>starttext</cmd>.<br />
<br />
== Mtxrun ==<br />
<br />
The actual generation of the epub can be triggered with the <code>mtxrun</code> command shown in the output.<br />
<br />
<br />
Example log entry:<br />
<br />
...<br />
backend > export > saving xml data in 'oeps.export<br />
backend > export > saving css template in 'oeps.template<br />
backend > export > saving xhtml variant in 'oeps.xhtml<br />
backend > export > saving specification in 'oeps.specification' (mtxrun --script epub --make oeps.specification)<br />
...<br />
<br />
The "oeps" will be replaced with the appropriate name given to the export backend.<br />
<br />
<br />
Therefore, execute:<br />
<br />
mtxrun --script epub --make oeps.specification<br />
<br />
This will create an ''oeps.tree'' folder with an ''oeps.epub'' inside it. When pdf images are used and no suitable svg alternative is present inkscape will be used to create the svg file. <br />
<br />
More on this on the mailing list, thread starts at: [http://www.ntg.nl/pipermail/ntg-context/2011/058996.html ntg-context].<br />
<br />
== Minimal Example ==<br />
<br />
<texcode><br />
\setupbackend[export=yes,xhtml=test.xhtml]<br />
\starttext<br />
Hello world!<br />
\stoptext<br />
</texcode><br />
<br />
== Tools ==<br />
<br />
Viewer:<br />
* [http://calibre-ebook.com/ calibre]<br />
* [http://www.epubread.com/ EPUBReader for Firefox] (also does mathml) <br />
* [http://www.fbreader.org/ FBReader]<br />
* ''[http://www.adobe.com/products/digitaleditions/ Adobe Digital Editions]''<br />
<br />
Online:<br />
* [http://bookworm.oreilly.com/ bookworm]<br />
<br />
Editor:<br />
* [http://code.google.com/p/sigil/ sigil]<br />
<br />
Validation:<br />
* [http://code.google.com/p/epubcheck/ EpubCheck]<br />
* [http://www.amazon.com/gp/feature.html?docId=1000234621 KindleGen]<br />
<br />
Specification:<br />
* [http://idpf.org/epub epub 2/3]<br />
<br />
== Current Issues ==<br />
<br />
As of 08:41, 16 June 2011 (CEST):<br />
<br />
<table><br />
<tr style="background:#cccccc;"><br />
<td>tool</td><br />
<td>description</td><br />
<td>error</td><br />
</tr><br />
<tr><br />
<td><code>[https://gist.github.com/1013262 mtx-epub.lua]</code></td><br />
<td>OPF 2.0.1</td><br />
<td>amazoncover, bookid, id & ncx fix</td><br />
</tr><br />
<tr><br />
<td style="border-top: 1px solid black">epubcheck-1.2</td><br />
<td style="border-top: 1px solid black">OPS 2.0.1</td><br />
<td style="border-top: 1px solid black"><code>test.xhtml</code>: <code><document></code><br />elements from namespace "" are not allowed<br />xhtml DOCTYPE missing, html + body elements</td><br />
</tr><br />
<tr><br />
<td>epubreader</td><br />
<td>OPS 2.0.1</td><br />
<td>This XML file does not appear to have any style information associated with it.</td><br />
</tr><br />
<tr><br />
<td>kindlegen</td><br />
<td>OPS 2.0.1</td><br />
<td>No BODY tag found in content file.</td><br />
</tr><br />
</table><br />
<br />
<br />
<table><br />
<tr style="background:#cccccc;"><br />
<td>feature</td><br />
<td>description</td><br />
</tr><br />
<tr><br />
<td>metadata</td><br />
<td>add author and title to local:package and local:navigation (mtx-epub.lua)</td><br />
</tr><br />
<tr><br />
<td>cover</td><br />
<td>add [http://code.google.com/p/epubcheck/issues/detail?id=74 cover element], 600×800 (min. 500) for amazon</td><br />
</tr><br />
<tr><br />
<td>toc</td><br />
<td>table of contents is missing</td><br />
</tr><br />
<tr><br />
<td>chapter break</td><br />
<td>new title element → new xhtml</td><br />
</tr><br />
</table></div>Hagenhttps://wiki.contextgarden.net/index.php?title=Epub&diff=13112Epub2011-06-17T14:59:09Z<p>Hagen: /* example */</p>
<hr />
<div>ConTeXt has preliminary [http://en.wikipedia.org/wiki/EPUB epub] support starting from [[Context 2011.05.18 | current 2011.05.18]].<br />
<br />
<br />
In order to make an epub (archive) from your ConTeXt source files, you need to:<br />
<br />
# enable the export backend in your <code>.tex</code> file or environment file (see [[Project structure]])<br />
# call the appropriate <code>mtxrun</code> command (with the epub script) shown in the output of a context run or in the log file<br />
<br />
<br />
'''Note:''' There is no support for graphics yet, that will be included in a later version.<br />
<br />
== Export ==<br />
<br />
To enable the export backend, depending on your needs, one of the following lines has to be included at the beginning of the document (before <cmd>starttext</cmd>).<br />
<br />
<texcode><br />
\setupbackend[export=yes]<br />
\setupbackend[export=yes,xhtml=yes]<br />
\setupbackend[export=yes,xhtml=whatever.xhtml]<br />
\setupbackend[export=yes,css={whatever.css,somemore.css}]<br />
</texcode><br />
<br />
The backend can export into:<br />
<br />
* xml<br />
* xhtml<br />
* xhtml+css<br />
<br />
''For making an epub, you need an xhtml export.''<br />
<br />
When using a css file, images are supported using an extra css file <code>*-images.css</code>. Images with suffix <code>pdf</code> are remapped to <code>svg</code> but <code>png</code> and <code>jpg</code> are passed on.<br />
<br />
You can add metadata using the following command:<br />
<br />
<texcode><br />
\settaggedmetadata<br />
[title=My Document,<br />
author=By Me,<br />
version=1.0]<br />
</texcode><br />
<br />
You are free to choose keys. Metadata is flushed as child of the next element.<br />
<br />
== the example file ==<br />
<br />
It is also possible to hook css into the output, see thread: [http://www.ntg.nl/pipermail/ntg-context/2011/058907.html ntg-context]. The distribution has a test file <code>export-example.tex</code>. This file exports conforming: <br />
<br />
<texcode><br />
\setupbackend<br />
[export=export-example.xml,<br />
xhtml=export-example.xhtml,<br />
css=export-example.css]<br />
</texcode><br />
<br />
This file shows some of the possibilities. You will notice that it is a rather normal context file. When the file is processed, you can create an epub file with: <br />
<br />
<texcode><br />
mtxrun --script epub export-example<br />
</texcode><br />
<br />
== additional tagging == <br />
<br />
You can mark sections that don't need to be exported: <br />
<br />
<texcode><br />
\startelement[ignore]<br />
<br />
titlepage makeup <br />
<br />
\stopelement<br />
</texcode><br />
<br />
You can also add data: <br />
<br />
<texcode><br />
\settaggedmetadata[name=Me]<br />
<br />
\startchapter[title=...]<br />
....<br />
\stopchapter<br />
<br />
</texcode><br />
<br />
In this case the data will be injected just after the start of the chapter tag. So, if you want to have document level metadata, you need to put the set command before <cmd>starttext</cmd>.<br />
<br />
== Mtxrun ==<br />
<br />
The actual generation of the epub can be triggered with the <code>mtxrun</code> command shown in the output.<br />
<br />
<br />
Example log entry:<br />
<br />
...<br />
backend > export > saving xml data in 'oeps.export<br />
backend > export > saving css template in 'oeps.template<br />
backend > export > saving xhtml variant in 'oeps.xhtml<br />
backend > export > saving specification in 'oeps.specification' (mtxrun --script epub --make oeps.specification)<br />
...<br />
<br />
The "oeps" will be replaced with the appropriate name given to the export backend.<br />
<br />
<br />
Therefore, execute:<br />
<br />
mtxrun --script epub --make oeps.specification<br />
<br />
This will create an ''oeps.tree'' folder with an ''oeps.epub'' inside it. When pdf images are used and no suitable svg alternative is present inkscape will be used to create the svg file. <br />
<br />
More on this on the mailing list, thread starts at: [http://www.ntg.nl/pipermail/ntg-context/2011/058996.html ntg-context].<br />
<br />
== Minimal Example ==<br />
<br />
<texcode><br />
\setupbackend[export=yes,xhtml=test.xhtml]<br />
\starttext<br />
Hello world!<br />
\stoptext<br />
</texcode><br />
<br />
== Tools ==<br />
<br />
Viewer:<br />
* [http://calibre-ebook.com/ calibre]<br />
* [http://www.epubread.com/ EPUBReader for Firefox] (also does mathml) <br />
* [http://www.fbreader.org/ FBReader]<br />
* ''[http://www.adobe.com/products/digitaleditions/ Adobe Digital Editions]''<br />
<br />
Online:<br />
* [http://bookworm.oreilly.com/ bookworm]<br />
<br />
Editor:<br />
* [http://code.google.com/p/sigil/ sigil]<br />
<br />
Validation:<br />
* [http://code.google.com/p/epubcheck/ EpubCheck]<br />
* [http://www.amazon.com/gp/feature.html?docId=1000234621 KindleGen]<br />
<br />
Specification:<br />
* [http://idpf.org/epub epub 2/3]<br />
<br />
== Current Issues ==<br />
<br />
As of 08:41, 16 June 2011 (CEST):<br />
<br />
<table><br />
<tr style="background:#cccccc;"><br />
<td>tool</td><br />
<td>description</td><br />
<td>error</td><br />
</tr><br />
<tr><br />
<td><code>[https://gist.github.com/1013262 mtx-epub.lua]</code></td><br />
<td>OPF 2.0.1</td><br />
<td>amazoncover, bookid, id & ncx fix</td><br />
</tr><br />
<tr><br />
<td style="border-top: 1px solid black">epubcheck-1.2</td><br />
<td style="border-top: 1px solid black">OPS 2.0.1</td><br />
<td style="border-top: 1px solid black"><code>test.xhtml</code>: <code><document></code><br />elements from namespace "" are not allowed<br />xhtml DOCTYPE missing, html + body elements</td><br />
</tr><br />
<tr><br />
<td>epubreader</td><br />
<td>OPS 2.0.1</td><br />
<td>This XML file does not appear to have any style information associated with it.</td><br />
</tr><br />
<tr><br />
<td>kindlegen</td><br />
<td>OPS 2.0.1</td><br />
<td>No BODY tag found in content file.</td><br />
</tr><br />
</table><br />
<br />
<br />
<table><br />
<tr style="background:#cccccc;"><br />
<td>feature</td><br />
<td>description</td><br />
</tr><br />
<tr><br />
<td>metadata</td><br />
<td>add author and title to local:package and local:navigation (mtx-epub.lua)</td><br />
</tr><br />
<tr><br />
<td>cover</td><br />
<td>add [http://code.google.com/p/epubcheck/issues/detail?id=74 cover element], 600×800 (min. 500) for amazon</td><br />
</tr><br />
<tr><br />
<td>toc</td><br />
<td>table of contents is missing</td><br />
</tr><br />
<tr><br />
<td>chapter break</td><br />
<td>new title element → new xhtml</td><br />
</tr><br />
</table></div>Hagenhttps://wiki.contextgarden.net/index.php?title=Epub&diff=13111Epub2011-06-17T14:54:08Z<p>Hagen: /* Mtxrun */</p>
<hr />
<div>ConTeXt has preliminary [http://en.wikipedia.org/wiki/EPUB epub] support starting from [[Context 2011.05.18 | current 2011.05.18]].<br />
<br />
<br />
In order to make an epub (archive) from your ConTeXt source files, you need to:<br />
<br />
# enable the export backend in your <code>.tex</code> file or environment file (see [[Project structure]])<br />
# call the appropriate <code>mtxrun</code> command (with the epub script) shown in the output of a context run or in the log file<br />
<br />
<br />
'''Note:''' There is no support for graphics yet, that will be included in a later version.<br />
<br />
== Export ==<br />
<br />
To enable the export backend, depending on your needs, one of the following lines has to be included at the beginning of the document (before <cmd>starttext</cmd>).<br />
<br />
<texcode><br />
\setupbackend[export=yes]<br />
\setupbackend[export=yes,xhtml=yes]<br />
\setupbackend[export=yes,xhtml=whatever.xhtml]<br />
\setupbackend[export=yes,css={whatever.css,somemore.css}]<br />
</texcode><br />
<br />
The backend can export into:<br />
<br />
* xml<br />
* xhtml<br />
* xhtml+css<br />
<br />
''For making an epub, you need an xhtml export.''<br />
<br />
When using a css file, images are supported using an extra css file <code>*-images.css</code>. Images with suffix <code>pdf</code> are remapped to <code>svg</code> but <code>png</code> and <code>jpg</code> are passed on.<br />
<br />
You can add metadata using the following command:<br />
<br />
<texcode><br />
\settaggedmetadata<br />
[title=My Document,<br />
author=By Me,<br />
version=1.0]<br />
</texcode><br />
<br />
You are free to choose keys. Metadata is flushed as child of the next element.<br />
<br />
== cld-mkvi ==<br />
<br />
It is also possible to hook css into the output, see thread: [http://www.ntg.nl/pipermail/ntg-context/2011/058907.html ntg-context].<br />
<br />
Example:<br />
<br />
<texcode><br />
\setupbackend<br />
[export=cld-mkiv-export.xml,<br />
xhtml=cld-mkiv-export.xhtml,<br />
css={cld-mkiv-export.css,mathml.css}]<br />
</texcode><br />
<br />
You can mark sections that don't need to be exported: <br />
<br />
<texcode><br />
\startelement[ignore]<br />
<br />
titlepage makeup <br />
<br />
\stopelement<br />
</texcode><br />
<br />
You can also add data: <br />
<br />
<texcode><br />
\settaggedmetadata[name=Me]<br />
<br />
\startchapter[title=...]<br />
....<br />
\stopchapter<br />
<br />
</texcode><br />
<br />
In this case the data will be injected just after the start of the chapter tag. So, if you want to have document level metadata, you need to put the set command before <cmd>starttext</cmd>.<br />
<br />
== Mtxrun ==<br />
<br />
The actual generation of the epub can be triggered with the <code>mtxrun</code> command shown in the output.<br />
<br />
<br />
Example log entry:<br />
<br />
...<br />
backend > export > saving xml data in 'oeps.export<br />
backend > export > saving css template in 'oeps.template<br />
backend > export > saving xhtml variant in 'oeps.xhtml<br />
backend > export > saving specification in 'oeps.specification' (mtxrun --script epub --make oeps.specification)<br />
...<br />
<br />
The "oeps" will be replaced with the appropriate name given to the export backend.<br />
<br />
<br />
Therefore, execute:<br />
<br />
mtxrun --script epub --make oeps.specification<br />
<br />
This will create an ''oeps.tree'' folder with an ''oeps.epub'' inside it. When pdf images are used and no suitable svg alternative is present inkscape will be used to create the svg file. <br />
<br />
More on this on the mailing list, thread starts at: [http://www.ntg.nl/pipermail/ntg-context/2011/058996.html ntg-context].<br />
<br />
== Minimal Example ==<br />
<br />
<texcode><br />
\setupbackend[export=yes,xhtml=test.xhtml]<br />
\starttext<br />
Hello world!<br />
\stoptext<br />
</texcode><br />
<br />
== Tools ==<br />
<br />
Viewer:<br />
* [http://calibre-ebook.com/ calibre]<br />
* [http://www.epubread.com/ EPUBReader for Firefox] (also does mathml) <br />
* [http://www.fbreader.org/ FBReader]<br />
* ''[http://www.adobe.com/products/digitaleditions/ Adobe Digital Editions]''<br />
<br />
Online:<br />
* [http://bookworm.oreilly.com/ bookworm]<br />
<br />
Editor:<br />
* [http://code.google.com/p/sigil/ sigil]<br />
<br />
Validation:<br />
* [http://code.google.com/p/epubcheck/ EpubCheck]<br />
* [http://www.amazon.com/gp/feature.html?docId=1000234621 KindleGen]<br />
<br />
Specification:<br />
* [http://idpf.org/epub epub 2/3]<br />
<br />
== Current Issues ==<br />
<br />
As of 08:41, 16 June 2011 (CEST):<br />
<br />
<table><br />
<tr style="background:#cccccc;"><br />
<td>tool</td><br />
<td>description</td><br />
<td>error</td><br />
</tr><br />
<tr><br />
<td><code>[https://gist.github.com/1013262 mtx-epub.lua]</code></td><br />
<td>OPF 2.0.1</td><br />
<td>amazoncover, bookid, id & ncx fix</td><br />
</tr><br />
<tr><br />
<td style="border-top: 1px solid black">epubcheck-1.2</td><br />
<td style="border-top: 1px solid black">OPS 2.0.1</td><br />
<td style="border-top: 1px solid black"><code>test.xhtml</code>: <code><document></code><br />elements from namespace "" are not allowed<br />xhtml DOCTYPE missing, html + body elements</td><br />
</tr><br />
<tr><br />
<td>epubreader</td><br />
<td>OPS 2.0.1</td><br />
<td>This XML file does not appear to have any style information associated with it.</td><br />
</tr><br />
<tr><br />
<td>kindlegen</td><br />
<td>OPS 2.0.1</td><br />
<td>No BODY tag found in content file.</td><br />
</tr><br />
</table><br />
<br />
<br />
<table><br />
<tr style="background:#cccccc;"><br />
<td>feature</td><br />
<td>description</td><br />
</tr><br />
<tr><br />
<td>metadata</td><br />
<td>add author and title to local:package and local:navigation (mtx-epub.lua)</td><br />
</tr><br />
<tr><br />
<td>cover</td><br />
<td>add [http://code.google.com/p/epubcheck/issues/detail?id=74 cover element], 600×800 (min. 500) for amazon</td><br />
</tr><br />
<tr><br />
<td>toc</td><br />
<td>table of contents is missing</td><br />
</tr><br />
<tr><br />
<td>chapter break</td><br />
<td>new title element → new xhtml</td><br />
</tr><br />
</table></div>Hagenhttps://wiki.contextgarden.net/index.php?title=Epub&diff=13110Epub2011-06-17T14:52:57Z<p>Hagen: /* Tools */</p>
<hr />
<div>ConTeXt has preliminary [http://en.wikipedia.org/wiki/EPUB epub] support starting from [[Context 2011.05.18 | current 2011.05.18]].<br />
<br />
<br />
In order to make an epub (archive) from your ConTeXt source files, you need to:<br />
<br />
# enable the export backend in your <code>.tex</code> file or environment file (see [[Project structure]])<br />
# call the appropriate <code>mtxrun</code> command (with the epub script) shown in the output of a context run or in the log file<br />
<br />
<br />
'''Note:''' There is no support for graphics yet, that will be included in a later version.<br />
<br />
== Export ==<br />
<br />
To enable the export backend, depending on your needs, one of the following lines has to be included at the beginning of the document (before <cmd>starttext</cmd>).<br />
<br />
<texcode><br />
\setupbackend[export=yes]<br />
\setupbackend[export=yes,xhtml=yes]<br />
\setupbackend[export=yes,xhtml=whatever.xhtml]<br />
\setupbackend[export=yes,css={whatever.css,somemore.css}]<br />
</texcode><br />
<br />
The backend can export into:<br />
<br />
* xml<br />
* xhtml<br />
* xhtml+css<br />
<br />
''For making an epub, you need an xhtml export.''<br />
<br />
When using a css file, images are supported using an extra css file <code>*-images.css</code>. Images with suffix <code>pdf</code> are remapped to <code>svg</code> but <code>png</code> and <code>jpg</code> are passed on.<br />
<br />
You can add metadata using the following command:<br />
<br />
<texcode><br />
\settaggedmetadata<br />
[title=My Document,<br />
author=By Me,<br />
version=1.0]<br />
</texcode><br />
<br />
You are free to choose keys. Metadata is flushed as child of the next element.<br />
<br />
== cld-mkvi ==<br />
<br />
It is also possible to hook css into the output, see thread: [http://www.ntg.nl/pipermail/ntg-context/2011/058907.html ntg-context].<br />
<br />
Example:<br />
<br />
<texcode><br />
\setupbackend<br />
[export=cld-mkiv-export.xml,<br />
xhtml=cld-mkiv-export.xhtml,<br />
css={cld-mkiv-export.css,mathml.css}]<br />
</texcode><br />
<br />
You can mark sections that don't need to be exported: <br />
<br />
<texcode><br />
\startelement[ignore]<br />
<br />
titlepage makeup <br />
<br />
\stopelement<br />
</texcode><br />
<br />
You can also add data: <br />
<br />
<texcode><br />
\settaggedmetadata[name=Me]<br />
<br />
\startchapter[title=...]<br />
....<br />
\stopchapter<br />
<br />
</texcode><br />
<br />
In this case the data will be injected just after the start of the chapter tag. So, if you want to have document level metadata, you need to put the set command before <cmd>starttext</cmd>.<br />
<br />
== Mtxrun ==<br />
<br />
The actual generation of the epub can be triggered with the <code>mtxrun</code> command shown in the output.<br />
<br />
<br />
Example log entry:<br />
<br />
...<br />
backend > export > saving xml data in 'oeps.export<br />
backend > export > saving css template in 'oeps.template<br />
backend > export > saving xhtml variant in 'oeps.xhtml<br />
backend > export > saving specification in 'oeps.specification' (mtxrun --script epub --make oeps.specification)<br />
...<br />
<br />
The "oeps" will be replaced with the appropriate name given to the export backend.<br />
<br />
<br />
Therefore, execute:<br />
<br />
mtxrun --script epub --make oeps.specification<br />
<br />
This will create an ''oeps.tree'' folder with an ''oeps.epub'' inside it.<br />
<br />
<br />
More on this on the mailing list, thread starts at: [http://www.ntg.nl/pipermail/ntg-context/2011/058996.html ntg-context].<br />
<br />
== Minimal Example ==<br />
<br />
<texcode><br />
\setupbackend[export=yes,xhtml=test.xhtml]<br />
\starttext<br />
Hello world!<br />
\stoptext<br />
</texcode><br />
<br />
== Tools ==<br />
<br />
Viewer:<br />
* [http://calibre-ebook.com/ calibre]<br />
* [http://www.epubread.com/ EPUBReader for Firefox] (also does mathml) <br />
* [http://www.fbreader.org/ FBReader]<br />
* ''[http://www.adobe.com/products/digitaleditions/ Adobe Digital Editions]''<br />
<br />
Online:<br />
* [http://bookworm.oreilly.com/ bookworm]<br />
<br />
Editor:<br />
* [http://code.google.com/p/sigil/ sigil]<br />
<br />
Validation:<br />
* [http://code.google.com/p/epubcheck/ EpubCheck]<br />
* [http://www.amazon.com/gp/feature.html?docId=1000234621 KindleGen]<br />
<br />
Specification:<br />
* [http://idpf.org/epub epub 2/3]<br />
<br />
== Current Issues ==<br />
<br />
As of 08:41, 16 June 2011 (CEST):<br />
<br />
<table><br />
<tr style="background:#cccccc;"><br />
<td>tool</td><br />
<td>description</td><br />
<td>error</td><br />
</tr><br />
<tr><br />
<td><code>[https://gist.github.com/1013262 mtx-epub.lua]</code></td><br />
<td>OPF 2.0.1</td><br />
<td>amazoncover, bookid, id & ncx fix</td><br />
</tr><br />
<tr><br />
<td style="border-top: 1px solid black">epubcheck-1.2</td><br />
<td style="border-top: 1px solid black">OPS 2.0.1</td><br />
<td style="border-top: 1px solid black"><code>test.xhtml</code>: <code><document></code><br />elements from namespace "" are not allowed<br />xhtml DOCTYPE missing, html + body elements</td><br />
</tr><br />
<tr><br />
<td>epubreader</td><br />
<td>OPS 2.0.1</td><br />
<td>This XML file does not appear to have any style information associated with it.</td><br />
</tr><br />
<tr><br />
<td>kindlegen</td><br />
<td>OPS 2.0.1</td><br />
<td>No BODY tag found in content file.</td><br />
</tr><br />
</table><br />
<br />
<br />
<table><br />
<tr style="background:#cccccc;"><br />
<td>feature</td><br />
<td>description</td><br />
</tr><br />
<tr><br />
<td>metadata</td><br />
<td>add author and title to local:package and local:navigation (mtx-epub.lua)</td><br />
</tr><br />
<tr><br />
<td>cover</td><br />
<td>add [http://code.google.com/p/epubcheck/issues/detail?id=74 cover element], 600×800 (min. 500) for amazon</td><br />
</tr><br />
<tr><br />
<td>toc</td><br />
<td>table of contents is missing</td><br />
</tr><br />
<tr><br />
<td>chapter break</td><br />
<td>new title element → new xhtml</td><br />
</tr><br />
</table></div>Hagenhttps://wiki.contextgarden.net/index.php?title=Epub&diff=13099Epub2011-06-15T22:57:51Z<p>Hagen: /* Export */</p>
<hr />
<div>ConTeXt has preliminary [http://en.wikipedia.org/wiki/EPUB epub] support starting from [[Context 2011.05.18 | current 2011.05.18]].<br />
<br />
<br />
In order to make an epub (archive) from your ConTeXt source files, you need to:<br />
<br />
# enable the export backend in your <code>.tex</code> file or environment file (see [[Project structure]])<br />
# call the appropriate <code>mtxrun</code> command (with the epub script) shown in the output of a context run or in the log file<br />
<br />
<br />
'''Note:''' There is no support for graphics yet, that will be included in a later version.<br />
<br />
== Export ==<br />
<br />
To enable the export backend, depending on your needs, one of the following lines has to be included at the beginning of the document (before <cmd>starttext</cmd>).<br />
<br />
<texcode><br />
\setupbackend[export=yes]<br />
\setupbackend[export=yes,xhtml=yes]<br />
\setupbackend[export=yes,xhtml=whatever.xhtml]<br />
\setupbackend[export=yes,css={whatever.css,somemore.css}]<br />
</texcode><br />
<br />
The backend can export into:<br />
<br />
* xml<br />
* xhtml<br />
* xhtml+css<br />
<br />
''For making an epub, you need an xhtml export.''<br />
<br />
When using a css file, images are supported using an extra css file <code>*-images.css</code>. Images with suffix <code>pdf</code> are remapped to <code>svg</code> but <code>png</code> and <code>jpg</code> are passed on.<br />
<br />
You can add metadata using the following command:<br />
<br />
<texcode><br />
\settaggedmetadata<br />
[title=My Document,<br />
author=By Me,<br />
version=1.0]<br />
</texcode><br />
<br />
You are free to choose keys. Metadata is flushed as child of the next element.<br />
<br />
== cld-mkvi ==<br />
<br />
It is also possible to hook css into the output, see thread: [http://www.ntg.nl/pipermail/ntg-context/2011/058907.html ntg-context].<br />
<br />
Example:<br />
<br />
<texcode><br />
\setupbackend<br />
[export=cld-mkiv-export.xml,<br />
xhtml=cld-mkiv-export.xhtml,<br />
css={cld-mkiv-export.css,mathml.css}]<br />
</texcode><br />
<br />
You can mark sections that don't need to be exported: <br />
<br />
<texcode><br />
\startelement[ignore]<br />
<br />
titlepage makeup <br />
<br />
\stopelement<br />
</texcode><br />
<br />
You can also add data: <br />
<br />
<texcode><br />
\settaggedmetadata[name=Me]<br />
<br />
\startchapter[title=...]<br />
....<br />
\stopchapter<br />
<br />
</texcode><br />
<br />
In this case the data will be injected just after the start of the chapter tag. So, if you want to have document level metadata, you need to put the set command before <cmd>starttext</cmd>.<br />
<br />
== Mtxrun ==<br />
<br />
The actual generation of the epub can be triggered with the <code>mtxrun</code> command shown in the output.<br />
<br />
<br />
Example log entry:<br />
<br />
...<br />
backend > export > saving xml data in 'oeps.export<br />
backend > export > saving css template in 'oeps.template<br />
backend > export > saving xhtml variant in 'oeps.xhtml<br />
backend > export > saving specification in 'oeps.specification' (mtxrun --script epub --make oeps.specification)<br />
...<br />
<br />
The "oeps" will be replaced with the appropriate name given to the export backend.<br />
<br />
<br />
Therefore, execute:<br />
<br />
mtxrun --script epub --make oeps.specification<br />
<br />
This will create an ''oeps.tree'' folder with an ''oeps.epub'' inside it.<br />
<br />
<br />
More on this on the mailing list, thread starts at: [http://www.ntg.nl/pipermail/ntg-context/2011/058996.html ntg-context].<br />
<br />
== Example ==<br />
<br />
<texcode><br />
\setupbackend[export=yes,xhtml=test.xhtml]<br />
\starttext<br />
Hello world!<br />
\stoptext<br />
</texcode><br />
<br />
== Tools ==<br />
<br />
Viewer:<br />
* [http://calibre-ebook.com/ calibre]<br />
* [http://www.epubread.com/ EPUBReader for Firefox]<br />
* [http://www.fbreader.org/ FBReader]<br />
* ''[http://www.adobe.com/products/digitaleditions/ Adobe Digital Editions]''<br />
<br />
Online:<br />
* [http://bookworm.oreilly.com/ bookworm]<br />
<br />
Editor:<br />
* [http://code.google.com/p/sigil/ sigil]<br />
<br />
Validation:<br />
* [http://code.google.com/p/epubcheck/ EpubCheck]<br />
* [http://www.amazon.com/gp/feature.html?docId=1000234621 KindleGen]<br />
<br />
Specification:<br />
* [http://idpf.org/epub epub 2/3]<br />
<br />
== Current Issues ==<br />
<br />
As of 19:43, 9 June 2011 (CEST):<br />
<br />
<table><br />
<tr style="background:#cccccc;"><br />
<td>tool</td><br />
<td>description</td><br />
<td>error</td><br />
</tr><br />
<tr><br />
<td><code>[https://gist.github.com/1013262 mtx-epub.lua]</code></td><br />
<td>OPF 2.0.1</td><br />
<td>bookid & id & ncx fix</td><br />
</tr><br />
<tr><br />
<td style="border-top: 1px solid black">epubcheck-1.2</td><br />
<td style="border-top: 1px solid black">OPS 2.0.1</td><br />
<td style="border-top: 1px solid black"><code>test.xhtml</code>: <code><document></code><br />elements from namespace "" are not allowed<br />xhtml DOCTYPE missing, html + body elements</td><br />
</tr><br />
<tr><br />
<td>epubreader</td><br />
<td>OPS 2.0.1</td><br />
<td>This XML file does not appear to have any style information associated with it.</td><br />
</tr><br />
<tr><br />
<td>kindlegen</td><br />
<td>OPS 2.0.1</td><br />
<td>No BODY tag found in content file.</td><br />
</tr><br />
<tr><br />
<td>kindlegen</td><br />
<td>OPS 2.0.1</td><br />
<td>Cover not specified, [http://s3.amazonaws.com/kindlegen/AmazonKindlePublishingGuidelinesV1.3.pdf amazon]</td><br />
</tr><br />
</table><br />
<br />
<br />
<table><br />
<tr style="background:#cccccc;"><br />
<td>feature</td><br />
<td>description</td><br />
</tr><br />
<tr><br />
<td>cover</td><br />
<td>add [http://code.google.com/p/epubcheck/issues/detail?id=74 cover element]</td><br />
</tr><br />
<tr><br />
<td>toc</td><br />
<td>table of contents is missing</td><br />
</tr><br />
<tr><br />
<td>chapter break</td><br />
<td>new title element → new xhtml</td><br />
</tr><br />
</table></div>Hagenhttps://wiki.contextgarden.net/index.php?title=Epub&diff=13098Epub2011-06-15T22:57:19Z<p>Hagen: /* Export */</p>
<hr />
<div>ConTeXt has preliminary [http://en.wikipedia.org/wiki/EPUB epub] support starting from [[Context 2011.05.18 | current 2011.05.18]].<br />
<br />
<br />
In order to make an epub (archive) from your ConTeXt source files, you need to:<br />
<br />
# enable the export backend in your <code>.tex</code> file or environment file (see [[Project structure]])<br />
# call the appropriate <code>mtxrun</code> command (with the epub script) shown in the output of a context run or in the log file<br />
<br />
<br />
'''Note:''' There is no support for graphics yet, that will be included in a later version.<br />
<br />
== Export ==<br />
<br />
To enable the export backend, depending on your needs, one of the following lines has to be included at the beginning of the document (before <cmd>starttext</cmd>).<br />
<br />
<texcode><br />
\setupbackend[export=yes]<br />
\setupbackend[export=yes,xhtml=yes]<br />
\setupbackend[export=yes,xhtml=whatever.xhtml]<br />
\setupbackend[export=yes,css={whatever.css,somemore.css}]<br />
</texcode><br />
<br />
The backend can export into:<br />
<br />
* xml<br />
* xhtml<br />
* xhtml+css<br />
<br />
<br />
''For making an epub, you need an xhtml export.''<br />
<br />
When using a css file, images are supported using an extra css file <code>*-images.css</code>. Images with suffix <code>pdf</code> are remapped to <code>svg</code> but <code>png</code> and <code>jpg</code> are passed on.<br />
<br />
You can add metadata using the following command:<br />
<br />
<texcode><br />
\settaggedmetadata<br />
[title=My Document,<br />
author=By Me,<br />
version=1.0]<br />
</texcode><br />
<br />
You are free to choose keys. Metadata is flushed as child of the next element.<br />
<br />
== cld-mkvi ==<br />
<br />
It is also possible to hook css into the output, see thread: [http://www.ntg.nl/pipermail/ntg-context/2011/058907.html ntg-context].<br />
<br />
Example:<br />
<br />
<texcode><br />
\setupbackend<br />
[export=cld-mkiv-export.xml,<br />
xhtml=cld-mkiv-export.xhtml,<br />
css={cld-mkiv-export.css,mathml.css}]<br />
</texcode><br />
<br />
You can mark sections that don't need to be exported: <br />
<br />
<texcode><br />
\startelement[ignore]<br />
<br />
titlepage makeup <br />
<br />
\stopelement<br />
</texcode><br />
<br />
You can also add data: <br />
<br />
<texcode><br />
\settaggedmetadata[name=Me]<br />
<br />
\startchapter[title=...]<br />
....<br />
\stopchapter<br />
<br />
</texcode><br />
<br />
In this case the data will be injected just after the start of the chapter tag. So, if you want to have document level metadata, you need to put the set command before <cmd>starttext</cmd>.<br />
<br />
== Mtxrun ==<br />
<br />
The actual generation of the epub can be triggered with the <code>mtxrun</code> command shown in the output.<br />
<br />
<br />
Example log entry:<br />
<br />
...<br />
backend > export > saving xml data in 'oeps.export<br />
backend > export > saving css template in 'oeps.template<br />
backend > export > saving xhtml variant in 'oeps.xhtml<br />
backend > export > saving specification in 'oeps.specification' (mtxrun --script epub --make oeps.specification)<br />
...<br />
<br />
The "oeps" will be replaced with the appropriate name given to the export backend.<br />
<br />
<br />
Therefore, execute:<br />
<br />
mtxrun --script epub --make oeps.specification<br />
<br />
This will create an ''oeps.tree'' folder with an ''oeps.epub'' inside it.<br />
<br />
<br />
More on this on the mailing list, thread starts at: [http://www.ntg.nl/pipermail/ntg-context/2011/058996.html ntg-context].<br />
<br />
== Example ==<br />
<br />
<texcode><br />
\setupbackend[export=yes,xhtml=test.xhtml]<br />
\starttext<br />
Hello world!<br />
\stoptext<br />
</texcode><br />
<br />
== Tools ==<br />
<br />
Viewer:<br />
* [http://calibre-ebook.com/ calibre]<br />
* [http://www.epubread.com/ EPUBReader for Firefox]<br />
* [http://www.fbreader.org/ FBReader]<br />
* ''[http://www.adobe.com/products/digitaleditions/ Adobe Digital Editions]''<br />
<br />
Online:<br />
* [http://bookworm.oreilly.com/ bookworm]<br />
<br />
Editor:<br />
* [http://code.google.com/p/sigil/ sigil]<br />
<br />
Validation:<br />
* [http://code.google.com/p/epubcheck/ EpubCheck]<br />
* [http://www.amazon.com/gp/feature.html?docId=1000234621 KindleGen]<br />
<br />
Specification:<br />
* [http://idpf.org/epub epub 2/3]<br />
<br />
== Current Issues ==<br />
<br />
As of 19:43, 9 June 2011 (CEST):<br />
<br />
<table><br />
<tr style="background:#cccccc;"><br />
<td>tool</td><br />
<td>description</td><br />
<td>error</td><br />
</tr><br />
<tr><br />
<td><code>[https://gist.github.com/1013262 mtx-epub.lua]</code></td><br />
<td>OPF 2.0.1</td><br />
<td>bookid & id & ncx fix</td><br />
</tr><br />
<tr><br />
<td style="border-top: 1px solid black">epubcheck-1.2</td><br />
<td style="border-top: 1px solid black">OPS 2.0.1</td><br />
<td style="border-top: 1px solid black"><code>test.xhtml</code>: <code><document></code><br />elements from namespace "" are not allowed<br />xhtml DOCTYPE missing, html + body elements</td><br />
</tr><br />
<tr><br />
<td>epubreader</td><br />
<td>OPS 2.0.1</td><br />
<td>This XML file does not appear to have any style information associated with it.</td><br />
</tr><br />
<tr><br />
<td>kindlegen</td><br />
<td>OPS 2.0.1</td><br />
<td>No BODY tag found in content file.</td><br />
</tr><br />
<tr><br />
<td>kindlegen</td><br />
<td>OPS 2.0.1</td><br />
<td>Cover not specified, [http://s3.amazonaws.com/kindlegen/AmazonKindlePublishingGuidelinesV1.3.pdf amazon]</td><br />
</tr><br />
</table><br />
<br />
<br />
<table><br />
<tr style="background:#cccccc;"><br />
<td>feature</td><br />
<td>description</td><br />
</tr><br />
<tr><br />
<td>cover</td><br />
<td>add [http://code.google.com/p/epubcheck/issues/detail?id=74 cover element]</td><br />
</tr><br />
<tr><br />
<td>toc</td><br />
<td>table of contents is missing</td><br />
</tr><br />
<tr><br />
<td>chapter break</td><br />
<td>new title element → new xhtml</td><br />
</tr><br />
</table></div>Hagenhttps://wiki.contextgarden.net/index.php?title=Epub&diff=13097Epub2011-06-15T22:54:05Z<p>Hagen: /* Current Issues */</p>
<hr />
<div>ConTeXt has preliminary [http://en.wikipedia.org/wiki/EPUB epub] support starting from [[Context 2011.05.18 | current 2011.05.18]].<br />
<br />
<br />
In order to make an epub (archive) from your ConTeXt source files, you need to:<br />
<br />
# enable the export backend in your <code>.tex</code> file or environment file (see [[Project structure]])<br />
# call the appropriate <code>mtxrun</code> command (with the epub script) shown in the output of a context run or in the log file<br />
<br />
<br />
'''Note:''' There is no support for graphics yet, that will be included in a later version.<br />
<br />
== Export ==<br />
<br />
To enable the export backend, depending on your needs, one of the following lines has to be included at the beginning of the document (before <cmd>starttext</cmd>).<br />
<br />
<texcode><br />
\setupbackend[export=yes]<br />
\setupbackend[export=yes,xhtml=yes]<br />
\setupbackend[export=yes,xhtml=whatever.xhtml]<br />
\setupbackend[export=yes,css={whatever.css,somemore.css}]<br />
</texcode><br />
<br />
The backend can export into:<br />
<br />
* xml<br />
* xhtml<br />
* xhtml+css<br />
<br />
<br />
''For making an epub, you need an xhtml export.''<br />
<br />
When using a css file, images are supported using an extra css file <code>*-images.css</code>. Images with suffix <code>pdf</code> are remapped to <code>svg</code> but <code>png</code> and <code>jpg</code> are passed on.<br />
<br />
== cld-mkvi ==<br />
<br />
It is also possible to hook css into the output, see thread: [http://www.ntg.nl/pipermail/ntg-context/2011/058907.html ntg-context].<br />
<br />
Example:<br />
<br />
<texcode><br />
\setupbackend<br />
[export=cld-mkiv-export.xml,<br />
xhtml=cld-mkiv-export.xhtml,<br />
css={cld-mkiv-export.css,mathml.css}]<br />
</texcode><br />
<br />
You can mark sections that don't need to be exported: <br />
<br />
<texcode><br />
\startelement[ignore]<br />
<br />
titlepage makeup <br />
<br />
\stopelement<br />
</texcode><br />
<br />
You can also add data: <br />
<br />
<texcode><br />
\settaggedmetadata[name=Me]<br />
<br />
\startchapter[title=...]<br />
....<br />
\stopchapter<br />
<br />
</texcode><br />
<br />
In this case the data will be injected just after the start of the chapter tag. So, if you want to have document level metadata, you need to put the set command before <cmd>starttext</cmd>.<br />
<br />
== Mtxrun ==<br />
<br />
The actual generation of the epub can be triggered with the <code>mtxrun</code> command shown in the output.<br />
<br />
<br />
Example log entry:<br />
<br />
...<br />
backend > export > saving xml data in 'oeps.export<br />
backend > export > saving css template in 'oeps.template<br />
backend > export > saving xhtml variant in 'oeps.xhtml<br />
backend > export > saving specification in 'oeps.specification' (mtxrun --script epub --make oeps.specification)<br />
...<br />
<br />
The "oeps" will be replaced with the appropriate name given to the export backend.<br />
<br />
<br />
Therefore, execute:<br />
<br />
mtxrun --script epub --make oeps.specification<br />
<br />
This will create an ''oeps.tree'' folder with an ''oeps.epub'' inside it.<br />
<br />
<br />
More on this on the mailing list, thread starts at: [http://www.ntg.nl/pipermail/ntg-context/2011/058996.html ntg-context].<br />
<br />
== Example ==<br />
<br />
<texcode><br />
\setupbackend[export=yes,xhtml=test.xhtml]<br />
\starttext<br />
Hello world!<br />
\stoptext<br />
</texcode><br />
<br />
== Tools ==<br />
<br />
Viewer:<br />
* [http://calibre-ebook.com/ calibre]<br />
* [http://www.epubread.com/ EPUBReader for Firefox]<br />
* [http://www.fbreader.org/ FBReader]<br />
* ''[http://www.adobe.com/products/digitaleditions/ Adobe Digital Editions]''<br />
<br />
Online:<br />
* [http://bookworm.oreilly.com/ bookworm]<br />
<br />
Editor:<br />
* [http://code.google.com/p/sigil/ sigil]<br />
<br />
Validation:<br />
* [http://code.google.com/p/epubcheck/ EpubCheck]<br />
* [http://www.amazon.com/gp/feature.html?docId=1000234621 KindleGen]<br />
<br />
Specification:<br />
* [http://idpf.org/epub epub 2/3]<br />
<br />
== Current Issues ==<br />
<br />
As of 19:43, 9 June 2011 (CEST):<br />
<br />
<table><br />
<tr style="background:#cccccc;"><br />
<td>tool</td><br />
<td>description</td><br />
<td>error</td><br />
</tr><br />
<tr><br />
<td><code>[https://gist.github.com/1013262 mtx-epub.lua]</code></td><br />
<td>OPF 2.0.1</td><br />
<td>bookid & id & ncx fix</td><br />
</tr><br />
<tr><br />
<td style="border-top: 1px solid black">epubcheck-1.2</td><br />
<td style="border-top: 1px solid black">OPS 2.0.1</td><br />
<td style="border-top: 1px solid black"><code>test.xhtml</code>: <code><document></code><br />elements from namespace "" are not allowed<br />xhtml DOCTYPE missing, html + body elements</td><br />
</tr><br />
<tr><br />
<td>epubreader</td><br />
<td>OPS 2.0.1</td><br />
<td>This XML file does not appear to have any style information associated with it.</td><br />
</tr><br />
<tr><br />
<td>kindlegen</td><br />
<td>OPS 2.0.1</td><br />
<td>No BODY tag found in content file.</td><br />
</tr><br />
<tr><br />
<td>kindlegen</td><br />
<td>OPS 2.0.1</td><br />
<td>Cover not specified, [http://s3.amazonaws.com/kindlegen/AmazonKindlePublishingGuidelinesV1.3.pdf amazon]</td><br />
</tr><br />
</table><br />
<br />
<br />
<table><br />
<tr style="background:#cccccc;"><br />
<td>feature</td><br />
<td>description</td><br />
</tr><br />
<tr><br />
<td>cover</td><br />
<td>add [http://code.google.com/p/epubcheck/issues/detail?id=74 cover element]</td><br />
</tr><br />
<tr><br />
<td>toc</td><br />
<td>table of contents is missing</td><br />
</tr><br />
<tr><br />
<td>chapter break</td><br />
<td>new title element → new xhtml</td><br />
</tr><br />
</table></div>Hagenhttps://wiki.contextgarden.net/index.php?title=Epub&diff=13096Epub2011-06-15T22:53:43Z<p>Hagen: /* Export */</p>
<hr />
<div>ConTeXt has preliminary [http://en.wikipedia.org/wiki/EPUB epub] support starting from [[Context 2011.05.18 | current 2011.05.18]].<br />
<br />
<br />
In order to make an epub (archive) from your ConTeXt source files, you need to:<br />
<br />
# enable the export backend in your <code>.tex</code> file or environment file (see [[Project structure]])<br />
# call the appropriate <code>mtxrun</code> command (with the epub script) shown in the output of a context run or in the log file<br />
<br />
<br />
'''Note:''' There is no support for graphics yet, that will be included in a later version.<br />
<br />
== Export ==<br />
<br />
To enable the export backend, depending on your needs, one of the following lines has to be included at the beginning of the document (before <cmd>starttext</cmd>).<br />
<br />
<texcode><br />
\setupbackend[export=yes]<br />
\setupbackend[export=yes,xhtml=yes]<br />
\setupbackend[export=yes,xhtml=whatever.xhtml]<br />
\setupbackend[export=yes,css={whatever.css,somemore.css}]<br />
</texcode><br />
<br />
The backend can export into:<br />
<br />
* xml<br />
* xhtml<br />
* xhtml+css<br />
<br />
<br />
''For making an epub, you need an xhtml export.''<br />
<br />
When using a css file, images are supported using an extra css file <code>*-images.css</code>. Images with suffix <code>pdf</code> are remapped to <code>svg</code> but <code>png</code> and <code>jpg</code> are passed on.<br />
<br />
== cld-mkvi ==<br />
<br />
It is also possible to hook css into the output, see thread: [http://www.ntg.nl/pipermail/ntg-context/2011/058907.html ntg-context].<br />
<br />
Example:<br />
<br />
<texcode><br />
\setupbackend<br />
[export=cld-mkiv-export.xml,<br />
xhtml=cld-mkiv-export.xhtml,<br />
css={cld-mkiv-export.css,mathml.css}]<br />
</texcode><br />
<br />
You can mark sections that don't need to be exported: <br />
<br />
<texcode><br />
\startelement[ignore]<br />
<br />
titlepage makeup <br />
<br />
\stopelement<br />
</texcode><br />
<br />
You can also add data: <br />
<br />
<texcode><br />
\settaggedmetadata[name=Me]<br />
<br />
\startchapter[title=...]<br />
....<br />
\stopchapter<br />
<br />
</texcode><br />
<br />
In this case the data will be injected just after the start of the chapter tag. So, if you want to have document level metadata, you need to put the set command before <cmd>starttext</cmd>.<br />
<br />
== Mtxrun ==<br />
<br />
The actual generation of the epub can be triggered with the <code>mtxrun</code> command shown in the output.<br />
<br />
<br />
Example log entry:<br />
<br />
...<br />
backend > export > saving xml data in 'oeps.export<br />
backend > export > saving css template in 'oeps.template<br />
backend > export > saving xhtml variant in 'oeps.xhtml<br />
backend > export > saving specification in 'oeps.specification' (mtxrun --script epub --make oeps.specification)<br />
...<br />
<br />
The "oeps" will be replaced with the appropriate name given to the export backend.<br />
<br />
<br />
Therefore, execute:<br />
<br />
mtxrun --script epub --make oeps.specification<br />
<br />
This will create an ''oeps.tree'' folder with an ''oeps.epub'' inside it.<br />
<br />
<br />
More on this on the mailing list, thread starts at: [http://www.ntg.nl/pipermail/ntg-context/2011/058996.html ntg-context].<br />
<br />
== Example ==<br />
<br />
<texcode><br />
\setupbackend[export=yes,xhtml=test.xhtml]<br />
\starttext<br />
Hello world!<br />
\stoptext<br />
</texcode><br />
<br />
== Tools ==<br />
<br />
Viewer:<br />
* [http://calibre-ebook.com/ calibre]<br />
* [http://www.epubread.com/ EPUBReader for Firefox]<br />
* [http://www.fbreader.org/ FBReader]<br />
* ''[http://www.adobe.com/products/digitaleditions/ Adobe Digital Editions]''<br />
<br />
Online:<br />
* [http://bookworm.oreilly.com/ bookworm]<br />
<br />
Editor:<br />
* [http://code.google.com/p/sigil/ sigil]<br />
<br />
Validation:<br />
* [http://code.google.com/p/epubcheck/ EpubCheck]<br />
* [http://www.amazon.com/gp/feature.html?docId=1000234621 KindleGen]<br />
<br />
Specification:<br />
* [http://idpf.org/epub epub 2/3]<br />
<br />
== Current Issues ==<br />
<br />
As of 19:43, 9 June 2011 (CEST):<br />
<br />
<table><br />
<tr style="background:#cccccc;"><br />
<td>tool</td><br />
<td>description</td><br />
<td>error</td><br />
</tr><br />
<tr><br />
<td><code>[https://gist.github.com/1013262 mtx-epub.lua]</code></td><br />
<td>OPF 2.0.1</td><br />
<td>bookid & id & ncx fix</td><br />
</tr><br />
<tr><br />
<td style="border-top: 1px solid black">epubcheck-1.2</td><br />
<td style="border-top: 1px solid black">OPS 2.0.1</td><br />
<td style="border-top: 1px solid black"><code>test.xhtml</code>: <code><document></code><br />elements from namespace "" are not allowed<br />xhtml DOCTYPE missing, html + body elements</td><br />
</tr><br />
<tr><br />
<td>epubreader</td><br />
<td>OPS 2.0.1</td><br />
<td>This XML file does not appear to have any style information associated with it.</td><br />
</tr><br />
<tr><br />
<td>kindlegen</td><br />
<td>OPS 2.0.1</td><br />
<td>No BODY tag found in content file.</td><br />
</tr><br />
<tr><br />
<td>kindlegen</td><br />
<td>OPS 2.0.1</td><br />
<td>Cover not specified, [http://s3.amazonaws.com/kindlegen/AmazonKindlePublishingGuidelinesV1.3.pdf amazon]</td><br />
</tr><br />
</table><br />
<br />
<br />
<table><br />
<tr style="background:#cccccc;"><br />
<td>feature</td><br />
<td>description</td><br />
</tr><br />
<tr><br />
<td>cover</td><br />
<td>add [http://code.google.com/p/epubcheck/issues/detail?id=74 cover element]</td><br />
</tr><br />
<tr><br />
<td>toc</td><br />
<td>table of contents is missing</td><br />
</tr><br />
<tr><br />
<td>chapter break</td><br />
<td>new title element → new xhtml</td><br />
</tr><br />
<tr><br />
<td>graphics</td><br />
<td>include graphics</td><br />
</tr><br />
</table></div>Hagenhttps://wiki.contextgarden.net/index.php?title=Epub&diff=13083Epub2011-06-08T17:06:32Z<p>Hagen: /* cld-mkvi */</p>
<hr />
<div>ConTeXt has preliminary [http://en.wikipedia.org/wiki/EPUB epub] support starting from [[Context 2011.05.18 | current 2011.05.18]].<br />
<br />
<br />
In order to make an epub (archive) from your ConTeXt source files, you need to:<br />
<br />
# enable the export backend in your <code>.tex</code> file or environment file (see [[Project structure]])<br />
# call the appropriate <code>mtxrun</code> command (with the epub script) shown in the output of a context run or in the log file<br />
<br />
<br />
'''Note:''' There is no support for graphics yet, that will be included in a later version.<br />
<br />
== Export ==<br />
<br />
To enable the export backend, depending on your needs, one of the following lines has to be included at the beginning of the document (before <cmd>starttext</cmd>).<br />
<br />
<texcode><br />
\setupbackend[export=yes]<br />
\setupbackend[export=yes,xhtml=yes]<br />
\setupbackend[export=yes,xhtml=whatever.xhtml]<br />
\setupbackend[export=yes,css={whatever.css,somemore.css}]<br />
</texcode><br />
<br />
The backend can export into:<br />
<br />
* xml<br />
* xhtml<br />
* xhtml+css<br />
<br />
<br />
''For making an epub, you need an xhtml export.''<br />
<br />
== cld-mkvi ==<br />
<br />
It is also possible to hook css into the output, see thread: [http://www.ntg.nl/pipermail/ntg-context/2011/058907.html ntg-context].<br />
<br />
Example:<br />
<br />
<texcode><br />
\setupbackend<br />
[export=cld-mkiv-export.xml,<br />
xhtml=cld-mkiv-export.xhtml,<br />
css={cld-mkiv-export.css,mathml.css}]<br />
</texcode><br />
<br />
You can mark sections that don't need to be exported: <br />
<br />
<texcode><br />
\startelement[ignore]<br />
<br />
titlepage makeup <br />
<br />
\stopelement<br />
</texcode><br />
<br />
You can also add data: <br />
<br />
<texcode><br />
\settaggedmetadata[name=Me]<br />
<br />
\startchapter[title=...]<br />
....<br />
\stopchapter<br />
<br />
</texcode><br />
<br />
In this case the data will be injected just after the start of the chapter tag. So, if you want to have document level metadata, you need to put the set command before <cmd>starttext</cmd>.<br />
<br />
== Mtxrun ==<br />
<br />
The actual generation of the epub can be triggered with the <code>mtxrun</code> command shown in the output.<br />
<br />
<br />
Example log entry:<br />
<br />
...<br />
backend > export > saving xml data in 'oeps.export<br />
backend > export > saving css template in 'oeps.template<br />
backend > export > saving xhtml variant in 'oeps.xhtml<br />
backend > export > saving specification in 'oeps.specification' (mtxrun --script epub --make oeps.specification)<br />
...<br />
<br />
The "oeps" will be replaced with the appropriate name given to the export backend.<br />
<br />
<br />
Therefore, execute:<br />
<br />
mtxrun --script epub --make oeps.specification<br />
<br />
This will create an ''oeps.tree'' folder with an ''oeps.epub'' inside it.<br />
<br />
<br />
More on this on the mailing list, thread starts at: [http://www.ntg.nl/pipermail/ntg-context/2011/058996.html ntg-context].<br />
<br />
== Example ==<br />
<br />
<texcode><br />
\setupbackend[export=yes,xhtml=test.xhtml]<br />
\starttext<br />
Hello world!<br />
\stoptext<br />
</texcode><br />
<br />
== Tools ==<br />
<br />
Viewer:<br />
* [http://calibre-ebook.com/ calibre]<br />
* [http://www.epubread.com/ EPUBReader for Firefox]<br />
* [http://www.fbreader.org/ FBReader]<br />
<br />
Editor:<br />
* [http://code.google.com/p/sigil/ sigil]<br />
<br />
Validation:<br />
* [http://code.google.com/p/epubcheck/ EpubCheck]<br />
* [http://www.amazon.com/gp/feature.html?docId=1000234621 KindleGen]<br />
<br />
Specification:<br />
* [http://idpf.org/epub epub]<br />
<br />
== Current Issues ==<br />
<br />
As of 13:34, 8 June 2011 (CEST):<br />
<br />
<table><br />
<tr style="background:#cccccc;"><br />
<td>tool</td><br />
<td>description</td><br />
<td>error</td><br />
</tr><br />
<tr><br />
<td><code>mtx-epub.lua</code></td><br />
<td>OPF 2.0.1</td><br />
<td>[https://gist.github.com/1013262 bookid & ncx fix]</td><br />
</tr><br />
<tr><br />
<td style="border-top: 1px solid black">epubcheck-1.2</td><br />
<td style="border-top: 1px solid black">OPS 2.0.1</td><br />
<td style="border-top: 1px solid black"><code>test.xhtml</code>: <code><document></code><br />elements from namespace "" are not allowed<br />xhtml DOCTYPE missing, html + body elements</td><br />
</tr><br />
<tr><br />
<td>epubreader</td><br />
<td>OPS 2.0.1</td><br />
<td>This XML file does not appear to have any style information associated with it.</td><br />
</tr><br />
<tr><br />
<td>kindlegen</td><br />
<td>OPS 2.0.1</td><br />
<td>No BODY tag found in content file.</td><br />
</tr><br />
<tr><br />
<td>kindlegen</td><br />
<td>OPS 2.0.1</td><br />
<td>Cover not specified, [http://s3.amazonaws.com/kindlegen/AmazonKindlePublishingGuidelinesV1.3.pdf amazon]</td><br />
</tr><br />
</table><br />
<br />
<br />
<table><br />
<tr style="background:#cccccc;"><br />
<td>feature</td><br />
<td>description</td><br />
</tr><br />
<tr><br />
<td>id field</td><br />
<td>sort out id name from specs, [http://code.google.com/p/epubcheck/wiki/Errors xhtml name], [http://idpf.org/epub/30/spec/epub30-ocf.html 3.0 draft], uuid</td><br />
</tr><br />
<tr><br />
<td>cover</td><br />
<td>add [http://code.google.com/p/epubcheck/issues/detail?id=74 cover element]</td><br />
</tr><br />
<tr><br />
<td>toc</td><br />
<td>table of contents is missing</td><br />
</tr><br />
<tr><br />
<td>chapter break</td><br />
<td>new title element → new xhtml</td><br />
</tr><br />
<tr><br />
<td>graphics</td><br />
<td>include graphics</td><br />
</tr><br />
</table></div>Hagenhttps://wiki.contextgarden.net/index.php?title=Epub&diff=13082Epub2011-06-08T17:05:53Z<p>Hagen: /* cld-mkvi */</p>
<hr />
<div>ConTeXt has preliminary [http://en.wikipedia.org/wiki/EPUB epub] support starting from [[Context 2011.05.18 | current 2011.05.18]].<br />
<br />
<br />
In order to make an epub (archive) from your ConTeXt source files, you need to:<br />
<br />
# enable the export backend in your <code>.tex</code> file or environment file (see [[Project structure]])<br />
# call the appropriate <code>mtxrun</code> command (with the epub script) shown in the output of a context run or in the log file<br />
<br />
<br />
'''Note:''' There is no support for graphics yet, that will be included in a later version.<br />
<br />
== Export ==<br />
<br />
To enable the export backend, depending on your needs, one of the following lines has to be included at the beginning of the document (before <cmd>starttext</cmd>).<br />
<br />
<texcode><br />
\setupbackend[export=yes]<br />
\setupbackend[export=yes,xhtml=yes]<br />
\setupbackend[export=yes,xhtml=whatever.xhtml]<br />
\setupbackend[export=yes,css={whatever.css,somemore.css}]<br />
</texcode><br />
<br />
The backend can export into:<br />
<br />
* xml<br />
* xhtml<br />
* xhtml+css<br />
<br />
<br />
''For making an epub, you need an xhtml export.''<br />
<br />
== cld-mkvi ==<br />
<br />
It is also possible to hook css into the output, see thread: [http://www.ntg.nl/pipermail/ntg-context/2011/058907.html ntg-context].<br />
<br />
Example:<br />
<br />
<texcode><br />
\setupbackend<br />
[export=cld-mkiv-export.xml,<br />
xhtml=cld-mkiv-export.xhtml,<br />
css={cld-mkiv-export.css,mathml.css}]<br />
</texcode><br />
<br />
You can mark sections that don't need to be exported: <br />
<br />
<texcode><br />
\startelement[ignore]<br />
<br />
titlepage makeup <br />
<br />
\stopelement<br />
</texcode><br />
<br />
You can also add data: <br />
<br />
<texcode><br />
\settaggedmetadata[name=Me]<br />
<br />
\startchapter[title=...]<br />
....<br />
\stopchapter<br />
<br />
</texcode><br />
<br />
In this case the data will be injected just after the start of the chapter tag. So, if you want to have document level metadata, you need to put the set command before the document starts.<br />
<br />
== Mtxrun ==<br />
<br />
The actual generation of the epub can be triggered with the <code>mtxrun</code> command shown in the output.<br />
<br />
<br />
Example log entry:<br />
<br />
...<br />
backend > export > saving xml data in 'oeps.export<br />
backend > export > saving css template in 'oeps.template<br />
backend > export > saving xhtml variant in 'oeps.xhtml<br />
backend > export > saving specification in 'oeps.specification' (mtxrun --script epub --make oeps.specification)<br />
...<br />
<br />
The "oeps" will be replaced with the appropriate name given to the export backend.<br />
<br />
<br />
Therefore, execute:<br />
<br />
mtxrun --script epub --make oeps.specification<br />
<br />
This will create an ''oeps.tree'' folder with an ''oeps.epub'' inside it.<br />
<br />
<br />
More on this on the mailing list, thread starts at: [http://www.ntg.nl/pipermail/ntg-context/2011/058996.html ntg-context].<br />
<br />
== Example ==<br />
<br />
<texcode><br />
\setupbackend[export=yes,xhtml=test.xhtml]<br />
\starttext<br />
Hello world!<br />
\stoptext<br />
</texcode><br />
<br />
== Tools ==<br />
<br />
Viewer:<br />
* [http://calibre-ebook.com/ calibre]<br />
* [http://www.epubread.com/ EPUBReader for Firefox]<br />
* [http://www.fbreader.org/ FBReader]<br />
<br />
Editor:<br />
* [http://code.google.com/p/sigil/ sigil]<br />
<br />
Validation:<br />
* [http://code.google.com/p/epubcheck/ EpubCheck]<br />
* [http://www.amazon.com/gp/feature.html?docId=1000234621 KindleGen]<br />
<br />
Specification:<br />
* [http://idpf.org/epub epub]<br />
<br />
== Current Issues ==<br />
<br />
As of 13:34, 8 June 2011 (CEST):<br />
<br />
<table><br />
<tr style="background:#cccccc;"><br />
<td>tool</td><br />
<td>description</td><br />
<td>error</td><br />
</tr><br />
<tr><br />
<td><code>mtx-epub.lua</code></td><br />
<td>OPF 2.0.1</td><br />
<td>[https://gist.github.com/1013262 bookid & ncx fix]</td><br />
</tr><br />
<tr><br />
<td style="border-top: 1px solid black">epubcheck-1.2</td><br />
<td style="border-top: 1px solid black">OPS 2.0.1</td><br />
<td style="border-top: 1px solid black"><code>test.xhtml</code>: <code><document></code><br />elements from namespace "" are not allowed<br />xhtml DOCTYPE missing, html + body elements</td><br />
</tr><br />
<tr><br />
<td>epubreader</td><br />
<td>OPS 2.0.1</td><br />
<td>This XML file does not appear to have any style information associated with it.</td><br />
</tr><br />
<tr><br />
<td>kindlegen</td><br />
<td>OPS 2.0.1</td><br />
<td>No BODY tag found in content file.</td><br />
</tr><br />
<tr><br />
<td>kindlegen</td><br />
<td>OPS 2.0.1</td><br />
<td>Cover not specified, [http://s3.amazonaws.com/kindlegen/AmazonKindlePublishingGuidelinesV1.3.pdf amazon]</td><br />
</tr><br />
</table><br />
<br />
<br />
<table><br />
<tr style="background:#cccccc;"><br />
<td>feature</td><br />
<td>description</td><br />
</tr><br />
<tr><br />
<td>id field</td><br />
<td>sort out id name from specs, [http://code.google.com/p/epubcheck/wiki/Errors xhtml name], [http://idpf.org/epub/30/spec/epub30-ocf.html 3.0 draft], uuid</td><br />
</tr><br />
<tr><br />
<td>cover</td><br />
<td>add [http://code.google.com/p/epubcheck/issues/detail?id=74 cover element]</td><br />
</tr><br />
<tr><br />
<td>toc</td><br />
<td>table of contents is missing</td><br />
</tr><br />
<tr><br />
<td>chapter break</td><br />
<td>new title element → new xhtml</td><br />
</tr><br />
<tr><br />
<td>graphics</td><br />
<td>include graphics</td><br />
</tr><br />
</table></div>Hagenhttps://wiki.contextgarden.net/index.php?title=Mark_IV&diff=12929Mark IV2011-03-18T13:36:32Z<p>Hagen: </p>
<hr />
<div>== Introducing Mark IV (and MkVI) ==<br />
<br />
Mark IV is the name of the [[LuaTeX]]-aware part of ConTeXt; that is, when you use ConTeXt over the LuaTeX engine instead of PDFTeX or XeTeX. You run it with<br />
texexec --lua filename<br />
or<br />
context filename<br />
<br />
There are fundamental differences between Mark IV and Mark II that you should be aware of. Many parts of ConTeXt have been redesigned from scratch making extensive use of the Lua programming language. And that is besides the heavy use of LuaTeX-only features in MkIV. As a result, there are a few intentional incompatibilities between the two ConTeXt versions. See [[MkIV Differences]] for these details.<br />
<br />
The first public beta has been released on the 6th of August, 2007. Currently the easiest way to try it out is to install [[ConTeXt Minimals]].<br />
<br />
It takes advantage of the amazing capabilities of LuaTeX and opens up a whole new world of possibilities, in particular with fonts.<br />
<br />
In the distribution the MkII files have suffix 'mkiv'. There are also files with suffix 'mkvi' and more will follow. The most significant difference is that these files use a different (and still somewhat experimental) syntax. <br />
<br />
== Installation and maintenance ==<br />
<br />
The Mark IV code needs to be configured before it is usable. [[Running Mark IV|This page]] explains how to do that. <br />
<br />
== Troubleshooting ==<br />
<br />
The environment variable TEXINPUTS has to be empty or unset. If not, you<br />
can get errors about "file.tex not found".<br />
<br />
== Sample code ==<br />
<br />
Here are some examples of cool stuff you can do with Mark IV.<br />
=== Lua core ===<br />
<br />
The first thing you will want to test are the lua functions. Try<br />
<br />
<texcode><br />
\ctxlua{a = 1.5 ; b = 1.8 ; c = a*b ; tex.print(c) ;}<br />
</texcode><br />
<br />
or the equivalent:<br />
<br />
<texcode><br />
\startlua<br />
a = 1.5<br />
b = 1.8<br />
c = a*b<br />
tex.print(c)<br />
\stoplua<br />
</texcode><br />
<br />
You can also do more elaborate calculations with the lua <code>math</code> library:<br />
<br />
<texcode><br />
\ctxlua{tex.print("$\string\\sqrt{2} = " .. math.sqrt(2) .. "$")}<br />
</texcode><br />
<br />
Note that the above works with any flavour of LuaTeX; nothing is actually ConTeXt-specific (except for <cmd>ctxlua</cmd> and <cmd>startlua</cmd>/<cmd>stoplua</cmd>).<br />
<br />
=== Fonts and typescripts ===<br />
<br />
This is detailed in [[Fonts in LuaTeX]].<br />
<br />
=== More sample code ===<br />
<br />
Other examples of Lua(TeX) code are to be found on [[User:Luigi.scarso#Luatex_examples|Luigi's user page]] as well as [http://luatex.bluwiki.com/ http://luatex.bluwiki.com/]<br />
<br />
[[Category:LuaTeX]]</div>Hagenhttps://wiki.contextgarden.net/index.php?title=Mark_IV&diff=12928Mark IV2011-03-18T13:36:04Z<p>Hagen: </p>
<hr />
<div>== Introducing Mark IV ==<br />
<br />
Mark IV is the name of the [[LuaTeX]]-aware part of ConTeXt; that is, when you use ConTeXt over the LuaTeX engine instead of PDFTeX or XeTeX. You run it with<br />
texexec --lua filename<br />
or<br />
context filename<br />
<br />
There are fundamental differences between Mark IV and Mark II that you should be aware of. Many parts of ConTeXt have been redesigned from scratch making extensive use of the Lua programming language. And that is besides the heavy use of LuaTeX-only features in MkIV. As a result, there are a few intentional incompatibilities between the two ConTeXt versions. See [[MkIV Differences]] for these details.<br />
<br />
The first public beta has been released on the 6th of August, 2007. Currently the easiest way to try it out is to install [[ConTeXt Minimals]].<br />
<br />
It takes advantage of the amazing capabilities of LuaTeX and opens up a whole new world of possibilities, in particular with fonts.<br />
<br />
== Mark VI == <br />
<br />
In the distribution the MkII files have suffix 'mkiv'. There are also files with suffix 'mkvi' and more will follow. The most significant difference is that these files use a different (and still somewhat experimental) syntax. <br />
<br />
== Installation and maintenance ==<br />
<br />
The Mark IV code needs to be configured before it is usable. [[Running Mark IV|This page]] explains how to do that. <br />
<br />
== Troubleshooting ==<br />
<br />
The environment variable TEXINPUTS has to be empty or unset. If not, you<br />
can get errors about "file.tex not found".<br />
<br />
== Sample code ==<br />
<br />
Here are some examples of cool stuff you can do with Mark IV.<br />
=== Lua core ===<br />
<br />
The first thing you will want to test are the lua functions. Try<br />
<br />
<texcode><br />
\ctxlua{a = 1.5 ; b = 1.8 ; c = a*b ; tex.print(c) ;}<br />
</texcode><br />
<br />
or the equivalent:<br />
<br />
<texcode><br />
\startlua<br />
a = 1.5<br />
b = 1.8<br />
c = a*b<br />
tex.print(c)<br />
\stoplua<br />
</texcode><br />
<br />
You can also do more elaborate calculations with the lua <code>math</code> library:<br />
<br />
<texcode><br />
\ctxlua{tex.print("$\string\\sqrt{2} = " .. math.sqrt(2) .. "$")}<br />
</texcode><br />
<br />
Note that the above works with any flavour of LuaTeX; nothing is actually ConTeXt-specific (except for <cmd>ctxlua</cmd> and <cmd>startlua</cmd>/<cmd>stoplua</cmd>).<br />
<br />
=== Fonts and typescripts ===<br />
<br />
This is detailed in [[Fonts in LuaTeX]].<br />
<br />
=== More sample code ===<br />
<br />
Other examples of Lua(TeX) code are to be found on [[User:Luigi.scarso#Luatex_examples|Luigi's user page]] as well as [http://luatex.bluwiki.com/ http://luatex.bluwiki.com/]<br />
<br />
[[Category:LuaTeX]]</div>Hagenhttps://wiki.contextgarden.net/index.php?title=Talk:Main_Page&diff=388Talk:Main Page2004-11-09T16:38:07Z<p>Hagen: /* reaching 100th page */</p>
<hr />
<div>== reaching 100th page ==<br />
<br />
If you have a look at [[Special:Statistics]], we now have 99 pages! Great! Without all your effort, this would not be the case. Who is going to create the 100th page?<br />
<br />
Thanks to all the authors,<br />
<br />
[[User:Patrick Gundlach|pg]]<br />
<br />
<br />
'''I win!''' :) Page 100 is the [[Context 2004.10.28]] details page for the latest release. [[User:Taco|Taco]]<br />
<br />
: There is not much I can offer as a reward... What about a 'lifelong' free email address at contextgarden.net? --[[User:Patrick Gundlach|pg]] :-)<br />
<br />
I'm not quite sure life-long is long enough. It seems a term of about 70 years post-mortem with possible extension is the standard these days. ;-)<br />
<br />
Hi! What's the license of ConTexT? It's not readily apparent from the wiki or from the company web page. [[User:BBB|BBB]] 15:49, 6 Nov 2004 (CET)<br />
: Hello, the license of ConTeXt is GPL (GNU General Public Licence). It is stated in mreadme.pdf [[User:Patrick Gundlach|pg]]<br />
:: Actually, it says "in the spirit of the GNU general public license". This made me suspiciuos, since if it were available under GPL, then why not say so plainly. The sentence as written could imply that it's not formally GPL, but it's "in the spirit", i.e. inspired by GPL. Also, I couldn't find the license text in the distribution. Anyway, that's a suggestion for improvement. [[User:BBB|BBB]] 13:55, 7 Nov 2004 (CET)<br />
::: see the mailinglist archive http://archive.contextgarden.net/message/20040628.160854.0c05d1d0.html . If this doesn't help you, please discuss this issue on the list<br />
<br />
:::: Well, i can understand the 'spirit' of those gnu licences, but the gory details are beyond me, so that's why i've written down things my way; it permits me to add my own spirit, which boils down to: use it any way you want, as long as you don't mess around with the files in a way that it backfires on me or users.--[[User:Hagen|Hans]] 17:38, 9 Nov 2004 (CET)</div>Hagenhttps://wiki.contextgarden.net/index.php?title=Talk:Main_Page&diff=387Talk:Main Page2004-11-09T16:37:31Z<p>Hagen: /* reaching 100th page */</p>
<hr />
<div>== reaching 100th page ==<br />
<br />
If you have a look at [[Special:Statistics]], we now have 99 pages! Great! Without all your effort, this would not be the case. Who is going to create the 100th page?<br />
<br />
Thanks to all the authors,<br />
<br />
[[User:Patrick Gundlach|pg]]<br />
<br />
<br />
'''I win!''' :) Page 100 is the [[Context 2004.10.28]] details page for the latest release. [[User:Taco|Taco]]<br />
<br />
: There is not much I can offer as a reward... What about a 'lifelong' free email address at contextgarden.net? --[[User:Patrick Gundlach|pg]] :-)<br />
<br />
I'm not quite sure life-long is long enough. It seems a term of about 70 years post-mortem with possible extension is the standard these days. ;-)<br />
<br />
Hi! What's the license of ConTexT? It's not readily apparent from the wiki or from the company web page. [[User:BBB|BBB]] 15:49, 6 Nov 2004 (CET)<br />
: Hello, the license of ConTeXt is GPL (GNU General Public Licence). It is stated in mreadme.pdf [[User:Patrick Gundlach|pg]]<br />
:: Actually, it says "in the spirit of the GNU general public license". This made me suspiciuos, since if it were available under GPL, then why not say so plainly. The sentence as written could imply that it's not formally GPL, but it's "in the spirit", i.e. inspired by GPL. Also, I couldn't find the license text in the distribution. Anyway, that's a suggestion for improvement. [[User:BBB|BBB]] 13:55, 7 Nov 2004 (CET)<br />
::: see the mailinglist archive http://archive.contextgarden.net/message/20040628.160854.0c05d1d0.html . If this doesn't help you, please discuss this issue on the list<br />
<br />
:::: Well, i can understand the 'spirit' of those gnu licences, but the gory details are beyond me, so that's why i've written down things my way; it permits me to add my own spirit, which boils down to: use it any way you want, as long as you don't mess around with the files in a way that it backfires on me or users.</div>Hagenhttps://wiki.contextgarden.net/index.php?title=Talk:Main_Page&diff=366Talk:Main Page2004-09-24T15:40:09Z<p>Hagen: /* pretty printing */</p>
<hr />
<div>[comment deleted --[[User:Patrick Gundlach|pg]]]<br />
----<br />
<br />
Cool. Patrick, IMO it would be good if you create [[http://www.contextgarden.net www.contextgarden.net]] as an index page for all of the separate subdomains. You have so many now that it would be nice to have an overview.<br />
<br />
[[User:Taco|Taco]] 10:04, 24 Aug 2004 (CEST)<br />
* Good suggestion. for a start I'll add the subdomains on the navigation bar. I won't be home the next few days, so all work will take some time (as usual). But I'll think about a main page at www.contextgarden.net --[[User:Patrick Gundlach|pg]]<br />
----<br />
I have changed the appearance of the <tt>pre</tt> element; the lines were sticking together in my browser (safari). I hope I didn't break any other browsers' appearance. And I have added a simple TeX prettyprinter. See [[Help:Editing]] for a description (where else should I describe the new features?) <br />
: [[User:Patrick Gundlach|pg]] 12:00, 25 Aug 2004 (CEST)<br />
----<br />
The lineheight of <tt>pre</tt> is now a bit loose for me, but not so much so that it is actually irritating in Gecko-based stuff (Mozilla 1.7.2 &co). In konqueror (Khtml) it looks worse, but that's more or less normal for me (I have font problems). Someone else should check.<br />
<br />
That new prettyprinter does wonders for the Changes page. Much easier on they brain now.<br />
--[[User:Taco|Taco]] 15:07, 25 Aug 2004 (CEST)<br />
<br />
* Perhaps the line height is different on the pages where <tt>texcode</tt> is included in the <tt>small</tt> element? In http://sandbox.contextgarden.net/Changes there is no <tt>small</tt> element, as opposed to [[Changes]]. Hmm, I just looked at the pages with Camino (gecko) and IE 5 (mac) - and I am not statisfied. --[[User:Patrick Gundlach|pg]] <br />
<br />
== pretty printing ==<br />
<br />
* the actual '''texcode''' pretty printer doesn't handle \\ correctly, see <pre>one\\two</pre> vs. <texcode>one\\two</texcode><br />
* a pretty printer for XML would be nice!<br />
--[[User:Hraban|Hraban]] 13:21, 2 Sep 2004 (CEST)<br />
: OK, I have fixed <tt>texcode</tt>, and an xml prettyprinter is on my todo list... [[User:Patrick Gundlach|pg]] 23:53, 2 Sep 2004 (CEST) <br />
: xmlcode can be used for xml verbatim text. See [[Image Database]] for an example. OK? [[User:Patrick Gundlach|pg]]<br />
:: Thank you! --[[User:Hraban|Hraban]] 16:47, 12 Sep 2004 (CEST)<br />
<br />
There '''is''' a pretty printer for xml: <br />
<br />
texexec --pdf --use=xml-pretty yourfile.xml<br />
<br />
you can call the pretty printer directly (see files) and tune teh output for inline and display elements and such<br />
<br />
HH (dunno how to add a signature)<br />
<br />
== something to play with ==<br />
I have added a wiki<->tex interface. See http://sandbox.contextgarden.net for an example. If this looks stable, I'll put it in the main wiki.<br />
: [[User:Patrick Gundlach|pg]] 01:07, 8 Sep 2004 (CEST)<br />
<br />
Well, no complaints yet. So we can do: <br><br />
<context><br />
\setupcolors [state=start]<br />
\framed [background=color,<br />
backgroundcolor=green,<br />
offset=1cm ]{hello world!}<br />
</context><br />
<br />
<pre><nowiki><br />
<context><br />
\setupcolors [state=start]<br />
\framed [background=color,<br />
backgroundcolor=green,<br />
offset=1cm ]{hello world!}<br />
</context><br />
</nowiki></pre><br />
BTW: I'll announce news on contextgarden.net and related stuff on http://news.contextgarden.net/ <br />
<br />
--[[User:Patrick Gundlach|pg]]<br />
: Patrick, would it be possible to enhance this nice feature, so that one can use more than one context-block on a page? (e.g. for samples of different setups) --[[User:Hraban|Hraban]]<br />
: Should be fixed; some stupid programming error --[[User:Patrick Gundlach|pg]]<br />
----</div>Hagenhttps://wiki.contextgarden.net/index.php?title=Talk:Main_Page&diff=325Talk:Main Page2004-09-24T15:38:50Z<p>Hagen: /* pretty printing */</p>
<hr />
<div>[comment deleted --[[User:Patrick Gundlach|pg]]]<br />
----<br />
<br />
Cool. Patrick, IMO it would be good if you create [[http://www.contextgarden.net www.contextgarden.net]] as an index page for all of the separate subdomains. You have so many now that it would be nice to have an overview.<br />
<br />
[[User:Taco|Taco]] 10:04, 24 Aug 2004 (CEST)<br />
* Good suggestion. for a start I'll add the subdomains on the navigation bar. I won't be home the next few days, so all work will take some time (as usual). But I'll think about a main page at www.contextgarden.net --[[User:Patrick Gundlach|pg]]<br />
----<br />
I have changed the appearance of the <tt>pre</tt> element; the lines were sticking together in my browser (safari). I hope I didn't break any other browsers' appearance. And I have added a simple TeX prettyprinter. See [[Help:Editing]] for a description (where else should I describe the new features?) <br />
: [[User:Patrick Gundlach|pg]] 12:00, 25 Aug 2004 (CEST)<br />
----<br />
The lineheight of <tt>pre</tt> is now a bit loose for me, but not so much so that it is actually irritating in Gecko-based stuff (Mozilla 1.7.2 &co). In konqueror (Khtml) it looks worse, but that's more or less normal for me (I have font problems). Someone else should check.<br />
<br />
That new prettyprinter does wonders for the Changes page. Much easier on they brain now.<br />
--[[User:Taco|Taco]] 15:07, 25 Aug 2004 (CEST)<br />
<br />
* Perhaps the line height is different on the pages where <tt>texcode</tt> is included in the <tt>small</tt> element? In http://sandbox.contextgarden.net/Changes there is no <tt>small</tt> element, as opposed to [[Changes]]. Hmm, I just looked at the pages with Camino (gecko) and IE 5 (mac) - and I am not statisfied. --[[User:Patrick Gundlach|pg]] <br />
<br />
== pretty printing ==<br />
<br />
* the actual '''texcode''' pretty printer doesn't handle \\ correctly, see <pre>one\\two</pre> vs. <texcode>one\\two</texcode><br />
* a pretty printer for XML would be nice!<br />
--[[User:Hraban|Hraban]] 13:21, 2 Sep 2004 (CEST)<br />
: OK, I have fixed <tt>texcode</tt>, and an xml prettyprinter is on my todo list... [[User:Patrick Gundlach|pg]] 23:53, 2 Sep 2004 (CEST) <br />
: xmlcode can be used for xml verbatim text. See [[Image Database]] for an example. OK? [[User:Patrick Gundlach|pg]]<br />
:: Thank you! --[[User:Hraban|Hraban]] 16:47, 12 Sep 2004 (CEST)<br />
<br />
There '''is''' a pretty printer for xml: <br />
<br />
texexec --pdf --use=xml-pretty yourfile.xml<br />
<br />
you can call the pretty printer directly (see files) and tune teh output for inline and display elements and such<br />
<br />
== something to play with ==<br />
I have added a wiki<->tex interface. See http://sandbox.contextgarden.net for an example. If this looks stable, I'll put it in the main wiki.<br />
: [[User:Patrick Gundlach|pg]] 01:07, 8 Sep 2004 (CEST)<br />
<br />
Well, no complaints yet. So we can do: <br><br />
<context><br />
\setupcolors [state=start]<br />
\framed [background=color,<br />
backgroundcolor=green,<br />
offset=1cm ]{hello world!}<br />
</context><br />
<br />
<pre><nowiki><br />
<context><br />
\setupcolors [state=start]<br />
\framed [background=color,<br />
backgroundcolor=green,<br />
offset=1cm ]{hello world!}<br />
</context><br />
</nowiki></pre><br />
BTW: I'll announce news on contextgarden.net and related stuff on http://news.contextgarden.net/ <br />
<br />
--[[User:Patrick Gundlach|pg]]<br />
: Patrick, would it be possible to enhance this nice feature, so that one can use more than one context-block on a page? (e.g. for samples of different setups) --[[User:Hraban|Hraban]]<br />
: Should be fixed; some stupid programming error --[[User:Patrick Gundlach|pg]]<br />
----</div>Hagen