### Table Configuration Example Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/internal-api-quantity-table.md Demonstrates a table column with specific formatting for number of digits and alignment. ```latex \begin{tabular}{S[table-format=3.2, table-alignment=center]} \multicolumn{1}{c}{Value} \\ 1.2 \\ 12.34 \\ \multicolumn{1}{c}{—} \end{tabular} ``` -------------------------------- ### Example Unit Expression Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/types-and-structures.md A concrete example of a unit expression that can be parsed. ```latex \kilo\metre\per\second\squared ``` -------------------------------- ### Unit Formatting Modes (Fraction Mode) Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/types-and-structures.md Examples of unit formatting using the 'fraction' per-mode. ```text km/s km/s² ``` -------------------------------- ### Parsed Unit Expression Example Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/types-and-structures.md Shows the parsed structure for the example unit expression '\kilo\metre\per\second\squared'. ```text product-chain: term₁: prefix: kilo (10³) base-unit: metre power: 1 term₂: prefix: none base-unit: second power: -2 ``` -------------------------------- ### Processing Options at Content Start Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/overview.md Illustrates how to process siunitx configuration options immediately before a block of content. This is useful for applying settings to a specific section. ```latex \siunitx_process_option_next: ``` -------------------------------- ### Unit Formatting Modes (Symbol Mode) Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/types-and-structures.md Examples of unit formatting using the 'symbol' per-mode. ```text km/s km·s⁻¹ km/s² ``` -------------------------------- ### Examples of Sexagesimal Angle Formatting Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/advanced-features.md Demonstrates various ways to format sexagesimal angles using `\siunitx_sexagesimal_angle:n`, including full, partial, and mixed components. ```latex \siunitx_sexagesimal_angle:n { 45;30;15 } % 45° 30′ 15″ ``` ```latex \siunitx_sexagesimal_angle:n { ;;30 } % 30″ (seconds only) ``` ```latex \siunitx_sexagesimal_angle:n { 10;-5; } % 10° -5′ (mixed) ``` -------------------------------- ### Use Custom Exponent Product Notation Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/configuration.md Customize the notation used for the exponent base with `exponent-product`. This example uses 'e' for the exponent. ```latex \num[exponent-product=e]{1.23e-5} % 1.23e-5 ``` -------------------------------- ### Set Print Configuration Options Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/internal-api-quantity-table.md Configure the appearance of printed numbers and units by setting options like number-color, unit-color, and mode. This example sets the number color to blue, unit color to red, and printing mode to text. ```latex \siunitx_keys_set: { number-color = blue, unit-color = red, mode = text } ``` -------------------------------- ### Internal Number Format Examples Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/types-and-structures.md Provides examples of how numbers are represented in the internal format, showing scientific notation and uncertainty. ```text 1 . 2 3 e 5 → 1.23 × 10⁵ ``` ```text - 0 . 0 0 1 2 3 e -4 → -1.23 × 10⁻⁴ ``` ```text 5 . 0 ( 2 ) → 5.0 ± 0.2 ``` -------------------------------- ### Unit Formatting Modes (Reciprocal Mode) Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/types-and-structures.md Examples of unit formatting using the 'reciprocal' per-mode. ```text km s⁻¹ km s⁻² ``` -------------------------------- ### Using siunitx within sidenotes Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/examples-and-patterns.md Provides an example of embedding a siunitx quantity within a sidenote, requiring the 'siunitx' and 'sidenotes' packages. ```latex \documentclass{article} \usepackage{siunitx, sidenotes} \begin{document} This measurement\sidenote{\SI{10 \pm 0.5}{m}} was precise. \end{document} ``` -------------------------------- ### siunitx Example Error Message Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/types-and-structures.md Provides a concrete example of an error message from siunitx, indicating an invalid unit symbol. ```tex Package siunitx: Error: invalid-unit-symbol: '\invalid' is not a recognized unit ``` -------------------------------- ### Set Number-Unit Separator Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/configuration.md Use `number-unit-product` to specify the separator between a number and its unit. This example uses a space. ```latex \qty[number-unit-product={\{~}]{10}{m} % 10 m (with space) ``` -------------------------------- ### Example Usage of PDF String Mode Functions Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/advanced-features.md Demonstrates how to use PDF string mode functions within \texorpdfstring for section titles. ```latex \section{\texorpdfstring{\SI{10}{m}}{10 m}} \section{\texorpdfstring{\qty{10}{m}}{\numInBookmark{10} m}} ``` -------------------------------- ### siunitx for tikz/pgfplots Axis Labels Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/advanced-features.md Provides an example of using siunitx commands to format axis labels in tikz/pgfplots graphs. ```latex \begin{tikzpicture} \begin{axis}[ xlabel = \SI{}{m}, ylabel = \SI{}{s} ] \end{axis} \end{tikzpicture} ``` -------------------------------- ### Customize Quantity Output Separators Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/advanced-features.md Customize the separators used for products and lists in quantity output. This example shows how to set custom product and division symbols. ```latex \qty[ number-unit-product={~}, inter-unit-product = \cdot, per-symbol = \div ]{10}{m/s} ``` -------------------------------- ### Set Output Mode for Quantity Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/configuration.md The `mode` option controls the output mode for all content within the quantity. This example renders the quantity in text mode. ```latex \qty[mode=text]{10}{m} % Rendered in text mode ``` -------------------------------- ### Set Number Color Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/configuration.md Use `number-color` to specify a color for the numerical part of a quantity. This example sets the number to blue. ```latex \qty[number-color=blue]{10}{m} % Number in blue ``` -------------------------------- ### Evaluate Arithmetic Expressions Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/configuration.md Use the 'evaluate-expression' option with \num to compute arithmetic expressions directly. This example calculates 2 to the power of 10. ```latex \num[evaluate-expression]{2^10} ``` -------------------------------- ### Applying Custom Text Font Command Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/advanced-features.md Example of setting a custom text font command using `\siunitx_keys_set:n`. The `reset-text-series=false` option can be used to preserve font series. ```latex \siunitx_keys_set:n { text-font-command = \ttfamily } \num[mode=text]{123} % Typewriter font \qty[reset-text-series=false]{10}{m} % Preserve bold ``` -------------------------------- ### Configure Input Decimal Markers Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/configuration.md Use \num with the 'input-decimal-markers' option to specify recognized decimal point characters. This example treats a comma as a thousands separator. ```latex \num[input-decimal-markers={.}]{1,234} ``` -------------------------------- ### Correct and Incorrect Unit Symbols Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/examples-and-patterns.md Demonstrates the correct usage of unit symbols in siunitx and highlights an example of an incorrect symbol that would cause an error. ```latex \SI{10}{\metre} % Correct \SI{10}{\meters} % Error: \meters doesn't exist ``` -------------------------------- ### Locale Effects on Number Formatting Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/advanced-features.md Illustrates how different locales affect decimal and thousands separators. The example shows the default rendering and how to achieve German formatting. ```latex \documentclass{article} \usepackage[locale=DE]{siunitx} \begin{document} \num{1234.56} % Rendered as: 1.234,56 \end{document} ``` -------------------------------- ### Applying Configuration Options Per Command Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/overview.md Shows how to apply specific siunitx configuration options directly to an individual command using optional arguments. This allows for localized customization. ```latex \qty[key=value]{...}{...} ``` -------------------------------- ### Use siunitx with amsmath Environments Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/advanced-features.md Demonstrates using siunitx commands within standard LaTeX math environments provided by amsmath. ```latex \[ E = \SI{3e8}{m/s}^2 \] ``` -------------------------------- ### siunitx in Math Environments Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/examples-and-patterns.md Shows how to use siunitx commands to display quantities and their units within a LaTeX math environment, including calculations involving units. ```latex \[ v = \frac{\SI{100}{m}}{\SI{10}{s}} = \SI{10}{m.s^{-1}} \] ``` -------------------------------- ### Usage of Binary Prefixes with Units Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/advanced-features.md Demonstrates how to use the defined binary prefixes with units like \byte. Ensure the `binary-units` option is enabled for recognition. ```latex \SI{256}{\kibi\byte} % 256 KiB \SI{16}{\gibi\byte} % 16 GiB ``` -------------------------------- ### Setting siunitx Configuration Keys Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/overview.md Demonstrates how to set siunitx configuration options globally in the LaTeX preamble using a key-value syntax. These settings affect subsequent typesetting commands. ```latex \siunitx_keys_set:n { key = value, ... } ``` -------------------------------- ### Set Unit Color Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/configuration.md Use `unit-color` to specify a color for the unit part of a quantity. This example sets the unit to red. ```latex \qty[unit-color=red]{10}{m} % Unit in red ``` -------------------------------- ### Basic Quantity Formatting Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/examples-and-patterns.md Shows the basic usage of \SI and \qty commands for formatting numbers with units. \SI is the traditional command, while \qty is a modern alternative. ```latex \SI{10}{m} % 10 m \qty{10}{m} % 10 m (modern) \SI{9.81}{m.s^{-2}} % 9.81 m\cdot s^{-2} ``` -------------------------------- ### Extract Exponent Prefix Handling Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/configuration.md Shows how to extract the prefix and apply it to the number's exponent. ```latex \SI[prefix-mode=extract-exponent]{1.5}{km} % 1.5 × 10³ m ``` -------------------------------- ### Quantity Formatting with Symbolic Units Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/examples-and-patterns.md Demonstrates using symbolic unit names with \SI for common units like kilometers, meters per second squared, kilohertz, and grams per mole. ```latex \SI{5}{\kilo\metre} % 5 km \SI{9.81}{\metre\per\second\squared} % 9.81 m/s^{2} \SI{100}{\kilo\hertz} % 100 kHz \SI{1.5}{\gram\per\mole} % 1.5 g/mol ``` -------------------------------- ### Coloring Numbers with xcolor Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/advanced-features.md Shows how to set number colors using siunitx keys in conjunction with the xcolor package. ```latex \siunitx_keys_set:n { number-color = red } \num{123} % Red number ``` -------------------------------- ### Set Per-Command siunitx Keys Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/configuration.md Apply siunitx options to individual commands like \num, \SI, or \qty. Options are specified within the command's optional argument. ```latex \num[key1=value1]{123} ``` ```latex \SI[key2=value2]{123}{m} ``` ```latex \qty[key1=value1, key2=value2]{123}{m} ``` -------------------------------- ### Set Debug Mode for Verbose Output Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/advanced-features.md Enable debug mode to get verbose output during siunitx processing. This is useful for development and troubleshooting. ```latex \siunitx_keys_set:n { debug-mode = true } ``` -------------------------------- ### Set Unit Module Configuration Options Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/internal-api-unit.md Use `\siunitx_keys_set:n` to configure unit module behavior, such as division formatting, inter-unit product separators, and output mode. ```latex \siunitx_keys_set: { per-mode = fraction, inter-unit-product = \cdot, unit-mode = text } ``` -------------------------------- ### siunitx User Settings Configuration Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/types-and-structures.md Illustrates how users can define their own values for siunitx options. ```tex siunitx / option-name = user-value ``` -------------------------------- ### siunitx Module Token List Variable Conventions Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/types-and-structures.md Illustrates naming conventions for module-specific token list variables in siunitx. ```latex \l_siunitx_number_* % Number module variables \l_siunitx_unit_* % Unit module variables \l_siunitx_quantity_* % Quantity module variables ``` -------------------------------- ### Fractional Division Formatting Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/configuration.md Shows how to format division between units using a fraction. ```latex \SI[per-mode=fraction]{10}{\metre\per\second} % m/s (fraction) ``` -------------------------------- ### Format Quantity with Fractional Unit Notation using \SI Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/user-commands.md Use the 'per-mode=fraction' option with \SI to display units like meters per second as fractions. Ensure the siunitx package is included. ```latex \SI[per-mode=fraction]{1.23}{\metre\per\second} ``` -------------------------------- ### \qty Command Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/user-commands.md A modern alias for the \SI command, used for formatting and displaying quantities. It is the recommended command for new documents due to its simpler naming convention. ```APIDOC ## \qty Command ### Description Formats and displays a quantity (modern alias for `\SI`). ### Signature ```latex \qty[options]{number}{unit} ``` ### Parameters #### Path Parameters - **options** (Key-value pairs) - Optional - Formatting options - **number** (Text) - Required - Numeric input - **unit** (Symbolic or literal) - Required - Unit definition ### Returns Formatted quantity. ### Behavior Identical to `\SI` but using modern command naming. This is the recommended command for new documents. ### Request Example ```latex \qty{10.5}{kg} \qty[mode=text]{10.5}{kg} \qty[per-mode=symbol]{100}{\metre\per\second} ``` ``` -------------------------------- ### Set Locale for Number Formatting Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/configuration.md Use `locale` to configure number formatting according to regional conventions. For example, setting `locale = DE` uses a comma for the decimal marker and a period for the thousands separator. ```latex \siunitx_keys_set:n { locale = DE } \num{1234,56} % Output: 1.234,56 ``` -------------------------------- ### siunitx Module Defaults Configuration Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/types-and-structures.md Shows the format for setting module-level default values for siunitx options. ```tex siunitx / option-name . default-value ``` -------------------------------- ### Fractional Uncertainty Input Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/examples-and-patterns.md Illustrates inputting fractional uncertainty, including custom markers for clarity. ```latex \num{1.23(4)} % With input-open-uncertainty="(" % Interprets as 1.23 ± 0.04 \num[fractional-uncertainty-marker={,}]{1.23,4} % Custom marker ``` -------------------------------- ### Complete Configuration Reference Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/INDEX.md A detailed catalog of all configuration options available in siunitx, organized by functional area. ```APIDOC ## Complete Configuration Reference ### Description This section details all available configuration options for customizing the behavior and output of siunitx. ### Configuration Areas - **Numeric Input/Parsing**: 13 options (decimal markers, exponent, expressions). - **Numeric Formatting**: 40+ options (grouping, exponents, rounding, uncertainty, padding, font control). - **Unit Formatting**: 10+ options (product separators, prefix modes, spacing). - **Quantity Options**: 3 options (spacing, breaks). - **Font and Output**: 15+ options (mode, colors, font resets, mapping). - **Table Options**: 12+ options (alignment, format, spacing). - **Locale and Localization**: 4+ options (presets, custom markers). - **Preamble-Only Options**: 5 options (free-standing units, overwrite, xspace). ``` -------------------------------- ### Basic Number Formatting Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/examples-and-patterns.md Demonstrates the fundamental usage of the \num command for simple numbers and scientific notation. ```latex \documentclass{article} \usepackage{siunitx} \begin{document} \num{1234.5678} % Output: 1234.5678 \num{0.00123} % Output: 0.00123 \num{1.23e-5} % Output: 1.23 \times 10^{-5} \end{document} ``` -------------------------------- ### siunitx Input/Output Token List Variable Conventions Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/types-and-structures.md Shows naming conventions for token list variables related to input options and module-specific value storage. ```latex \l_keys_value_tl % Current option value \l_@@_value_tl % Module-specific value storage ``` -------------------------------- ### Format Quantity in Text Mode using \qty Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/user-commands.md Use the 'mode=text' option with \qty to ensure the unit is rendered in text mode. Ensure the siunitx package is included. ```latex \qty[mode=text]{10.5}{kg} ``` -------------------------------- ### Prefix Mode: Combine Exponent Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/examples-and-patterns.md Demonstrates the 'combine-exponent' mode, which merges number exponents with unit prefixes for concise representation. ```latex % Combines number exponent with unit prefix \SI[prefix-mode=combine-exponent]{1.5 e3}{m} % 1.5 km \SI[prefix-mode=combine-exponent]{2.5 e6}{g} % 2.5 Mg % Useful for data processing \SI[prefix-mode=combine-exponent]{1 e-6}{s} % 1 µs ``` -------------------------------- ### Binary Prefixes Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/types-and-structures.md Lists the binary prefixes available in siunitx. ```latex \kibi, \mebi, \gibi, \tebi, \pebi, \exbi, \zebi, \yobi ``` -------------------------------- ### Default Prefix Handling Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/configuration.md Displays the default behavior for handling prefixes in unit input. ```latex \SI{1.5 e 3}{m} % 1.5 × 10³ m ``` -------------------------------- ### Defining a Custom Locale Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/advanced-features.md Shows how to define a custom locale with specific output decimal markers and group separators using `\siunitx_keys_set:n`. ```latex \siunitx_keys_set:n { output-decimal-marker = {,}, group-separator = {~}, locale = custom } ``` -------------------------------- ### Set Emulation Mode to v1 Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/exported-symbols.md Sets the siunitx package to emulate v1 behavior. This is generally not recommended for new code. ```latex \siunitx_keys_set:n { version = 1 } ``` -------------------------------- ### siunitx Command Scope Configuration Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/types-and-structures.md Demonstrates setting an option value within the scope of a specific command's optional argument. ```tex [option-name = command-value] % In command optional argument ``` -------------------------------- ### Define and Use Custom Units Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/examples-and-patterns.md Define custom prefixes and units using \siunitx_declare_prefix and \DeclareSIUnit, then use them with \SI. ```latex \siunitx_declare_prefix:Nnn \myprefix { mp } { 12 } \SI{1.5}{\myprefix\gram} % 1.5 mpg \DeclareSIUnit \hertz { Hz } \SI{50}{\hertz} % 50 Hz ``` -------------------------------- ### Setting Locales for Regional Conventions Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/advanced-features.md Demonstrates how to set predefined locales for siunitx using `\siunitx_keys_set:n`. Available locales include German (DE), French (FR), and Swiss (CH). ```latex \siunitx_keys_set:n { locale = DE } % German \siunitx_keys_set:n { locale = FR } % French \siunitx_keys_set:n { locale = CH } % Swiss ``` -------------------------------- ### Format Quantity with Symbolic Unit Notation using \qty Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/user-commands.md Use the 'per-mode=symbol' option with \qty to format units symbolically. Ensure the siunitx package is included. ```latex \qty[per-mode=symbol]{100}{\metre\per\second} ``` -------------------------------- ### Quantity Formatting with Different per-Modes Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/examples-and-patterns.md Illustrates controlling the representation of 'per' in units using the 'per-mode' option in \SI. Options include 'symbol', 'fraction', and 'reciprocal'. ```latex \SI[per-mode=symbol]{10}{\metre\per\second} % 10 m/s \SI[per-mode=fraction]{10}{\metre\per\second} % 10 m over s (fraction) \SI[per-mode=reciprocal]{10}{\metre\per\second} % 10 m\cdot s^{-1} ``` -------------------------------- ### Quantity Formatting with Spacing Control Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/examples-and-patterns.md Shows how to control the spacing between the number and the unit in quantities using the 'number-unit-product' option in \SI. This allows for custom separators or no separator. ```latex % Default spacing (thin space) \SI{100}{kg} % Custom spacing \SI[number-unit-product={~}]{100}{kg} % Regular space \SI[number-unit-product={,}]{100}{kg} % Comma separator % No space \SI[number-unit-product={}]{100}{kg} % No separator ``` -------------------------------- ### Prefix Mode: Input (Default) Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/examples-and-patterns.md Shows the default input mode for prefixes, where scientific notation is directly interpreted. ```latex \SI{1.5 e3}{m} % 1.5 × 10³ m \SI{1.5}{km} % 1.5 km \SI[prefix-mode=input]{1.5 e3}{km} % 1.5 × 10³ km ``` -------------------------------- ### Define siunitx Key-Value Options Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/types-and-structures.md Defines a new key-value option within the 'siunitx' namespace. Use this to create custom options with specified types and default values. ```latex \keys_define:nn { siunitx } { option-name .type:N = \l_module_var, option-name .default:n = { default-value } } ``` -------------------------------- ### Set Number Module Configuration Options Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/internal-api-number.md Use this snippet to configure thousands separators, exponent notation, and rounding behavior for numbers. This is useful for customizing the output format of numerical data according to specific requirements. ```latex \siunitx_keys_set: { group-separator = {~}, exponent-mode = scientific, round-mode = figures, round-precision = 3 } ``` -------------------------------- ### Number Formatting with Grouping Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/examples-and-patterns.md Shows how to format numbers with group separators for better readability. The \num command automatically applies grouping to decimal numbers with sufficient places. ```latex \siunitx_keys_set:n { group-separator = {~} } \num{123456789} % Output: 123 456 789 \num{0.123456} % Output: 0.123 456 (if \ge 4 decimal places) ``` -------------------------------- ### Adjusting Quantity Spacing Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/examples-and-patterns.md Illustrates the default thin space between a quantity and its unit and shows how to use the 'number-unit-product' option to insert a regular space. ```latex \SI{10}{m} % Default thin space ``` ```latex \SI[number-unit-product={~}]{10}{m} % Regular space ``` -------------------------------- ### Configure Engineering Notation Output Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/examples-and-patterns.md Set siunitx for engineering notation with custom grouping and per-mode settings. ```latex \siunitx_keys_set:n { exponent-mode = engineering, group-separator = {~}, per-mode = symbol } % Units in engineering style with powers of 1000 ``` -------------------------------- ### Generate Unit for PDF Bookmark Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/advanced-features.md Produces plain text output suitable for PDF bookmarks and other non-typesetting contexts. No formatting is applied. ```latex \SIInBookmark[options]{number}[power]{unit} ``` -------------------------------- ### Format Quantity Lists Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/examples-and-patterns.md Use \SIlist to create lists of quantities with units. Similar to \numlist, custom separators can be applied. ```latex \SIlist{1;2;3}{m} % 1, 2, 3 m \SIlist{10;20;30}{kg} % 10, 20, 30 kg ``` ```latex \SIlist[list-final-separator={~and~}]{5;10;15}{s} % 5, 10 and 15 s ``` -------------------------------- ### Configure Table Format Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/configuration.md Use `table-format` to specify the expected number of integer and decimal digits for columns in a table. This helps in aligning numbers correctly. ```latex \begin{tabular}{S[table-format=3.2]} 1.23 \\ 12.34 \end{tabular} ``` -------------------------------- ### Applying Powers with \raiseto Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/user-commands.md The \raiseto command is used to apply powers to units. This is an alternative notation for expressing units raised to a power, like cubic meters. ```latex \SI{100}{\metre\raiseto{3}} % Alternative power notation ``` -------------------------------- ### Scientific and Engineering Notation Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/examples-and-patterns.md Illustrates how to use \num with different exponent modes for scientific and engineering notation. 'engineering' uses powers of 1000, while 'scientific' uses powers of 10. ```latex % Engineering notation (powers of 1000) \num[exponent-mode=engineering]{12345} % Output: 12.345 \times 10^{3} % Scientific notation (powers of 10) \num[exponent-mode=scientific]{12345} % Output: 1.2345 \times 10^{4} % Forced scientific \num[scientific-notation=true]{123} % Output: 1.23 \times 10^{2} ``` -------------------------------- ### siunitx Local Token List Variable Conventions Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/types-and-structures.md Shows naming conventions for local temporary token list variables used within siunitx modules. ```latex \l_@@_tmp_tl % Temporary token list \l_@@_tmp_fp % Temporary floating point \l_@@_tmp_clist % Temporary comma list \l_@@_result_tl % Result accumulator ``` -------------------------------- ### Set siunitx Option Scope Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/configuration.md Demonstrates how siunitx options are inherited hierarchically. Options set globally, in a local scope, or as a command-level argument affect number formatting. ```latex \siunitx_keys_set:n { exponent-mode = scientific } % Global { \siunitx_keys_set:n { exponent-mode = engineering } % Local scope \num{123} % Uses engineering mode } \num{123} % Uses scientific mode again \num[exponent-mode=input]{123} % Uses input mode for this command only ``` -------------------------------- ### Format Quantity with Literal Unit using \qty Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/user-commands.md Use the modern \qty command to format a numerical value with a literal unit string. Ensure the siunitx package is included. ```latex \qty{10.5}{kg} ``` -------------------------------- ### Integrating siunitx with pgfplots Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/examples-and-patterns.md Shows how to use siunitx commands for axis labels when integrating with the pgfplots package to create plots with units. ```latex \begin{tikzpicture} \begin{axis}[ xlabel = \SI{}{s}, ylabel = \SI{}{m} ] \addplot coordinates { (0,0) (1,5) (2,10) }; \end{axis} \end{tikzpicture} ``` -------------------------------- ### Decimal Prefixes Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/types-and-structures.md Lists the standard decimal prefixes available in siunitx. ```latex \yotta, \zetta, \exa, \peta, \tera, \giga, \mega, \kilo, \hecto, \deca, \deci, \centi, \milli, \micro, \nano, \pico, \femto, \atto, \zepto, \yocto ``` -------------------------------- ### User-Facing Commands Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/INDEX.md These are the primary commands that end users invoke directly within their LaTeX documents to format numbers, units, and quantities. ```APIDOC ## User-Facing Commands ### Description Provides commands for formatting standalone numbers, quantities (number + unit), angles, and lists or ranges of these. ### Commands - `\num{number}`: Format standalone numbers. - `\SI{number}{unit}`: Format quantities (number + unit). - `\qty{number}{unit}`: Modern quantity command. - `\ang{deg;min;sec}`: Format angles. - `\numlist{...}`: Format number lists. - `\numrange{n1}{n2}`: Format number ranges. - `\SIlist{...}{unit}`: Format quantity lists. - `\SIrange{n1}{n2}{unit}`: Format quantity ranges. - Unit symbolic commands: SI base units, prefixes, derived units. ``` -------------------------------- ### Format Quantity with Symbolic Unit using \SI Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/user-commands.md Use \SI with symbolic unit commands for standardized output. Ensure the siunitx package is included. ```latex \SI{1.23}{\metre\per\second} ``` -------------------------------- ### Generate Unit Range for PDF Bookmark Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/advanced-features.md Produces plain text output suitable for PDF bookmarks and other non-typesetting contexts. No formatting is applied. ```latex \SIrangeInBookmark[options]{n1}{n2}{unit} ``` -------------------------------- ### Symmetric Uncertainty in Quantities Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/examples-and-patterns.md Shows how to apply symmetric uncertainty to quantities with units, including options for repeating or omitting the unit with the uncertainty. ```latex % In quantities \SI{1.23(4)}{m} % 1.23 ± 0.04 m (bracketed) \SI[separate-uncertainty-units=repeat]{1.23(4)}{m} % 1.23 m ± 0.04 m ``` -------------------------------- ### Define Custom Prefixes and Powers Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/examples-and-patterns.md Define custom non-power-of-10 prefixes and custom powers for units. ```latex % Custom prefix (non-power-of-10) \siunitx_declare_prefix:Nn \custom { c } % Custom powers \siunitx_declare_power:NNn \squared \squared { 2 } \SI{4}{\metre\squared} % 4 m² ``` -------------------------------- ### Reciprocal Division Formatting Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/configuration.md Illustrates using reciprocal notation for division between units. ```latex \SI[per-mode=reciprocal]{10}{\metre\per\second} % m s⁻¹ (inline) ``` -------------------------------- ### Apply Bold and Custom Fonts with siunitx Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/examples-and-patterns.md Apply bold formatting directly or use 'text-font-command' to specify custom fonts like typewriter for numbers. ```latex % Bold text {\bfseries \num{123}} % Bold number % Custom fonts with text-font-command \num[mode=text, text-font-command=\ttfamily]{123} % Typewriter ``` -------------------------------- ### Symmetric Uncertainty in Numbers Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/examples-and-patterns.md Demonstrates how to input symmetric uncertainty using parentheses or explicit operators. ```latex \num{1.23(4)} % 1.23 ± 0.04 \num{1.23 +- 0.04} % 1.23 ± 0.04 ``` -------------------------------- ### Standard Mathematical Font Commands Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/advanced-features.md Lists the standard LaTeX commands used by siunitx for applying different font styles in math mode, such as Roman, bold, and italic. ```latex \mathrm{...} % Roman font (used for units) \mathbf{...} % Bold (for numbers in bold context) \mathit{...} % Italic \mathsf{...} % Sans-serif \mathtt{...} % Teletype ``` -------------------------------- ### Prefix Mode: Extract Exponent Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/examples-and-patterns.md Illustrates the 'extract-exponent' mode, where prefixes are extracted from the number and applied to the unit's exponent. ```latex % Extracts prefix and applies to exponent \SI[prefix-mode=extract-exponent]{1.5}{km} % 1.5 × 10³ m \SI[prefix-mode=extract-exponent]{2.5}{Mg} % 2.5 × 10⁶ g ``` -------------------------------- ### Main siunitx Document Commands Source: https://github.com/josephwright/siunitx/blob/main/_autodocs/overview.md These are the primary commands users interact with in a LaTeX document to typeset numbers, quantities, angles, and lists. They accept optional parameters for customization. ```latex \num[options]{number} \SI[options]{number}[power]{unit} \qty[options]{number}{unit} \ang[options]{deg;min;sec} \numlist[options]{number;number;...} \numrange[options]{number}{number} \SIlist[options]{number;number;...}{unit} \SIrange[options]{num1}{num2}{unit} ```