Note that def-files with non-ASCII characters should be UTF-8
encoded.
Within a def-file the semicolon (;) is used to separate the
single slots. So, when using a semicolon within a text, it must be quoted
with a backslash (\;).
def-files are not only used to create interface code, but also allow the
generation of PDF reference manuals, the HTML documentation, and
the help files used to access operator knowledge via HALCON operators like get_operator_info. For the online help and
the HTML files an ASCII version of each text is needed, whereas the reference
manuals are produced compiling a LaTeX-file generated from the def-files. To
avoid the necessity of writing two text blocks for one operator (ASCII and
LaTeX), both versions are generated by using one text. Therefore, the
following conventions must be observed:
- Quotation marks:
- There are two kinds of quotation marks
- 'string':
- This notation signals that the quoted text is a string
as used within programming languages. So hcomp treats
'string' as a string-parameter.
- “Text”:
- This notation must be used in all other cases, particularly when quoting
a word or text segment because of its content. So hcomp treats
``Text'' as a quoted section of a text.
Please do not
forget or permute the quotation marks (starting with `` and
ending with '').
- Underscores:
- Underscores can be used directly for both the ASCII and the LaTeX output. The HALCON compiler hcomp automatically prefixes them
with the necessary backslashes for the LaTeX output (\_).
Please note that if you want to use an underscore in a LaTeX part to create
a subscript, you must encase the subscript text in curly braces ({})
even if the subscript is only a single character. For example, to create the
output “Sx” you must write $S_{x}$. If you leave out the
braces, an underscore is printed, e.g., $S_x$ results in “S_x”.
- Backslash:
- All backslashes (\) within the text are ignored while generating the
ASCII version. So the LaTeX-linefeed-symbol (\\) can be used without
any problems.
To embed a literal backslash in the output, use \textbackslash{} in
the def-file.
- Tilde:
- To use the tilde (e.g. as symbol for negation:
set_check(::'~clear':)),
the following special notation must be used for the LaTeX-text:
set_check(::'\~{}clear':).
- Formulas:
- Short formulas can be bracketed by dollar symbols ($) just as in LaTeX.
These symbols are ignored for the ASCII version of the text.
To set an index of one character (e.g. Ab) LaTeX allows to simply write
$A_b$. This is not possible here, because of the special underscore
handling. Therefore, any index must be written exactly as any longer index
within LaTeX: A_{b}.
- HALCON:
- The string HALCON is generated by \Halcon. Note, that in the
PDF files derived from the generated LaTeX version of the
def-files, no space is generated after the string HALCON.
Thus, if you do not want to start the next character/string without a blank,
that is concatenated
to the string HALCON, you should use \Halcon\ instead.
So “\Halcon XYZ” results in “HALCON XYZ” and
“\Halcon\ XYZ” results in “HALCON XYZ”.
With the ASCII version all backslashes are ignored (see above).
- Names of parameters and operators:
-
Any reference to HALCON operators or their parameters must be written as
\OpRef{operator_name}, respectively as
\ParRef{parameter_name}. These keywords
and the brackets are ignored, when generating the ASCII version so that only
operator_name or parameter_name remains in the ASCII file. In
the HTML and PDF documents, hyperlinks are generated from these references.
- Parameter values:
-
A specific value for a parameter should be written as
\ValRef{parameter_value}. For example,
the parameter \ParRef{LightDark} of the operator
\OpRef{dyn_threshold} can hold one of the values
\ValRef{'light'}, \ValRef{'dark'}, or
\ValRef{'equal'}.
The keyword ValRef
and the brackets are ignored, when generating the ASCII version so that only
parameter_value remains in the ASCII file.
- Paragraphs:
- If you want to divide a longer text into paragraphs to increase the
readability, all you need to do is to insert an empty line between the
paragraphs:
This is a paragraph ...
.. which ends here.
The next paragraph starts after an empty line ...
This corresponds to the standard LaTeX way of separating paragraphs; in the
HTML documents, the paragraphs are enclosed with the tag <P>.
- Chapter references:
- You can add a link to a certain chapter or section using
\ChapRef{chapter} or
\ChapRef{chapter, section},
respectively.
The chapter/section names must match the English names of an existing chapter
definition, see section “chapter”.
- Formatted text:
- You can use the following LaTeX commands to format text both in the LaTeX and HTML version:
- \emph{text}:
results in text (HTML tag <E>)
- \texttt{text}:
results in text (HTML tag <TT>)
- \textbf{text}:
results in text (HTML tag <B>)
- \textit{text}:
results in text (HTML tag <I>)
Please note that these commands cannot be nested!
- Links:
- The following special environment adds a hyperlink to the specified URL into
the HTML version of the documentation.
In the LaTeX version, the link text appears as plain text.
\begin{External}{URL}
Link text...
\end{External}
- Lists:
- You can use the following LaTeX environments to format text in lists
both in the LaTeX and HTML version:
- description lists:
\begin{description}
\item[title 1] text ...
\item[title 2] text ...
\end{description}
- lists with bullet points:
\begin{itemize}
\item text ...
\item text ...
\end{itemize}
- enumerated lists:
\begin{enumerate}
\item text ...
\item text ...
\end{enumerate}
Paragraph alignment: You can use the following special environment to specify the alignment
of the included text. The parameter format may be set to
left, center, or right.
\begin{Alignment}{format}
...
\end{Alignment}
Tables: You can use the following special environment to format text in tabular
format both in the LaTeX and HTML version.
This table environment is not to be confused with the standard
LaTeX table or tabular environment.
Tables are centered by default.
To change the alignment of a table, enclose it in the Alignment
environment (see above).
\begin{Table}[style]{format}
column & column & .. \\
column & column & ..
\end{Table}
Columns are separated by &, and a new row is started with
\\.
Note that the last row of the table has no trailing \\.
The style specification (including the square brackets) is
optional. The following values are available:
layout:
Simple table without any borders.
This is the default if no table style is specified.
grid:
Each table cell has a border.
table:
The first row is formatted as the table header.
The header and the bottom of the table are marked with horizontal lines.
The format specification defines the number of columns, their
alignment, and (optionally) their width. Each occurrence of one of the
letters l, r, or c defines a left-aligned,
right-aligned or centered column, respectively.
The column specifier may be followed by a number which defines the
relative width of the column in percent.
Note that the alignment of a column is disregarded in the LaTeX version if the width is specified. In that case the text of the
corresponding column is justified.
For readability, the column specifications may be separated by commas.
Extra spacing is ignored.
Thus the following table specifications are equivalent:
\begin{Table}{l 40, c 30, r 30}
\begin{Table}{l40c30r30}
Other LaTeX commands: If you want to use additional LaTeX command within a text
segment, two versions of this segment must be provided – one for ASCII
(with @a signalling the start of the ASCII section)
and another as pure LaTeX text (with @l starting the
LaTeX version and @e ending the special section).
In particular, this technique is necessary for tables and larger formulas.
Example:
@a g_o >= g_m + \ParRef{Offset}
@l\[ g_{o} \ge g_{m} + \ParRef{Offset} \]@e
This parenthesis can also be used for only one of the two text types:
... text text @l \aSpecialLatexCommand @e text text ...
In fact, the ASCII mode has two sub-modes: If @a is immediately
followed by a carriage return, the following lines are enclosed with the HTML
tag <PRE>. Thus, they appear “as they come”, including all
spaces and carriage returns. Otherwise, i.e., if @a is followed by any
character (including a space!), carriage returns and spaces are not preserved
in the HTML document.