Skip to content

Commit

Permalink
Consistently use quotes inside inline code for units
Browse files Browse the repository at this point in the history
  • Loading branch information
HansOlsson committed May 16, 2019
1 parent 2d0e01c commit c830bbe
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions chapters/unitexpressions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ \chapter{Unit Expressions}\doublelabel{unit-expressions}

Note that this document uses the American spelling meter, whereas the SI specification from BIPM uses the British spelling metre.

Examples for the syntax of unit expressions used in Modelica: "\lstinline!N.m!",
"\lstinline!kg.m/s2!", "\lstinline!kg.m.s-2!" "\lstinline!1/rad!",
"\lstinline!mm/s!".
Examples for the syntax of unit expressions used in Modelica: \lstinline!"N.m"!,
\lstinline!"kg.m/s2"!, \lstinline!"kg.m.s-2"! \lstinline!"1/rad"!,
\lstinline!"mm/s"!.

\section{The Syntax of Unit Expressions}\doublelabel{the-syntax-of-unit-expressions}
\begin{lstlisting}[language=grammar]
Expand All @@ -28,12 +28,12 @@ \section{The Syntax of Unit Expressions}\doublelabel{the-syntax-of-unit-expressi
unit_factor | "(" unit_expression ")"
\end{lstlisting}

The unit of measure of a dimension free quantity is denoted by "1". The
The unit of measure of a dimension free quantity is denoted by \lstinline!"1"!. The
SI standard does not define any precedence between multiplications and
divisions. The SI recommendation is to have at most one division, where
the expression to the right of "\lstinline!/!" either contains no multiplications or
the expression to the right of \lstinline!/! either contains no multiplications or
is enclosed within parentheses, or use negative
exponents, for example, "\lstinline!J/(kg.K)!" may be written as "\lstinline!J.kg-1.K-1!".
exponents, for example, \lstinline!"J/(kg.K)"! may be written as \lstinline!"J.kg-1.K-1"!.

\begin{lstlisting}[language=grammar]
unit_factors:
Expand All @@ -44,13 +44,12 @@ \section{The Syntax of Unit Expressions}\doublelabel{the-syntax-of-unit-expressi
\end{lstlisting}

The SI standard specifies that a multiplication operator symbol is written as space
or as a dot. For example, Modelica does not support "\lstinline!Nm!" for
newton-meter,
but requires it to written as "\lstinline!N.m!".

The SI standard requires that this "dot" is a bit above the base line: "·", which is not part of ASCII.
or as a dot. The SI standard requires that this "dot" is a bit above the base line: "·", which is not part of ASCII.
The ISO standard also prefers "·", but Modelica supports the ISO alternative ".", which is an ordinary "dot" on the base line.

For example, Modelica does not support \lstinline!"Nm"! for newton-meter,
but requires it to written as \lstinline!"N.m"!.

\begin{lstlisting}[language=grammar]
unit_factor:
unit_operand [ unit_exponent ]
Expand All @@ -77,13 +76,13 @@ \section{The Syntax of Unit Expressions}\doublelabel{the-syntax-of-unit-expressi
Modelica should know the basic and derived units of the SI system. It is
possible to support user defined unit symbols. In the base version Greek
letters is not supported, but full names must then be written, for
example "\lstinline!Ohm!".
example \lstinline!"Ohm"!.

A \lstinline!unit_operand! should first be interpreted as a \lstinline!unit_symbol! and only
if not successful the second alternative assuming a prefixed operand
should be exploited. There must be no spacing between the \lstinline!unit_symbol!
and a possible \lstinline!unit_prefix!. The values of the prefixes are according to
the ISO standard. The letter "u" is used as a symbol for the prefix
the ISO standard. The letter \lstinline!u! is used as a symbol for the prefix
micro.

\begin{nonnormative}
Expand All @@ -92,15 +91,15 @@ \section{The Syntax of Unit Expressions}\doublelabel{the-syntax-of-unit-expressi

\section{Examples}\doublelabel{examples2}

The unit expression "\lstinline!m!" means meter and not milli
The unit expression \lstinline!"m"! means meter and not milli
(10\textsuperscript{-3}), since prefixes cannot be used in isolation.
For millimeter use "\lstinline!mm!" and for square meter, m\textsuperscript{2}, write
"\lstinline!m2!".
For millimeter use \lstinline!"mm"! and for square meter, m\textsuperscript{2}, write
\lstinline!"m2"!.

The expression "\lstinline!mm2!" means \lstinline!mm2! = (10\textsuperscript{-3}m)2 =
The expression \lstinline!"mm2"! means \lstinline!mm2! = (10\textsuperscript{-3}m)2 =
10\textsuperscript{-6}m\textsuperscript{2}. Note that exponentiation
includes the prefix.

The unit expression "\lstinline!T!" means tesla, but note that the letter "\lstinline!T!" is
The unit expression \lstinline!"T"! means tesla, but note that the letter \lstinline!T! is
also the symbol for the prefix \lstinline!tera! which has a multiplier value of
10\textsuperscript{12}.

0 comments on commit c830bbe

Please sign in to comment.