https://wiki.contextgarden.net/api.php?action=feedcontributions&user=Pont&feedformat=atomWiki - User contributions [en]2024-03-29T14:27:03ZUser contributionsMediaWiki 1.34.1https://wiki.contextgarden.net/index.php?title=Question_marks_in_bibliography_entries&diff=13587Question marks in bibliography entries2012-02-05T04:40:52Z<p>Pont: </p>
<hr />
<div>Some publications have a title which ends in a question mark (a.k.a. interrogation mark or interrogation point). This becomes a problem when typesetting a bibliography, since a full stop is added after the title, resulting in something like:<br />
<br />
Livermore, R., Hillenbrand, C.-D., Meredith, M. and Eagles, G. (2007). Drake Passage and Cenozoic climate: An open and shut case?. ''Geochemistry, Geophysics, Geosystems'', 8(1), Q01005.<br />
<br />
Note the ugly ‘?.’ conjunction at the end of the title.<br />
<br />
A solution was suggested [http://www.tug.org/pipermail/texhax/2009-November/013714.html on the texhax mailing list]; at least one of the suggested hacks appears to work with ConTeXt. It requires the modification of the bibliography entries, and the definition of a new command. Below is a working example.<br />
<br />
The BibTeX file, test.bib:<br />
<br />
<texcode><br />
@article{art1,<br />
title = {{Is this a question?\killstop}},<br />
author = {Author, A.},<br />
pages = {1--2},<br />
journal = {Journal of Something},<br />
volume = {1},<br />
number = {2},<br />
year = {2000}<br />
}<br />
</texcode><br />
<br />
The document itself, test.tex:<br />
<br />
<texcode><br />
% bibtex hack starts here<br />
\def\gobblestop#1#2{#1}<br />
\def\killstop{%<br />
\aftergroup\gobblestop<br />
}<br />
% bibtex hack stops here<br />
<br />
\setupbibtex[database={test},sort=author]<br />
\setuppublications[sorttype=bbl,refcommand=authoryear]<br />
\starttext<br />
\cite[art1]<br />
\placepublications[criterium=text]<br />
\stoptext<br />
</texcode><br />
<br />
Notes:<br />
<br />
* I successfully tested this example with ConTeXt MkIV version 2011.10.01<br />
<br />
* Define the \killstop command before \starttext. The environment file is a good place for it, if you are using one.<br />
<br />
* Note the modifications necessary to the BibTeX entry itself: an extra pair of braces, and insertion of \killstop at the end.</div>Ponthttps://wiki.contextgarden.net/index.php?title=Question_marks_in_bibliography_entries&diff=13586Question marks in bibliography entries2012-02-05T04:39:40Z<p>Pont: corrected journal entry</p>
<hr />
<div>Some publications have a title which ends in a question mark (a.k.a. interrogation mark or interrogation point). This becomes a problem when typesetting a bibliography, since a full stop is added after the title, resulting in something like:<br />
<br />
Livermore, R., Hillenbrand, C.-D., Meredith, M. and Eagles, G. (2007). Drake Passage and Cenozoic climate: An open and shut case?. ''Geochemistry, Geophysics, Geosystems'', 8(1), Q01005.<br />
<br />
Note the ugly ‘?.’ conjunction at the end of the title.<br />
<br />
A solution was suggested [http://www.tug.org/pipermail/texhax/2009-November/013714.html on the texhax mailing list]; only one of the suggested hacks appears to work with ConTeXt. It requires the modification of the bibliography entries, and the definition of a new command. Below is a working example.<br />
<br />
The BibTeX file, test.bib:<br />
<br />
<texcode><br />
@article{art1,<br />
title = {{Is this a question?\killstop}},<br />
author = {Author, A.},<br />
pages = {1--2},<br />
journal = {Journal of Something},<br />
volume = {1},<br />
number = {2},<br />
year = {2000}<br />
}<br />
</texcode><br />
<br />
The document itself, test.tex:<br />
<br />
<texcode><br />
% bibtex hack starts here<br />
\def\gobblestop#1#2{#1}<br />
\def\killstop{%<br />
\aftergroup\gobblestop<br />
}<br />
% bibtex hack stops here<br />
<br />
\setupbibtex[database={test},sort=author]<br />
\setuppublications[sorttype=bbl,refcommand=authoryear]<br />
\starttext<br />
\cite[art1]<br />
\placepublications[criterium=text]<br />
\stoptext<br />
</texcode><br />
<br />
Notes:<br />
<br />
* I successfully tested this example with ConTeXt MkIV version 2011.10.01<br />
<br />
* Define the \killstop command before \starttext. The environment file is a good place for it, if you are using one.<br />
<br />
* Note the modifications necessary to the BibTeX entry itself: an extra pair of braces, and insertion of \killstop at the end.</div>Ponthttps://wiki.contextgarden.net/index.php?title=Question_marks_in_bibliography_entries&diff=13585Question marks in bibliography entries2012-02-05T04:38:59Z<p>Pont: Added notes</p>
<hr />
<div>Some publications have a title which ends in a question mark (a.k.a. interrogation mark or interrogation point). This becomes a problem when typesetting a bibliography, since a full stop is added after the title, resulting in something like:<br />
<br />
Livermore, R., Hillenbrand, C.-D., Meredith, M. and Eagles, G. (2007). Drake<br />
Passage and Cenozoic climate: An open and shut case?. ''Geochemistry,<br />
Geophysics, Geosystems'', 8(1), Q01005.<br />
<br />
Note the ugly ‘?.’ conjunction at the end of the title.<br />
<br />
A solution was suggested [http://www.tug.org/pipermail/texhax/2009-November/013714.html on the texhax mailing list]; only one of the suggested hacks appears to work with ConTeXt. It requires the modification of the bibliography entries, and the definition of a new command. Below is a working example.<br />
<br />
The BibTeX file, test.bib:<br />
<br />
<texcode><br />
@article{art1,<br />
title = {{Is this a question?\killstop}},<br />
author = {Author, A.},<br />
pages = {1--2},<br />
journal = {Journal of Something},<br />
volume = {1},<br />
number = {2},<br />
year = {2000}<br />
}<br />
</texcode><br />
<br />
The document itself, test.tex:<br />
<br />
<texcode><br />
% bibtex hack starts here<br />
\def\gobblestop#1#2{#1}<br />
\def\killstop{%<br />
\aftergroup\gobblestop<br />
}<br />
% bibtex hack stops here<br />
<br />
\setupbibtex[database={test},sort=author]<br />
\setuppublications[sorttype=bbl,refcommand=authoryear]<br />
\starttext<br />
\cite[art1]<br />
\placepublications[criterium=text]<br />
\stoptext<br />
</texcode><br />
<br />
Notes:<br />
<br />
* I successfully tested this example with ConTeXt MkIV version 2011.10.01<br />
<br />
* Define the \killstop command before \starttext. The environment file is a good place for it, if you are using one.<br />
<br />
* Note the modifications necessary to the BibTeX entry itself: an extra pair of braces, and insertion of \killstop at the end.</div>Ponthttps://wiki.contextgarden.net/index.php?title=Question_marks_in_bibliography_entries&diff=13584Question marks in bibliography entries2012-02-05T04:34:48Z<p>Pont: Added working example</p>
<hr />
<div>Some publications have a title which ends in a question mark (a.k.a. interrogation mark or interrogation point). This becomes a problem when typesetting a bibliography, since a full stop is added after the title, resulting in something like:<br />
<br />
Livermore, R., Hillenbrand, C.-D., Meredith, M. and Eagles, G. (2007). Drake<br />
Passage and Cenozoic climate: An open and shut case?. ''Geochemistry,<br />
Geophysics, Geosystems'', 8(1), Q01005.<br />
<br />
Note the ugly ‘?.’ conjunction at the end of the title.<br />
<br />
A solution was suggested [http://www.tug.org/pipermail/texhax/2009-November/013714.html on the texhax mailing list]; only one of the suggested hacks appears to work with ConTeXt. It requires the modification of the bibliography entries, and the definition of a new command. Below is a working example.<br />
<br />
The BibTeX file:<br />
<br />
<texcode><br />
@article{art1,<br />
title = {{Is this a question?\killstop}},<br />
author = {Author, A.},<br />
pages = {1--2},<br />
journal = {Journal of Something},<br />
volume = {1},<br />
number = {2},<br />
year = {2000}<br />
}<br />
</texcode><br />
<br />
The document itself:<br />
<br />
<texcode><br />
\def\gobblestop#1#2{#1}<br />
\def\killstop{%<br />
\aftergroup\gobblestop<br />
}<br />
<br />
\setupbibtex[database={test},sort=author]<br />
\setuppublications[sorttype=bbl,refcommand=authoryear]<br />
\starttext<br />
\cite[art1]<br />
\placepublications[criterium=text]<br />
\stoptext<br />
</texcode></div>Ponthttps://wiki.contextgarden.net/index.php?title=Question_marks_in_bibliography_entries&diff=13583Question marks in bibliography entries2012-02-05T04:30:55Z<p>Pont: Stated the problem.</p>
<hr />
<div>Some publications have a title which ends in a question mark (a.k.a. interrogation mark or interrogation point). This becomes a problem when typesetting a bibliography, since a full stop is added after the title, resulting in something like:<br />
<br />
Livermore, R., Hillenbrand, C.-D., Meredith, M. and Eagles, G. (2007). Drake<br />
Passage and Cenozoic climate: An open and shut case?. ''Geochemistry,<br />
Geophysics, Geosystems'', 8(1), Q01005.<br />
<br />
Note the ugly ‘?.’ conjunction at the end of the title.</div>Ponthttps://wiki.contextgarden.net/index.php?title=Bibliography_mkii&diff=13582Bibliography mkii2012-02-05T04:27:56Z<p>Pont: Note on question marks</p>
<hr />
<div>< [[Modules]] | [[Bibliography| Bibliographies in mkii]] | [[Bibliography mkiv|Bibliographies in mkiv]] | [[sample_bib| sample bib file]] ><br />
<br />
The '''bib''' module provides the<br />
<cmd>cite</cmd><br />
and <br />
<cmd>placepublications</cmd><br />
commands, in addition to some setup commands, for collecting and referencing bibliography. Single references can be supplied by special commands, or by using BibTeX databases.<br />
<br />
As of [[Context 2005.01.13]], this module is part of the standard distribution. The current version is also on the<br />
[[modules:bib]] page (Hans picks up the zip from that location as well, so the current version will always be in the modules part of the ConTeXt distribution).<br />
<br />
The PDF manual can be found on the [[modules:bibman| bib module manual]] page or in your ConTeXt installation. For me (ConTeXt installed in my home directory), it's in <tt>~/texmf/doc/context/bib/bibmod-doc.pdf</tt>. <b>Read this manual, it is much more complete than this page!</b><br />
<br />
== Example of use with bibtex ==<br />
<br />
Bibtex support is integrated in texexec you just have to set up the database name.<br />
<br />
Assuming you have saved this bit of code as bibdemo.tex:<br />
<texcode><br />
\usemodule[bib]<br />
\usemodule[bibltx]<br />
\setupbibtex[database=xampl]<br />
\setuppublications[numbering=yes] % Show reference numbers in the generated list.<br />
\starttext<br />
As \cite[article-full] already indicated, bibtex is a \LaTeX-centric program.<br />
\completepublications<br />
\stoptext<br />
</texcode><br />
<br />
Then you just have to run the following command:<br />
<pre><br />
texexec bibdemo<br />
</pre><br />
To get the typeset result. xampl.bib is a bibtex file example coming with the bibtex distribution (it should be on your harddisk somewhere already: on my teTeX 3.0 system, <tt>/usr/share/texmf-tetex/bibtex/bib/base/xampl.bib</tt> is the location), in which the <tt>article-full</tt> key is referred.<br />
<br />
The <code>\usemodule[bibltx]</code> line is needed because <tt>xampl.bib</tt> uses LaTeX commands and defines them using LaTeX syntax. The <tt>bibltx</tt> module allows ConTeXt to understand some such constructions (which is enough for it to work with <tt>xampl.bib</tt>).<br />
<br />
Note: Since Bibtex is added to the context core, no external module is necessary. It is sufficient to type for example (minimal):<br />
<br />
<texcode><br />
\setupbibtex[database=bib]<br />
<br />
\starttext<br />
\completepublications<br />
\stoptext<br />
</texcode><br />
<br />
== Changing the way you show the publication list ==<br />
<br />
If you use bibtex and you want to change the way you show the publication list you might want to look<br />
at the following example, it will change the publication list showing <br />
the surname in uppercase. <br />
<br />
(Credits go to Taco Hoekwater)<br />
<br />
<texcode><br />
%D Copied from \invertedshortauthor, with an extra \uppercase<br />
%D \type{#1} = firstnames<br />
%D \type{#2} = von<br />
%D \type{#3} = surname<br />
%D \type{#4} = inits<br />
%D \type{#5} = junior<br />
<br />
\unprotect\def\UCauthor#1#2#3#4#5%<br />
{\bibdoif{#2}{#2\bibalternative\c!vonsep}%<br />
\uppercase{#3}\bibalternative\c!surnamesep <br />
\bibdoif{#5}{#5\bibalternative\c!juniorsep}%<br />
\bibdoif{#4}{#4\unskip}}<br />
\protect<br />
</texcode><br />
<br />
After that, you can do:<br />
<texcode><br />
\setuppublicationlist<br />
[artauthor=\UCauthor,<br />
editor=\UCauthor,<br />
author=\UCauthor]<br />
</texcode><br />
<br />
== Active URLs ==<br />
<br />
If you want active (clickable) URLs in the references, you need to do a few steps. [Thanks to Tobias Burnus for the working minimal example, which I've modified only slightly.]<br />
<br />
* Use a patched <code>t-bib.tex</code> (until the next ConTeXt release sometime in May 2007 that will contain the patch).<br />
<br />
* Use the <code>url</code> field in the <code>bibtex</code> entries.<br />
<br />
* Setup a publication layout (for those types of <code>bibtex</code> entries) that knows how to include a URL.<br />
<br />
The minimal example is in [[Image:Biburls.zip]], which includes the patched <code>t-bib.tex</code>. But here are the details of steps 2 and 3. A <code>bibtex</code> <code>book</code> entry using the <code>url</code> field looks like:<br />
<br />
<texcode><br />
@Book{HPL2000,<br />
editor = {John D. Barnsford and Ann L. Brown and Rodney R. Cocking},<br />
title = {{How people learn: Brain, mind, experience, and school}},<br />
publisher = {National Academy Press},<br />
year = 2000,<br />
address = {Washington, DC},<br />
edition = {expanded},<br />
url = {http://www.nap.edu/}<br />
}<br />
</texcode><br />
<br />
The modified <code>\setuppublicationlayout</code>, which goes into an environment file or in the preamble of the <code>.tex</code> file, includes lines to use the <code>url</code> field. Since I use the <code>num</code> style for the publication list, with <code>\setuppublications[alternative=num]</code>, I take the <code>book</code> layout from the <code>bibl-num.tex</code> source file and modify it by adding two lines:<br />
<br />
<texcode><br />
\unprotect<br />
% copied from bibl-num.tex and added<br />
% \inserturl and \insertdoi<br />
\setuppublicationlayout[book]{%<br />
\insertauthors{}{\unskip. }{\inserteditors{}{\unskip, editor%<br />
\ifnum\getvalue{editor@num}> 1 s\fi.%<br />
\ \global\editedbooktrue <br />
}{\insertthekey{}{\unskip. }{}}}%<br />
\inserttitle<br />
{\bgroup\it }%<br />
{\/\egroup <br />
\ifeditedbook.%<br />
\global\editedbookfalse<br />
\insertvolume<br />
{ Number~}%<br />
{\insertseries<br />
{ in~\bgroup}%<br />
{\egroup. }%<br />
{\insertcrossref{ in~}{}{. }}}%<br />
{\insertseries{ }{.}{} }%<br />
\else<br />
\insertcrossref<br />
{\insertchap{, }{}{}%<br />
\insertpages{, pages }{. }{. }%<br />
\insertvolume{Volume~}{ of~}{}%<br />
}%<br />
{}%<br />
{\insertvolume<br />
{, volume~}%<br />
{\insertseries<br />
{ of~\bgroup\it}%<br />
{\egroup}<br />
{}}<br />
{}%<br />
\insertchap{, }{}{}%<br />
\insertpages{, pages }{.}{.}%<br />
}%<br />
\fi}%<br />
{}%<br />
\insertpublisher<br />
{ }%<br />
{\insertedition{, }{ edition}{}%<br />
\insertpubyear{, }{.}{.}}%<br />
{\insertedition{, }{ edition}{}%<br />
\insertpubyear{, }{.}{.}}%<br />
\insertpages{ }{p.}{}%<br />
\insertdoi{ }{.}{}%added<br />
\insertbiburl{ }{.}{}%added<br />
\insertnote{ }{.}{}%<br />
}<br />
\protect<br />
</texcode><br />
<br />
When running 'texexec', check the terminal output (or logfile) to ensure that texexec finds the modified t-bib.tex (which I have been keeping in the current directory) rather than the system-supplied t-bib.tex. Once the patched t-bib.tex becomes the official release (Taco says sometime in May 2007), that step won't be necessary.<br />
<br />
== Other tips ==<br />
<br />
* <cmd>placepublications</cmd> and <cmd>completepublications</cmd> default to producing a publication list for the citations that are local to the current sectioning level. If you find that your reference list is empty even though the citations look fine, you will probably need to add an option to the list command, like so:<br />
<texcode><br />
\placepublications[criterium=all]<br />
</texcode><br />
<br />
* To refer directly to a reference number (called inline or online cite), you can do <tt>\cite[left=,right=][myRef]</tt> or simply define<br />
<texcode><br />
\def\onlinecite{\cite[left=,right=]}<br />
<br />
\onlinecite[myRef]<br />
</texcode><br />
<br />
* To add further information to a reference, such as a page number within a book, do<br />
<texcode><br />
\cite[extras={, page 275}][your-book-reference]<br />
</texcode><br />
<br />
* Bibtex supports mnemonics for months, for example<br />
month=jan,<br />
month=feb,<br />
etc. This allows the style file to choose how to display months. By default, the bib module does not do any conversion of the months. This causes the months to turn up as digits. If you want months to come in words add<br />
<br />
<texcode><br />
\setuppublications [monthconversion=month] %or month:mnem<br />
</texcode><br />
<br />
* Even though Bibtex is not encoding-aware at all, it does allows special (8-bit) characters. So there is no need for ugly constructs like \"a (for ä) or \'e (for é). The one exception is within author family names, because those are handled specially, both for sorting and for generating so-called 'short tags'. For the same reasons, one must also avoid using non-ascii characters in the bibtex citation reference labels. <br />
<br />
[[Category:Modules]]<br />
<br />
* Bibliography items whose title ends in a ‘?’ (question mark, interrogation mark) can cause problems. See [[Question marks in bibliography entries]] for details of how to work around this.<br />
<br />
==What can I do, if entries are not shown?==<br />
<br />
Check if a <code>jobname.bbl</code> - file is generated. If it is empty, try manually running<br />
<br />
bibtex <filename><br />
<br />
In case of an error message like <code>I couldn't open style file cont-no.bst</code>, you can try<br />
<br />
mktexlsr<br />
<br />
in root terminal. Bibtex uses LS-R to find these files.</div>Ponthttps://wiki.contextgarden.net/index.php?title=LaTeX_Thanks&diff=13542LaTeX Thanks2012-01-20T21:04:37Z<p>Pont: </p>
<hr />
<div>< [[From LaTeX to ConTeXt]] | [[Footnotes]] ><br />
<br />
In LaTeX, there is a form of metadata common to many classes, known as the <tt>\thanks</tt> command. It is essentially an un-numbered footnote that comes out of sequence with the rest of the footnotes. It can be simulated in ConTeXt simply by defining another note type (see <cmd>setupfootnotes</cmd> for a rough idea of the available parameters):<br />
<texcode><br />
\definenote[thanks][conversion=set 2]<br />
</texcode><br />
And used with the usual note and referencing commands:<br />
<texcode><br />
\starttext<br />
{\bfc This is a title\footnote{This is an unnecessary footnote.}}<br />
<br />
\subject{ % just a cheap heading without explicitly renaming it `\author'<br />
A. U. Thor\thanks[Misk]{A. U. Thor and W.H. Gates, III, are at Miskatonic U.}, <br />
A. N. Onymouse\thanks{A. N. Onymouse is at Shoggoth Enterprises.}, and<br />
W. H. Gates, III\note[Misk]<br />
}<br />
<br />
Footnotes\footnote{Another note} return here.<br />
\stoptext<br />
</texcode><br />
<br />
In Mark IV you should use numberconversion instead of conversion.<br />
<br />
This bare example looks like:<br />
<br />
<context><br />
\definenote[thanks][conversion=set 2]<br />
\starttext<br />
\strut\vfill % A hack to shorten the page.<br />
<br />
{\bfc This is a title\footnote{This is an unnecessary footnote.}}<br />
<br />
\subject{ % just a cheap heading without explicitly renaming it `\author'<br />
A. U. Thor\thanks[Misk]{A. U. Thor and W.H. Gates, III, are at Miskatonic U.}, <br />
A. N. Onymouse\thanks{A. N. Onymouse is at Shoggoth Enterprises.}, and<br />
W. H. Gates, III\note[Misk]<br />
}<br />
<br />
Footnotes\footnote{Another note} return here.<br />
\stoptext <br />
</context><br />
<br />
== Alternative ==<br />
<br />
An alternative approach is given here: http://archive.contextgarden.net/message/20120120.171632.b45676e9.en.html</div>Ponthttps://wiki.contextgarden.net/index.php?title=Math&diff=13505Math2011-12-04T18:52:56Z<p>Pont: Link to new fractions page</p>
<hr />
<div>< [[Main Page]] | [[Math with newmat]] | [[MathML]] | [[Math_structures]]><br />
<br />
== Introduction ==<br />
TeX was designed for ease of typesetting books that contained mathematics. As ConTeXt is built on top of TeX, it inherits all those features. In addition to these, ConTeXt adds lot of macros to make the typesetting of mathematics easier.<br />
<br />
There are '''two''' kinds of '''math modes''' --- '''inline math and display math'''. Mathematical expressions that are written with the running text are called inline math; while mathematical expressions that break the flow of the text (such as formulas or equations) are called display math. TeX takes care of proper spacing around expressions and provides macros to typeset most mathematical constructs.<br />
Complicated expressions can be built by working in steps---break down the expression into sub-expressions, build the sub-expressions and then combine them to get the complicated expression.<br />
<br />
The basics of typesetting math in ConTeXt is explained here.<br />
<br />
=== Display math mode ===<br />
Type<br />
<br />
<texcode><br />
\startformula ... \stopformula<br />
</texcode><br />
<br />
to get display math mode.<br />
<br />
=== Inline math mode ===<br />
There are three equivalent commands to get inline math mode:<br />
<br />
<texcode><br />
$ ... $<br />
\math{ ... }<br />
\mathematics{ ... }<br />
</texcode><br />
<br />
=== Note to Plain TeX Users ===<br />
ConTeXt is plain TeX compatible. So, if you have any old document written in plain TeX, it will work with ConTeXt. This does not mean that you will get pixel by pixel identical output with ConTeXt. For inline math, everything that you learnt for plain TeX is also true for ConTeXt. However, display math is significantly different. '''Do not use <code>$$ .... $$</code>''' to write display math formulas in ConTeXt, since you will not get the correct spacing around the formulas. Instead use <br />
<br />
<texcode><br />
\startformula ... \stopformula<br />
</texcode><br />
<br />
See [[Math/Display]] for more details on how to use display math in ConTeXt.<br />
<br />
=== Note to AMSTeX/LaTeX Users ===<br />
ConTeXt offers almost all the features that are present in AMSTeX and LaTeX. However, ConTeXt syntax is different. See this [http://dl.contextgarden.net/myway/context-latex-math.pdf My Way] for how to 'translate' from amsmath syntax to ConTeXt syntax. [[LaTeX_Math_in_ConTeXt]] gives some brief ideas on how to get the LaTeX syntax to run in ConTeXt.<br />
<br />
== The details ==<br />
<br />
=== The basics ===<br />
* [[Math/basic | How to input math]] (binary relations, greek letters, subscripts and superscripts)<br />
* Accents<br />
* underbrace, overbrace<br />
* [[Math/fractions | Fractions, Binomials, genfrac, continued fractions.]]<br />
* Delimiters (big, bigg, left, middle, right)<br />
* Integrals and Sums<br />
* ([[Math/functions|Log like]]) functions<br />
* dots<br />
* [[Multiline_equations#Cases|Cases]], matrices, bordermatrix<br />
* Arrows (see [http://dl.contextgarden.net/myway/matharrows.pdf Math Arrows])<br />
* [[Vectors]]<br />
<br />
=== Display Math ===<br />
* [[Math/Display | Formula, formula number]]<br />
* [[Multiline equations]] (see [http://dl.contextgarden.net/myway/mathalign.pdf Using \mathalign and friends])<br />
* Math sub-alignment<br />
<br />
==Math [[Fonts]]==<br />
* [[Bold Math]]<br />
* [http://dl.contextgarden.net/websitesarchive/atl/tex/EulerContext.pdf Euler in ConTeXt (using Euler math font)] by Adam Lindsay<br />
* [[rsfs]] Using Ralph Smith's Formal Script<br />
* [[Doublestroke]] Using Double Stroke Font<br />
* [[Blackboard bold]]<br />
* [[Product integral]] symbol<br />
<br />
== Other Methods ==<br />
* There are two different math modules on [http://dante.ctan.org/tex-archive/macros/context/contrib/maths/ CTAN], [[Math with nath|nath]] and [[Math with amsl|amsl]]. And there's a [[Math with newmat|new math]] module in the distribution.<br />
* Context now has inbuilt support for [[Multiline equations]]<br />
* It is also possible to use most [[LaTeX Math in ConTeXt|LaTeX equations in ConTeXt]] with a relatively small set of supporting definitions.<br />
* The "native" ConTeXt way of math is [[MathML]], an application of [[XML]] - rather verbose but mighty.<br />
<br />
==Science==<br />
* Esp. for physics there’s the [[Units]] module.<br />
* Additions to [[MathML]] are PhysML and ChemML.<br />
* [[Chemistry]]<br />
* There's a module for chemical structure formulae: [[Chemistry|PPCHTeX]] (works also with LaTeX).<br />
<br />
==Number Formatting==<br />
There's a special command, <cmd>digits</cmd>, with its own manual about formatting numbers, see [http://www.pragma-ade.com/general/magazines/mag-0003.pdf Pasting digits together]<br />
<br />
==Evaluating expressions in ConTeXt==<br />
(i.e. ''doing'' math)<br />
* See also [[Expressions]].<br />
<br />
[[Category:Math]]</div>Ponthttps://wiki.contextgarden.net/index.php?title=Math/fractions&diff=13504Math/fractions2011-12-04T18:51:20Z<p>Pont: Added information on binomials.</p>
<hr />
<div>= Fractions, Binomials, genfrac, continued fractions =<br />
<br />
== Binomials ==<br />
<br />
Binomials: Wolfgang explains (ntg-context list, 2011-12-04): Instead if \choose you can use \binom which is the recommended way in context. The \dbinom command sets the content in display style while \tbinom use textstyle.<br />
<br />
<texcode><br />
\starttext<br />
<br />
Using \tex{binom} in text $\binom{n}{\frac{n}{2}}$.<br />
<br />
Using \tex{dbinom} in text $\dbinom{n}{\frac{n}{2}}$.<br />
<br />
Using \tex{tbinom} in text $\tbinom{n}{\frac{n}{2}}$.<br />
<br />
\startformula<br />
\binom{n}{\frac{n}{2}}<br />
\stopformula<br />
<br />
\stoptext<br />
</texcode></div>Ponthttps://wiki.contextgarden.net/index.php?title=Floating_Objects&diff=13476Floating Objects2011-11-14T03:36:20Z<p>Pont: Alternative captions for float and list</p>
<hr />
<div>< [[Visuals]] | [[Graphics]] | [[Using Graphics]] ><br />
<br />
Floats are elements like tables or figures that are placed (and numbered) automatically by TeX. They are so called as they can ''float'' around the output pages to a place where TeX thinks they are appropriate (You can influence what TeX thinks as appropriate).<br />
<br />
Floats are ConTeXt's "base class" for everything that uses a <tt>\place...</tt> command (table, figure, own floats).<br />
<br />
If you search options of e.g. <cmd>placeexternalfigure</cmd> you must look after <cmd>placefloat</cmd> in the manual! (same for <tt>\setup...</tt> etc.)<br />
<br />
The float types "graphic", "figure", "table" and "intermezzo" are readily defined. If you need more (i.e. if you need another numbering or table of something), you can easily define your own floats with <cmd>definefloat</cmd>.<br />
<br />
<texcode><br />
\placefloat[place][reference]{caption}{some float}<br />
</texcode><br />
<br />
'''place''' is one or several (comma separated) of:<br />
<table><br />
<tr bgcolor="#AAAAAA"><th>preference</th><th align="left">result</th></tr><br />
<tr bgcolor="#DDDDDD"><td>left</td><td>left of text</td></tr><br />
<tr><td>right</td><td>right of text</td></tr><br />
<tr bgcolor="#DDDDDD"><td>here</td><td>preferably here</td></tr><br />
<tr><td>top</td><td>at top of page</td></tr><br />
<tr bgcolor="#DDDDDD"><td>bottom</td><td>at bottom of page</td></tr><br />
<tr><td>inleft</td><td>in left margin</td></tr><br />
<tr bgcolor="#DDDDDD"><td>inright</td><td>in right margin</td></tr><br />
<tr><td>inmargin</td><td>in the margin (left or right)</td></tr><br />
<tr bgcolor="#DDDDDD"><td>margin</td><td>in the margin (margin float)</td></tr><br />
<tr><td>page</td><td>on a new (empty) page</td></tr><br />
<tr bgcolor="#DDDDDD"><td>opposite</td><td>on the left page</td></tr><br />
<tr><td>always</td><td>precedence over stored floats</td></tr><br />
<tr bgcolor="#DDDDDD"><td>force</td><td>per se here</td></tr><br />
<tr><td>split</td><td>(For TABLES only) split tables</td></tr><br />
</table><br />
(table copied from the manual)<br />
<br />
<cmd>placefigure</cmd> and <cmd>placetable</cmd> also accept the same set of options, and allow to create floating figures and captions respectively.<br />
<br />
'''reference'''<br />
<br />
If you don't need to refer to your float, you can leave this parameter out.<br />
<br />
== Examples ==<br />
I will explain the examples in terms of <cmd>placefigure</cmd> but the same set of options are also valid for other floats.<br />
<br />
* If you do not want a caption<br />
<texcode><br />
\placefigure {none} {\externalfigure[figurename]}<br />
</texcode><br />
<br />
or<br />
<br />
<texcode><br />
\placefigure[none] {} {\externalfigure[figurename]}<br />
</texcode><br />
<br />
<br />
* If you do not want the figure to be numbered (but still want the caption)<br />
<br />
<texcode><br />
\placefigure [nonumber] {caption} {\externalfigure[figurename]}<br />
</texcode><br />
<br />
* Suppose you want the figure to be placed on the right side of the page, a few lines into the paragraph, and want the rest of the paragraph to warp around the figure<br />
<br />
<texcode><br />
\placefigure [right,2*line] {caption} {\externalfigure[figurename]}<br />
</texcode><br />
<br />
or <br />
<br />
<texcode><br />
\placefigure [right,2*hang] {caption} {\externalfigure[figurename]}<br />
</texcode><br />
<br />
This does not want correctly at a page boundary. The <tt>line</tt> options leaves the space above the figures empty, while the <tt>hang</tt> option also wraps texts above the figure.<br />
<br />
==Floats and columns==<br />
<br />
This special case is discussed [[Columns#Floats_and_other_limitations_of_columns|here]].<br />
<br />
==Protruding Floats in Double-Sided Documents==<br />
<br />
If you have a double-sided document with wide outer margins then you might want your figures to protrude into the margin. In a double-sided document you need to tell ConTeXt to decide whether to make the figure protrude to the left or the right. This can be done as follows:<br />
<br />
<texcode><br />
\definefloat[textmarginfigure][textmarginfigures]<br />
\setupfloat[textmarginfigure][location=inner]<br />
\placetextmarginfigure{\externalfigure[figurename]}<br />
</texcode><br />
<br />
The following code gives a full example that can be pasted into live ConTeXt:<br />
<br />
<texcode><br />
\setuppagenumbering [alternative=doublesided]<br />
\setuplayout[location=middle,backspace=2pc, width=20pc]<br />
\definefloat[textmarginfigure][textmarginfigures]<br />
\setupfloat[textmarginfigure][location=inner]<br />
\starttext<br />
\input knuth<br />
\placetextmarginfigure[here]{}{\externalfigure[figurename][width=30pc]}<br />
\input knuth<br />
\placetextmarginfigure[here]{}{\externalfigure[figurename][width=30pc]}<br />
\input knuth<br />
\stoptext<br />
</texcode><br />
<br />
== Floats and section headings ==<br />
By default, section headings don't wrap "around" floating objects. Instead, they will be moved down as far as needed to appear below the float. This behaviour can be controlled using the <tt>aligntitle</tt> option of the <cmd>setupheads</cmd> or <cmd>setuphead</cmd> commands.<br />
<br />
== Captions ==<br />
To change the style of figure(table) captions, use <cmd>setupcaptions</cmd>.<br />
<br />
To use a different (e.g. abbreviated) caption in the list of floats, you can do:<br />
<br />
<texcode><br />
\defineselector[caption][max=2,n=2]<br />
\starttext<br />
\setupselector[caption][n=1]<br />
\completelistoffigures<br />
\setupselector[caption][n=2]<br />
\placefigure[][]<br />
{\select{caption}<br />
{Short caption for list}<br />
{A rather longer caption which will appear below the figure itself}}<br />
{This is the content of the actual figure}<br />
\stoptext<br />
</texcode><br />
<br />
Or in more recent (circa November 2011 and later) versions of ConTeXt:<br />
<br />
<texcode><br />
\startplacefigure[title={A rather long caption},list={A short caption}]<br />
This is the content of the actual figure<br />
\stopplacefigure<br />
</texcode><br />
<br />
== Flushing floats ==<br />
<br />
The command <cmd>placefloats</cmd> outputs all pending floats.</div>Ponthttps://wiki.contextgarden.net/index.php?title=Floating_Objects&diff=13402Floating Objects2011-09-29T22:04:55Z<p>Pont: Added note to double-sided protruding floats section</p>
<hr />
<div>< [[Visuals]] | [[Graphics]] | [[Using Graphics]] ><br />
<br />
Floats are elements like tables or figures that are placed (and numbered) automatically by TeX. They are so called as they can ''float'' around the output pages to a place where TeX thinks they are appropriate (You can influence what TeX thinks as appropriate).<br />
<br />
Floats are ConTeXt's "base class" for everything that uses a <tt>\place...</tt> command (table, figure, own floats).<br />
<br />
If you search options of e.g. <cmd>placeexternalfigure</cmd> you must look after <cmd>placefloat</cmd> in the manual! (same for <tt>\setup...</tt> etc.)<br />
<br />
The float types "graphic", "figure", "table" and "intermezzo" are readily defined. If you need more (i.e. if you need another numbering or table of something), you can easily define your own floats with <cmd>definefloat</cmd>.<br />
<br />
<texcode><br />
\placefloat[place][reference]{caption}{some float}<br />
</texcode><br />
<br />
'''place''' is one or several (comma separated) of:<br />
<table><br />
<tr bgcolor="#AAAAAA"><th>preference</th><th align="left">result</th></tr><br />
<tr bgcolor="#DDDDDD"><td>left</td><td>left of text</td></tr><br />
<tr><td>right</td><td>right of text</td></tr><br />
<tr bgcolor="#DDDDDD"><td>here</td><td>preferably here</td></tr><br />
<tr><td>top</td><td>at top of page</td></tr><br />
<tr bgcolor="#DDDDDD"><td>bottom</td><td>at bottom of page</td></tr><br />
<tr><td>inleft</td><td>in left margin</td></tr><br />
<tr bgcolor="#DDDDDD"><td>inright</td><td>in right margin</td></tr><br />
<tr><td>inmargin</td><td>in the margin (left or right)</td></tr><br />
<tr bgcolor="#DDDDDD"><td>margin</td><td>in the margin (margin float)</td></tr><br />
<tr><td>page</td><td>on a new (empty) page</td></tr><br />
<tr bgcolor="#DDDDDD"><td>opposite</td><td>on the left page</td></tr><br />
<tr><td>always</td><td>precedence over stored floats</td></tr><br />
<tr bgcolor="#DDDDDD"><td>force</td><td>per se here</td></tr><br />
<tr><td>split</td><td>(For TABLES only) split tables</td></tr><br />
</table><br />
(table copied from the manual)<br />
<br />
<cmd>placefigure</cmd> and <cmd>placetable</cmd> also accept the same set of options, and allow to create floating figures and captions respectively.<br />
<br />
'''reference'''<br />
<br />
If you don't need to refer to your float, you can leave this parameter out.<br />
<br />
== Examples ==<br />
I will explain the examples in terms of <cmd>placefigure</cmd> but the same set of options are also valid for other floats.<br />
<br />
* If you do not want a caption<br />
<texcode><br />
\placefigure {none} {\externalfigure[figurename]}<br />
</texcode><br />
<br />
or<br />
<br />
<texcode><br />
\placefigure[none] {} {\externalfigure[figurename]}<br />
</texcode><br />
<br />
<br />
* If you do not want the figure to be numbered (but still want the caption)<br />
<br />
<texcode><br />
\placefigure [nonumber] {caption} {\externalfigure[figurename]}<br />
</texcode><br />
<br />
* Suppose you want the figure to be placed on the right side of the page, a few lines into the paragraph, and want the rest of the paragraph to warp around the figure<br />
<br />
<texcode><br />
\placefigure [right,2*line] {caption} {\externalfigure[figurename]}<br />
</texcode><br />
<br />
or <br />
<br />
<texcode><br />
\placefigure [right,2*hang] {caption} {\externalfigure[figurename]}<br />
</texcode><br />
<br />
This does not want correctly at a page boundary. The <tt>line</tt> options leaves the space above the figures empty, while the <tt>hang</tt> option also wraps texts above the figure.<br />
<br />
==Floats and columns==<br />
<br />
This special case is discussed [[Columns#Floats_and_other_limitations_of_columns|here]].<br />
<br />
==Protruding Floats in Double-Sided Documents==<br />
<br />
If you have a double-sided document with wide outer margins then you might want your figures to protrude into the margin. In a double-sided document you need to tell ConTeXt to decide whether to make the figure protrude to the left or the right. This can be done as follows:<br />
<br />
<texcode><br />
\definefloat[textmarginfigure][textmarginfigures]<br />
\setupfloat[textmarginfigure][location=inner]<br />
\placetextmarginfigure{\externalfigure[figurename]}<br />
</texcode><br />
<br />
The following code gives a full example that can be pasted into live ConTeXt:<br />
<br />
<texcode><br />
\setuppagenumbering [alternative=doublesided]<br />
\setuplayout[location=middle,backspace=2pc, width=20pc]<br />
\definefloat[textmarginfigure][textmarginfigures]<br />
\setupfloat[textmarginfigure][location=inner]<br />
\starttext<br />
\input knuth<br />
\placetextmarginfigure[here]{}{\externalfigure[figurename][width=30pc]}<br />
\input knuth<br />
\placetextmarginfigure[here]{}{\externalfigure[figurename][width=30pc]}<br />
\input knuth<br />
\stoptext<br />
</texcode><br />
<br />
Note that there may be problems with this approach in versions of ConTeXt<br />
MkIV later than February 2011; see the mailing list thread starting <br />
[http://www.ntg.nl/pipermail/ntg-context/2011/062003.html here] for details.<br />
<br />
== Floats and section headings ==<br />
By default, section headings don't wrap "around" floating objects. Instead, they will be moved down as far as needed to appear below the float. This behaviour can be controlled using the <tt>aligntitle</tt> option of the <cmd>setupheads</cmd> or <cmd>setuphead</cmd> commands.<br />
<br />
== Captions ==<br />
To change the style of figure(table) captions, use <cmd>setupcaptions</cmd>.<br />
<br />
== Flushing floats ==<br />
<br />
The command <cmd>placefloats</cmd> outputs all pending floats.</div>Ponthttps://wiki.contextgarden.net/index.php?title=Project_structure&diff=13342Project structure2011-08-28T22:54:17Z<p>Pont: /* See also */ Link to ConTEXt magazine issue.</p>
<hr />
<div>< [[The ConTeXt Way]] | [[Structurals]] ><br />
<br />
==Introduction==<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 />
==File and directory setup==<br />
<br />
===Naming conventions===<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 />
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 />
===Example files===<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 />
===Subdirectories===<br />
<br />
If you keep all files in one directory, it tends to get confusing. Here’s a structured example where we keep all parts of one product together:<br />
<br />
env_mymag.tex<br />
project_mymag.tex<br />
2011-01/prd_issue2011-01.tex<br />
2011-02/prd_issue2011-02.tex<br />
2011-03/prd_issue2011-03.tex<br />
...<br />
2011-03/c_editorial.tex<br />
2011-03/c_article1.tex<br />
...<br />
2011-03/img/author1.jpg<br />
...<br />
general_img/logo.pdf<br />
...<br />
<br />
'''Environment'''<br />
<texcode><br />
\startenvironment env_mymag<br />
\project project_mymag<br />
<br />
...<br />
<br />
% where \product and \component look for TeX input files<br />
\usepath[{2011-01,2011-02,2011-03}]<br />
<br />
% where to look for images<br />
\doifmodeelse{*product}<br />
{\setupexternalfigures[directory={../general_img}]}<br />
{\setupexternalfigures[directory={../general_img, img}]}<br />
<br />
...<br />
\stopenvironment<br />
</texcode><br />
<br />
'''Product'''<br />
<texcode><br />
\startproduct prd_issue2011-01<br />
\project project_mymag<br />
\environment env_mymag<br />
<br />
\component c_editorial<br />
\component c_article1<br />
...<br />
<br />
\stopproduct<br />
</texcode><br />
<br />
(This is untested. I assume that ConTeXt looks automatically into parent directories.)<br />
<br />
==Command behaviour==<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 />
|}<br />
<br />
==See also==<br />
<br />
Hans Hagen (2011) [http://pragma-ade.com/general/magazines/mag-1101.pdf Project Structure], ConTEXt magazine #1101.</div>Ponthttps://wiki.contextgarden.net/index.php?title=Project_structure&diff=13341Project structure2011-08-28T22:51:06Z<p>Pont: Added a "see also" section</p>
<hr />
<div>< [[The ConTeXt Way]] | [[Structurals]] ><br />
<br />
==Introduction==<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 />
==File and directory setup==<br />
<br />
===Naming conventions===<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 />
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 />
===Example files===<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 />
===Subdirectories===<br />
<br />
If you keep all files in one directory, it tends to get confusing. Here’s a structured example where we keep all parts of one product together:<br />
<br />
env_mymag.tex<br />
project_mymag.tex<br />
2011-01/prd_issue2011-01.tex<br />
2011-02/prd_issue2011-02.tex<br />
2011-03/prd_issue2011-03.tex<br />
...<br />
2011-03/c_editorial.tex<br />
2011-03/c_article1.tex<br />
...<br />
2011-03/img/author1.jpg<br />
...<br />
general_img/logo.pdf<br />
...<br />
<br />
'''Environment'''<br />
<texcode><br />
\startenvironment env_mymag<br />
\project project_mymag<br />
<br />
...<br />
<br />
% where \product and \component look for TeX input files<br />
\usepath[{2011-01,2011-02,2011-03}]<br />
<br />
% where to look for images<br />
\doifmodeelse{*product}<br />
{\setupexternalfigures[directory={../general_img}]}<br />
{\setupexternalfigures[directory={../general_img, img}]}<br />
<br />
...<br />
\stopenvironment<br />
</texcode><br />
<br />
'''Product'''<br />
<texcode><br />
\startproduct prd_issue2011-01<br />
\project project_mymag<br />
\environment env_mymag<br />
<br />
\component c_editorial<br />
\component c_article1<br />
...<br />
<br />
\stopproduct<br />
</texcode><br />
<br />
(This is untested. I assume that ConTeXt looks automatically into parent directories.)<br />
<br />
==Command behaviour==<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 />
|}<br />
<br />
==See also==</div>Ponthttps://wiki.contextgarden.net/index.php?title=Command/inothermargin&diff=13168Command/inothermargin2011-06-30T21:29:38Z<p>Pont: Pointers to inmargin / inother for MkIV.</p>
<hr />
<div>{{Reference<br />
|name=inothermargin<br />
|attributes=<br />
}}<br />
<br />
== [[Help:Reference|Syntax]] ==<br />
<table cellspacing="4" cellpadding="2" class="cmd"><br />
<tr><br />
<td colspan="2" class="cmd">\inothermargin<span class="first" style="color:red;">[...]</span><span class="second" style="color:red;">[ref]</span><span class="third" >{...}</span></td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[...]</td><br />
<td>+ - low </td><br />
</tr><br />
<tr valign="top" class="second"><br />
<td class="cmd">[ref]</td><br />
<td></td><br />
</tr><br />
<tr valign="top" class="third"><br />
<td class="cmd">{...}</td><br />
<td><i>text</i> </td><br />
</tr><br />
</table><br />
<br />
<br />
== Description == <br />
<br />
Apparently obsolete in MkIV, replaced by [[cmd:inmargin|\inmargin]] and [[cmd:inother|\inother]]. See [http://www.ntg.nl/pipermail/ntg-context/2011/060348.html this message] for more details.<br />
<br />
== Example ==<br />
<!-- Please fill in an example if you can --><br />
<br />
== See also ==<br />
<!-- something like [[cmd:goto|\goto]] --><br />
<br />
[[Category:Reference/en|inothermargin]]</div>Ponthttps://wiki.contextgarden.net/index.php?title=Command/switchtobodyfont&diff=13167Command/switchtobodyfont2011-06-29T04:35:34Z<p>Pont: Linked setupbodyfont</p>
<hr />
<div>{{Reference<br />
|name=switchtobodyfont<br />
|attributes=<br />
}}<br />
<br />
== [[Help:Reference|Syntax]] ==<br />
<table cellspacing="4" cellpadding="2" class="cmd"><br />
<tr><br />
<td colspan="2" class="cmd">\switchtobodyfont<span class="first" >[...,...,...]</span></td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[...,...,...]</td><br />
<td>5pt ... 12pt small big global </td><br />
</tr><br />
</table><br />
<br />
<br />
== Description == <br />
<br />
Use [[cmd:setupbodyfont|\setupbodyfont]] to change the font size for whole document, [[cmd:switchtobodyfont|\switchtobodyfont]] doesn’t change the size for the header/footer.<br />
<br />
== Example ==<br />
<!-- Please fill in an example if you can --><br />
<br />
== See also ==<br />
<!-- something like [[cmd:goto|\goto]] --><br />
<br />
[[Category:Reference/en|switchtobodyfont]]</div>Ponthttps://wiki.contextgarden.net/index.php?title=Command/switchtobodyfont&diff=13166Command/switchtobodyfont2011-06-29T04:34:44Z<p>Pont: Note on setupbodyfont vs. switchtobodyfont</p>
<hr />
<div>{{Reference<br />
|name=switchtobodyfont<br />
|attributes=<br />
}}<br />
<br />
== [[Help:Reference|Syntax]] ==<br />
<table cellspacing="4" cellpadding="2" class="cmd"><br />
<tr><br />
<td colspan="2" class="cmd">\switchtobodyfont<span class="first" >[...,...,...]</span></td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[...,...,...]</td><br />
<td>5pt ... 12pt small big global </td><br />
</tr><br />
</table><br />
<br />
<br />
== Description == <br />
<br />
Use \setupbodyfont to change the font size for whole document, [[cmd:switchtobodyfont|\switchtobodyfont]] doesn’t change the size for the header/footer.<br />
<br />
== Example ==<br />
<!-- Please fill in an example if you can --><br />
<br />
== See also ==<br />
<!-- something like [[cmd:goto|\goto]] --><br />
<br />
[[Category:Reference/en|switchtobodyfont]]</div>Ponthttps://wiki.contextgarden.net/index.php?title=Command/setupbodyfont&diff=13165Command/setupbodyfont2011-06-29T04:34:22Z<p>Pont: Note on setupbodyfont vs switchtobodyfont</p>
<hr />
<div>{{Reference<br />
|name=setupbodyfont<br />
|attributes=<br />
}}<br />
<br />
== [[Help:Reference|Syntax]] ==<br />
<table cellspacing="4" cellpadding="2" class="cmd"><br />
<tr><br />
<td colspan="2" class="cmd">\setupbodyfont<span class="first" >[...,...,...]</span></td><br />
</tr><br />
<tr valign="top" class="first"><br />
<td class="cmd">[...,...,...]</td><br />
<td>name serif regular roman sans support sansserif mono type teletype handwritten calligraphic 5pt ... 12pt </td><br />
</tr><br />
</table><br />
<br />
<br />
== Description == <br />
<br />
Use \setupbodyfont to change the font size for whole document; [[cmd:switchtobodyfont|\switchtobodyfont]] doesn’t change the size for the header/footer.<br />
<br />
== Example ==<br />
<!-- Please fill in an example if you can --><br />
<br />
== See also ==<br />
<!-- something like [[cmd:goto|\goto]] --><br />
<br />
[[Category:Reference/en|setupbodyfont]]</div>Ponthttps://wiki.contextgarden.net/index.php?title=FAQ&diff=12990FAQ2011-04-13T08:09:02Z<p>Pont: Updated oldstyle figures technique</p>
<hr />
<div>{{todo|This FAQ needs to have a lot of things worked on. To avoid clutter from repeated TODO tags, just note missing answers with "...", and put notes about missing information in parentheses.}}<br />
<br />
== ConTeXt General ==<br />
<br />
=== What is ConTeXt? ===<br />
:It is a document production system based on Donald Knuth's [http://www.tug.org/ TeX]. It is a set of high-level macros written in the (somewhat arcane) TeX language, and these macros simplify the task of designing layouts, making hyperlinks, etc.<br />
<br />
=== How does ConTeXt versioning work? ===<br />
:There are 2 different development trees for ConTeXt, called Mark II and Mark IV (MkII, MkIV). They are always released together in a single package because they share a fair amount of code. MkII is stable and is in maintenance-only mode, MkIV is actively developed, including several enhanced features and completely new font handling.<br />
:There are 3 different typesetting engines that work with ConTeXt: pdfTeX, XeTeX and LuaTeX. MkIV works only with LuaTeX, MkII with any one of the engines (pdfTeX is the default). Font setups (typescripts) differ per engine. <br />
:ConTeXt releases are identified by a time stamp, e.g. ''2010.06.23 12:45''. At most times, there is both a ''current'' and a ''beta'' ConTeXt release package available. As explained above, both packages contain MkII and MkIV, the difference between ''current'' and ''beta'' is that the latter contains the unstable developments to MkIV for testing by power users.<br />
:Since "betas" are declared "current" only a few times a year and no bugfixes happen for "currents" (in contrary to "stable" branches in many software projects), you’re mostly better off with beta. It has some bugs fixed, bur mostly some new bugs. If you need a really stable and reliable system and can’t wait a few days for a fix, stick with MkII.<br />
<br />
== Starting with ConTeXt ==<br />
<br />
=== How do I install ConTeXt? ===<br />
:See [[Installation]]<br />
<br />
=== Is there a hello-world document? ===<br />
:Yes. See [[First Document]] and [[Hello world]].<br />
<br />
=== Is ConTeXt free (libre, open source) software? ===<br />
:Yes. See the [[Read Me]] page for details.<br />
<br />
=== Does ConTeXt support Unicode? ===<br />
:Yes. It supports Unicode (UTF-8). In [[XeTeX]] and [[LuaTeX]] it is the default input encoding, while you need to use <cmd>enableregime</cmd><tt>[utf-8]</tt> command when working with [[pdfTeX]]. See also [[Encodings and Regimes]] (This needs a bit of elaboration!)<br />
<br />
=== Why should I only use letters, digits and hyphens in file/path names? ===<br />
:Please see section "Files" of the [http://pmrb.free.fr/contextref.pdf ConTeXt manual]. And also [http://www.ntg.nl/pipermail/ntg-context/2011/057342.html here] for some discussion on the mailing-list.<br />
<br />
== ConTeXt vs. LaTeX ==<br />
<br />
=== What are the differences between ConTeXt and LaTeX? ===<br />
<br />
:The main difference between the two, in my opinion, is a philosophical one: LaTeX was created with the idea of separating content and presentation to such an extent that the typical author would write their content and then use a style file created by someone else to provide the visual presentation. Thus, the proliferation of style files and related things.<br />
<br />
:ConTeXt, on the other hand, retained the idea of separating content and presentation, but was created with the idea of being used for books, where each book tends to have a different layout, and so the expected "end user" is the person doing all the layout. Thus, it's designed to provide a vast amount of flexibility for layout in a way that can be fairly easily defined without needing to write a package (or go find one that's already written).<br />
<br />
:To some extent, modern LaTeX has become a lot more like ConTeXt's intent, with a large quantity of packages, and classes like "memoir" that are designed to give the end user a large amount of control of the visual presentation. Thus, the difference is more one of focus and arrangement -- ConTeXt is all "of a piece" and most things are built in and designed as a complete set, whereas with LaTeX it's generally the case that when you want to do something different, you need to find the right package, and sometimes find that there are three that almost do what you want and none that are quite right (but, then, that also means that there are usually choices for how to do things, which can be good.)<br />
<br />
:Another difference is that IMO, ConTeXt is a lot easier to program in. It was designed a fair bit later than LaTeX, for much faster computers, and thus includes a lot of things that make it load and run slower but make programming a lot easier. <br />
<br />
:Author: Brooks Moses on c.t.t. usenet<br />
<br />
:(Note that the internal coding of ConTeXt has become much easier, too, with the use of LuaTeX - or perhaps seemingly more complicated, as one has to then learn lua to understand the internal workings of ConTeXt. Most users will never delve into this level, but do indeed benefit from the increased performance of the ConTeXt system. The loading of the ConTeXt macros and the processing of even very large typesetting projects is not slow!)<br />
<br />
=== What are the advantages of ConTeXt over LaTeX? ===<br />
<br />
:ConTeXt is a macro package that’s far more advanced than LaTeX. You can enhance LaTeX with third party packages, but not all macro packages work together with each other. ConTeXt is an integrated, powerful and flexible macro package for which you seldom need third party packages. ConTeXt also has been used to create large and complex on-screen documents, including hyperlinks, on screen buttons, forms, cross-document links, and so on.<br />
<br />
:Source: ''LaTeX in proper ConTeXt'' (by Berend de Boer)<br />
<br />
=== What are the advantages of LaTeX over ConTeXt? ===<br />
<br />
:It has been a long battle to get publishers of scientific journals, for example, to accept submissions coded in LaTeX. Currently, submitting a ConTeXt document to such journals or to open repositories such as arXiv is problematic. This is one reason to continue using LaTeX for such work.<br />
<br />
:Another advantage is that many good books on LaTeX exist. Documentation of ConTeXt is not satisfactory, as attested by much activity on the mailing list, but is slowly being improved. And good books on the use of ConTeXt need to be written!<br />
<br />
=== How transcribe this LaTeX macro to ConTeXt? ===<br />
Could you please advice me, how transcribe this macro, controlling that no last line of a paragraph is shorter than the paragraph indenting?<br />
<br />
<texcode><br />
\parfillskip=\hsize<br />
\advance\parfillskip by -1.5\parindent<br />
\advance\parfillskip by 0pt minus \parfillskip<br />
\advance\parfillskip by 0pt minus -1em<br />
</texcode><br />
<br />
Like this:<br />
<texcode><br />
\installalign<br />
{block}<br />
{\parfillskip=\hsize<br />
\advance\parfillskip by -1.5\parindent<br />
\advance\parfillskip by 0pt minus \parfillskip<br />
\advance\parfillskip by 0pt minus -1em}<br />
<br />
% followed by<br />
\setupalign[block]<br />
</texcode><br />
<br />
== XML and other formats ==<br />
<br />
=== How can I convert a document into RTF or HTML? ===<br />
<br />
:Hot topic on the mailing list!<br />
<br />
:There's currently no converter such as LaTeX2html available for ConTeXt. If you're ready to pay a price and put some more effort in your document, the best way is to use XML and produce PDF out of it with ConTeXt and HTML using XSLT.<br />
<br />
:[http://archive.contextgarden.net/thread/20050921.151245.b6a6f87e.en.html ConTeXt to RTF Conversion]<br />
<br />
=== What about the other way around? ===<br />
<br />
:[http://archive.contextgarden.net/thread/20050926.213139.45057948.en.html DOC/RTF to ConTeXt via XML]<br />
<br />
=== XML: please tell me more about it ===<br />
There is a section on the wiki dedicated to typesetting [[XML]] under the various flavours of ConTeXt.<br />
<br />
== Fonts and Typography ==<br />
<br />
=== Can I change to LaTeX’s Computer Modern font? ===<br />
<br />
I see differences in screen between default fonts in ConTeXt (latin modern) and LaTeX (computer modern). Can I switch to latex default font?. I think it's more stetical<br />
: No.<br />
: ''(I mean - of course you can; you only need to modify a few type-xxx.tex files and replace lm with cm in the source. But that solution is not/will not be supported officially.)''<br />
:: Is there any tutorial for doing it?<br />
::: ''No. There are no tutorials for the things that one is not supposed to mess with. Take a look at how things are done in those files and replace any occurrence of lm with cm.''<br />
<br />
=== How can I get the “oldstyle numbers” (text figures) in a document? ===<br />
The mediaeval numbers can be inserted locally via the font switch <code>\os</code>.<br />
<br />
With OpenType fonts that come with text figures you can just ''add'' the respective<br />
font feature to the set of font features.<br />
<br />
<texcode><br />
\definefontfeature[default][default][onum=yes]<br />
<br />
\setupbodyfont[schola,8pt]<br />
<br />
\starttext<br />
1234567890<br />
\stoptext<br />
</texcode><br />
<br />
or<br />
<br />
<texcode><br />
\setupbodyfont[schola,8pt]<br />
<br />
\definefontfeature[oldstyle][onum=yes]<br />
<br />
\starttext<br />
1234567890 {\addff{oldstyle}1234567890}<br />
\stoptext<br />
</texcode><br />
<br />
See mailing list discussion at http://www.ntg.nl/pipermail/ntg-context/2011/058394.html .<br />
<br />
(You can check whether your font supports the “onum” feature by running<br />
<code>otfinfo -f</code> on the OTF file.)<br />
<br />
== Alignment ==<br />
<br />
=== Why does <code>\startalignment[right]</code> or <code>\framed[align=right]{some text}</code> align my text left instead of right and vice versa? ===<br />
:This is for backward compatibility with older versions; see [[Right and left]]. Hans was originally thinking of "ragged right" and "ragged left" alignment. Use '''flushleft''' and '''flushright''' instead.<br />
<br />
=== Why is \framed{} not centred? ===<br />
<texcode><br />
\starttext<br />
\startalignment[middle]<br />
\framed{middle?}<br />
\stopalignment<br />
\startalignment[middle]<br />
middle!<br />
\stopalignment<br />
\stoptext<br />
</texcode><br />
<br />
Answer: \framed switches to vmode, so you need \dontleavehmode:<br />
<texcode><br />
\starttext<br />
\startalignment[middle]<br />
\dontleavehmode<br />
\framed{middle!}<br />
\stopalignment<br />
\stoptext<br />
</texcode><br />
<br />
== Spacing ==<br />
<br />
=== <code>\setupindenting[medium]</code> doesn't work? ===<br />
:This does work, but the effect is not what you expect. Without <code>yes</code>, you have now set up the default size, but you have not turned paragraph indenting on. You have to execute <code>\setupindenting[yes]</code> before it starts actually indenting your paragraphs.<br />
<br />
=== How can I get a horizontal space with a defined width, so as ex. "\hspace{3em}" or "\hspace*{3em}" in LaTeX? ===<br />
:A horizontal space can be inserted with the TeX-Primitive<code>hskip〈dimension〉</code> or with the ConTeXt command <cmd>hspace</cmd><tt>[identifier]</tt>.<br />
<br />
=== Why is there a line-break in the output after some commands? ===<br />
<texcode><br />
\starttext<br />
\externalfigure[hacker][width=1cm] Why a new line here?<br />
\stoptext<br />
</texcode><br />
<br />
Answer: \externalfigure switches to vmode, so you need \dontleavehmode:<br />
<texcode><br />
\starttext<br />
\dontleavehmode<br />
\externalfigure[hacker][width=1cm] Same line!<br />
\stoptext<br />
</texcode><br />
<br />
=== Why the space is gobbled after some commands? ===<br />
<texcode><br />
\starttext<br />
X \externalfigure[hacker][width=1cm] X<br />
\stoptext<br />
</texcode><br />
<br />
Answer: When you don't use all of the optional square bracket arguments,<br />
ConTeXt gobbles the space after the last square bracket. You have at<br />
least 2 solutions:<br />
<texcode><br />
\starttext<br />
X \externalfigure[hacker][width=1cm][] X % adding empty square brackets<br />
<br />
X \externalfigure[hacker][width=1cm]\ X % adding explicit space command<br />
\stoptext<br />
</texcode><br />
<br />
== Math ==<br />
<br />
=== Does $$...$$ work for display math, like in (La)TeX? ===<br />
:No; the spacing above and below the equation will be wrong, and maybe other aspects too. Instead use <cmd>startformula</cmd> and <cmd>stopformula</cmd> (just as one rather generally prefers to use <cmd>begin{equation}</cmd> and <cmd>end{equation}</cmd> in LaTeX).<br />
<br />
=== How do I get a numbered equation? ===<br />
:Add <cmd>placeformula</cmd> before the <cmd>startformula</cmd>.<br />
<br />
== Misc ==<br />
<br />
=== Can I use some simpler bibliography method? ===<br />
<br />
I see that the method of [[http://wiki.contextgarden.net/Bibliography adding references in ConTexT]] is like bibtex in latex. Is there any simple methood like build-in latex method (\thebibliography)?<br />
: Perhaps [[http://wiki.contextgarden.net/Simple_Bibliography Simple bibliography (in simple bibliography)]]?<br />
<br />
=== How do I make a presentation? ===<br />
<br />
:You don't need any special package (like prosper or seminar in LaTeX) to make a presentation. In contrast to LaTeX, changing the document size, changing colors, adding hyperlinks, ... appears to be extremely simple in ConTeXt. See [[Presentations]] for more specific topics.</div>Pont