Open main menu

Changes

1,079 bytes added ,  16:32, 5 August 2006
Aditya's macro for \myin
As I told you in \in{chapter}[preface] on \at{page}[preface], I really like \ConTeXt. And Mr.\,Zapf (see \at{page}[zapfquote]) at least likes \TeX\ in general.
</context>
 
== Different layouts for different kinds of references ==
 
If you want less typing to get special formatting for the references to sections, equations, ... here's Aditya's recipe to do it.
 
Suppose that you want to get
:See ''equation (2.3)'' or ''section 4.2''.
where the slanted content is typeset automatically. You first need to define the formatting with [[cmd:definereferenceformat|\definereferenceformat]]:
<texcode>
\definereferenceformat[insec][text=section]
\definereferenceformat[ineq] [left=(,right=),text=equation]
</texcode>
Then you can simply type
<texcode>
See \ineq[eq:some equation] or \insec[sec:some section].
</texcode>
 
A more automated solution uses the following macro:
 
<texcode>
\def\myin[#1:#2]{%
\expandafter\ifx\csname in#1\endcsname\relax
\writestatus{warning}{referenceformat in#1 not defined}%
\in[#1:#2]%
\else
\csname in#1\endcsname[#1:#2]%
\fi}
</texcode>
 
and requires you to write the following code:
 
<texcode>
See \myin[eq:some equation] or \myin[sec:some section].
</texcode>
 
{{todo|complete example would be better}}