Difference between revisions of "Paragraph Referencing"

From ConTeXt wiki
Jump to navigationJump to search
(Added temporary download url)
 
(13 intermediate revisions by 3 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-pararef-0.8.2.zip here]).
  
This module understands a paragraph as a full closed block of one thought. This means that inside a paragraph enumerations, formulas etc. can apear. That is why a paragraph must be defined manuelly via <code>\startParagraph</code> and <code>\stopParagraph</code>.
+
The [https://modules.contextgarden.net/cgi-bin/module.cgi/ruid=1253027735/action=view/id=64 pararef] module understands a paragraph as a full closed block of one thought. This means that inside a paragraph enumerations, formulas etc. can appear. That is why a paragraph must be defined manually via <code>\startParagraph</code> and <code>\stopParagraph</code>.
  
 
==Paragraphs==
 
==Paragraphs==
Line 26: Line 26:
 
\stoptext
 
\stoptext
 
</texcode>
 
</texcode>
 +
 +
[[Image:t-pararef-1.jpg]]
 +
  
 
==References==
 
==References==
  
Now the more practical part: the paragraph referencing. To reference to an paragraph the package pararef contains the function <code>\crossref</code>
+
Now the more practical part: the paragraph referencing. To reference to an paragraph the package pararef makes use of the [[Cross Referencing|crossref]] module.
 
 
<texcode>
 
\crossref[<reference>]
 
\crossref[brakets=...,text=...][<reference>]
 
</texcode>
 
  
 
Here a simple usage example:
 
Here a simple usage example:
Line 40: Line 38:
 
<texcode>
 
<texcode>
 
\usemodule[pararef]
 
\usemodule[pararef]
 +
\usemodule[crossref]
  
 
\starttext
 
\starttext
Line 57: Line 56:
 
Here are two references to destinations on the same page:
 
Here are two references to destinations on the same page:
 
\startitemize[nowhite]
 
\startitemize[nowhite]
\item ref1 should be: para. 1.1/2 and is: \crossref[text={para.}][ref1]
+
\item ref1 should be: para. 1.1/2 and is: \crossref[label={para.}][ref1]
\item ref2 should be: sec. 1.2 and is: \crossref[text={sec.}][ref2]
+
\item ref2 should be: sec. 1.2 and is: \crossref[label={sec.}][ref2]
 
\stopitemize
 
\stopitemize
 
Here is one references with brakets:
 
Here is one references with brakets:
 
\startitemize[nowhite]
 
\startitemize[nowhite]
\item ref1 should be: para. 1.1/2 and is: \crossref[brakets=yes,text={para.}][ref1]
+
\item ref1 should be: (para. 1.1/2) and is: \crossref[left={(},right={)},label={para.}][ref1]
 
\stopitemize
 
\stopitemize
 
\stopParagraph
 
\stopParagraph
Line 74: Line 73:
 
Here are two references to destinations on an other page:
 
Here are two references to destinations on an other page:
 
\startitemize[nowhite]
 
\startitemize[nowhite]
\item ref1 should be: para. 1.1/2 on page 1 and is: \crossref[text={para.}][ref1]
+
\item ref1 should be: para. 1.1/2 on page 1 and is: \crossref[label={para.}][ref1]
\item ref2 should be: sec. 1.2 on page 1 and is: \crossref[text={sec.}][ref2]
+
\item ref2 should be: sec. 1.2 on page 1 and is: \crossref[label={sec.}][ref2]
 
\stopitemize
 
\stopitemize
 
\stopParagraph
 
\stopParagraph
Line 83: Line 82:
 
\stoptext
 
\stoptext
 
</texcode>
 
</texcode>
 +
 +
[[File:t-pararef-2.jpg]]
 +
[[File:t-pararef-3.jpg]]
  
 
==Text part divider==
 
==Text part divider==
Line 93: Line 95:
  
 
<texcode>
 
<texcode>
\usemodule
+
\usemodule[pararef]
  
 
\starttext
 
\starttext
Line 100: Line 102:
 
\startParagraph
 
\startParagraph
 
Some introduction text \input tufte
 
Some introduction text \input tufte
\stoptext
+
\stopParagraph
  
 
\textpartdivider
 
\textpartdivider
  
\dorecurse[3]{
+
\dorecurse{3}{
 
\startParagraph
 
\startParagraph
 
Some main theme text \input tufte
 
Some main theme text \input tufte
\stoptext
+
\stopParagraph
 
}
 
}
  
Line 114: Line 116:
 
\startParagraph
 
\startParagraph
 
Some section summarizing text \input tufte
 
Some section summarizing text \input tufte
\stoptext
+
\stopParagraph
  
 
\stopsection
 
\stopsection
Line 122: Line 124:
 
\stoptext
 
\stoptext
 
</texcode>
 
</texcode>
 +
 +
[[File:t-pararef-4.jpg]]
  
 
==Settings==
 
==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:
+
In pararef the colors can be set via two paramters:
* <code>crossrefColor</code> for the entire reference text,
 
 
* <code>textpartdividerColor</code> for the color of the line and
 
* <code>textpartdividerColor</code> for the color of the line and
 
* <code>paragraphNumberColor</code> for the number of the paragraph.
 
* <code>paragraphNumberColor</code> for the number of the paragraph.
Line 132: Line 135:
 
They are defined as parameters of the module:
 
They are defined as parameters of the module:
 
<texcode>
 
<texcode>
\usemodule[bgcolor][crossrefColor=...,textpartdividerColor=...,paragraphNumberColor=...]
+
\usemodule[pararef][textpartdividerColor=...,paragraphNumberColor=...]
 
...
 
...
 
</texcode>
 
</texcode>
  
The brakets and text part for <code>\crossref</code> can also be adjusted or extended with other languages:
+
For now the color and style of the paragraph title has to be set via the normal outer margin settings.
 
 
<texcode>
 
\setupparareftext[en][braketOpen={(}]
 
\setupparareftext[en][braketClose={)}]
 
\setupparareftext[en][atpageLeft={ on page }]
 
\setupparareftext[en][atpageRight={}]
 
\setupparareftext[de][braketOpen={(}]
 
\setupparareftext[de][braketClose={)}]
 
\setupparareftext[de][atpageLeft={ auf Seite }]
 
\setupparareftext[de][atpageRight={}]
 
</texcode>
 
 
 
For now the color and style of the paragraph title has to be set via ......
 

Latest revision as of 16:26, 15 April 2019

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

The pararef module understands a paragraph as a full closed block of one thought. This means that inside a paragraph enumerations, formulas etc. can appear. That is why a paragraph must be defined manually via \startParagraph and \stopParagraph.

Paragraphs

Each paragraph gets numbered started by each title. In order to link to a paragraph it can be reference by the optional parameter reference=... as a text reference.

One or more paragraphs can be summarized by a low level title which is displayed as a margin note (margin title) via the optional parameter title=....

 \startParagraph[reference=...,title=...]
 ...
 \stopParagraph

Here how a single paragraph with a title looks like:

\usemodule[pararef]

\starttext
\startParagraph[title={Paragraph heading}]
\input tufte
\stopParagraph
\stoptext

t-pararef-1.jpg


References

Now the more practical part: the paragraph referencing. To reference to an paragraph the package pararef makes use of the crossref module.

Here a simple usage example:

\usemodule[pararef]
\usemodule[crossref]

\starttext

\startchapter[title={Lorem ipsum}]
\startsection[title={Dolor sit}]

\startParagraph
\input tufte 
\stopParagraph

\startParagraph[reference=ref1]
\input tufte 
\stopParagraph

\startParagraph
Here are two references to destinations on the same page:
\startitemize[nowhite]
\item ref1 should be: para. 1.1/2 and is: \crossref[label={para.}][ref1]
\item ref2 should be: sec. 1.2 and is: \crossref[label={sec.}][ref2]
\stopitemize
Here is one references with brakets:
\startitemize[nowhite]
\item ref1 should be: (para. 1.1/2) and is: \crossref[left={(},right={)},label={para.}][ref1]
\stopitemize
\stopParagraph

\stopsection
\startsection[title={Amet},reference=ref2]

\page

\startParagraph
Here are two references to destinations on an other page:
\startitemize[nowhite]
\item ref1 should be: para. 1.1/2 on page 1 and is: \crossref[label={para.}][ref1]
\item ref2 should be: sec. 1.2 on page 1 and is: \crossref[label={sec.}][ref2]
\stopitemize
\stopParagraph

\stopsection
\stopchapter
\stoptext

t-pararef-2.jpg t-pararef-3.jpg

Text part divider

Each section (subsection, subsubsection etc.) has mostly three parts:

  • introduction part,
  • one or several main parts and
  • summary part.

Each part contains one or more paragraphs. To make the logic parts visible the parts are divided by a line \textpartdivider.

\usemodule[pararef]

\starttext

\startsection[title={Lorem ipsum}]
\startParagraph
Some introduction text \input tufte
\stopParagraph

\textpartdivider

\dorecurse{3}{
\startParagraph
Some main theme text \input tufte
\stopParagraph
}

\textpartdivider

\startParagraph
Some section summarizing text \input tufte
\stopParagraph

\stopsection
\startsection[title={Doloris sit}]
...
\stopsection
\stoptext

t-pararef-4.jpg

Settings

In pararef the colors can be set via two paramters:

  • textpartdividerColor for the color of the line and
  • paragraphNumberColor for the number of the paragraph.

They are defined as parameters of the module:

\usemodule[pararef][textpartdividerColor=...,paragraphNumberColor=...]
...

For now the color and style of the paragraph title has to be set via the normal outer margin settings.