\documentclass[11pt]{article}

% -----------------------------------------------------------------------------
% linesys — User Manual, version 1.0
% -----------------------------------------------------------------------------
\usepackage[a4paper,margin=24mm,headheight=24pt]{geometry}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{microtype}
\usepackage{amsmath}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{array}
\usepackage{booktabs}
\usepackage{enumitem}
\usepackage{listings}
\usepackage[most]{tcolorbox}
\usepackage[hidelinks]{hyperref}
\usepackage{fancyhdr}
\usepackage{titlesec}
\usepackage{parskip}
\usepackage{linesys}

% -----------------------------------------------------------------------------
% Manual-only helpers.  These are examples of wrappers; they are not provided
% by linesys itself.
% -----------------------------------------------------------------------------
\newcommand*{\Scale}[2][1.5]{\scalebox{#1}{\ensuremath{#2}}}

% Correctly typeset a control sequence name such as \Scale or \linesys.
% In particular, do not use \textbackslash followed by a space here.
\newcommand*{\cmd}[1]{\texttt{\detokenize{#1}}}
\newcommand*{\key}[1]{\texttt{#1}}
\newcommand*{\val}[1]{\texttt{#1}}
\newcommand*{\meta}[1]{\texttt{\textless#1\textgreater}}

% -----------------------------------------------------------------------------
% Listings
% -----------------------------------------------------------------------------
\lstdefinestyle{linesyscode}{%
  language=[LaTeX]TeX,
  basicstyle=\ttfamily\small,
  columns=fullflexible,
  keepspaces=true,
  showstringspaces=false,
  breaklines=true,
  frame=single,
  framerule=0.3pt,
  rulecolor=\color{black!20},
  backgroundcolor=\color{black!2},
  xleftmargin=0pt,
  xrightmargin=0pt,
  aboveskip=0.5ex,
  belowskip=0.5ex,
}
\lstset{style=linesyscode}

% -----------------------------------------------------------------------------
% Page design
% -----------------------------------------------------------------------------
\definecolor{linesysblue}{RGB}{31,78,121}
\definecolor{linesysgray}{RGB}{75,75,75}
\definecolor{linesyslight}{RGB}{245,247,249}
\definecolor{linesysrule}{RGB}{210,215,220}

\hypersetup{
  colorlinks=true,
  linkcolor=linesysblue,
  urlcolor=linesysblue,
  citecolor=linesysblue,
  pdftitle={The linesys package — User Manual},
  pdfauthor={Fernando de Lacerda Mortari},
}

\pagestyle{fancy}
\fancyhf{}
\lhead{\textsf{\textbf{linesys}}}
\rhead{\textsf{User Manual \textperiodcentered\ Version 1.0}}
\cfoot{\thepage}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\headrule}{\hbox to\headwidth{\color{linesysrule}\leaders\hrule height \headrulewidth\hfill}}

\titleformat{\section}{\Large\bfseries\color{linesysblue}}{\thesection}{0.7em}{}
\titleformat{\subsection}{\large\bfseries\color{linesysblue}}{\thesubsection}{0.7em}{}
\titleformat{\subsubsection}{\normalsize\bfseries\color{linesysgray}}{\thesubsubsection}{0.7em}{}

\setlist[itemize]{topsep=0.4ex,itemsep=0.25ex,parsep=0pt}
\setlist[enumerate]{topsep=0.4ex,itemsep=0.25ex,parsep=0pt}

% A compact callout.
\newtcolorbox{noteBox}{
  enhanced,
  breakable,
  colback=linesyslight,
  colframe=linesysrule,
  boxrule=0.5pt,
  arc=2pt,
  left=7pt,right=7pt,top=5pt,bottom=5pt,
  before skip=8pt,after skip=8pt,
}

\newtcolorbox{importantBox}{
  enhanced,
  breakable,
  colback=yellow!7,
  colframe=orange!55!black,
  boxrule=0.6pt,
  arc=2pt,
  left=7pt,right=7pt,top=5pt,bottom=5pt,
  before skip=8pt,after skip=8pt,
}

% Code on the left, live rendering on the right.  The two panels are maintained
% explicitly in the manual source: the listing shows the user-facing example,
% while the right panel compiles the corresponding linesys environment live.
\newenvironment{linesysexample}[1]{%
  \begin{tcolorbox}[
    enhanced,breakable,colback=white,colframe=linesysrule,boxrule=0.5pt,arc=2pt,
    title={\textbf{#1}},coltitle=black,fonttitle=\normalsize,
    before skip=9pt,after skip=9pt]
  \begin{minipage}[t]{0.47\linewidth}
    \textbf{Code}\par\smallskip
}{%
  \end{minipage}\end{tcolorbox}
}
\newcommand*{\result}{%
  \end{minipage}\hfill
  \begin{minipage}[t]{0.47\linewidth}
    \textbf{Result}\par\smallskip
}

\newcommand{\linesysTitle}{\textsf{\textbf{linesys}}}

\begin{document}
\hypersetup{pageanchor=false}
\pagenumbering{roman}

% -----------------------------------------------------------------------------
% Title page
% -----------------------------------------------------------------------------
\begin{titlepage}
\thispagestyle{empty}
\vspace*{18mm}
{\Huge\bfseries\color{linesysblue} linesys\par}
\vspace{3mm}
{\LARGE User Manual\par}
\vspace{8mm}
{\large Version 1.0\par}
\vspace{14mm}
\begin{tcolorbox}[
  enhanced,colback=linesyslight,colframe=linesysrule,boxrule=0.5pt,arc=3pt,
  left=10pt,right=10pt,top=9pt,bottom=9pt]
\large
\textbf{Linear systems and linear expressions from matrix-like input.}\par
\medskip
Write an augmented matrix to produce a system of linear equations or inequalities,
or write a single coefficient row to produce a linear expression. \linesysTitle{} keeps
both forms close to ordinary matrix notation while providing configurable
variables, coefficient formatting, spacing, wrappers, and system-specific
features such as delimiters and pivot highlighting.
\end{tcolorbox}
\vfill
\begin{tabular}{@{}>{\bfseries}l p{0.58\textwidth}@{}}
Package author & Fernando de Lacerda Mortari \\
Affiliation & Department of Mathematics, Federal University of Santa Catarina (UFSC) \\
Contact & \href{mailto:fernando.mortari@ufsc.br}{fernando.mortari@ufsc.br} \\
Environments & \cmd{linesys}, \cmd{linexp} \\
Inline expression command & \cmd{\linexpr} \\
Package & \cmd{linesys} \\
Version & 1.0 \\
Engine used for this manual & pdfLaTeX
\end{tabular}
\vfill
{\small\color{linesysgray}
This manual documents the user-visible behavior of the package as supplied
for version 1.0. Examples are compiled with the package itself rather than
being simulated illustrations.
}
\end{titlepage}
\hypersetup{pageanchor=true}

\tableofcontents
\clearpage
\pagenumbering{arabic}
\setcounter{page}{1}

% -----------------------------------------------------------------------------
\section{Overview}
% -----------------------------------------------------------------------------

The \linesysTitle{} package provides two closely related environments. The
\cmd{linesys} environment turns an augmented matrix into a system of linear
equations or inequalities, while \cmd{linexp} turns one coefficient row into
a linear expression. The inline companion \cmd{\linexpr} uses the same
linear-expression renderer when an environment would be unnecessarily heavy.
In all three forms the input is deliberately close to matrix notation.

For a linear system:

\begin{lstlisting}
\begin{linesys}
    1&2&-1&4\\
    0&-3&2&5\\
    2&0&1&-1
\end{linesys}
\end{lstlisting}

The final column is interpreted as the right-hand side. All preceding columns
are coefficient columns. With the default configuration, the result is

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

A linear expression uses the same coefficient syntax but has no constant
column:

\begin{lstlisting}
\begin{linexp}
    1&2&-3
\end{linexp}
\end{lstlisting}

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

Environment options configure how a system or expression is presented without altering the supplied coefficient data.

\begin{noteBox}
\textbf{Authorship and AI assistance.} The concept, package design, specification,
and authorship of \linesysTitle{} are by Fernando de Lacerda Mortari, Department
of Mathematics, Federal University of Santa Catarina (UFSC). Code implementation,
testing, and the design, drafting, and revision of this manual were developed with
assistance from OpenAI's ChatGPT. AI assistance was used as a development and
editorial tool; final design decisions, validation, and responsibility for the
released package and documentation remain with the author.
\end{noteBox}
% ------------

% -----------------------------------------------------------------------------
\section{Installation and loading}
% -----------------------------------------------------------------------------

Place \texttt{linesys.sty} somewhere in the TeX search path, then load it in
the document preamble:

\begin{lstlisting}
\usepackage{linesys}
\end{lstlisting}

The package loads \texttt{amsmath}, \texttt{xparse}, and \texttt{tikz}. The examples in this manual
also use additional packages for documentation layout; those are not
requirements of \linesysTitle{}.

\begin{importantBox}
The manual's helper command \cmd{\Scale} is defined by the manual solely to
demonstrate that \key{wrap} can apply arbitrary user-supplied commands. It is
\textbf{not} a command provided by \linesysTitle{}.
\end{importantBox}

% -----------------------------------------------------------------------------
\section{The \texttt{linesys} environment}
% -----------------------------------------------------------------------------

The complete environment syntax is:

\begin{lstlisting}
\begin{linesys}[options]
    coefficient & coefficient & ... & constant \\
    coefficient & coefficient & ... & constant \\
    ...
\end{linesys}
\end{lstlisting}

The optional argument contains a comma-separated list of package options.
Rows are separated with \cmd{\\}; cells are separated with \texttt{\&}.
A trailing \cmd{\\} is harmless: it does not create an additional
mathematical row.

\subsection{A first example}

\begin{linesysexample}{The minimal form}
\begin{lstlisting}
\begin{linesys}
    2&-1&3\\
    0&4&-2
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}
2&-1&3\\
0&4&-2
\end{linesys}
\]
\endgroup
\end{linesysexample}

\subsection{Rows and columns}

For a system with two variables, each row has three entries: two coefficients
followed by one constant. For three variables, each row has four entries, and
so on.

\begin{lstlisting}
% two variables
\begin{linesys}
    1&2&3\\
    4&5&6
\end{linesys}

% three variables
\begin{linesys}
    1&2&3&4\\
    0&-1&2&5
\end{linesys}
\end{lstlisting}

Blank rows are ignored when the package counts rows. The first non-empty row
is used to determine the matrix width. Every later non-empty row must contain
the same number of entries. If a row has a different width, \linesysTitle{}
reports an error identifying the rendered row number, the expected number of
columns, and the number actually found. A trailing row separator creates only
a blank row item and does not trigger this diagnostic.

% -----------------------------------------------------------------------------
\section{The \texttt{linexp} environment}
% -----------------------------------------------------------------------------

The \cmd{linexp} environment typesets one linear expression from one row of
coefficients. Every input column is a coefficient column; there is no
right-hand-side column. The complete syntax is:

\begin{lstlisting}
\begin{linexp}[options]
  coefficient & coefficient & ... & coefficient
\end{linexp}
\end{lstlisting}

If the row contains \(N\) coefficients, exactly \(N\) variables are resolved.
The environment accepts exactly one non-empty row. Blank row items are ignored,
so a trailing \cmd{\\} is harmless, but a second non-empty row produces a
package error.

\begin{linesysexample}{A basic linear expression}
\begin{lstlisting}
\begin{linexp}
    1&2&3
\end{linexp}
\end{lstlisting}
\result
\begingroup
\[
\begin{linexp}
1&2&3
\end{linexp}
\]
\endgroup
\end{linesysexample}

\subsection{Inline form: \texttt{\textbackslash linexpr}}

For short expressions, the command form

\begin{lstlisting}
\linexpr[options]{coefficient & coefficient & ... & coefficient}
\end{lstlisting}

uses the same renderer, options, persistent defaults, wrappers, and diagnostics
as \cmd{linexp}. It may be used directly in ordinary text or inside an existing
math environment. Its coefficient argument obeys the same one-non-empty-row
rule as the environment.

\begin{linesysexample}{An inline linear expression}
\begin{lstlisting}
The expression \linexpr{1&2&-3}
can appear directly in a sentence.
\end{lstlisting}
\result
\begingroup
The expression \linexpr{1&2&-3}
can appear directly in a sentence.
\endgroup
\end{linesysexample}

%Local options work exactly as they do for \cmd{linexp}.
%
%\begin{lstlisting}
%\[
%\linexpr[
%    full=true,
%    scalarops=true,
%    scalaropsymbol=\ast,
%    var=x_i,
%    varindexstart=2
%]{1&2&3}
%\]
%\end{lstlisting}
%
%The environment deliberately omits system-specific options: it has no
%\key{align}, \key{relation}, \key{relations}, \key{pivots}, \key{pivotcols},
%\key{pivotparen}, \key{rhspivots}, \key{delim}, or \key{rowsep}. It does support the shared variable,
%coefficient, scalar-operation, column-spacing, and wrapper features described
%throughout this manual.

% -----------------------------------------------------------------------------
\section{Options at a glance}
% -----------------------------------------------------------------------------

These are the options for the \cmd{linesys} environment (rightmost column lists built-in defaults).

\begin{center}
\small
\begin{tabular}{@{}>{\ttfamily}p{0.22\linewidth}p{0.5\linewidth}p{0.18\linewidth}@{}}
\toprule
Option & Meaning & Default \\
\midrule
align & Alignment of expression terms and the right-hand side & \texttt{r} \\
relation & Uniform relation symbol & \texttt{=} \\
relations & One relation symbol per non-empty row & none \\
var & Variable specification & \texttt{x,y,z,w,t} \\
hidezeros & Hide zero terms & \texttt{true} \\
emptyzeros & Treat empty cells as zero & \texttt{false} \\
full & Show all matrix terms & \texttt{false} \\
pivots & Highlight pivots & \texttt{false} \\
pivotcols & Choose automatic or manual pivot positions & \texttt{auto} \\
pivotparen & Parenthesize negative pivots in full mode & \texttt{true} \\
rhspivots & Highlight eligible RHS pivots & \texttt{true} \\
scalarops & Show an explicit multiplication symbol & \texttt{false} \\
scalaropsymbol & Multiplication symbol & \texttt{\string\cdot} \\
delim & Left/right delimiters & \texttt{.,.} \\
rowsep & Extra vertical row spacing & \texttt{0pt} \\
colsep & Array column spacing & \texttt{\string\arraycolsep} \\
varindex & Placeholder token in indexed templates & \texttt{i} \\
varindexstart & First index in generated indexed variables & \texttt{1} \\
varindexstep & Step between generated indices & \texttt{1} \\
varindexdecrease & Convenience setting for a step of $-1$ & \texttt{false} \\
varmode & Variable-specification interpretation & \texttt{auto} \\
wrap & Component formatting rules & none \\
\bottomrule
\end{tabular}
\end{center}

The \cmd{linexp} environment accepts the following subset, with independent
persistent defaults:

\begin{center}
\small
\begin{tabular}{@{}>{\ttfamily}p{0.22\linewidth}p{0.45\linewidth}p{0.18\linewidth}@{}}
\toprule
Option & Meaning & Default \\
\midrule
var & Variable specification & \texttt{x,y,z,w,t} \\
hidezeros & Hide zero terms & \texttt{true} \\
emptyzeros & Treat empty coefficients as zero & \texttt{false} \\
full & Show all coefficients explicitly & \texttt{false} \\
scalarops & Show an explicit multiplication symbol & \texttt{false} \\
scalaropsymbol & Multiplication symbol & \texttt{\string\cdot} \\
colsep & Array column spacing & \texttt{\string\arraycolsep} \\
varindex & Placeholder token in indexed templates & \texttt{i} \\
varindexstart & First index in generated indexed variables & \texttt{1} \\
varindexstep & Step between generated indices & \texttt{1} \\
varindexdecrease & Convenience setting for a step of $-1$ & \texttt{false} \\
varmode & Variable-specification interpretation & \texttt{auto} \\
wrap & Component formatting rules & none \\
\bottomrule
\end{tabular}
\end{center}

Boolean options accept the usual \texttt{true} and \texttt{false} values.
For example, \texttt{full=true} is valid, as is\linebreak
\texttt{hidezeros=false}.

% -----------------------------------------------------------------------------
\section{Alignment: \texttt{align}}
% -----------------------------------------------------------------------------

\key{align} controls the alignment of the main mathematical-content columns:
the coefficient/variable terms and the right-hand side. The package's internal
operation-sign and relation columns remain centered. The option accepts exactly
three values: \val{l} (left), \val{c} (center), and \val{r} (right). The default is \val{r}.

\begin{linesysexample}{Right alignment (default)}
\begin{lstlisting}
\begin{linesys}[align=r]
    1&2&36\\
    12&-4&5\\
    0&7&-2
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[align=r]
1&2&36\\
12&-4&5\\
0&7&-2
\end{linesys}
\]
\endgroup
\end{linesysexample}

\begin{linesysexample}{Centered and left alignment}
\begin{lstlisting}
\begin{linesys}[align=c]
    1&2&36\\
    12&-4&5
\end{linesys}

\begin{linesys}[align=l]
    1&2&36\\
    12&-4&5
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[align=c]
1&2&36\\
12&-4&5
\end{linesys}
\]
\vspace{0.8cm}
\[
\begin{linesys}[align=l]
1&2&36\\
12&-4&5
\end{linesys}
\]
\endgroup
\end{linesysexample}

% -----------------------------------------------------------------------------
\section{Relation symbols: \texttt{relation} and \texttt{relations}}
% -----------------------------------------------------------------------------

By default, every row of a \cmd{linesys} environment uses the equality symbol
\(=\). The \key{relation} option replaces that symbol uniformly, making the
same matrix-like input suitable for systems of inequalities or other linear
relations.

\begin{linesysexample}{A system of linear inequalities}
\begin{lstlisting}
\begin{linesys}[relation=\le]
    1&2&5\\
    -1&3&4
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[relation=\le]
1&2&5\\
-1&3&4
\end{linesys}
\]
\endgroup
\end{linesysexample}

The relation value is math material rather than a restricted choice. Commands
such as \cmd{\le}, \cmd{\ge}, \cmd{\neq}, or another suitable relation symbol
may therefore be supplied directly. The built-in default is
\key{relation=\{=\}}.

For mixed systems, \key{relations} accepts a comma-separated list containing
exactly one relation symbol for each rendered non-empty row. Blank row items
and a trailing \cmd{\\} do not consume list entries.

\begin{linesysexample}{Different relations by row}
\begin{lstlisting}
\begin{linesys}[
    relations={=,\le,\ge}
    ]
    1&2&3\\
    4&-1&5\\
    0&2&6
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[relations={=,\le,\ge}]
1&2&3\\
4&-1&5\\
0&2&6
\end{linesys}
\]
\endgroup
\end{linesysexample}

The two options use ordinary left-to-right key semantics. Processing
\key{relations=\{...\}} activates per-row relation mode; processing a later
\key{relation=...} clears that list and restores one uniform symbol. Thus

\begin{lstlisting}
relations={\le,=}, relation=\neq
\end{lstlisting}

uses \(\neq\) on every row, while

\begin{lstlisting}
relation=\le, relations={=,\ge}
\end{lstlisting}

uses the two symbols from the later per-row list. Both options are supported by the persistent-defaults mechanism described in
Section~\ref{sec:persistent-defaults}. When a stored per-row list is active,
its length must match the number of non-empty rows in each system that inherits
it. A local \key{relation=...} is a convenient way to return such a system to
uniform-relation mode.

Relation symbols are generated output rather than matrix entries. They are not
matched by an \key{entries} wrapper; instead, use the dedicated
\key{relations} wrapper target described in the wrapper section.

% -----------------------------------------------------------------------------
\section{Variables}
% -----------------------------------------------------------------------------

The variable options in this section are shared by \cmd{linesys} and \cmd{linexp}. The \key{var} option determines the variable sequence. In the default \key{varmode=auto}, a specification may be

\begin{enumerate}
\item an explicit comma-separated list;
\item \val{roman} for \(a,b,c,\ldots\);
\item \val{Roman} for \(A,B,C,\ldots\);
\item \val{greek} for the supported lowercase Greek sequence;
\item an indexed token template containing the placeholder selected by \key{varindex}.
\end{enumerate}

The \key{varmode} option can also force a specification to be interpreted as an explicit list or as an indexed template when automatic interpretation would be ambiguous.

\subsection{Explicit variable lists}

Variables are taken from the given list, in the order they were provided.

\begin{linesysexample}{Explicit variables}	
\begin{lstlisting}
\begin{linesys}[var={u,v}]
    2&3&7\\
    -1&4&2
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[var={u,v}]
2&3&7\\
-1&4&2
\end{linesys}
\]
\endgroup
\end{linesysexample}

\begin{linesysexample}{List can have more variables than needed}	
\begin{lstlisting}
\begin{linesys}[var={u,v,w,s}]
    1&2&3\\
    4&5&6
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[var={u,v,w,s}]
	1&2&3\\
	4&5&6
\end{linesys}
\]
\endgroup
\end{linesysexample}

Here only \(u\) and \(v\) are needed; \(w\) and \(s\) remain unused. Supplying fewer variables than needed results in an error. The built-in default
\key{var=\{x,y,z,w,t\}} is an explicit five-item list, not an open-ended
generator; systems requiring more than five variables therefore need another
\key{var} specification.

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

\begin{linesysexample}{Automatic \(a,b,c,\ldots\)}
\begin{lstlisting}
\begin{linesys}[var=roman]
    1&2&3&4&5\\
    0&1&-1&2&3
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[var=roman]
1&2&3&4&5\\
0&1&-1&2&3
\end{linesys}
\]
\endgroup
\end{linesysexample}

The generator provides as many variables as required, up to at most 26 variables.

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

\begin{linesysexample}{Automatic \(A,B,C,\ldots\)}
\begin{lstlisting}
\begin{linesys}[var=Roman]
    1&2&3&4\\
    0&-1&2&5
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[var=Roman]
1&2&3&4\\
0&-1&2&5
\end{linesys}
\]
\endgroup
\end{linesysexample}

The uppercase generator also provides at most 26 variables.

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

The lowercase Greek generator uses this order:
\[
\alpha,\beta,\gamma,\delta,\epsilon,\zeta,\eta,\theta,\iota,\kappa,
\lambda,\mu,\nu,\xi,\pi,\rho,\sigma,\tau,\upsilon,\phi,\chi,\psi,\omega.
\]
It provides at most 23 variables.

\begin{linesysexample}{Automatic Greek variables}
\begin{lstlisting}
\begin{linesys}[var=greek]
    1&2&3&4\\
    0&-1&2&5
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[var=greek]
1&2&3&4\\
0&-1&2&5
\end{linesys}
\]
\endgroup
\end{linesysexample}

\subsection{Indexed variables: templates, starting values, and steps}

Indexed variables are generated from a token template that includes a placeholder for the index. The token selected by
\key{varindex} acts as the index placeholder; its default is \val{i}. In the default
\key{varmode=auto}, a single specification containing that token is normally
recognized as an indexed template, and every occurrence of the placeholder is
replaced by the corresponding braced integer.

Thus the familiar form \texttt{x\_i} produces
\(x_1,x_2,x_3,\ldots\):

\begin{linesysexample}{Default indexed variables}
\begin{lstlisting}
\begin{linesys}[var=x_i]
    1&2&3&4\\
    0&-1&2&5
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[var=x_i]
1&2&3&4\\
0&-1&2&5
\end{linesys}
\]
\endgroup
\end{linesysexample}

The index placeholder need not occur immediately after an underscore. It
may appear anywhere in the template, including inside grouped subscripts,
superscripts, or more elaborate constructions.

\begin{linesysexample}{General indexed templates}
\begin{lstlisting}
\begin{linesys}[var=x_{2,i}]
    1&2&3&4\\
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[var=x_{2,i}]
1&2&3&4\\
\end{linesys}
\]
\endgroup
\end{linesysexample}

As another example, \texttt{var=x\string^{(i)}} generates
\(x^{(1)},x^{(2)},x^{(3)},\ldots\). Repeated occurrences of the index placeholder are all replaced, thus \cmd{var={\frac{(x-x_0)^{i}}{i!}}} produces
\[
\frac{(x-x_0)^1}{1!},\quad
\frac{(x-x_0)^2}{2!},\quad
\frac{(x-x_0)^3}{3!},\ldots
\]
when the default start and step are used.

To use another placeholder token, set \key{varindex}. For example:

\begin{linesysexample}{Changing the index token}
\begin{lstlisting}
\begin{linesys}[
    var=\alpha_j,
    varindex=j
    ]
    1&2&3&4\\
    0&-1&2&5
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[var=\alpha_j,varindex=j]
1&2&3&4\\
0&-1&2&5
\end{linesys}
\]
\endgroup
\end{linesysexample}

\subsubsection{Index progression: \texttt{varindexstart}, \texttt{varindexstep}, and \texttt{varindexdecrease}}

The first generated index is \key{varindexstart}; its default is \val{1}.
Successive indices differ by \key{varindexstep}, whose default is also
\val{1}. For the variable in position \(n\), the generated index is
\[
\texttt{varindexstart}+(n-1)\,\texttt{varindexstep}.
\]
The step may be positive, zero, or negative.

\begin{linesysexample}{A custom index step}
\begin{lstlisting}
\begin{linexp}[
    var=x_i,
    varindexstart=10,
    varindexstep=-2
    ]
    3&4&5
\end{linexp}
\end{lstlisting}
\result
\begingroup
\[
\begin{linexp}[var=x_i,varindexstart=10,varindexstep=-2]
3&4&5
\end{linexp}
\]
\endgroup
\end{linesysexample}

\key{varindexdecrease} is a boolean convenience setting for the common
unit-step cases: \val{true} sets the step to \(-1\), while \val{false} sets
it to \(1\). Omitting the value is equivalent to \val{true}. These settings
are processed sequentially, so a later \key{varindexstep} or
\key{varindexdecrease} setting determines the final step.

Generated indices are ordinary integers, so negative values require no special
syntax.

\subsubsection{Choosing the interpretation: \texttt{varmode}}

The default \key{varmode=auto} uses the following interpretation order:

\begin{enumerate}
\item the exact values \val{roman}, \val{Roman}, and \val{greek} select their named generators;
\item a specification with more than one top-level comma-separated item is an explicit variable list;
\item a single specification exactly equal to the \key{varindex} placeholder is an explicit one-variable list;
\item otherwise, if the placeholder occurs anywhere in the specification, it is an indexed template;
\item otherwise the specification is treated as an explicit one-variable list.
\end{enumerate}

TeX grouping therefore distinguishes an explicit list such as
\texttt{var=\{i,j,k\}} from a one-item template such as
\texttt{var=x\_\{2,i\}}: the commas in the latter are inside the grouped
subscript and do not split the top-level variable list.

\begin{linesysexample}{An explicit list containing the default placeholder}
\begin{lstlisting}
\begin{linesys}[var={i,j,k}]
    1&2&3&4\\
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[var={i,j,k}]
1&2&3&4\\
\end{linesys}
\]
\endgroup
\end{linesysexample}

For genuinely ambiguous cases, \key{varmode=list} and
\key{varmode=indexed} bypass automatic inference and force the desired
interpretation. In forced indexed mode, the specification must contain the
configured \key{varindex} placeholder.

\begin{linesysexample}{Forcing list and indexed interpretations}
\begin{lstlisting}
\begin{linexp}[var=i^2,varmode=list]
    3
\end{linexp}

\begin{linexp}[
    var={(x_i,y_i)},
    varmode=indexed
    ]
    1&2&3
\end{linexp}
\end{lstlisting}
\result
\begingroup
\[
\begin{linexp}[var=i^2,varmode=list]
3
\end{linexp}
\]
\[
\begin{linexp}[var={(x_i,y_i)},varmode=indexed]
1&2&3
\end{linexp}
\]
\endgroup
\end{linesysexample}

\begin{noteBox}
\key{varindex} selects a TeX token, not a character substring. A control
sequence such as \cmd{\sin} is therefore not affected merely because its
name contains the letter \texttt{i}. Literal occurrences of the configured
placeholder token elsewhere in an indexed template are replaced; choose a
different \key{varindex} token when such occurrences are meant to remain
literal.
\end{noteBox}

% -----------------------------------------------------------------------------
\section{Lexical coefficient classification}
% -----------------------------------------------------------------------------

Both environments classify coefficients lexically before deciding whether a
term is zero, whether its magnitude is a unit coefficient, and whether it has
a leading sign. Classification is performed on a temporary copy; the original
coefficient tokens remain the source of the rendered mathematics.

For classification, the package can look through ordinary outer grouping and
selected transparent formatting forms, including \cmd{\color} declarations and
\cmd{\textcolor}. Thus harmless formatting does not by itself change whether a
coefficient counts as zero, a unit, or a leading-negative coefficient. User-defined one-argument formatting commands can
be added to this transparent set with \cmd{\linesysdeclaretransparentwrapper},
described below.

A single explicit leading sign is normalized for classification. Consequently,
\texttt{0}, \texttt{+0}, and \texttt{-0} all classify as zero, while
\texttt{1}, \texttt{+1}, and \texttt{-1} all have unit magnitude. A redundant
leading \texttt{+} is removed in the rendered coefficient; a leading
\texttt{-} continues to follow the ordinary sign and full-mode rules.

\begin{linesysexample}{Formatting does not change zero classification}
\begin{lstlisting}
\begin{linesys}[pivots=true]
    \textcolor{red}{0}&{+0}&2&3
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[pivots=true]
\textcolor{red}{0}&{+0}&2&3
\end{linesys}
\]
\endgroup
\end{linesysexample}

The boundary remains deliberately lexical rather than algebraic. An expression
such as \texttt{1-1} is not simplified to zero, and arbitrary macros are not
expanded in an attempt to discover their mathematical value.

\subsection{Declaring custom transparent wrappers}

When a document uses its own simple formatting command around coefficients, the
command can be declared transparent to the lexical classifier:

\begin{lstlisting}
\newcommand*{\Tint}[1]{\textcolor{violet}{#1}}
\linesysdeclaretransparentwrapper{\Tint}
\end{lstlisting}

The declaration argument must be exactly one control sequence. Once registered,
the lexical source form \texttt{\string\Tint\{content\}} is treated like the
package's built-in transparent forms for zero, unit-magnitude, and leading-sign
classification. The original wrapper is retained when visible coefficient
content is rendered; the declaration changes classification, not presentation.
The same declaration applies to \cmd{linesys}, \cmd{linexp}, and \cmd{\linexpr}
because all three use the same coefficient classifier.

\begin{linesysexample}{A user-declared transparent wrapper}
\begin{lstlisting}
\newcommand*{\Tint}[1]{%
    \textcolor{violet}{#1}}
\begingroup
\linesysdeclaretransparentwrapper{\Tint}
\begin{linesys}[pivots=true]
    \Tint{0}&\Tint{-1}&2
\end{linesys}
\endgroup
\end{lstlisting}
\result
\begingroup
\newcommand*{\Tint}[1]{\textcolor{violet}{#1}}
\linesysdeclaretransparentwrapper{\Tint}
\[
\begin{linesys}[pivots=true]
\Tint{0}&\Tint{-1}&2
\end{linesys}
\]
\endgroup
\end{linesysexample}

Declarations obey ordinary TeX grouping and duplicate declarations are
harmless. This makes local classifier extensions straightforward:

\begin{lstlisting}
\begingroup
  \linesysdeclaretransparentwrapper{\Tint}
  % \Tint{...} is transparent here.
\endgroup
% \Tint{...} is opaque again here.
\end{lstlisting}

The registered source shape is intentionally narrow. A declaration recognizes
only \texttt{\string\foo\{content\}}: an invocation such as
\texttt{\string\foo[option]\{content\}} or
\texttt{\string\foo\{content\}\{extra\}} remains opaque. Registered wrappers
may be nested; classification peels them recursively while preserving the
nested wrappers in visible output.

\begin{noteBox}
Declare only commands that are genuinely transparent to the mathematical value
of their argument. The command tells \linesysTitle{} that it may classify the
wrapped content as though the outer command were not present; it does not cause
arbitrary macro expansion or algebraic simplification. Built-in handling of
\cmd{\color} and \cmd{\textcolor} remains available
independently of this declaration API.
\end{noteBox}

% -----------------------------------------------------------------------------
\section{Zero terms and empty cells}
% -----------------------------------------------------------------------------

Both environments support the same \key{hidezeros} and \key{emptyzeros}
settings.

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

With the default \key{hidezeros=true}, coefficients classified as zero are
omitted. This includes transparent/grouped forms of literal zero and the signed
forms \texttt{+0} and \texttt{-0}. In \cmd{linesys}, a row with all zero
coefficients and constant \(k\) is handled specially and prints \(0=k\). In
\cmd{linexp}, an all-zero coefficient row prints the lone expression \(0\).

\begin{linesysexample}{Hidden zeros (default)}
\begin{lstlisting}
\begin{linesys}
    1&0&-2&5\\
    0&3&0&-1\\
    0&0&0&6\\
    0&0&0&0    
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}
1&0&-2&5\\
0&3&0&-1\\
0&0&0&6\\
0&0&0&0  
\end{linesys}
\]
\endgroup
\end{linesysexample}

\begin{linesysexample}{An all-zero linear expression}
\begin{lstlisting}
\begin{linexp}
    0&0&0
\end{linexp}
\end{lstlisting}
\result
\begingroup
\[
\begin{linexp}
0&0&0
\end{linexp}
\]
\endgroup
\end{linesysexample}

Set \key{hidezeros=false} to retain zero terms:

\begin{linesysexample}{Visible zeros}
\begin{lstlisting}
\begin{linesys}[hidezeros=false]
    1&0&-2&5\\
    0&3&0&-1\\
    0&0&0&6\\
    0&0&0&0  
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[hidezeros=false]
1&0&-2&5\\
0&3&0&-1\\
0&0&0&6\\
0&0&0&0  
\end{linesys}
\]
\endgroup
\end{linesysexample}

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

An empty coefficient gives an error by default; in \cmd{linesys}, the same is true of an empty constant. Use
\key{emptyzeros=true} when an empty cell should be interpreted as zero.

\begin{linesysexample}{Empty cells interpreted as zero}
\begin{lstlisting}
\begin{linesys}[emptyzeros=true]
    1&&4\\
    &2&5
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[emptyzeros=true]
1&&4\\
&2&5
\end{linesys}
\]
\endgroup
\end{linesysexample}

This option changes the interpretation of empty cells; it does not by itself
make zero terms visible. Combine it with \key{hidezeros=false} when desired.

% -----------------------------------------------------------------------------
\section{Pivot highlighting}
% -----------------------------------------------------------------------------

Pivot highlighting is disabled by default. Enable the built-in circular
highlighter with \key{pivots=true}.

\begin{linesysexample}{Built-in pivot highlighting}
\begin{lstlisting}
\begin{linesys}[pivots=true]
    2&1&0&4\\
    0&-3&2&5\\
    0&0&7&-1
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[pivots=true]
	2&1&0&4\\
	0&-3&2&5\\
	0&0&7&-1
\end{linesys}
\]
\endgroup
\end{linesysexample}

The built-in highlighter is a genuine circle produced with TikZ. With the
default \key{pivotcols=auto}, pivot logic is row-wise: the first coefficient
that does not classify as zero is the variable pivot. Transparent/grouped zeros
and signed zeros therefore do not become pivots. If no variable-column pivot
occurs, a RHS entry that does not classify as zero is eligible as the row's RHS
pivot. The \key{rhspivots} option controls whether such automatically detected
RHS pivots are highlighted.

\subsection{Manual pivot selection: \texttt{pivotcols}}

The \key{pivotcols} option separates pivot \emph{selection} from pivot
\emph{highlighting}. Its default value, \val{auto}, uses the automatic rule
described above. A comma-separated selector list instead chooses one pivot
state for each rendered non-empty row.

Each selector may be:
\begin{itemize}
\item a positive variable-column number, such as \val{1} or \val{3};
\item \val{rhs}, selecting the right-hand side;
\item \val{none}, selecting no pivot in that row.
\end{itemize}

The list must contain exactly one selector for each non-empty row. Row numbering
uses the same rendered-row convention as wrapper row filters, so blank row
items and a trailing \cmd{\\} do not consume selectors.

\begin{linesysexample}{Manual pivot positions}
\begin{lstlisting}
\begin{linesys}[
    pivots=true,
    pivotcols={2,1,rhs}
    ]
    3&-2&7\\
    4&5&8\\
    0&0&9
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[pivots=true,pivotcols={2,1,rhs}]
3&-2&7\\
4&5&8\\
0&0&9
\end{linesys}
\]
\endgroup
\end{linesysexample}

Manual selection is explicit rather than inferential. A selected coefficient or
RHS entry remains the row's pivot even when it classifies as zero. Such a zero
is therefore retained when it must be rendered as the selected pivot. Likewise,
\val{none} suppresses pivot status for that row even if nonzero entries are
present.

\begin{linesysexample}{Manual zero, no pivot, and RHS pivot}
\begin{lstlisting}
\begin{linesys}[
    pivots=true,
    rhspivots=false,
    pivotcols={2,none,rhs}
    ]
    3&0&4\\
    5&6&7\\
    0&0&0
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[pivots=true,rhspivots=false,pivotcols={2,none,rhs}]
3&0&4\\
5&6&7\\
0&0&0
\end{linesys}
\]
\endgroup
\end{linesysexample}

The \key{pivots} option still controls only whether and how the selected pivot
is highlighted. Manual pivot status therefore remains meaningful with
\key{pivots=false}; for example, it still interacts with \key{pivotparen} in
full mode. Similarly, \key{rhspivots} governs automatic RHS-pivot highlighting
only: an explicit \val{rhs} selector is not vetoed by
\key{rhspivots=false}.

Use \key{pivotcols=auto} to restore automatic first-nonzero/RHS detection,
including when a surrounding persistent default supplies a manual pivot map.

\subsection{RHS-pivot highlighting}

The \key{rhspivots} option controls only whether an eligible RHS pivot is
highlighted; it does not change variable-column pivot detection. Its default is
\val{true}.

\begin{linesysexample}{RHS pivot enabled}
\begin{lstlisting}
\begin{linesys}[
    pivots=true,
    rhspivots=true
    ]
    0&0&5\\
    1&0&2
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[pivots=true,rhspivots=true]
	0&0&5\\
	1&0&2
\end{linesys}
\]
\endgroup
\end{linesysexample}

\begin{linesysexample}{RHS pivot disabled}
\begin{lstlisting}
\begin{linesys}[
    pivots=true,
    rhspivots=false
    ]
    0&0&5\\
    1&0&2
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[pivots=true,rhspivots=false]
	0&0&5\\
	1&0&2
\end{linesys}
\]
\endgroup
\end{linesysexample}

\subsection{Custom pivot highlighters}

Instead of \val{true}, the \key{pivots} option accepts a command. That command
receives the pivot as its single mandatory argument.

For example:

\begin{lstlisting}
\newcommand*{\myPivot}[1]{\fbox{\ensuremath{#1}}}

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

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

A custom highlighter is treated as user code and is applied with precedence
over coefficient/entry wrappers in the pivot case (more on wrappers below). This makes constructions
such as a custom color highlighter useful even when a coefficient wrapper
also supplies a different color.

% -----------------------------------------------------------------------------
\section{Full mode: \texttt{full}}
% -----------------------------------------------------------------------------

\key{full=true} is available in both environments and requests a fully explicit coefficient representation. It implies the visible-zero behavior and changes coefficient/sign formatting:

\begin{itemize}
\item zero coefficients remain visible;
\item coefficients \(1\) and \(-1\) are not hidden;
\item coefficient signs are not split into a separate operation sign and
      magnitude;
\item generated plus signs are retained as explicit term separators, while
      a redundant leading \texttt{+} supplied as part of a coefficient is
      normalized away;
\item a coefficient classified as leading-negative is parenthesized;
      \cmd{linesys} can alter this only for pivot coefficients through
      \key{pivotparen}, described below.
\end{itemize}

\begin{linesysexample}{Full mode}
\begin{lstlisting}
\begin{linesys}[full=true]
    1&-2&3\\
    0&-1&4
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[full=true]
1&-2&3\\
0&-1&4
\end{linesys}
\]
\endgroup
\end{linesysexample}

\subsection{Leading-negative coefficients}

The negative test uses the same lexical classifier described earlier. The
package can look through its supported transparent formatting forms, but it
does not algebraically simplify an expression. Consequently, expressions such
as \texttt{-1+\textbackslash sqrt\{2\}} and
\texttt{-\textbackslash sqrt\{3\}} are treated as leading-negative
coefficients. An explicit leading \texttt{+}, including one inside transparent
formatting, is normalized away rather than printed as part of the coefficient.

\begin{linesysexample}{Parenthesized negative coefficients in full mode}
\begin{lstlisting}
\begin{linesys}[full=true]
    -2&-1+\sqrt{2}&3\\
    -\sqrt{3}&4&5
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[full=true]
-2&-1+\sqrt{2}&3\\
-\sqrt{3}&4&5
\end{linesys}
\]
\endgroup
\end{linesysexample}

\subsection{Full mode and pivot parentheses: \texttt{pivotparen}}

The boolean option \key{pivotparen} controls whether a leading-negative
\emph{pivot coefficient} receives the usual full-mode parentheses. Its default
is \val{true}. The option is relevant only when \key{full=true}; outside full
mode it has no effect.

With the default setting, a negative pivot is parenthesized just like any other
negative coefficient:

\begin{linesysexample}{Default pivot parentheses in full mode}
\begin{lstlisting}
\begin{linesys}[full=true]
    -1&2&3
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[full=true]
-1&2&3
\end{linesys}
\]
\endgroup
\end{linesysexample}

Literal \key{pivots=true} selects the built-in circular highlighter and, when
that key is processed, also sets \key{pivotparen=false}. This preserves the
compact built-in rendering in which the circle itself visually separates a
negative pivot from the surrounding row. Other negative coefficients
remain parenthesized.

\begin{linesysexample}{Full mode with built-in pivot highlighting}
\begin{lstlisting}
\begin{linesys}[full=true,pivots=true]
    -2&-3&4\\
    0&-4&5
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[full=true,pivots=true]
-2&-3&4\\
0&-4&5
\end{linesys}
\]
\endgroup
\end{linesysexample}

Option order is significant when \key{pivots=true} and \key{pivotparen} are
both supplied. A later explicit value overrides the earlier one:

\begin{linesysexample}{Circle around (-1)}
\begin{lstlisting}
\begin{linesys}[
    full=true,
    pivots=true,
    pivotparen=true
    ]
    -1&2&3
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[full=true,pivots=true,pivotparen=true]
	-1&2&3
\end{linesys}
\]
\endgroup
\end{linesysexample}

\begin{linesysexample}{Circle around -1}
\begin{lstlisting}
\begin{linesys}[
    full=true,
    pivotparen=true,
    pivots=true	
    ]
    -1&2&3
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[full=true,pivotparen=true,pivots=true]
	-1&2&3
\end{linesys}
\]
\endgroup
\end{linesysexample}

A custom pivot highlighter does not change \key{pivotparen}; it uses the current
state. This is useful for highlighters such as framed boxes, where parentheses
may or may not be desirable.

\begin{linesysexample}{Custom highlighter with pivot parentheses disabled}
\begin{lstlisting}
\newcommand*{\myPivot}[1]{\fbox{\ensuremath{#1}}}
\begin{linesys}[
    full=true,
    pivots=\myPivot,
    pivotparen=false
    ]
    -1&2&3
\end{linesys}
\end{lstlisting}
\result
\begingroup
\newcommand*{\myPivotParManual}[1]{\fbox{\ensuremath{#1}}}
\[
\begin{linesys}[full=true,pivots=\myPivotParManual,pivotparen=false]
-1&2&3
\end{linesys}
\]
\endgroup
\end{linesysexample}

The option is independent of highlighting. Thus
\key{full=true,pivots=false,pivotparen=false} leaves a leading-negative row
pivot unparenthesized even though no pivot marker is drawn. Non-pivot negative
coefficients keep their ordinary full-mode parentheses.

The \cmd{linexp} environment has no pivot concept and therefore no
\key{pivotparen} option. In its full mode, every lexically leading-negative
coefficient follows the ordinary parenthesizing rule.

\begin{linesysexample}{Full mode in a linear expression}
\begin{lstlisting}
\begin{linexp}[full=true]
    -1&-2&3
\end{linexp}
\end{lstlisting}
\result
\begingroup
\[
\begin{linexp}[full=true]
-1&-2&3
\end{linexp}
\]
\endgroup
\end{linesysexample}

% -----------------------------------------------------------------------------
\section{Coefficient formatting and scalar multiplication}
% -----------------------------------------------------------------------------

In both environments, unit coefficients are suppressed in the ordinary (non-full)
representation. Unit magnitude is determined by the shared lexical classifier,
so transparent/grouped forms of \texttt{1}, \texttt{+1}, and \texttt{-1}
behave consistently. Thus \(-1\,y\) is printed as \(-y\), while a coefficient
such as \(2\) remains visible.

A leading \texttt{+} is treated as unary coefficient syntax rather than as
part of the coefficient's printed content. Transparent formatting is preserved
around the remaining magnitude.

\begin{linesysexample}{Transparent signs and unit coefficients}
\begin{lstlisting}
\begin{linexp}[scalarops=true]
    \textcolor{red}{+1}&{\color{blue}-1}&+2
\end{linexp}
\end{lstlisting}
\result
\begingroup
\[
\begin{linexp}[scalarops=true]
\textcolor{red}{+1}&{\color{blue}-1}&+2
\end{linexp}
\]
\endgroup
\end{linesysexample}

\key{scalarops=true} changes the ordinary presentation by inserting an explicit
multiplication symbol between a coefficient and its variable. The default
symbol is \(\cdot\) (made with \cmd{\cdot}).

\begin{linesysexample}{Explicit scalar multiplication}
\begin{lstlisting}
\begin{linesys}[scalarops=true]
    2&-3&4\\
    -1&1&5
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[scalarops=true]
2&-3&4\\
-1&1&5
\end{linesys}
\]
\endgroup
\end{linesysexample}

With \key{scalarops=true}, unit magnitudes are not hidden. You can replace
\(\cdot\) using \key{scalaropsymbol}.

\begin{linesysexample}{Custom multiplication symbol}
\begin{lstlisting}
\begin{linesys}[
    scalarops=true,
    scalaropsymbol=\ast
    ]
    2&-3&4\\
    -1&1&5
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[scalarops=true,
  scalaropsymbol=\ast]
2&-3&4\\
-1&1&5
\end{linesys}
\]
\endgroup
\end{linesysexample}

In full mode, the explicit full-mode coefficient presentation takes
precedence over the ordinary hiding rules; \key{scalarops} can still insert
its multiplication symbol.

% -----------------------------------------------------------------------------
\section{Delimiters: \texttt{delim}}
% -----------------------------------------------------------------------------

The \key{delim} option belongs to \cmd{linesys}; \cmd{linexp} does not add surrounding delimiters. \key{delim} takes a comma-separated pair:

\begin{lstlisting}
delim={left,right}
\end{lstlisting}

A dot \val{.} means ``no visible delimiter'' on that side. The default is
\val{.,.} (no delimiter on either side).

\begin{linesysexample}{Curly braces on left only}
\begin{lstlisting}
\begin{linesys}[delim={\{,.}]
    1&2&3\\
    4&5&6
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[delim={\{,.}]
1&2&3\\
4&5&6
\end{linesys}
\]
\endgroup
\end{linesysexample}

\begin{linesysexample}{Brackets and a right floor}
\begin{lstlisting}
\begin{linesys}[delim={[,\rfloor}]
    1&2&3\\
    4&5&6
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[delim={[,\rfloor}]
1&2&3\\
4&5&6
\end{linesys}
\]
\endgroup
\end{linesysexample}

The delimiters are applied with LaTeX's \cmd{left} and \cmd{right}, so they
scale with the height of the system.

% -----------------------------------------------------------------------------
\section{Spacing: \texttt{rowsep} and \texttt{colsep}}
% -----------------------------------------------------------------------------

\key{rowsep} is a \cmd{linesys}-only option. It adds vertical space after each rendered row and is a dimension.

\begin{linesysexample}{Extra row spacing}
\begin{lstlisting}
\begin{linesys}[rowsep=8pt]
    1&2&3\\
    4&5&6\\
    7&8&9
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[rowsep=8pt]
1&2&3\\
4&5&6\\
7&8&9
\end{linesys}
\]
\endgroup
\end{linesysexample}

\key{colsep} is shared by both environments and changes the local \cmd{arraycolsep} used by the rendered array. Each environment stores its own default, initially taken from \cmd{arraycolsep}.

\begin{linesysexample}{Tighter columns}
\begin{lstlisting}
\begin{linesys}[colsep=1pt]
    1&22&333\\
    4&55&666
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[colsep=1pt]
1&22&333\\
4&55&666
\end{linesys}
\]
\endgroup
\end{linesysexample}

The spacing changes are local to the current \cmd{linesys} or \cmd{linexp} array.

% -----------------------------------------------------------------------------
\section{Wrappers}
% -----------------------------------------------------------------------------

The wrapper facility is the most flexible formatting feature in \linesysTitle. Both environments use the same public wrapper grammar and nesting model, while exposing targets and filters appropriate to their output. It lets you apply arbitrary LaTeX commands to selected rendered components.

The public grammar is:

\begin{lstlisting}
wrap={TARGETS}[FILTERS]{WRAPPERS}
\end{lstlisting}

For example:

\begin{lstlisting}
wrap={coefficients}{\color{blue}}
wrap={variables}[columns=2]{\mathbf}
wrap={entries}[rows=1,columns=2]{\fbox}
\end{lstlisting}

\subsection{Targets}

For \cmd{linesys}, there are five targets:

\begin{description}[style=nextline,leftmargin=3cm]
\item[\key{entries}] matrix entries: coefficients and constants.
\item[\key{coefficients}] coefficient components only.
\item[\key{constants}] right-hand-side constants only.
\item[\key{variables}] variable symbols only.
\item[\key{relations}] generated relation symbols only.
\end{description}

The special target \key{entries} matches both coefficient and constant
components, but not variables or relation symbols. In \cmd{linexp}, the only valid targets are
\key{coefficients} and \key{variables}.

\begin{linesysexample}{Formatting all coefficients}
\begin{lstlisting}
\begin{linesys}[
    wrap={coefficients}{\color{blue}}
    ]
    2&-3&4\\
    5&1&6
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[
  wrap={coefficients}{\color{blue}}]
2&-3&4\\
5&1&6
\end{linesys}
\]
\endgroup
\end{linesysexample}

\begin{linesysexample}{Formatting variables and constants}
\begin{lstlisting}
\begin{linesys}[
    wrap={variables}{\mathbf},
    wrap={constants}{\color{blue}}
    ]
    2&-3&4\\
    5&1&6
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[
  wrap={variables}{\mathbf},
  wrap={constants}{\color{blue}}]
2&-3&4\\
5&1&6
\end{linesys}
\]
\endgroup
\end{linesysexample}

\begin{linesysexample}{Formatting relation symbols}
\begin{lstlisting}
\begin{linesys}[
    relations={=,\le,\neq},
    wrap={relations}{\color{blue}}
    ]
    1&2&3\\
    4&5&6\\
    7&8&9
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[
  relations={=,\le,\neq},
  wrap={relations}{\color{blue}}]
1&2&3\\
4&5&6\\
7&8&9
\end{linesys}
\]
\endgroup
\end{linesysexample}

The \key{relations} target is row-level output. Row filters therefore select
relation symbols naturally, while a column filter has no coordinate meaning;
if supplied, it is ignored with a package warning.

\subsection{Row and column filters}

Filters are optional. In \cmd{linesys}, the canonical filter names are
\key{rows} and \key{columns}; singular aliases \key{row} and \key{column}
are also accepted. Selectors are positive integer lists. In \cmd{linexp}, only
\key{columns} (or the singular alias \key{column}) is valid; a row filter is
an error because a linear expression contains only one mathematical row.

Each \key{wrap} declaration has its own filter state: omitting a supported
selector means ``all'' for that declaration, and selectors from another wrapper
declaration are not inherited.

\begin{lstlisting}
wrap={coefficients}[rows={1,3}]{\color{red}}
wrap={variables}[columns=2]{\mathbf}
wrap={entries}[rows=1,columns=2]{\fbox}
\end{lstlisting}

A row selector is based on the rendered, non-empty row number. A column
selector refers to matrix columns for \key{entries} and \key{coefficients},
and to variable columns for \key{variables}. Constants and relations are
row-level special cases: a column selector supplied with either
\key{constants} or \key{relations} is ignored and a package warning is issued.

%\subsubsection{Selecting rows and columns}

Selectors combine with \textbf{AND}: a rule with both a row and column
selector applies only where both conditions match. Here's an example:

\begin{lstlisting}
\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}
\end{lstlisting}

\[
\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}
\]

Only the first and third coefficients in the second row are being colored red.

For \cmd{linexp}, column selectors refer directly to coefficient/variable
positions in the expression:

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

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

\subsection{Multiple targets}

The target list is comma-separated. One declaration can therefore affect
several component types:

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

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

\subsection{Multiple wrappers and order}

The wrapper list is also comma-separated. Wrappers are applied in declaration
order by nesting each later matching wrapper around the result of the earlier
one. Consequently, the visible precedence of stateful declarations such as
\cmd{\color}follows normal TeX grouping rules rather than a simple ``last
wrapper wins'' rule.

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

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

Multiple wrapper declarations are likewise retained in declaration order.
This makes it possible to build a predictable sequence of local formatting
operations.

\subsection{Optional arguments in wrappers}

Wrapper commands may take optional arguments. The wrapper list parser accepts
the usual LaTeX form, for example:

\begin{lstlisting}
wrap={coefficients}{\Scale[1.5]}
wrap={coefficients,variables}[rows=1]{\textbf,\Scale[1.2]}
\end{lstlisting}

The manual's \cmd{\Scale}helper demonstrates this feature:

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

\begin{importantBox}
The wrapper parser splits the wrapper list at commas. TeX grouping protects
ordinary mandatory arguments such as \texttt{\textbackslash color\{red\}}.
Optional arguments are accepted in the usual LaTeX form. The package does not
claim special parsing for arbitrary comma-containing optional arguments.
\end{importantBox}

\subsection{Entries versus coefficients and constants}

An \key{entries} wrapper can style either kind of matrix entry. This is useful
when a single rule should cover the complete augmented matrix while leaving
variables untouched.

\begin{linesysexample}{All entries, but not variables}
\begin{lstlisting}
\begin{linesys}[
    wrap={entries}{\color{blue}}
    ]
    2&-3&4\\
    5&1&6
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[
  wrap={entries}{\color{blue}}]
2&-3&4\\
5&1&6
\end{linesys}
\]
\endgroup
\end{linesysexample}

\subsection{Wrapper scoping}

Each wrapper application is local to its target component. Formatting does not
leak into neighboring coefficients, variables, or constants.

\subsection{Temporarily disabling wrappers}

The commands \cmd{\linesyswrapdisable}and \cmd{\linesyswrapenable}provide a
package-wide, group-local switch for the visual application of wrapper rules in both \cmd{linesys} and \cmd{linexp}. Wrappers are
enabled by default. While wrapping is disabled, \key{wrap} declarations are
still parsed and validated, but matching wrapper commands are not applied to
the rendered system.

\begin{linesysexample}{Group-local wrapper suppression}
\begin{lstlisting}
\begingroup
\linesyswrapdisable
\begin{linesys}[
    wrap={coefficients}{\color{red}}
    ]
    2&-1&3\\
    4&5&6
\end{linesys}
\endgroup
\end{lstlisting}
\result
\begingroup
\begingroup
\linesyswrapdisable
\[
\begin{linesys}[wrap={coefficients}{\color{red}}]
2&-1&3\\
4&5&6
\end{linesys}
\]
\endgroup
\endgroup
\end{linesysexample}

Both commands obey ordinary TeX grouping. A nested \cmd{\linesyswrapenable}
can therefore restore wrapper rendering temporarily inside a region in which
wrappers have been disabled; leaving the nested group restores the surrounding
disabled state.

% -----------------------------------------------------------------------------
\section{Interaction between wrappers and pivots}
% -----------------------------------------------------------------------------

The package distinguishes the built-in and custom pivot highlighters when
combining them with wrappers.

\subsection{Built-in pivot highlighter}

With \key{pivots=true}, the built-in circle is applied around the normally
wrapped pivot. For example, coefficient wrappers can style the pivot inside
the circle.

\begin{linesysexample}{Built-in pivot plus coefficient wrapper}
\begin{lstlisting}
\begin{linesys}[
    pivots=true,
    wrap={coefficients}{\color{blue}}
    ]
    2&-3&4\\
    0&5&6
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[pivots=true,
  wrap={coefficients}{\color{blue}}]
2&-3&4\\
0&5&6
\end{linesys}
\]
\endgroup
\end{linesysexample}

\subsection{Custom highlighter precedence}

A custom pivot highlighter is nested inside the ordinary coefficient/entry
wrappers rather than outside them. This nesting allows an inner stateful
declaration, such as a custom pivot color, to remain effective against a
conflicting outer wrapper; for example, a blue pivot can override a red
coefficient wrapper.

\begin{linesysexample}{Custom pivot color overrides coefficient color}
\begin{lstlisting}
\begin{linesys}[
    pivots=\color{blue},
    wrap={coefficients}{\color{red}}
    ]
    2&-3&4\\
    0&5&6
\end{linesys}
\end{lstlisting}
\result
\begingroup
\[
\begin{linesys}[pivots=\color{blue},
  wrap={coefficients}{\color{red}}]
2&-3&4\\
0&5&6
\end{linesys}
\]
\endgroup
\end{linesysexample}

The same precedence rule applies to a custom highlighter used for an RHS
pivot.

The package also defines \cmd{\linesyscircled}as the command used by the
built-in pivot highlighter. It takes one argument and places that argument inside a
TikZ circle; this command is available independently of the environment.

\begin{lstlisting}
\[
\linesyscircled{p}
\qquad
\linesyscircled{-2}
\]
\end{lstlisting}

\[
\linesyscircled{p}
\qquad
\linesyscircled{-2}
\]

% -----------------------------------------------------------------------------
\section{Persistent defaults}\label{sec:persistent-defaults}
% -----------------------------------------------------------------------------

Use \cmd{linesyssetdefaultoptions} to change the defaults used by subsequent
\cmd{linesys} environments:

\begin{lstlisting}
\linesyssetdefaultoptions{
  var={x,y},
  hidezeros=false,
  rowsep=4pt
}
\end{lstlisting}

Only the supplied settings change. Later environments inherit those values,
while an option in an individual environment still takes precedence. Relation
settings are persistent as well: \key{relation} stores one uniform symbol and
clears any stored per-row list, while \key{relations} stores one symbol per
rendered row. Their left-to-right override behavior is the same in the defaults
command as in an individual environment. The \key{pivotcols} option is
defaultable as well: a manual selector list can be
stored persistently, while a local \key{pivotcols=auto} restores automatic
pivot detection for one environment. The \key{pivotparen} option is part of
this defaults system and follows the same sequential-key behavior as in an
individual environment: literal
\key{pivots=true} sets it to \val{false} when processed, while a later
\key{pivotparen=true} can set it back to \val{true}. The indexed-variable
settings are persistent in the same way: \key{varindexstep} stores the
numeric step, while \key{varindexdecrease} is a convenience setting that
writes either $-1$ or $1$ to that step. The \key{varmode} interpretation mode
is also defaultable.

Wrapper declarations are intentionally environment-local: \key{wrap} is not a
supported key of \cmd{\linesyssetdefaultoptions} and cannot be stored as a
persistent default. The separate \cmd{\linesyswrapdisable} and
\cmd{\linesyswrapenable} commands are likewise group-local switches, not
stored default keys.

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

The command is local to the surrounding TeX group. In particular,
\begin{lstlisting}
\begingroup
    \linesyssetdefaultoptions{...}
    % changed defaults here
\endgroup
% original defaults are restored here
\end{lstlisting}

is a convenient pattern for temporary document-wide configuration.

The \cmd{linexp} environment has a separate persistent-default command:

\begin{lstlisting}
\linexpsetdefaultoptions{
    var=x_i,
    varindexstart=2,
    varindexstep=3,
    scalarops=true
}
\end{lstlisting}

Its supported keys are exactly the non-wrapper \cmd{linexp} options listed
above, including all variable-generation controls: \key{varindex},
\key{varindexstart}, \key{varindexstep}, \key{varindexdecrease}, and
\key{varmode}. The two defaults systems are independent: changing
\cmd{linesys} defaults does not change \cmd{linexp} defaults, and vice versa.
As with \cmd{linesyssetdefaultoptions}, \key{wrap} is intentionally not a
persistent default.

\subsection{Defaults shared by both renderers}

When the same persistent configuration should apply to both \cmd{linesys} and
\cmd{linexp} (and therefore also to \cmd{\linexpr}), use
\cmd{\linesyssetcommonoptions}:

\begin{lstlisting}
\linesyssetcommonoptions{
    var=x_i,
    varindexstart=0,
    varindexstep=2,
    hidezeros=false,
    scalarops=true
}
\end{lstlisting}

The command updates only options that exist with the same meaning in both
renderers. The supported keys are \key{var}, \key{hidezeros},
\key{emptyzeros}, \key{full}, \key{scalarops}, \key{scalaropsymbol},
\key{colsep}, \key{varindex}, \key{varindexstart}, \key{varindexstep},
\key{varindexdecrease}, and \key{varmode}. System-specific settings such as
relations, pivots, delimiters, and row spacing are untouched. Wrapper
declarations remain environment-local and are not accepted here.

The command writes to the two established persistent-default families rather
than creating a third layer of runtime options. Consequently, later calls to
\cmd{linesyssetdefaultoptions} or \cmd{linexpsetdefaultoptions} can still
override one renderer independently, and individual environment or
\cmd{\linexpr} options still take final precedence. Like the other defaults
commands, \cmd{\linesyssetcommonoptions}is local to the surrounding TeX
group.

\begin{linesysexample}{Shared persistent defaults}
\begin{lstlisting}
\begingroup
\linesyssetcommonoptions{
    var=x_i,
    varindexstart=0,
    hidezeros=false
}
\begin{linesys}
    1&0&5
\end{linesys}
\;
\linexpr{1&0}
\endgroup
\end{lstlisting}
\result
\begingroup
\begingroup
\linesyssetcommonoptions{var=x_i,varindexstart=0,hidezeros=false}
$\begin{linesys}1&0&5\end{linesys}\;\linexpr{1&0}$
\endgroup
\endgroup
\end{linesysexample}

\newpage

% -----------------------------------------------------------------------------
\section{A compact option reference}
% -----------------------------------------------------------------------------

This section collects the exact user-facing forms in one place.

\subsection*{Core presentation}
\begin{description}[style=nextline,leftmargin=5.0cm]
\item[\key{align}=\val{l|c|r}] \cmd{linesys} only: alignment of expression terms and the right-hand side. Default \val{r}.
\item[\key{hidezeros}=\val{true|false}] Hide zero coefficients. Default \val{true}.
\item[\key{emptyzeros}=\val{true|false}] Treat empty cells as zero. Default \val{false}.
\item[\key{full}=\val{true|false}] Fully explicit coefficient presentation. Default \val{false}.
\item[\key{pivotparen}=\val{true|false}] \cmd{linesys} only: in full mode, control parentheses around leading-negative pivot coefficients. Default \val{true}; literal \key{pivots=true} sets it to \val{false} when processed.
\item[\key{scalarops}=\val{true|false}] Insert multiplication symbols. Default \val{false}.
\item[\key{scalaropsymbol}=\meta{code}] Symbol inserted by \key{scalarops}. Default \cmd{\cdot}.
\end{description}

\subsection*{Relations (\texttt{linesys} only)}
\begin{description}[style=nextline,leftmargin=5.0cm]
\item[\key{relation}=\meta{code}] Use one relation symbol for every rendered row. Default \val{=}. Processing this key clears any active per-row \key{relations} list.
\item[\key{relations}=\meta{list}] Supply exactly one relation symbol for each non-empty row. A later \key{relation} restores uniform-relation mode.
\end{description}

\subsection*{Variables}
\begin{description}[style=nextline,leftmargin=5.0cm]
\item[\key{var}=\meta{spec}] Explicit list, \val{roman}, \val{Roman}, \val{greek}, or an indexed token template.
\item[\key{varindex}=\meta{token}] Placeholder token for indexed templates. Default \val{i}.
\item[\key{varindexstart}=\meta{integer}] First generated index. Default \val{1}.
\item[\key{varindexstep}=\meta{integer}] Difference between successive generated indices. Default \val{1}.
\item[\key{varindexdecrease}] Boolean convenience setting: \val{true} sets the index step to \(-1\), while \val{false} sets it to \(1\).
\item[\key{varmode}] Values \val{auto}, \val{list}, or \val{indexed}; choose automatic, forced-list, or forced-indexed interpretation of \key{var}. Default \val{auto}.
\end{description}

\subsection*{Pivots (\texttt{linesys} only)}
\begin{description}[style=nextline,leftmargin=5.0cm]
\item[\key{pivots}=\val{true}] Built-in circular highlighter.
\item[\key{pivots}=\val{false}] Disable pivot highlighting.
\item[\key{pivots}=\meta{command}] Custom highlighter receiving one argument.
\item[\key{pivotcols}=\val{auto}] Use automatic first-nonzero/RHS pivot detection. Default \val{auto}.
\item[\key{pivotcols}=\meta{selectors}] Manually select one pivot state per non-empty row; each selector is a positive variable-column number, \val{rhs}, or \val{none}.
\item[\key{rhspivots}=\val{true|false}] Highlight an eligible automatically detected nonzero RHS pivot when no variable pivot occurs. Default \val{true}; an explicit manual \val{rhs} selection is not vetoed by this option.
\end{description}

\subsection*{Geometry}
\begin{description}[style=nextline,leftmargin=5.0cm]
\item[\key{delim}=\meta{left,right}] \cmd{linesys} only: scalable delimiters; \val{.} means invisible. Default \val{.,.}.
\item[\key{rowsep}=\meta{dimension}] \cmd{linesys} only: extra row spacing. Default \val{0pt}.
\item[\key{colsep}=\meta{dimension}] Local array column spacing. Default \cmd{\arraycolsep}.
\end{description}

\subsection*{Wrappers}
\begin{description}[style=nextline,leftmargin=5.0cm]
\item[\key{wrap}] Form: \texttt{wrap=\{TARGETS\}}\hspace{0pt}\texttt{[FILTERS]\{WRAPPERS\}}. Apply formatting commands to selected components. \cmd{linesys} supports the five targets documented in the Wrappers section; \cmd{linexp} supports only \key{coefficients} and \key{variables}. Column filters are ignored for the row-level \key{constants} and \key{relations} targets. The option is environment-local and is not accepted by any of the persistent-default commands.
\item[\cmd{\linesyswrapdisable}] Suppress visual wrapper application within the surrounding TeX group; wrapper syntax is still parsed and validated.
\item[\cmd{\linesyswrapenable}] Re-enable visual wrapper application within the surrounding TeX group.
\end{description}

\subsection*{Commands and persistent defaults}
\begin{description}[style=nextline,leftmargin=5.0cm]
\item[\cmd{\linexpr[options]\{...\}}] Inline companion to \cmd{linexp}; accepts the same coefficient row, options, defaults, wrappers, and diagnostics.
\item[\cmd{\linesyssetdefaultoptions\{...\}}] Set persistent defaults for \cmd{linesys}.
\item[\cmd{\linexpsetdefaultoptions\{...\}}] Set persistent defaults for \cmd{linexp} and \cmd{\linexpr}.
\item[\cmd{\linesyssetcommonoptions\{...\}}] Set only the persistent options shared by both renderers.
\item[\cmd{\linesysdeclaretransparentwrapper\{\foo\}}] Declare a one-argument source form \texttt{\string\foo\{content\}} transparent to lexical coefficient classification. Declarations are TeX-group-local and duplicate registrations are harmless.
\end{description}

\subsection*{Environment-specific options}
\begin{description}[style=nextline,leftmargin=3.0cm]
\item[\cmd{linesys}] Additionally supports the relation and pivot controls described above, together with \key{align}, \key{delim}, and \key{rowsep}.
\item[\cmd{linexp}] Supports only the shared coefficient/variable options listed above; it has no RHS, pivot, delimiter, row-spacing, or alignment options.
\end{description}

% -----------------------------------------------------------------------------
\section{Practical patterns}
% -----------------------------------------------------------------------------

The following combinations cover common presentation tasks.

\subsection{A textbook-style linear system}

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

\[
\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{A mixed system of linear relations}

\begin{lstlisting}
\begin{linesys}[
    relations={=,\le,\ge},
    delim={\{,.}
    ]
    1&2&5\\
    3&-1&4\\
    0&2&6
\end{linesys}
\end{lstlisting}

\[
\begin{linesys}[relations={=,\le,\ge},delim={\{,.}]
1&2&5\\
3&-1&4\\
0&2&6
\end{linesys}
\]

\subsection{An explicit algebra display}

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

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

\subsection{Selective emphasis}

\begin{lstlisting}
\begin{linesys}[
    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}
\end{lstlisting}

\[
\begin{linesys}[
	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{A styled linear combination}

\begin{lstlisting}
\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}
\end{lstlisting}

\[
\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}
\]

\newpage

% -----------------------------------------------------------------------------
\section{Validation and diagnostics}
% -----------------------------------------------------------------------------

The package performs several structural checks before opening its internal
array. The important user-facing cases are listed below.

\begin{center}
\small
\begin{tabular}{@{}p{0.36\linewidth}p{0.53\linewidth}@{}}
\toprule
Situation & Package response \\
\midrule
One-column or empty-width matrix & Error: the system must have at least one variable column. \\
Inconsistent non-empty row width & Error identifying the rendered row number, expected number of columns, and number found. \\
Manual \key{pivotcols} selector count does not match the non-empty row count & Error identifying both counts. \\
Invalid \key{pivotcols} selector & Error identifying the selector and row; use a positive variable-column number, \val{rhs}, or \val{none}. \\
Manual pivot column exceeds the number of variable columns & Error identifying the invalid column, row, and column limit. \\
Too few explicit variables in \cmd{linesys} & Error identifying the required and supplied counts. \\
Forced indexed mode without its placeholder (either environment) & Error identifying the missing \key{varindex} token. \\
More than 26 Roman variables requested & Error. \\
More than 26 uppercase Roman variables requested & Error. \\
More than 23 Greek variables requested & Error. \\
Empty coefficient/constant with \key{emptyzeros=false} & Error. \\
Invalid transparent-wrapper declaration & Error requiring exactly one control sequence. \\
Invalid \cmd{linesys} wrapper target & Error listing the five valid targets. \\
Per-row \key{relations} count does not match the non-empty row count & Error identifying both counts. \\
Empty uniform or per-row relation symbol & Error requiring math material such as \val{=}, \cmd{\le}, or \cmd{\ge}. \\
Invalid \cmd{linesys} wrapper row/column selector & Error identifying the invalid index and the system limit. \\
Column selector on \key{constants} or \key{relations} in \cmd{linesys} & Warning; selector is ignored. \\
Malformed \cmd{linesys} wrapper syntax & Error with the canonical wrapper grammar. \\
\midrule
\cmd{linexp} or \cmd{\linexpr} with zero or multiple non-empty rows & Error requiring exactly one non-empty coefficient row. \\
Too few explicit variables in \cmd{linexp} or \cmd{\linexpr} & Error identifying the required and supplied counts. \\
Empty \cmd{linexp} coefficient with \key{emptyzeros=false} & Error. \\
Invalid \cmd{linexp} wrapper target & Error; valid targets are \key{coefficients} and \key{variables}. \\
Row filter in a \cmd{linexp} wrapper & Error; only column filters are supported. \\
Invalid \cmd{linexp} wrapper column selector & Error identifying the invalid index and expression limit. \\
Malformed \cmd{linexp} wrapper syntax & Error with the \cmd{linexp} wrapper grammar. \\
\bottomrule
\end{tabular}
\end{center}

\begin{noteBox}
The package reports these conditions through its own diagnostics rather than
intentionally continuing into an incomplete array. This is especially useful
for invalid variable specifications and wrapper selectors. The inline
\cmd{\linexpr} command delegates to \cmd{linexp}, so it reports the same
expression-level diagnostics rather than maintaining a separate validation path.
\end{noteBox}

\subsection{A note about coefficient interpretation}

Coefficient handling is lexical, not algebraic. Zero, unit-magnitude, and
leading-sign tests share the transparent classification rules described earlier,
so outer grouping, supported built-in formatting, and registered one-argument
transparent wrappers do not change those basic lexical properties. A single
leading \texttt{+} or \texttt{-} is ignored when testing literal zero or unit
magnitude; the sign itself is still handled by the normal rendering rules.

The package does not evaluate mathematical expressions or expand arbitrary
macros to discover their value. In particular, \texttt{1-1} is not classified
as zero merely because it is mathematically equal to zero. The original source
formatting is preserved for rendered coefficient content wherever that content
remains visible.

% -----------------------------------------------------------------------------
\section{Recommended workflow}
% -----------------------------------------------------------------------------

For most documents, the following progression is enough:

\begin{enumerate}
\item Choose \cmd{linesys} for an augmented-matrix system, \cmd{linexp} for one displayed linear expression, or \cmd{\linexpr} when the same expression renderer is more convenient inline; let the default variables \(x,y,z,w,t\) do the work.
\item Set \key{var} when the system or expression uses different variable names.
\item In \cmd{linesys}, set \key{relation} for a uniform inequality or other relation, or \key{relations} when the rows use different symbols.
\item Use \key{hidezeros=false} or \key{full=true} when a more explicit coefficient presentation is needed.
\item In \cmd{linesys}, use \key{pivots=true} when pivot positions should be visible; use \key{pivotcols} when the pivot positions should be chosen manually rather than detected automatically. In full mode, use \key{pivotparen} when you want explicit control over parentheses around negative pivots.
\item In automatic pivot mode, add \key{rhspivots=false} if eligible RHS pivots should not be highlighted.
\item If custom one-argument formatting commands should be transparent to
      coefficient classification, register them with
      \cmd{\linesysdeclaretransparentwrapper} in the scope where that behavior
      is wanted.
\item Use \key{wrap} for selective emphasis rather than manually rebuilding
      rendered rows.
\item If the same supported non-wrapper configuration is repeated throughout a
      document, use the persistent-defaults mechanism described in
      Section~\ref{sec:persistent-defaults}. Use \cmd{\linesyssetcommonoptions}
      when the shared settings should apply to both system and expression
      rendering, and the environment-specific defaults commands when they should
      diverge.
\end{enumerate}

\begin{noteBox}
\textbf{A useful mental model:} the matrix body supplies the data; the options
choose how that data is interpreted and displayed; wrappers provide a final,
local formatting layer. Keeping those roles separate makes complicated
examples much easier to maintain.
\end{noteBox}

% -----------------------------------------------------------------------------
\section{Quick reference}
% -----------------------------------------------------------------------------

\begin{center}
\footnotesize
\renewcommand{\arraystretch}{1.25}
\begin{tabular}{@{}ll@{}}
\toprule
\textbf{Task} & \textbf{Use} \\
\midrule
Load package & \cmd{\usepackage\{linesys\}} \\
Basic system & \cmd{\begin{linesys} ... \end{linesys}} \\
Basic linear expression & \cmd{\begin{linexp} ... \end{linexp}} \\
Inline linear expression & \cmd{\linexpr[options]\{...\}} \\
Choose variables & \key{var=...} \\
Choose variable interpretation & \key{varmode=auto|list|indexed} \\
Choose index step & \key{varindexstep=...} \\
Decrease generated indices by one & \key{varindexdecrease=true} \\
Hide/show zeros & \key{hidezeros=true/false} \\
Treat blanks as zeros & \key{emptyzeros=true} \\
Show full coefficients & \key{full=true} \\
Choose one relation for all rows & \texttt{relation=\string\le} \\
Choose relations row by row & \texttt{relations=\{=,\string\le,\string\ge\}} \\
Highlight pivots & \key{pivots=true} \\
Custom pivot command & \key{pivots=\meta{command}} \\
Choose manual pivots & \key{pivotcols=\{1,2,rhs,none,...\}} \\
Return to automatic pivots & \key{pivotcols=auto} \\
Disable automatic RHS-pivot highlighting & \key{rhspivots=false} \\
Explicit multiplication & \key{scalarops=true} \\
Choose multiplication symbol & \key{scalaropsymbol=...} \\
Choose delimiters & \key{delim=\{left,right\}} \\
Vertical spacing & \key{rowsep=...} \\
Horizontal spacing & \key{colsep=...} \\
Selective formatting & \key{wrap=\{targets\}[filters]\{wrappers\}} \\
Temporarily disable/enable wrappers & \cmd{\linesyswrapdisable} / \cmd{\linesyswrapenable} \\
Declare transparent wrapper & \cmd{\linesysdeclaretransparentwrapper\{\foo\}} \\
Persistent system configuration & \cmd{\linesyssetdefaultoptions\{...\}} \\
Persistent expression configuration & \cmd{\linexpsetdefaultoptions\{...\}} \\
Persistent configuration shared by both & \cmd{\linesyssetcommonoptions\{...\}} \\
\bottomrule
\end{tabular}
\end{center}

\vfill
\begin{center}
\color{linesysgray}\small
End of the \linesysTitle{} version 1.0 user manual.
\end{center}

\end{document}
