[NTG-context] Some questions about context

Xan DXpublica at telefonica.net
Mon Mar 5 21:12:42 CET 2007


Well, thank you very much to all of you: Wolfgang, Aditya and Mojca.

First of all thank you for answering to what I want (in latex groups 
people use to answer "this can't be done" or "do you really want that?")

And secondly, wow!! you provided very amount of information: examples 
and code. Good!!! More than ever I imagine

I will study all of that

Thanks,
Xan.

PS: Yes, I refer to xyfig. And my version is
texexec --version

  TeXExec 5.2.4 - ConTeXt / PRAGMA ADE 1997-2005

                texexec : TeXExec 5.2.4 - ConTeXt / PRAGMA ADE 1997-2005
                texutil : TeXUtil 9.0.0 - ConTeXt / PRAGMA ADE 1992-2004
                    tex : pdfeTeX, 3.141592-1.21a-2.2 (Web2C 7.5.4)
                context : ver: 2005.01.31
                cont-en : ver: 2005.01.31  fmt: 2006.6.1  mes: english

         total run time : 1 seconds

in ubuntu system




En/na Wolfgang Schuster ha escrit:
> On Mon, 05 Mar 2007 13:43:51 +0100
> Xan <DXpublica at telefonica.net> wrote:
> 
>> Hi,
>>
> 
> Hi Xan,
> 
>> I'm new user of context. I gone from latex, which I use in the last 5 
>> years intensively
>>
>> 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
> 
>> 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]
> 
>> 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.
> 
>> 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"?
> 
> 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
> 
>> 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.
> 
>> 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
> 
>> 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.
> 
>> Thank you very much,
>> Xan.
>>
> 
> Wolfgang
> 
> 
> ------------------------------------------------------------------------
> 
> %D \module
> %D   [       file=wolf-txt,
> %D        version=2006.10.28,
> %D          title=\CONTEXT\ User Module,
> %D       subtitle=Texts,
> %D         author=Wolfgang Schuster,
> %D           date=\currentdate,
> %D      copyright=Wolfgang Schuster]
> 
> \writestatus{loading}{Context User Module / Texts}
> 
> \unprotect
> 
> \startnotmode[wolf]
> 
>   \def\????tx{@@@@tx}
> 
>   \def\useifdefined#1%
>     {\ifcsname#1\endcsname
>        \csname#1\endcsname
>      \fi}
> 
> \stopnotmode
> 
> %D \macros
> %D  {settoptexts, setheadertexts, settexttexts,
> %D   setfootertexts, setbottomtexts}
> %D
> %D \starttyping
> %D \setheadertexts
> %D   [reset]
> %D
> %D \setheadertexts
> %D   [left=odd left,middle=odd middle,right=odd right]
> %D
> %D \setheadertexts
> %D   [text]
> %D   [left=odd left,middle=odd middle,right=odd right]
> %D
> %D \setheadertexts
> %D   [left=odd left,middle=odd middle,right=odd right]
> %D   [left=even left,middle=even middle,right=even right]
> %D
> %D \setheadertexts
> %D   [text]
> %D   [left=odd left,middle=odd middle,right=odd right]
> %D   [left=even left,middle=even middle,right=even right]
> %D \stoptyping
> 
> \def\settoptexts    {\doquadrupleempty\dosetextendedtexts[\v!top]}
> \def\setheadertexts {\doquadrupleempty\dosetextendedtexts[\v!header]}
> \def\settexttexts   {\doquadrupleempty\dosetextendedtexts[\v!text]}
> \def\setfootertexts {\doquadrupleempty\dosetextendedtexts[\v!footer ]}
> \def\setbottomtexts {\doquadrupleempty\dosetextendedtexts[\v!bottom]}
> 
> %\def\dosettextcontent[#1][#2][#3][#4][#5]% header text middle text/text
> %  {\iffifthargument
> %     \setvalue{\??tk#1#2\executeifdefined{:\c!text:#3:}\c!middletext}%
> %       {\dodoubletexts{\??tk#1}{#2}%
> %          {\c!leftstyle \c!leftcolor \c!leftwidth }{#4}%
> %          {\c!rightstyle\c!rightcolor\c!rightwidth}{#5}}%
> %   \else\iffourthargument
> %     \setvalue{\??tk#1#2\executeifdefined{:\c!text:#3:}\c!middletext}%
> %       {\dodoubletexts{\??tk#1}{#2}%
> %          {\c!leftstyle \c!leftcolor \c!leftwidth }{#4}%
> %          {\c!rightstyle\c!rightcolor\c!rightwidth}{#4}}%
> %   \else\ifthirdargument
> %     \setvalue{\??tk#1#2\c!middletext}%
> %       {\dodoubletexts{\??tk#1}{#2}%
> %          {\c!leftstyle \c!leftcolor \c!leftwidth }{#3}%
> %          {\c!rightstyle\c!rightcolor\c!rightwidth}{#3}}%
> %   \fi\fi\fi}
> 
> \def\dosetextendedtexts[#1][#2][#3][#4]%
>   {\iffourthargument
>      \getparameters[\????tx\v!left] [#3]
>      \getparameters[\????tx\v!right][#4]
>      \dodosetextendedtexts{#1}{#2}
>    \else\ifthirdargument
>      \doifinsetelse{#2}{\v!text,\v!margin,\v!edge}
>        {\getparameters[\????tx\v!left] [#3]
>         \getparameters[\????tx\v!right][#3]
>         \dodosetextendedtexts{#1}{#2}}
>        {\getparameters[\????tx\v!left] [#2]
>         \getparameters[\????tx\v!right][#3]
>         \dodosetextendedtexts{#1}\v!text}
>    \else\ifsecondargument
>      \doifelse{#2}\v!reset
>        {\doresetextendedtexts{#1}}
>        {\getparameters[\????tx\v!left] [#2]
>         \getparameters[\????tx\v!right][#2]
>         \dodosetextendedtexts{#1}\v!text}
>    \fi\fi\fi}
> 
> \def\dodosetextendedtexts#1#2%
>     {\setvalue{\??tk#1#2\c!lefttext}%
>        {\dodoubletexts at wolf{\??tk#1}{#2}%
>           {\c!leftstyle \c!leftcolor \c!leftwidth }{\useifdefined{\????tx\v!left \v!left  }}%
>           {\c!rightstyle\c!rightcolor\c!rightwidth}{\useifdefined{\????tx\v!right\v!left  }}}%
>      \setvalue{\??tk#1#2\c!middletext}%
>        {\dodoubletexts at wolf{\??tk#1}{#2}%
>           {\c!leftstyle \c!leftcolor \c!leftwidth }{\useifdefined{\????tx\v!left \v!middle}}%
>           {\c!rightstyle\c!rightcolor\c!rightwidth}{\useifdefined{\????tx\v!right\v!middle}}}%
>      \setvalue{\??tk#1#2\c!righttext}%
>        {\dodoubletexts at wolf{\??tk#1}{#2}%
>           {\c!leftstyle \c!leftcolor \c!leftwidth }{\useifdefined{\????tx\v!left \v!right }}%
>           {\c!rightstyle\c!rightcolor\c!rightwidth}{\useifdefined{\????tx\v!right\v!right }}}}
> 
> \def\doresetextendedtexts#1%
>   {\def\docommand##1%
>      {\letvalue{\??tk#1##1\c!lefttext  }\empty
>       \letvalue{\??tk#1##1\c!middletext}\empty
>       \letvalue{\??tk#1##1\c!righttext }\empty}
>    \processcommalist[text,margin,edge]\docommand}
> 
> %\def\dosingletexts#1#2#3#4#5#6%
> %  {\bgroup
> %   \expandafter\convertargument#6\to\ascii
> %   \doifsomething\ascii
> %     {\doattributes{#1#2}#3#4%
> %        {\placetextlinestrut{#1}% here !
> %        %\doifdefinedelse{\??mk\ascii\c!coupling} % brrr
> %         \doifelsemarking\ascii
> %           {\dolimitatetexts{#1#2#5}{\getmarking[\ascii][\v!first]}}
> %           {\ConvertConstantAfter\doifelse\v!pagenumber{#6}
> %               \@@plaatspaginanummer
> %              {\ConvertConstantAfter\doifelse\v!date{#6}
> %                 {\currentdate}
> %                 {% #6{}{}{} -> {} needed for macros that look
> %                  % ahead, like \uniqueMPgraphic
> %                  \opeenregel\dolimitatetexts{#1#2#5}{#6{}{}{}}}}}}}%
> %  \egroup}
> 
> \def\dosingletexts at wolf#1#2#3#4#5#6%
>   {\bgroup
>    \edef\ascii at wolf{#6}%
>    \expandafter\convertargument\ascii at wolf\to\ascii
>    \doifsomething\ascii
>      {\doattributes{#1#2}#3#4%
>         {\placetextlinestrut{#1}% here !
>          \doifelsemarking\ascii
>            {\dolimitatetexts{#1#2#5}{\getmarking[\ascii][\v!first]}}
>            {\doifelse\v!pagenumber{#6}
>                \@@plaatspaginanummer
>               {\doifelse\v!date{#6}
>                  {\currentdate}
>                  {\opeenregel\dolimitatetexts{#1#2#5}{#6{}{}{}}}}}}}%
>   \egroup}
> 
> %\def\dodoubletexts#1#2#3#4#5#6%
> %  {\doifoddpageelse
> %     {\dosingletexts{#1}{#2}#3{#4}}  % #3 => provides three arguments
> %     {\dosingletexts{#1}{#2}#5{#6}}} % #5 => provides three arguments
> 
> \def\dodoubletexts at wolf#1#2#3#4#5#6%
>   {\doifoddpageelse
>      {\dosingletexts at wolf{#1}{#2}#3{#4}}  % #3 => provides three arguments
>      {\dosingletexts at wolf{#1}{#2}#5{#6}}} % #5 => provides three arguments
> 
> %D \macros{presettext}
> %D
> %D The next example demonstrates how we can use this
> %D mechanism to provide page (event) dependent text lines.
> %D
> %D \starttyping
> %D \presettext[chapter][footer][middle=pagenumber]
> %D \setuphead[chapter][header=high,footer=chapter]
> %D \setheadertexts[middle=pagenumber]
> %D \setfootertexts[left=left,right=right]
> %D \chapter{eerste} \dorecurse{20}{\input tufte \relax}
> %D \chapter{tweede} \dorecurse{20}{\input tufte \relax}
> %D \stoptyping
> 
> %\def\definetext
> %  {\doseventupleempty\dodefinetext}
> 
> \def\presettext
>   {\doquintupleempty\dopresettext}
> 
> %\def\dodefinetext[#1][#2][#3][#4][#5][#6][#7]%
> %  {\ifseventhargument
> %     \setvalue{\??tk#2#3#1}{\dosixtupleempty\dosetuptexts[#2][#3][#4][#5][#6][#7]}%
> %   \else\ifsixthargument
> %     \setvalue{\??tk  #2#1}{\dosixtupleempty\dosetuptexts[#2][#3][#4][#5][#6]}%
> %   \else\iffifthargument
> %     \setvalue{\??tk#2#3#1}{\dosixtupleempty\dosetuptexts[#2][#3][#4][#5]}%
> %   \else\iffourthargument
> %     \setvalue{\??tk  #2#1}{\dosixtupleempty\dosetuptexts[#2][#3][#4]}%
> %   \else
> %     \setvalue{\??tk  #2#1}{\dosixtupleempty\dosetuptexts[#2][#3]}%
> %   \fi\fi\fi\fi}
> 
> \def\dopresettext[#1][#2][#3][#4][#5]%
>   {\iffifthargument
>      \setvalue{\??tk#2#3#1}{\doquadrupleempty\dosetextendedtexts[#2][#3][#4][#5]}%
>    \else\iffourthargument
>      \setvalue{\??tk  #2#1}{\doquadrupleempty\dosetextendedtexts[#2][#3][#4]}%
>    \else
>      \setvalue{\??tk  #2#1}{\doquadrupleempty\dosetextendedtexts[#2][#3]}%
>    \fi\fi}
> 
> \protect \endinput
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> ntg-context mailing list
> ntg-context at ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context



More information about the ntg-context mailing list