Skip to content

Commit

Permalink
Make \firstuse add to document index, with possibility to override
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikt-ma committed Nov 21, 2021
1 parent 53a31ad commit 1c86ac4
Show file tree
Hide file tree
Showing 19 changed files with 125 additions and 106 deletions.
2 changes: 1 addition & 1 deletion chapters/abstract.tex
Expand Up @@ -6,7 +6,7 @@
\end{center}

This document defines the Modelica\footnote{%
\firstuse{Modelica}\index{Modelica} is a registered trademark of the Modelica Association.
\firstuse{Modelica} is a registered trademark of the Modelica Association.
}
language, version~\mlsversion, which is developed by the Modelica Association, a non-profit organization with seat in Linköping, Sweden.
Modelica is a freely available, object-oriented language for modeling of large, complex, and heterogeneous systems.
Expand Down
4 changes: 2 additions & 2 deletions chapters/annotations.tex
Expand Up @@ -198,7 +198,7 @@ \subsubsection{Plot Curves}\label{plot-curves}

\subsubsection{Escape sequences}\label{text-markup-escape-sequences}

In an attribute inside a figure where the variable replacements of \cref{variable-replacements} or the text markup of \cref{text-markup-in-captions} can be used, the following use of \firstuse{text markup escape sequences}\index{text markup escape sequence}\index{escape sequence!text markup} applies.
In an attribute inside a figure where the variable replacements of \cref{variable-replacements} or the text markup of \cref{text-markup-in-captions} can be used, the following use of \firstuse[text markup escape sequence]{text markup escape sequences}\index{escape sequence!text markup} applies.
These escape sequences are applied after the application of other markup, and is not applied at all inside some of the other markup, see details for the respective markup.

The percent character `\%' shall be encoded \lstinline!%%!. The following are all the recognized escape sequences:
Expand Down Expand Up @@ -320,7 +320,7 @@ \subsubsection{Text Markup in Captions}\label{text-markup-in-captions}
not supported, and any paragraph break before the first paragraph or after the last
paragraph has no impact.)

\firstuse{Vendor-specific markup}\index{vendor-specific markup} takes the form \lstinline!%__$\mathit{nameOfVendor}_{1}$($\mathit{data}_{1}$)$\ldots$__$\mathit{nameOfVendor}_{n}$($\mathit{data}_{n}$)[$\mathit{text}$]!, where $n \geq 1$.
\firstuse[vendor-specific markup]{Vendor-specific markup} takes the form \lstinline!%__$\mathit{nameOfVendor}_{1}$($\mathit{data}_{1}$)$\ldots$__$\mathit{nameOfVendor}_{n}$($\mathit{data}_{n}$)[$\mathit{text}$]!, where $n \geq 1$.
The $\mathit{nameOfVendor}$ consists of only digits and letters, and shall only convey the name of the vendor defining the meaning of the associated $\mathit{data}$.
Text markup escape sequences don't apply inside the $\mathit{data}$, implying that it cannot contain the closing parenthesis, `)'.
A tool which does not understand any of the vendor-specific meanings shall only display the mandatory $\mathit{text}$, but the $\mathit{text}$ may also be used together with the vendor-specific $\mathit{data}$.
Expand Down
18 changes: 9 additions & 9 deletions chapters/arrays.tex
Expand Up @@ -9,8 +9,8 @@ \chapter{Arrays}\label{arrays}
matrix have equal length, and all columns have equal length.

Each array has a certain dimensionality, i.e., number of dimensions.
The degenerate case of a \firstuse{scalar}\index{scalar} variable is not really an array, but can be regarded as an array with zero dimensions.
\firstuse{Vectors}\index{vector} have one dimension, matrices (sing.\ \firstuse{matrix}\index{matrix}) have two dimensions, etc.
The degenerate case of a \firstuse{scalar} variable is not really an array, but can be regarded as an array with zero dimensions.
\firstuse[vector]{Vectors} have one dimension, matrices (sing.\ \firstuse{matrix}) have two dimensions, etc.

So-called row vectors and column vectors do not exist in Modelica and cannot be distinguished since vectors have only one dimension.
If distinguishing these is desired, row matrices and column matrices are available, being the corresponding two-dimensional entities.
Expand Down Expand Up @@ -82,7 +82,7 @@ \section{Array Declarations}\label{array-declarations}
\end{table}

% henrikt-ma: The following paragraph was only modified slightly when migrated from the old glossary to the index, and seems to be in need of more attention:
A component declared with array dimensions, or where the element type is an array type, is called an \firstuse{array variable}\index{array!variable}.
A component declared with array dimensions, or where the element type is an array type, is called an \firstuse[array!variable]{array variable}.
It is a component whose components are \willintroduce{array elements} (see below).
For an array variable, the ordering of its components matters:
The $k$th element in the sequence of components of an array variable \lstinline!x! is the array element with index \lstinline!k!, denoted \lstinline!x[k]!.
Expand All @@ -92,7 +92,7 @@ \section{Array Declarations}\label{array-declarations}
An array element is hence referenced using $n$ indices in general, where $n$ is the number of dimensions of the array.

% henrikt-ma: The following paragraph was only modified slightly when migrated from the old glossary to the index, and seems to be in need of more attention:
A component contained in an array variable is called an \firstuse{array element}\index{array!element}.
A component contained in an array variable is called an \firstuse[array!element]{array element}.
An array element has no identifier.
Instead they are referenced by array access expressions called indices that use enumeration values or positive integer index values.

Expand Down Expand Up @@ -577,7 +577,7 @@ \subsubsection{Reduction Expressions}\label{reduction-expressions}
function-name "(" expression1 for iterators ")"
\end{lstlisting}%
\index{for@\robustinline{for}!reduction expression}
is a \firstuse{reduction expression}\index{reduction expression}.
is a \firstuse{reduction expression}.
The expressions in the iterators of a reduction expression shall be vector expressions.
They are evaluated once for each reduction expression, and are evaluated in the scope immediately enclosing the reduction expression.

Expand Down Expand Up @@ -706,7 +706,7 @@ \subsection{Matrix and Vector Algebra Functions}\label{matrix-and-vector-algebra

\section{Vector, Matrix and Array Constructors}\label{vector-matrix-and-array-constructors}

The \firstuse{array constructor}\index{array!constructor} function \lstinline!array(A, B, C, $\ldots$)! constructs an array from its arguments according to the following rules:
The \firstuse[array!constructor]{array constructor} function \lstinline!array(A, B, C, $\ldots$)! constructs an array from its arguments according to the following rules:
\begin{itemize}
\item
Size matching: All arguments must have the same sizes, i.e.,
Expand Down Expand Up @@ -751,7 +751,7 @@ \subsection{Array Constructor with Iterators}\label{array-constructor-with-itera
\begin{lstlisting}[language=grammar]
array "(" expression for iterators ")"
\end{lstlisting}
is an \firstuse{array constructor with iterators}\index{array!constructor!with iterators}.
is an \firstuse[array!constructor!with iterators]{array constructor with iterators}.
The expressions inside the iterators of an array constructor shall be vector expressions.
They are evaluated once for each array constructor, and are evaluated in the scope immediately enclosing the array constructor.

Expand Down Expand Up @@ -947,7 +947,7 @@ \section{Array Indexing}\label{array-indexing}

The array indexing operator \lstinline!$\mathit{name}$[$\ldots$]! is used to access array elements for retrieval of their values or for updating these values.
An indexing operation is subject to upper and lower array dimension index bounds (\cref{array-dimension-lower-and-upper-index-bounds}).
The indexing operator takes two or more operands, where the first operand is the array to be indexed and the rest of the operands are \firstuse{index}\index{index} (or \firstuse{subscript}\index{subscript}) expressions:
The indexing operator takes two or more operands, where the first operand is the array to be indexed and the rest of the operands are \firstuse{index} (or \firstuse{subscript}) expressions:

\lstinline!$\mathit{arrayname}$[$\mathit{indexexpr}_{1}$, $\mathit{indexexpr}_{2}$, $\ldots$]!

Expand All @@ -957,7 +957,7 @@ \section{Array Indexing}\label{array-indexing}
If the number of index arguments is smaller than the number of dimensions of the array, the trailing indices will use `\lstinline!:!'.

It is also possible to use the array access operator to assign to element/elements of an array in algorithm sections.
This is called an \firstuse{indexed assignment statement}\index{assignment statement!indexed}.
This is called an \firstuse[assignment statement!indexed]{indexed assignment statement}.
If the index is an array the assignments take place in the order given by the index array.
For assignments to arrays and elements of arrays, the entire right-hand side and the index on the left-hand side are evaluated before any element is assigned a new value.

Expand Down

0 comments on commit 1c86ac4

Please sign in to comment.