\documentclass{article}

% Regression document for the extracted linesys package.
% The package implementation is loaded from linesys.sty rather than embedded.
\usepackage{linesys}

% Regression-only helpers used to exercise formatting-sensitive cases.
\usepackage{xcolor}
\usepackage{graphicx}
\newcommand*{\Scale}[2][4]{\scalebox{#1}{\ensuremath{#2}}}
\newcommand*{\Tint}[1]{\textcolor{violet}{#1}}
\newcommand*{\Strong}[1]{\mathbf{#1}}
\newcommand*{\FlexTint}[2][1]{\scalebox{#1}{\ensuremath{#2}}}

\begin{document}

\subsection*{Public transparent-wrapper declarations}

% Before declaration, an arbitrary user wrapper remains opaque.  Its wrapped
% zero is therefore treated as a visible/nonzero coefficient and becomes the
% automatic pivot.
\[
\begin{linesys}[pivots=true]
  \Tint{0}&1&2
\end{linesys}
\]

\begingroup
\linesysdeclaretransparentwrapper{\Tint}
% Duplicate registration is deliberately harmless and idempotent.
\linesysdeclaretransparentwrapper{\Tint}

% Once declared, the same wrapper is transparent to zero classification.  The
% first coefficient disappears and the literal 1 becomes the automatic pivot.
\[
\begin{linesys}[pivots=true]
  \Tint{0}&1&2
\end{linesys}
\]

% Sign stripping and unit classification preserve the declared wrapper around
% visible magnitudes; the leading sign is emitted by the ordinary renderer.
\[
\begin{linexp}[hidezeros=false]
  \Tint{-2}&\Tint{+1}&3
\end{linexp}
\]
\endgroup

% Declarations follow normal TeX grouping.  Outside the group, \Tint is opaque
% again and its zero coefficient is visible in ordinary hidezeros mode.
\[
\begin{linexp}
  \Tint{0}&1
\end{linexp}
\]

\subsection*{Nested declarations and source-shape boundary}

\begingroup
\linesysdeclaretransparentwrapper{\Tint}
\linesysdeclaretransparentwrapper{\Strong}
\linesysdeclaretransparentwrapper{\FlexTint}

% Nested registered wrappers are peeled recursively for classification while
% remaining intact in the rendered coefficient.
\[
\begin{linexp}
  \Tint{\Strong{-2}}&1
\end{linexp}
\]

% A registered command is transparent only in the lexical form \foo{content}.
% The default-argument form below matches that shape and hides the zero, while
% the explicit optional-argument form remains opaque by design.
\[
\begin{linexp}
  \FlexTint{0}&1
\end{linexp}
\qquad
\begin{linexp}
  \FlexTint[1.4]{0}&1
\end{linexp}
\]
\endgroup

\subsection*{Common persistent defaults for both renderers}

\begingroup
\linesyssetcommonoptions{
	var=x_i,
	varindexstart=0,
	varindexstep=2,
	hidezeros=false,
	scalarops=true,
	scalaropsymbol=\ast
}

\[
\begin{linesys}
	1&0&5
\end{linesys}
\quad
\begin{linexp}
	1&0
\end{linexp}
\]
\endgroup

% The group above must not change the built-in defaults outside it.
\[
\begin{linesys}
	1&0&5
\end{linesys}
\qquad
\begin{linexp}
	1&0
\end{linexp}
\]

\subsection*{Common defaults preserve environment-specific independence}

\begingroup
\linesyssetcommonoptions{var={u,v,w},hidezeros=false}
\linesyssetdefaultoptions{var={a,b,c},relation=\le}
\linexpsetdefaultoptions{full=true}

\[
\begin{linesys}
	1&0&2&4
\end{linesys}
\qquad
\begin{linexp}
	1&0&2
\end{linexp}
\]
\endgroup

\subsection*{Inline \texttt{\\linexpr} reuses \texttt{linexp}}

Inline in text: \linexpr{1&2&-3}.

\[
\linexpr[
	full,
	scalarops,
	scalaropsymbol=\ast,
	var=x_i,
	varindexstart=2,
	wrap={coefficients}[columns={1,3}]{\color{blue}}
]{1&2&3}
\]

\begingroup
\linexpsetdefaultoptions{var=greek,hidezeros=false}
Defaulted inline expression: \linexpr{1&0&2}.

\linesyswrapdisable
Wrappers disabled inline:
\linexpr[wrap={coefficients}{\color{red}}]{1&2&3}.
\endgroup


\subsection*{Relation symbols and linear inequalities}

% relation=... applies one relation to every rendered row while preserving all
% ordinary system behavior, including pivots and delimiters.
\[
\begin{linesys}[relation=\le,pivots=true,delim={\{,.}]
  2&-1&3\\
  0&4&5
\end{linesys}
\]

% relations={...} selects one relation per rendered non-empty row.
\[
\begin{linesys}[relations={=,\le,\ge}]
  1&2&3\\
  4&5&6\\
  7&8&9
\end{linesys}
\]

% Relation symbols have their own wrapper target.  entries must continue to
% affect matrix entries only, not the generated relation column.
\[
\begin{linesys}[
  relations={=,\le,\neq},
  wrap={relations}[rows={2,3}]{\color{blue}},
  wrap={entries}{\mathbf}
]
  1&2&3\\
  4&5&6\\
  7&8&9
\end{linesys}
\]

\subsection*{Relation defaults and sequential override}

\begingroup
\linesyssetdefaultoptions{relation=\ge}
\[
\begin{linesys}
  1&2&3\\
  4&5&6
\end{linesys}
\]
% A per-row list overrides the uniform stored relation for this system.
\[
\begin{linesys}[relations={\le,=}]
  1&2&3\\
  4&5&6
\end{linesys}
\]
% A later relation key clears a preceding per-row list, restoring a uniform
% relation with ordinary left-to-right option semantics.
\[
\begin{linesys}[relations={\le,=},relation=\neq]
  1&2&3\\
  4&5&6
\end{linesys}
\]
\endgroup

\begingroup
\linesyssetdefaultoptions{relations={\le,\ge}}
\[
\begin{linesys}
  1&2&3\\
  4&5&6
\end{linesys}
\]
% A local uniform relation resets a stored per-row relation list.
\[
\begin{linesys}[relation={=} ]
  1&2&3\\
  4&5&6
\end{linesys}
\]
\endgroup

\subsection*{Relation diagnostics}

% Intentional malformed per-row relation lists.  Redirect the package errors so
% the regression document continues compiling while the validation paths run.
\begingroup
\ExplSyntaxOn
\msg_redirect_name:nnn { linesys } { relations-row-count } { info }
\msg_redirect_name:nnn { linesys } { empty-relation } { info }
\msg_redirect_name:nnn { linesys } { wrap-column-ignored-for-relations } { info }
\ExplSyntaxOff
\[
\begin{linesys}[relations={=,\le}]
  1&2&3\\
  4&5&6\\
  7&8&9
\end{linesys}
\]
\[
\begin{linesys}[relation={}]
  1&2&3
\end{linesys}
\]
% A column filter has no coordinate meaning for relation symbols and is
% therefore ignored with the dedicated package diagnostic.
\[
\begin{linesys}[relation=\le,wrap={relations}[columns=1]{\color{blue}}]
  1&2&3
\end{linesys}
\]
\endgroup

\subsection*{Manual pivot selection}

% Manual selectors are indexed by rendered non-empty rows.  The first row
% deliberately selects column 2 despite a nonzero entry in column 1; the third
% selects the RHS.  Automatic pivot detection is bypassed for all three rows.
\[
\begin{linesys}[pivots=true,pivotcols={2,1,rhs}]
  3&-2&7\\
  4&5&8\\
  0&0&9
\end{linesys}
\]

% A manually selected zero remains visible even with hidezeros=true.  none
% creates no pivot, while an explicitly selected zero RHS is still highlightable
% and is not vetoed by rhspivots=false.
\[
\begin{linesys}[pivots=true,rhspivots=false,pivotcols={2,none,rhs}]
  3&0&4\\
  5&6&7\\
  0&0&0
\end{linesys}
\]

% Manual coefficient pivots retain the established custom-highlighter/wrapper
% ordering.  The selected second-column pivot should remain blue inside the
% outer red coefficient wrapper.
\[
\begin{linesys}[
  pivots=\color{blue},
  pivotcols={2},
  wrap={coefficients}{\color{red}}
]
  2&-3&4
\end{linesys}
\]

% Manual pivots remain semantically active without highlighting.  In full mode
% pivotparen=false therefore removes parentheses from the selected negative
% second-column pivot, not from the negative non-pivot in column 1.
\[
\begin{linesys}[full,pivots=false,pivotparen=false,pivotcols={2}]
  -2&-3&4
\end{linesys}
\]

\subsection*{Manual pivot defaults and automatic reset}

\begingroup
\linesyssetdefaultoptions{pivots=true,pivotcols={2,rhs}}
\[
\begin{linesys}
  1&2&3\\
  0&0&4
\end{linesys}
\]
% A local pivotcols=auto restores ordinary first-nonzero / RHS detection even
% when the surrounding default is manual.
\[
\begin{linesys}[pivotcols=auto]
  1&2&3\\
  0&0&4
\end{linesys}
\]
\endgroup

\subsection*{Manual pivot diagnostics}

% Intentional malformed specifications.  Redirect the package errors so the
% regression document continues compiling while the validation paths execute.
\begingroup
\ExplSyntaxOn
\msg_redirect_name:nnn { linesys } { pivotcols-row-count } { info }
\msg_redirect_name:nnn { linesys } { invalid-pivot-selector } { info }
\msg_redirect_name:nnn { linesys } { invalid-pivot-column } { info }
\ExplSyntaxOff
\[
\begin{linesys}[pivotcols={1}]
  1&2&3\\
  4&5&6
\end{linesys}
\]
\[
\begin{linesys}[pivotcols={banana}]
  1&2&3
\end{linesys}
\]
\[
\begin{linesys}[pivotcols={3}]
  1&2&3
\end{linesys}
\]
\endgroup

\subsection*{Transparent coefficient classification}

% Transparent zeros are hidden and do not become pivots.  The first visible
% coefficient in each row should therefore be the highlighted pivot.
\[
\begin{linesys}[pivots=true]
  {0}&\textcolor{red}{0}&2&3\\
  \color{blue}0&-1&0&4
\end{linesys}
\]

% With zeros visible, source formatting on transparent zero entries is retained.
\[
\begin{linesys}[hidezeros=false]
  \textcolor{red}{0}&{\color{blue}0}&1&2\\
\end{linesys}
\]

% RHS-pivot eligibility uses the same normalized zero classification.
\[
\begin{linesys}[pivots=true]
  0&0&\textcolor{red}{0}\\
  0&0&\textcolor{blue}{5}
\end{linesys}
\]

\subsection*{Transparent signs, units, and explicit plus normalization}

% Transparent +/-1 coefficients classify as units.  Explicit leading plus signs
% are removed from coefficient content while equation-level plus signs remain.
\[
\begin{linesys}
  \textcolor{red}{+1}&{\color{blue}-1}&+2&3\\
\end{linesys}
\]

\[
\begin{linexp}
  \textcolor{red}{+1}&{\color{blue}-1}&+2
\end{linexp}
\qquad
\begin{linexp}[scalarops=true]
  \textcolor{red}{+1}&{\color{blue}-1}&+2
\end{linexp}
\]

% Sign stripping also descends through explicitly registered transparent
% wrappers, while preserving the wrapper itself in the rendered coefficient.
\begingroup
\linesysdeclaretransparentwrapper{\Tint}
\linesysdeclaretransparentwrapper{\Strong}
\[
\begin{linexp}[scalarops=true]
  \Tint{+1}&\Strong{-1}&2
\end{linexp}
\]
\endgroup

% Full mode keeps negative coefficients indivisible/parenthesized but removes a
% redundant leading plus.  A transparent -0 remains visible in full mode while
% still classifying as zero for pivot selection.
\[
\begin{linesys}[full,pivots=true,pivotparen=true]
  \textcolor{red}{-0}&\textcolor{blue}{-1}&+2&3\\
\end{linesys}
\]

\subsection*{Lexical boundary remains non-algebraic}

% 1-1 is not simplified to zero; it remains an ordinary nonzero-looking entry
% for lexical classification and therefore becomes the automatic pivot.
\[
\begin{linesys}[pivots=true]
  1-1&0&2\\
\end{linesys}
\]

\subsection*{Configurable index steps and sequential convenience settings}

\[
\begin{linesys}[var=x_i,varindexstart=10,varindexstep=-2]
  1&2&3&4\\
\end{linesys}
\]

\[
\begin{linexp}[var=x_i,varindexstart=5,varindexdecrease,varindexstep=2]
  1&1&1
\end{linexp}
\qquad
\begin{linexp}[var=x_i,varindexstart=5,varindexstep=2,varindexdecrease]
  1&1&1
\end{linexp}
\]

\subsection*{Generalized indexed templates}

\[
\begin{linesys}[var=x_{2,i}]
  1&2&3&4\\
\end{linesys}
\]

\[
\begin{linexp}[var=x^{(i)}]
  1&2&3
\end{linexp}
\]

\[
\begin{linexp}[var={\frac{(x-x_0)^{i}}{i!}},varindexstep=2]
  1&1&1
\end{linexp}
\]

\subsection*{Automatic list/template distinction and \texttt{varmode}}

\[
\begin{linesys}[var={i,j,k}]
  1&2&3&4\\
\end{linesys}
\qquad
\begin{linesys}[var={x_i,y,z}]
  1&2&3&4\\
\end{linesys}
\]

\[
\begin{linexp}[var=i]
  3
\end{linexp}
\qquad
\begin{linexp}[var=i^2,varmode=list]
  3
\end{linexp}
\]

\[
\begin{linexp}[var={(x_i,y_i)},varmode=indexed]
  1&2&3
\end{linexp}
\]

\begingroup
\linesyssetdefaultoptions{var=x_i,varindexstart=2,varindexstep=3}
\linexpsetdefaultoptions{var=x_i,varindexstart=4,varindexstep=-2}
\[
\begin{linesys}
  1&1&1&0\\
\end{linesys}
\qquad
\begin{linexp}
  1&1&1
\end{linexp}
\]
\endgroup

\begingroup
\linesyssetdefaultoptions{var={(x_i,y_i)},varmode=indexed}
\linexpsetdefaultoptions{var=i^2,varmode=list}
\[
\begin{linesys}
  1&1&0\\
\end{linesys}
\qquad
\begin{linexp}
  3
\end{linexp}
\]
\endgroup

\subsection*{Decreasing indexed variables in \texttt{linesys}}

\[
\begin{linesys}[var=x_i,varindexstart=10,varindexdecrease]
    3&4&5&6
\end{linesys}
\]

\[
\begin{linesys}[var=x_i,varindexstart=1,varindexdecrease=true]
    3&4&5&6
\end{linesys}
\]

\begingroup
\linesyssetdefaultoptions{var=x_i,varindexstart=4,varindexdecrease=true}
\[
\begin{linesys}
    1&1&1&0
\end{linesys}
\]
\endgroup

\subsection*{Basic \texttt{linexp} rendering}

\[
\begin{linexp}
    1&2&3
\end{linexp}
\]

\[
\begin{linexp}
    0&-1&2&0
\end{linexp}
\]

\[
\begin{linexp}[hidezeros=false]
    1&0&-1
\end{linexp}
\]

\[
\begin{linexp}
    0&0&0
\end{linexp}
\]

\[
\begin{linexp}[emptyzeros=true]
    1&&3
\end{linexp}
\]

% colsep remains a local array-spacing control for the rendered expression.
\[
\begin{linexp}[colsep=0pt]
    2&3&4
\end{linexp}
\]

\subsection*{\texttt{linexp} full mode, scalar operations, and indexed variables}

\[
\begin{linexp}[full=true]
    -1&-2&3
\end{linexp}
\]

\[
\begin{linexp}[
    full=true,
    scalarops=true,
    scalaropsymbol=\ast,
    var=\vec{v}_j,
    varindex=j,
    varindexstart=2,
    wrap={coefficients}[columns={1,3}]{\color{blue}}
]
    1&2&3
\end{linexp}
\]

\[
\begin{linexp}[var=x_i,varindexstart=1,varindexdecrease=true]
    3&4&5
\end{linexp}
\]

\subsection*{\texttt{linexp} wrappers and package-wide wrap control}

\[
\begin{linexp}[
    wrap={variables}[columns=2]{\mathbf},
    wrap={coefficients}[columns={1,3}]{\color{red}}
]
    2&-3&4
\end{linexp}
\]

% Filters are declaration-local here as in linesys: the second rule has no
% column selector and therefore applies to every coefficient.
\[
\begin{linexp}[
    wrap={variables}[columns=2]{\mathbf},
    wrap={coefficients}{\color{red}}
]
    2&3&4
\end{linexp}
\]

\[
\begin{linexp}[wrap={coefficients,variables}[columns=2]{\color{blue}}]
    2&3&4
\end{linexp}
\]

\begingroup
\linesyswrapdisable
\[
\begin{linexp}[wrap={coefficients}{\color{red}}]
    2&3&4
\end{linexp}
\]
\begingroup
\linesyswrapenable
\[
\begin{linexp}[wrap={coefficients}{\color{red}}]
    2&3&4
\end{linexp}
\]
\endgroup
\endgroup

\subsection*{\texttt{linexp} defaults and grouping}

\begingroup
\linexpsetdefaultoptions{var=greek,scalarops=true,varindexdecrease=true}
\[
\begin{linexp}
    1&2&3
\end{linexp}
\]
\begingroup
\linexpsetdefaultoptions{var={u,v,w},scalarops=false}
\[
\begin{linexp}
    1&2&3
\end{linexp}
\]
\endgroup
\[
\begin{linexp}
    1&2&3
\end{linexp}
\]
\endgroup

\subsection*{\texttt{linexp} one-term and validation cases}

\[
\begin{linexp}[var={u}]
    -1
\end{linexp}
\]

\begingroup
\ExplSyntaxOn
\msg_redirect_name:nnn { linesys } { linexp-row-count } { info }
\ExplSyntaxOff
\[
\begin{linexp}
    1&2&3\\
    4&5&6
\end{linexp}
\]
\endgroup

% Variable-resolution diagnostics are expression-specific while sharing the
% established variable-generation machinery.
\begingroup
\ExplSyntaxOn
\msg_redirect_name:nnn { linesys } { linexp-too-few-variables } { info }
\ExplSyntaxOff
\[
\begin{linexp}[var={u,v}]
    1&2&3
\end{linexp}
\]
\endgroup

\[
\begin{linexp}
    1&2&3\\
\end{linexp}
\]

\subsection*{Inconsistent row-width diagnostics}

% These malformed systems are intentional regression tests.  Redirect the
% package error to an informational message so the regression document can
% continue compiling while still exercising both width-mismatch directions.
\begingroup
\ExplSyntaxOn
\msg_redirect_name:nnn { linesys } { inconsistent-row-width } { info }
\ExplSyntaxOff
\[
\begin{linesys}
    1&2&3\\
    4&5
\end{linesys}
\]
\[
\begin{linesys}
    1&2&3\\
    4&5&6&7\\
\end{linesys}
\]
\endgroup

% A trailing row separator creates only a blank sequence item and must not
% trigger the row-width diagnostic.
\[
\begin{linesys}
    1&2&3\\
    4&5&6\\
\end{linesys}
\]

\subsection*{Group-local wrapper disable and enable}

\[
\begin{linesys}[wrap={coefficients}{\color{red}}]
    2&-1&3\\
    4&5&6
\end{linesys}
\]

\begingroup
\linesyswrapdisable
\[
\begin{linesys}[wrap={coefficients}{\color{red}}]
    2&-1&3\\
    4&5&6
\end{linesys}
\]
\begingroup
\linesyswrapenable
\[
\begin{linesys}[wrap={coefficients}{\color{red}}]
    2&-1&3\\
    4&5&6
\end{linesys}
\]
\endgroup
\[
\begin{linesys}[wrap={coefficients}{\color{red}}]
    2&-1&3\\
    4&5&6
\end{linesys}
\]
\endgroup

\[
\begin{linesys}[wrap={coefficients}{\color{red}}]
    2&-1&3\\
    4&5&6
\end{linesys}
\]

\subsection*{\texttt{pivotparen} in full mode}

% Default pivotparen=true: the negative pivot is parenthesized.
\[
\begin{linesys}[full=true]
    -1&2&3
\end{linesys}
\]

% pivots=true sets pivotparen=false when that key is processed.
\[
\begin{linesys}[full=true,pivots=true]
    -1&2&3
\end{linesys}
\]

% A later explicit pivotparen=true overrides the automatic false.
\[
\begin{linesys}[full=true,pivots=true,pivotparen=true]
    -1&2&3
\end{linesys}
\]

% Sequential key semantics also work in the opposite order.
\[
\begin{linesys}[full=true,pivotparen=true,pivots=true]
    -1&2&3
\end{linesys}
\]

% pivotparen=false is independent of highlighting, and only affects the pivot;
% the later negative non-pivot remains parenthesized.
\[
\begin{linesys}[full=true,pivots=false,pivotparen=false]
    -1&-2&3
\end{linesys}
\]

\begingroup
\newcommand*{\myPivotPar}[1]{\fbox{\ensuremath{#1}}}
\[
\begin{linesys}[full=true,pivots=\myPivotPar]
    -1&2&3
\end{linesys}
\]
\[
\begin{linesys}[full=true,pivots=\myPivotPar,pivotparen=false]
    -1&2&3
\end{linesys}
\]
\endgroup

\subsection*{\texttt{pivotparen} persistent defaults and grouping}

\begingroup
\linesyssetdefaultoptions{full=true,pivots=true,pivotparen=true}
\[
\begin{linesys}
    -1&2&3
\end{linesys}
\]
\begingroup
\linesyssetdefaultoptions{pivotparen=false}
\[
\begin{linesys}
    -1&2&3
\end{linesys}
\]
\endgroup
\[
\begin{linesys}
    -1&2&3
\end{linesys}
\]
\endgroup


\subsection*{color variables in row 3, and then coefficients in column 1}

\[
\begin{linesys}[full,
	wrap={variables}[rows=3]{\color{blue}},
	wrap={coefficients}[columns=1]{\color{red}}
	]
	2&1&0&4\\
	0&-3&2&5\\
	0&0&7&-1
\end{linesys}
\]

\subsection*{color coefficients in column 1, and then in row 3}

\[
\begin{linesys}[full,
	wrap={coefficients}[columns=1]{\color{red}},
	wrap={coefficients}[rows=3]{\color{blue}}
	]
	2&1&0&4\\
	0&-3&2&5\\
	0&0&7&-1
\end{linesys}
\]


\subsection*{wrapper filter isolation -- row selector followed by column selector}

\[
\begin{linesys}[full,
	wrap={coefficients}[rows=3]{\color{blue}},
	wrap={coefficients}[columns=1]{\color{red}}
	]
	2&1&0&4\\
	0&-3&2&5\\
	0&0&7&-1
\end{linesys}
\]

\subsection*{wrapper filter isolation -- both selectors followed by no selector}

\[
\begin{linesys}[full,
	wrap={coefficients}[rows=2,columns=2]{\mathbf},
	wrap={variables}{\color{blue}}
	]
	2&1&0&4\\
	0&-3&2&5\\
	0&0&7&-1
\end{linesys}
\]

\subsection*{wrapper filter isolation -- constants after a column selector}

\[
\begin{linesys}[full,
	wrap={coefficients}[columns=1]{\color{red}},
	wrap={constants}{\color{blue}}
	]
	2&1&0&4\\
	0&-3&2&5\\
	0&0&7&-1
\end{linesys}
\]

\subsection*{Full mode with a custom pivot operation}

\newcommand*{\boxedPivotManual}[1]{\fbox{\ensuremath{#1}}}
\[
\begin{linesys}[var={x,y},full=true,pivots=\boxedPivotManual,wrap={coefficients}{\color{red}}]
	-2&-3&4\\
	0&-4&5
\end{linesys}
\]

\subsection*{Indexed variables, pivots, delimiters, and wrappers}

\[
\begin{linesys}[var=x_i,varindexstart=0,pivots=true,delim={(,)},rowsep=4pt,wrap={variables}[columns=2]{\mathbf},wrap={constants}{\color{blue}}]
	2&-1&0&7\\
	0&3&4&-2\\
	0&0&5&6
\end{linesys}
\]

\subsection*{Selective emphasis}

\[
\begin{linesys}[
	var={x,y,z},
	pivots=true,
	wrap={variables}[columns=2]{\mathbf},
	wrap={constants}[rows={1,3}]{\color{blue}},
	wrap={coefficients}[rows=2]{\color{red}}
	]
	2&1&0&4\\
	0&-3&2&5\\
	0&0&7&-1
\end{linesys}
\]

\subsection*{An explicit algebra display}

\[
\begin{linesys}[full=true,scalarops=true]
	-2&3&5\\
	0&-1&4
\end{linesys}
\]

\subsection*{A textbook-style linear system}

\[
\begin{linesys}[var=x_i,pivots=true,delim={\{,.},rowsep=3pt]
	1&2&-1&4\\
	0&3&2&7\\
	0&0&5&-2
\end{linesys}
\]

\subsection*{Persistent defaults}

\begingroup
\linesyssetdefaultoptions{var={u,v},hidezeros=false}
\[
\begin{linesys}
	1&0&3\\
	0&2&4
\end{linesys}
\]
\endgroup

\subsection*{Custom highlighter precedence}

\[
\begin{linesys}[pivots=\color{blue},
	wrap={coefficients}{\color{red}}]
	2&-3&4\\
	0&5&6
\end{linesys}
\]

\subsection*{Built-in pivot highlighter -- interaction with wrappers}

\[
\begin{linesys}[pivots=true,
	wrap={coefficients}{\color{blue}}]
	2&-3&4\\
	0&5&6
\end{linesys}
\]

\subsection*{Entries versus coefficients and constants}

\[
\begin{linesys}[var={x,y},
	wrap={entries}{\color{blue}}]
	2&-3&4\\
	5&1&6
\end{linesys}
\]

\subsection*{Optional arguments in wrappers}

\[
\begin{linesys}[wrap={coefficients}[rows=1]{\Scale[1.35]}]
	2&-3&4\\
	5&1&6
\end{linesys}
\]

\subsection*{Multiple wrappers and order}

\[
\begin{linesys}[wrap={coefficients}[rows=1]{\textbf,\color{magenta}}]
	2&-3&4\\
	5&1&6
\end{linesys}
\]

\subsection*{Multiple targets}

\[
\begin{linesys}[
	wrap={coefficients,variables}[rows=1]{\mathbf}]
	2&-3&4\\
	5&1&6
\end{linesys}
\]

\subsection*{Row and column filters}

\[
\begin{linesys}[
	wrap={coefficients}[rows=2,columns={1,3}]{\color{red}},
	wrap={variables}[columns=2]{\mathbf}]
	1&2&3&4\\
	5&6&7&8\\
	9&10&11&12
\end{linesys}
\]

\subsection*{Wrappers}

\[
\begin{linesys}[
	wrap={variables}{\mathbf},
	wrap={constants}{\color{blue}}]
	2&-3&4\\
	5&1&6
\end{linesys}
\]

\[
\begin{linesys}[
	wrap={coefficients}{\color{blue}}]
	2&-3&4\\
	5&1&6
\end{linesys}
\]

\subsection*{Row and column separation}

\[
\begin{linesys}[colsep=2pt]
	1&22&333\\
	4&55&666
\end{linesys}
\]

\[
\begin{linesys}[rowsep=8pt]
	1&2&3\\
	4&5&6\\
	7&8&9
\end{linesys}
\]

\subsection*{Delimiters}

\[
\begin{linesys}[delim={[,\rfloor}]
	1&2&3\\
	4&5&6
\end{linesys}
\]

\[
\begin{linesys}[delim={\{,.}]
	1&2&3\\
	4&5&6
\end{linesys}
\]

\subsection*{Coefficient formatting and scalar multiplication}

\[
\begin{linesys}[scalarops=true,
	scalaropsymbol=\ast]
	2&-3&4\\
	-1&1&5
\end{linesys}
\]

\[
\begin{linesys}[scalarops=true]
	2&-3&4\\
	-1&1&5
\end{linesys}
\]

\subsection*{Full mode and pivots (no parenthesizing)}

\[
\begin{linesys}[var={x,y},full=true,pivots=true]
	-2&-3&4\\
	0&-4&5
\end{linesys}
\]

\subsection*{Leading-negative coefficients}

\[
\begin{linesys}[full=true]
	-2&-1+\sqrt{2}&3\\
	-\sqrt{3}&4&5
\end{linesys}
\]

\subsection*{Full mode}

\[
\begin{linesys}[full=true]
	1&-2&3\\
	0&-1&4
\end{linesys}
\]

\subsection*{Custom pivot highlighters}

\begingroup
\newcommand*{\myPivot}[1]{%
	\fbox{\ensuremath{#1}}}%
\[
\begin{linesys}[pivots=\myPivot]
	2&1&4\\
	0&-3&5
\end{linesys}
\]
\endgroup

\subsection*{Turning off RHS pivots}

\[
\begin{linesys}[pivots=true,rhspivots=false]
	0&0&5\\
	1&0&2
\end{linesys}
\]

\[
\begin{linesys}[pivots=true,rhspivots=true]
	0&0&5\\
	1&0&2
\end{linesys}
\]

\subsection*{Pivot highlighting}

\[
\begin{linesys}[pivots=true]
	2&1&0&4\\
	0&-3&2&5\\
	0&0&7&-1
\end{linesys}
\]

\subsection*{Empty entries: \texttt{emptyzeros}}

\[
\begin{linesys}[emptyzeros=true]
	1&&4\\
	&2&5
\end{linesys}
\]

\subsection*{Hiding zeros: \texttt{hidezeros}}

\[
\begin{linesys}[hidezeros=false]
	1&0&-2&5\\
	0&3&0&-1\\
	0&0&0&6\\
	0&0&0&0  
\end{linesys}
\]

\[
\begin{linesys}
	1&0&-2&5\\
	0&3&0&-1\\
	0&0&0&6\\
	0&0&0&0  
\end{linesys}
\]

\subsection*{Indexed variables: \texttt{varindex} and \texttt{varindexstart}}

\[
\begin{linesys}[var=\alpha_j,varindex=j,varindexstart=3]
	1&2&3&4\\
	0&-1&2&5
\end{linesys}
\]

\[
\begin{linesys}[var=x_i]
	1&2&3&4\\
	0&-1&2&5
\end{linesys}
\]

\subsection*{Lowercase Greek variables: \texttt{greek}}

\[
\begin{linesys}[var=greek]
	1&2&3&4\\
	0&-1&2&5
\end{linesys}
\]

\subsection*{Uppercase Roman variables: \texttt{Roman}}

\[
\begin{linesys}[var=Roman]
	1&2&3&4\\
	0&-1&2&5
\end{linesys}
\]

\subsection*{Lowercase Roman variables: \texttt{roman}}

\[
\begin{linesys}[var=roman]
	1&2&3&4&5\\
	0&1&-1&2&3
\end{linesys}
\]

\subsection*{Explicit variable lists}

\[
\begin{linesys}[var={u,v}]
	2&3&7\\
	-1&4&2
\end{linesys}
\]

\subsection*{Alignment: \texttt{align}}

\[
\begin{linesys}[align=r]
	1&2&36\\
	12&-4&5\\
	0&7&-2
\end{linesys}
\]

\[
\begin{linesys}[align=c]
	1&2&36\\
	12&-4&5
\end{linesys}
\]

\[
\begin{linesys}[align=l]
	1&2&36\\
	12&-4&5
\end{linesys}
\]

\subsection*{A first example}

\[
\begin{linesys}
	2&-1&3\\
	0&4&-2
\end{linesys}
\]

\end{document}