Difference between revisions of "Cross Referencing"

From ConTeXt wiki
Jump to navigationJump to search
(Added temporary download url)
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<div style="color: red">Page in progress...</div>
+
(This module is currently not in die distribution. Until it is, you can download it from [http://zenlima.com/context/t-crossref-0.9.3.zip here]).
  
References in a (academic) text are either interal (linking to an other point inside the same document) or external (linking to a entity of the bibliography that points to a different document).  
+
Cross references in a (academic) text are either internal (linking to an other point inside the same document) or external (linking to a entity of the bibliography that points to a different document).  
  
Here are some concrete example cross references:
+
Here are some concrete examples of cross references:
  
 
{| class=wikitable
 
{| class=wikitable
Line 81: Line 81:
  
 
<texcode>
 
<texcode>
 +
\setupcolors[state=start]
  
 +
\definecolor[red][r=1]
 +
\definecolor[green][g=1]
 +
\definecolor[blue][b=1]
 +
 +
\setupinteraction[state=start,style=normal,color=red,contrastcolor=red]
 +
% color and contrastcolor must be the the final color of the refref area in crossref
 +
 +
\usemodule[crossref][refColor=green,reffixColor=blue,refrefColor=red]
 +
 +
\starttext
 +
 +
\textreference[ref1]{1.1/3}
 +
 +
Should be: 1.1/3 and is: \crossref[ref1]
 +
 +
Should be: (Abs. 1.1/3) and is: \crossref[type=internal,left={(},label=Abs.,right={)}][ref1]
 +
 +
Should be: [Zen12, p 23] and is: \crossref[type=external,detail={p. 23}][ref2]
 +
 +
Should be: (nach [Zen12, S. 32-33] und weitere) and is: \crossref[type=external, left={(nach }, right={ und weitere)},detail={S. 32-33}][ref2]
 +
 +
\textreference[ref2]{Zen12} Biblio blabla fasel
 +
 +
\stoptext
 
</texcode>
 
</texcode>
  
Line 87: Line 112:
  
 
Often references (or links) are printed in a different color than the normal text. In pararef the colors can be set via three paramters:
 
Often references (or links) are printed in a different color than the normal text. In pararef the colors can be set via three paramters:
* <code>crossrefColor</code> for the entire reference text,
+
* <code>refColor</code> for the entire reference text,
* <code>crossreffixColor</code> for the color of the prefix and suffix if different from <code>crossrefColor</code>
+
* <code>reffixColor</code> for the color of the prefix and suffix if different from <code>refColor</code>
* <code>crossrefrefColor</code> for the detail, ref itself and ref details
+
* <code>refrefColor</code> for the detail, ref itself and ref details if different from <code>refColor</code>
  
They are defined as parameters of the module:
+
They are defined as parameters of the [https://modules.contextgarden.net/cgi-bin/module.cgi/ruid=1253027735/action=view/id=67 module]:
 
<texcode>
 
<texcode>
\usemodule[pararef][crossrefColor=...,crossreffixColor=...,crossrefrefColor=...]
+
\usemodule[crossref][refColor=...,reffixColor=...,refrefColor=...]
 
...
 
...
 
</texcode>
 
</texcode>
Line 102: Line 127:
 
\setupcrossreftext[internalPrefix={}]
 
\setupcrossreftext[internalPrefix={}]
 
\setupcrossreftext[internalSuffix={}]
 
\setupcrossreftext[internalSuffix={}]
\setupcrossreftext[externalPrefix={\[}]
+
\setupcrossreftext[externalPrefix={[}]
\setupcrossreftext[externalSuffix={\]}]
+
\setupcrossreftext[externalSuffix={]}]
 +
\setupcrossreftext[refDetailDivider={\textcomma\space}]
 
\setupcrossreftext[cz][atpageLeft={ na straně }]
 
\setupcrossreftext[cz][atpageLeft={ na straně }]
 
\setupcrossreftext[cz][atpageRight={ }]
 
\setupcrossreftext[cz][atpageRight={ }]
Line 110: Line 136:
 
\setupcrossreftext[en][atpageLeft={ on page }]
 
\setupcrossreftext[en][atpageLeft={ on page }]
 
\setupcrossreftext[en][atpageRight={}]
 
\setupcrossreftext[en][atpageRight={}]
 +
\setupcrossreftext[ru][atpageLeft={ на странице }]
 +
\setupcrossreftext[ru][atpageRight={}]
 +
\setupcrossreftext[uk][atpageLeft={ на сторінці }]
 +
\setupcrossreftext[uk][atpageRight={}]
 +
 
</texcode>
 
</texcode>
  
If you want to change the "classic" style of referencing to the "new" style you only need:
+
If you want to change the "classic" style of referencing to the "new" style you only need to add:
  
 
<texcode>
 
<texcode>

Latest revision as of 16:23, 15 April 2019

(This module is currently not in die distribution. Until it is, you can download it from here).

Cross references in a (academic) text are either internal (linking to an other point inside the same document) or external (linking to a entity of the bibliography that points to a different document).

Here are some concrete examples of cross references:

"Classic" style "New" style
(↑ = external link - ↗ = internal link)
[XYZ] (↑XYZ) and
if directly addressed ↑XYZ
[XYZ, p. 23] (↑XYZ, p. 23)
↑XYZ, p. 23,
[XYZ, p. 22] and [ABC, p. 22-45] (↑XYZ, p. 22, and ↑ABC, p. 22-45)
Abbildung 2.2 ↗Abbildung 2.2
Abbildung 2.2 auf Seite 23 ↗Abbildung 2.2 auf Seite 23
(Absatz 2.4.9/12 auf Seite 23 bis 2.4.2/10 auf Seite 25) (↗Absatz 2.4.9/12 auf Seite 23 bis ↗Absatz 2.4.2/10 auf Seite 25)
(siehe Abs. 3/21) (siehe ↗Absatz 3/21)
(siehe Absätze 3.1/35 und 3.1/38) (siehe Absätze ↗3.1/35 und ↗3.1/38)

This cross references have following structure in common:

left refprefix label ref detail refsuffix right
(
(siehe
Absätze
und
bis


[
Abbildung
Absatz
Abs.
XYZ
2.2
2.2 auf Seite 23
2.4.9/12 auf Seite 23
2.4.2/10 auf Seite 25
3/21
, p. 23 ] )

Referencing

For cross reference the method \crossref is created. It has follow syntax:

\crossref[#2]
\crossref[#1][#2]

#1	type	   	= *internal external none
	left		= ..text..
	right    	= ..text..
	label		= ..text..
	detail 		= ..text..

#2	<reference>

Here a simple usage example:

\setupcolors[state=start]

\definecolor[red][r=1]
\definecolor[green][g=1]
\definecolor[blue][b=1]

\setupinteraction[state=start,style=normal,color=red,contrastcolor=red]
% color and contrastcolor must be the the final color of the refref area in crossref

\usemodule[crossref][refColor=green,reffixColor=blue,refrefColor=red]

\starttext

\textreference[ref1]{1.1/3}

Should be: 1.1/3 and is: \crossref[ref1]

Should be: (Abs. 1.1/3) and is: \crossref[type=internal,left={(},label=Abs.,right={)}][ref1]

Should be: [Zen12, p 23] and is: \crossref[type=external,detail={p. 23}][ref2]

Should be: (nach [Zen12, S. 32-33] und weitere) and is: \crossref[type=external, left={(nach }, right={ und weitere)},detail={S. 32-33}][ref2]

\textreference[ref2]{Zen12} Biblio blabla fasel

\stoptext

Settings

Often references (or links) are printed in a different color than the normal text. In pararef the colors can be set via three paramters:

  • refColor for the entire reference text,
  • reffixColor for the color of the prefix and suffix if different from refColor
  • refrefColor for the detail, ref itself and ref details if different from refColor

They are defined as parameters of the module:

\usemodule[crossref][refColor=...,reffixColor=...,refrefColor=...]
...

The brackets and text part for \crossref can also be adjusted or extended with other languages:

\setupcrossreftext[internalPrefix={}]
\setupcrossreftext[internalSuffix={}]
\setupcrossreftext[externalPrefix={[}]
\setupcrossreftext[externalSuffix={]}]
\setupcrossreftext[refDetailDivider={\textcomma\space}]
\setupcrossreftext[cz][atpageLeft={ na straně }]
\setupcrossreftext[cz][atpageRight={ }]
\setupcrossreftext[de][atpageLeft={ auf Seite }]
\setupcrossreftext[de][atpageRight={}]
\setupcrossreftext[en][atpageLeft={ on page }]
\setupcrossreftext[en][atpageRight={}]
\setupcrossreftext[ru][atpageLeft={ на странице }]
\setupcrossreftext[ru][atpageRight={}]
\setupcrossreftext[uk][atpageLeft={ на сторінці }]
\setupcrossreftext[uk][atpageRight={}]

If you want to change the "classic" style of referencing to the "new" style you only need to add:

\setupcrossreftext[internalPrefix={}]
\setupcrossreftext[internalSuffix={}]
\setupcrossreftext[externalPrefix={}]
\setupcrossreftext[externalSuffix={}]