[NTG-context] Some questions about context

Aditya Mahajan adityam at umich.edu
Mon Mar 5 15:44:44 CET 2007


On Mon, 5 Mar 2007, Wolfgang Schuster wrote:

> On Mon, 05 Mar 2007 13:43:51 +0100
> Xan <DXpublica at telefonica.net> wrote:
>
> Hi Xan,
>
>> I'm new user of context. I gone from latex, which I use in the last 5
>> years intensively

Welcome to ConTeXt :)

>> I read your wiki but I don't find some answers to my wishes. Basically I
>> want to know what are the equivalent of latex commands/packages in
>> context. Can you help me in thay?. Thanks in advance.... so let's go:
>>
>> 1) The first question is about landscape mode and xdvi. In latex, if we
>> want landscape, we put:
>>
>> \documentclass[a4paper,10ptt,landscape]{article}
>>
>> but when we see .dvi in xdvi, xdvi does not detects automatically that
>> it's in landscape mode.
>>
>> For that, we have to put:
>>
>> \usepackage[dvips,...]{geometry}
>>
>> now the xdvi show .dvi in landscape mode
>>
>>
>> The question is, how we get the same in context?. If we put:
>>
>> \setuppapersize[A4,landscape][A4,landscape]
>>
>> the xdvi program does not detect that .dvi is in landscape mode. Is
>> there an equivalent command of geometry that allow that?
>
> ConTeXt use PDF as default output format. A short test with the dvips
> way show a rotated content but the page is not roatated, this seems to
> be not suported

I do not use dvi route, but the page should be rotated in the ps file. 
AFAIU, dvi has no option for specifying the page size or page 
orientation. The viewers that honor ps code for page orientation and 
size rely on the manner that latex puts in those commands in the dvi 
file. I do not know if ConTeXt follows that route or not.

>>
>> 2) In latex there is the fancyhdr package that allows to put lines at
>> bottom and at top of the page and put right and left headings and
>> footers like: \rhead{Hello} ....
>>
>> What is the equivalent in context?
>>
>
> The ConTeXt method for headers is:
>
> \setupheadertexts[centered on odd and even page]
> \setupheadertexts[left on odd and even page][right on odd and even page]
> \setupheadertexts[left on even page][right on even page]
>                 [left on odd page][right on odd page]
>
> The same methos id used for footer with \setupfootertexts instead of
> \setupheadertexts.
>
> I attached a file that provides another way to set the headers and
> footers in your document. You can use it with the command
> \usemodule[wolf-txt]. A few examples can be found in the source.
>
>> 3) Is there an equivalent to the package lastpage in context? So can we
>> put [number of page]/[total number of pages] at the bottom of the page?
>
> \setupfootertexts[\pagenumber/\lastpage]

A lot of Latex packages are built into ConTeXt. See 
http://wiki.contextgarden.net/Latex_Packages

>>
>> 4) How can we create new counters in context? Like latex
>> \newcounter{mycount}
>
> You can use the plain TeX command \newcount\mycount or the ConTeXt
> command \newcounter\mycount to create a counter. The ConTeXt methos
> provides also the two commands \increment\mycount to increase your own
> counter by one and the command \decrement\mycount to reduce your own
> counter by one.

There are also numbers, which I find easier to use. See 
http://wiki.contextgarden.net/Counters


>> 5) In mathematics, in context there are three modules: "nath", "amsl",
>> "new math", according to http://wiki.contextgarden.net/Math
>>
>> What are these features and limitations? What is the "best"?

I would suggest always use \usemodule[newmat] in your documents. For 
inline math, ConTeXt can do everything that LaTeX (and amsmath) do. 
For multi-line display, I would consider nath and amsl obsolete. 
Almost all of the functionality is available in the core. I wrote an 
article in Maps last year showing how to do the common multiline 
displays using ConTeXt. I do not think that article is available 
online to non-members of ntg right now.


> ConTeXt provides now many functions from these modules by default.
> Aditya wrote a few articles about the new option for maths in his My
> Ways and at the wiki.
>
> Please take a look at the following articles
>
> http://dl.contextgarden.net/myway/mathalign.pdf
> http://dl.contextgarden.net/myway/matharrows.pdf

The matharrows My Way is a slightly out of date. For matharrows, 
documentation is also provided in math-ext.tex.

And a to be written My Way on subformula numbering.

>> 6) Is there an equivalent module of xyfig?
>>
>
> Do you mean xypic?
>
> Take a look at Tikz/Pgf:
>
> http://sourceforge.net/projects/pgf/
>
> or MetaPost/MetaFun:
>
> http://wiki.contextgarden.net/MetaPost
> http://wiki.contextgarden.net/MetaFun
>
> bot come with their own manuals.
>
>> 7) Is there an equivalence of amssymbols?. How can I display for example
>> $x \leadsto \int_a^b \arcsin (x+\cos \alhpa)$?
>>
>
> This should work by default. AFAIK the AMS symbols are enabled by
> default in ConTeXT. A short test worked without problems.

You do need to correct the spelling ;) \alpha. Also see
http://wiki.contextgarden.net/Math/basic

I am working on explaining the whole math thing at 
http://wiki.contextgarden.net/Math_new but progress has been slow.


>> 8) How can we do a "minipage" in context?
>>
>
> You can use the more powerful frame environemnt.
>
> \starttext
>
> \framed[width=6cm,align=right]{\readfile{knuth}\donothing\donothing}
>
> \stoptext

Also read the documentation for \defineframedtext, and text 
backgrounds (which can also split across pages).


>> 9) Can you tell me some link about babel and hipernation?
>>
>
> You set the language for your document with the \mainlanguage[xx] and
> the \language[xx] commands where "xx" stands for your language id as
> "en" for english.

Also \enableregime[utf] for utf input encoding (same as 
\usepackage[utf-8]{inputenc}).

Aditya


More information about the ntg-context mailing list