%%
%% This is file `innerscript-user-guide.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% innerscript-code.dtx  (with options: `user')
%% 
%% This file is from version 1.4 of the free and open-source
%% LaTeX package "innerscript," released April 2025, to be
%% used with the LuaTeX engine.
%% 
%% Copyright 2021, 2023-2025 Conrad Kosowsky
%% 
%% This file may be distributed and modified under the terms
%% of the LaTeX Public Project License, version 1.3c or any
%% later version. The most recent version of this license is
%% available online at
%% 
%%           https://www.latex-project.org/lppl/
%% 
%% This work has the LPPL status "maintained," and the current
%% maintainer is the package author, Conrad Kosowsky. He can
%% be reached at kosowsky.latex@gmail.com.
%% 
%% PLEASE KNOW THAT THIS FREE SOFTWARE IS PROVIDED WITHOUT
%% ANY WARRANTY. SPECIFICALLY, THE "NO WARRANTY" SECTION OF
%% THE LATEX PROJECT PUBLIC LICENSE STATES THE FOLLOWING:
%% 
%% THERE IS NO WARRANTY FOR THE WORK. EXCEPT WHEN OTHERWISE
%% STATED IN WRITING, THE COPYRIGHT HOLDER PROVIDES THE WORK
%% `AS IS’, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
%% OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
%% WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
%% PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE
%% OF THE WORK IS WITH YOU. SHOULD THE WORK PROVE DEFECTIVE,
%% YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR
%% CORRECTION.
%% 
%% IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED
%% TO IN WRITING WILL THE COPYRIGHT HOLDER, OR ANY AUTHOR
%% NAMED IN THE COMPONENTS OF THE WORK, OR ANY OTHER PARTY
%% WHO MAY DISTRIBUTE AND/OR MODIFY THE WORK AS PERMITTED
%% ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL,
%% SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT
%% OF ANY USE OF THE WORK OR OUT OF INABILITY TO USE THE WORK
%% (INCLUDING, BUT NOT LIMITED TO, LOSS OF DATA, DATA BEING
%% RENDERED INACCURATE, OR LOSSES SUSTAINED BY ANYONE AS A
%% RESULT OF ANY FAILURE OF THE WORK TO OPERATE WITH ANY
%% OTHER PROGRAMS), EVEN IF THE COPYRIGHT HOLDER OR SAID
%% AUTHOR OR SAID OTHER PARTY HAS BEEN ADVISED OF THE
%% POSSIBILITY OF SUCH DAMAGES.
%% 
%% For more information, see the LaTeX Project Public License.
%% Derivative works based on this software may come with their
%% own license or terms of use, and the package author is not
%% responsible for any third-party software.
%% 
%% Happy TeXing!
%% 
\makeatletter
\documentclass[12pt]{article}
\usepackage[margin=72.27pt]{geometry}
\usepackage[factor=700,stretch=14,shrink=14,step=1]{microtype}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{amsmath}
\usepackage{doc}[=v2]
\MakeShortVerb{|}
\interfootnotelinepenalty=0

\newbox\fracbox
\setbox\fracbox\hbox{$\displaystyle\left(\frac x2\right)$}

\c@topnumber=1
\def\floatpagefraction{0}

\begin{document}

\def\documentname{User Guide}
\input innerscript-heading.tex

\def\@oddhead{\ifnum\c@page>\@ne
  \ifodd\c@page
    \hfil\the\c@page
  \else
    \the\c@page\hfil
  \fi\fi}

\noindent For several years before the first release of \textsf{innerscript}, I wondered whether it was possible to adjust two features of \TeX's automatic mathematics spacing, namely adding more space in superscripts and subscripts and removing the extra space around |\left|-|\right| delimiter pairs. Lua\TeX's extra math-mode primitives make these changes possible, and \textsf{innerscript} grew out of my desire to implement them in my documents. For example, compare the next two lines:
\begin{flalign}
&&\sum_{i=1}^n{}&x_i^{1+a}
  &f(x)&=g\left(\frac1x\right)
  &x(t)&y(t)
  &\hskip0.5\wd\fracbox &\clap@math{\left(\frac{x}2\right)}
    \hskip0.5\wd\fracbox
  &&\\
&&\sum_{i\mskip\scalemu{\thickmuskip}{0.6}=
    \mskip\scalemu{\thickmuskip}{0.6}1}^n
    {}&x_i^{1\mskip\scalemu{\medmuskip}{0.6}+
    \mskip\scalemu{\medmuskip}{0.6} a}
  &f(x)&=g{\left(\frac1x\right)}
  &x(t)\mskip\scalemu{\thinmuskip}{0.25}&\mskip\scalemu{\thinmuskip}{0.25}y(t)
  &\hskip0.5\wd\fracbox & \clap@math{\left(\frac{\vphantom{1}x}2\right)}
    \hskip0.5\wd\fracbox
  &&
\end{flalign}
Equation~(1) uses traditional \TeX\ formatting, and equation~(2) incorporates the small tweaks characteristic of \textsf{innerscript}. If you like equation~(2) more than equation~(1), then \textsf{innerscript} is the package for you! This file explains how to load \textsf{innerscript} and enable whichever adjustments you want to use. For version history and documentation of the code, see |innerscript-code.pdf|, which is included with the package installation and is available on \textsc{ctan}.

\begin{figure}[p]
\vbox to \vsize{

\centerline{\large\bfseries Options and Behavior of \textsf{innerscript}}

\bigskip
\nointerlineskip\centerline{\vrule height 0.5pt width 2in}
\medskip

\centerline{\strut\bfseries Table~1: Package Behavior Shown in Equation (2)}
\begin{tabular*}\textwidth{@{\extracolsep{\fill}}lllll}\toprule
Part of equation (2) & Summation & Functions & Product & Fraction\\\midrule
Option shown & |script| & |inner| & |close| & |cover|\\\bottomrule
\end{tabular*}

\vfil

\centerline{\strut\bfseries Table~2: Package Options for \textsf{innerscript}}
\begin{tabular*}\hsize{@{\extracolsep{\fill}}l>{\raggedright\arraybackslash}l}
\toprule
Package Option & Meaning\\
\midrule
|script| & Change |\scriptstyle| (and cramped style) spacing\\
|scriptscript| & Change |\scriptscriptstyle| (and cramped style) spacing\\
|inner| & Use |\mathord| spacing for |\mathinner| subformulas\\
|close| & Extra space between \vrb\mathclose\vrb\mathord\ pairs\\
|cover| & Resizable delimiters (i.e.\ |\left| and |\right|) fully cover contents\\\midrule
|no-script| & No changes to |\scriptstyle| spacing\\
|no-scriptscript| & No changes to |\scriptscriptstyle| spacing\\
|no-inner| & No changes to treatment of |\mathinner| subformulas\\
|no-close| & No changes to |\mathclose| atoms\\
|no-cover| & No changes to resizable delimiters\\
\bottomrule
\end{tabular*}

\vfil

\centerline{\bfseries\strut Table 3: Usual Space Inserted by \TeX\ between Atoms}
\begin{tabularx}{\textwidth}{Xp{1.1in}Xp{1.1in}}\toprule
Consecutive Atom Types & Space Added & Consecutive Atom Types & Space Added\\\midrule
\end{tabularx}
\hb@xt@\hsize{\hss\bgroup
\aboverulesep=0.7ex\relax
\belowrulesep=0.7ex\relax
\def\arraystretch{1.06}
\begin{tabularx}{0.495\textwidth}{Xp{1.1in}}
|\mathord||\mathop| & |\thinmuskip| \\
|\mathord||\mathbin| & |\medmuskip| \\
|\mathord||\mathrel| & |\thickmuskip| \\
|\mathord||\mathinner| & |\thinmuskip| \\\midrule
|\mathop||\mathord| & |\thinmuskip| \\
|\mathop||\mathop| & |\thinmuskip| \\
|\mathop||\mathrel| & |\thickmuskip| \\
|\mathop||\mathinner| & |\thickmuskip| \\\midrule
|\mathbin||\mathord| & |\medmuskip| \\
|\mathbin||\mathop| & |\medmuskip| \\
|\mathbin||\mathopen| & |\medmuskip| \\
|\mathbin||\mathinner| & |\medmuskip| \\\midrule
|\mathrel||\mathord| & |\thickmuskip| \\
|\mathrel||\mathop| & |\thickmuskip| \\
|\mathrel||\mathopen| & |\thickmuskip| \\
|\mathrel||\mathinner| & |\thickmuskip| \\
\end{tabularx}\egroup
\hskip 0.01\textwidth
\begin{tabularx}{0.495\textwidth}{Xp{1.1in}}
|\mathclose||\mathop| & |\thinmuskip| \\
|\mathclose||\mathbin| & |\medmuskip| \\
|\mathclose||\mathrel| & |\thickmuskip| \\
|\mathclose||\mathinner| & |\thinmuskip| \\\midrule
|\mathpunct||\mathord| & |\thinmuskip| \\
|\mathpunct||\mathop| & |\thinmuskip| \\
|\mathpunct||\mathrel| & |\thinmuskip| \\
|\mathpunct||\mathopen| & |\thinmuskip| \\
|\mathpunct||\mathclose| & |\thinmuskip| \\
|\mathpunct||\mathpunct| & |\thinmuskip| \\
|\mathpunct||\mathinner| & |\thinmuskip| \\\midrule
|\mathinner||\mathord| & |\thinmuskip| \\
|\mathinner||\mathop| & |\thinmuskip| \\
|\mathinner||\mathbin| & |\medmuskip| \\
|\mathinner||\mathrel| & |\thickmuskip| \\
|\mathinner||\mathopen| & |\thinmuskip| \\
|\mathinner||\mathpunct| & |\thinmuskip| \\
|\mathinner||\mathinner| & |\thinmuskip| \\
\end{tabularx}}
\vskip\aboverulesep
\hrule height \heavyrulewidth}
\end{figure}

Table~1 explains which parts of equation~(2) show different aspects of \textsf{innerscript}'s behavior. At far left, the subscript under the summation symbol and the superscript of $x_i$ have small amounts of extra space around the |=| and |+| signs respectively, and at center-left, the $g$ is directly next to the parenthesis. At center-right, the closing parenthesis is offset from the following $y$, and on the right, the parentheses cover the entire fraction instead of covering only most of it. Using the package will automate some or all of these changes for you depending on which options you specify.

Users can load \textsf{innerscript} with the standard |\usepackage| syntax, and to do so, you must typeset with Lua\TeX. If it detects a different engine, \textsf{innerscript} will raise an error and stop loading, so you will not see any changes to the math in your document. The package provides no user-level commands---rather, you can control its functionality through the ten options in Table~2. Options |script|, and |no-script| determine how \textsf{innerscript} treats superscripts and subscripts, and options |scriptscript|, and |no-scriptscript| are the same except that they deal with second-order superscripts and subscripts.\footnote{Version 1.2 of \textsf{innerscript} provided |legacy-| options for superscripts and subscripts with slightly different spacing. As of version 1.4, those options are officially deprecated. For backwards compatibility, \textsf{innerscript} still accepts |legacy-script| and |legacy-scriptscript| options, but they now produce the same space adjustments as |script| and |scriptscript|.} The |inner| option tells \TeX\ to avoid placing some extra spaces around |\mathinner| subformulas. Specifically, with this option, \TeX\ treats the left side of a |\mathinner| subformula like a left parenthesis and treats the right side like a right parenthesis. The |close| option adds a small amount of space after a closing grouping symbol, such as a right parenthesis, when it comes before a regular variable or number, and |cover| tells \TeX\ to make sure that resizable delimiters fully cover their contents. The |no-| variants disable formatting adjustments, and by default, \textsf{innerscript} enables all space adjustments described here.

The |inner|, |close|, and |cover| options are straightforward, but the options |script| and |scriptscript| warrant more explanation. With its usual math formatting, \TeX\ adds small amounts of space between different math-mode characters depending on what types of symbols they represent, and \TeX's fine-tuned math spacing is part of what makes it a great program for typesetting equations.\footnote{\TeX\ classifies math symbols into eight categories: \vrb\mathord\ (ordinary), \vrb\mathop\ (big operator), \vrb\mathbin\ (binary operation), \vrb\mathrel\ (relation), \vrb\mathopen\ (opening delimiter), \vrb\mathclose\ (closing delimiter), \vrb\mathpunct\ (punctuation), and \vrb\mathinner\ (``inner'' subformula). As part of its definition, every math-mode character is assigned a math class. See Donald Knuth, \textit{The \TeX book} (Addison Wesley, 1986), 170; David Salomon, \textit{The Advanced \TeX book} (Springer, 1995), 256--258.} However, some spacing additions from inline and display math don't appear inside superscripts and subscripts. The |script| and |scriptscript| options address this situation by setting the interatom space in superscripts and subscripts to scaled-down versions of the standard spacing rules. Table~3 lists the space that \TeX\ inserts between atoms of different types in display or inline math. With option |script|, \textsf{innerscript} sets the interatom spacing in superscripts and subscripts to be 60\% of the amounts in Table~3, and with option |scriptscript|, \textsf{innerscript} sets the interatom space to be 40\% of the amounts in Table~3.\footnote{Technically, \textsf{innerscript} scales down the standard spacing twice because the exact length of a \vrb\muskip\ register varies proportionally with the surrounding font size. For example, a \vrb\thinmuskip\ inside a superscript or subscript will be about two-thirds the size of a \vrb\thinmuskip\ in regular inline math. If \textsf{innerscript} inserted the same \vrb\muskip\ amounts from Table~3 in superscripts and subscripts, the spacing would be exactly proportional to inline and display spacing. However, doing so produces math where the symbols appear too far apart visually, so before using them, \textsf{innerscript} scales down the \vrb\muskip\ amounts in Table~3.} Atom pairs that do not appear in Table~3 do not by default receive extra space from \TeX\ or \textsf{innerscript}.

Finally, you are of course welcome to change the size of |\thinmuskip|, |\medmuskip|, or |\thickmuskip|, but I encourage you to do so before you load \textsf{innerscript}. If you do after loading this package, some of your changes will not register properly.

\end{document}
\endinput
%%
%% End of file `innerscript-user-guide.tex'.
