Difference between revisions of "FAQ"

From ConTeXt wiki
(What is ConTeXt?)
(file names)
Line 195: Line 195:
 
\stoptext
 
\stoptext
 
</texcode>
 
</texcode>
 +
 +
=== Why should I only use letters, digits and hyphens in file/path names? ===
 +
 +
Answer: 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.

Revision as of 22:29, 14 March 2011


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. (See: To-Do List)


What is ConTeXt?

It is a document production system based on Donald Knuth's 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.

How does ConTeXt versioning work?

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

Is there a hello-world document?

Yes. See First Document and Hello world.

Is ConTeXt free (open source) software?

Yes. See the Read Me page for details.

How do I install ConTeXt?

See Installation

Does ConTeXt support Unicode?

Yes. It supports Unicode (UTF-8). In XeTeX and LuaTeX it is the default input encoding, while you need to use \enableregime[utf-8] command when working with pdfTeX. See also Encodings and Regimes (This needs a bit of elaboration!)

Why does \startalignment[right] or \framed[align=right]{some text} align my text left instead of right and vice versa?

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.

What are the differences between ConTeXt and LaTeX?

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.
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).
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.)
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.
Author: Brooks Moses on c.t.t. usenet
(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!)

What are the advantages of ConTeXt over LaTeX?

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.
Source: LaTeX in proper ConTeXt (by Berend de Boer)

What are the advantages of LaTeX over ConTeXt?

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

How can I convert a document into RTF or HTML?

Hot topic on the mailing list!
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.
ConTeXt to RTF Conversion

What about the other way around?

DOC/RTF to ConTeXt via XML


Can I change to Computer Modern's LaTeX font?

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

No.
(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.)
Is there any tutorial for doing it?
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.

Can I use some simpler bibliography method?

I see that the method of [adding references in ConTexT] is like bibtex in latex. Is there any simple methood like build-in latex method (\thebibliography)?

Perhaps [Simple bibliography (in simple bibliography)]?

XML: please tell me more about it

There is a section on the wiki dedicated to typesetting XML under the various flavours of ConTeXt.

How do I make a presentation?

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.

\setupindenting[medium] doesn't work?

This does work, but the effect is not what you expect. Without yes, you have now set up the default size, but you have not turned paragraph indenting on. You have to execute \setupindenting[yes] before it starts actually indenting your paragraphs.

Does $$...$$ work for display math, like in (La)TeX?

No; the spacing above and below the equation will be wrong, and maybe other aspects too. Instead use \startformula and \stopformula (just as one rather generally prefers to use \begin{equation} and \end{equation} in LaTeX).

How do I get a numbered equation?

Add \placeformula before the \startformula.

How can I get a horizontal space with a defined width, so as ex. "\hspace{3em}" or "\hspace*{3em}" in LaTeX?

A horizontal space can be inserted with the TeX-Primitive\hskip〈dimension〉 or with the ConTeXt command \hspace[identifier].

How can I get the “oldstyle numbers” (text figures) in a document?

The mediaeval numbers can be inserted locally via the font switch \os.

With OpenType fonts that come with text figures you can just add the respective font feature to the current set of font features.

% defining a new feature set called “oldstyle”
\definefontfeature [oldstyle] [default] [onum=yes]

% adding this feature set
\addff{oldstyle}

\starttext
1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987
\stoptext

(You can check whether your font supports the “onum” feature by running otfinfo -f on the OTF file.)

How transcribe this LaTeX macro to ConTEXt?

Could you please advice me, how transcribe this macro, controlling that no last line of a paragraph is shorter than the paragraph indenting?

\parfillskip=\hsize
\advance\parfillskip by -1.5\parindent
\advance\parfillskip by 0pt minus \parfillskip
\advance\parfillskip by 0pt minus -1em

Like this:

\installalign
  {block}
  {\parfillskip=\hsize
   \advance\parfillskip by -1.5\parindent
   \advance\parfillskip by 0pt minus \parfillskip
   \advance\parfillskip by 0pt minus -1em}

% followed by
\setupalign[block]

Why is \framed{} not centred?

\starttext
\startalignment[middle]
  \framed{middle?}
\stopalignment
\startalignment[middle]
  middle!
\stopalignment
\stoptext

Answer: \framed switches to vmode, so you need \dontleavehmode:

\starttext
\startalignment[middle]
  \dontleavehmode
  \framed{middle!}
\stopalignment
\stoptext

Why is there a line-break in the output after some commands?

\starttext
\externalfigure[hacker][width=1cm] Why a new line here?
\stoptext

Answer: See previous answer!

\starttext
\dontleavehmode
\externalfigure[hacker][width=1cm] Same line!
\stoptext

Why the space is gobbled after some commands?

\starttext
X \externalfigure[hacker][width=1cm] X
\stoptext

Answer: When you don't use all of the optional square bracket arguments, ConTeXt gobbles the space after the last square bracket. You have at least 2 solutions:

\starttext
X \externalfigure[hacker][width=1cm][] X % adding empty square brackets

X \externalfigure[hacker][width=1cm]\ X % adding explicit space command
\stoptext

Why should I only use letters, digits and hyphens in file/path names?

Answer: Please see section "Files" of the [ConTeXt manual]. And also [here] for some discussion on the mailing-list.