| 1 |
%% |
| 2 |
%% This is file `innerscript-user-guide.tex', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% innerscript-code.dtx (with options: `user') |
| 8 |
%% |
| 9 |
%% This file is from version 1.4a of the free and open-source |
| 10 |
%% LaTeX package "innerscript," released May 2025, to be |
| 11 |
%% used with the LuaTeX engine. |
| 12 |
%% |
| 13 |
%% Copyright 2021, 2023-2025 Conrad Kosowsky |
| 14 |
%% |
| 15 |
%% This file may be distributed and modified under the terms |
| 16 |
%% of the LaTeX Public Project License, version 1.3c or any |
| 17 |
%% later version. The most recent version of this license is |
| 18 |
%% available online at |
| 19 |
%% |
| 20 |
%% https://www.latex-project.org/lppl/ |
| 21 |
%% |
| 22 |
%% This work has the LPPL status "maintained," and the current |
| 23 |
%% maintainer is the package author, Conrad Kosowsky. He can |
| 24 |
%% be reached at [email protected]. |
| 25 |
%% |
| 26 |
%% PLEASE KNOW THAT THIS FREE SOFTWARE IS PROVIDED WITHOUT |
| 27 |
%% ANY WARRANTY. SPECIFICALLY, THE "NO WARRANTY" SECTION OF |
| 28 |
%% THE LATEX PROJECT PUBLIC LICENSE STATES THE FOLLOWING: |
| 29 |
%% |
| 30 |
%% THERE IS NO WARRANTY FOR THE WORK. EXCEPT WHEN OTHERWISE |
| 31 |
%% STATED IN WRITING, THE COPYRIGHT HOLDER PROVIDES THE WORK |
| 32 |
%% `AS IS’, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED |
| 33 |
%% OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 34 |
%% WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 35 |
%% PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE |
| 36 |
%% OF THE WORK IS WITH YOU. SHOULD THE WORK PROVE DEFECTIVE, |
| 37 |
%% YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR |
| 38 |
%% CORRECTION. |
| 39 |
%% |
| 40 |
%% IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED |
| 41 |
%% TO IN WRITING WILL THE COPYRIGHT HOLDER, OR ANY AUTHOR |
| 42 |
%% NAMED IN THE COMPONENTS OF THE WORK, OR ANY OTHER PARTY |
| 43 |
%% WHO MAY DISTRIBUTE AND/OR MODIFY THE WORK AS PERMITTED |
| 44 |
%% ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, |
| 45 |
%% SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT |
| 46 |
%% OF ANY USE OF THE WORK OR OUT OF INABILITY TO USE THE WORK |
| 47 |
%% (INCLUDING, BUT NOT LIMITED TO, LOSS OF DATA, DATA BEING |
| 48 |
%% RENDERED INACCURATE, OR LOSSES SUSTAINED BY ANYONE AS A |
| 49 |
%% RESULT OF ANY FAILURE OF THE WORK TO OPERATE WITH ANY |
| 50 |
%% OTHER PROGRAMS), EVEN IF THE COPYRIGHT HOLDER OR SAID |
| 51 |
%% AUTHOR OR SAID OTHER PARTY HAS BEEN ADVISED OF THE |
| 52 |
%% POSSIBILITY OF SUCH DAMAGES. |
| 53 |
%% |
| 54 |
%% For more information, see the LaTeX Project Public License. |
| 55 |
%% Derivative works based on this software may come with their |
| 56 |
%% own license or terms of use, and the package author is not |
| 57 |
%% responsible for any third-party software. |
| 58 |
%% |
| 59 |
%% Happy TeXing! |
| 60 |
%% |
| 61 |
\makeatletter |
| 62 |
\documentclass[12pt]{article} |
| 63 |
\usepackage[margin=72.27pt]{geometry} |
| 64 |
\usepackage[factor=700,stretch=14,shrink=14,step=1]{microtype} |
| 65 |
\usepackage{booktabs} |
| 66 |
\usepackage{tabularx} |
| 67 |
\usepackage{amsmath} |
| 68 |
\usepackage{doc}[=v2] |
| 69 |
\MakeShortVerb{|} |
| 70 |
\interfootnotelinepenalty=0 |
| 71 |
|
| 72 |
\newbox\fracbox |
| 73 |
\setbox\fracbox\hbox{$\displaystyle\left(\frac x2\right)$} |
| 74 |
|
| 75 |
\c@topnumber=1 |
| 76 |
\def\floatpagefraction{0} |
| 77 |
\@fpsep=\fill |
| 78 |
|
| 79 |
\begin{document} |
| 80 |
|
| 81 |
\def\documentname{User Guide} |
| 82 |
\input innerscript-heading.tex |
| 83 |
|
| 84 |
\def\@oddhead{\ifnum\c@page>\@ne |
| 85 |
\ifodd\c@page |
| 86 |
\hfil\the\c@page |
| 87 |
\else |
| 88 |
\the\c@page\hfil |
| 89 |
\fi\fi} |
| 90 |
|
| 91 |
\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: |
| 92 |
\begin{flalign} |
| 93 |
&&\sum_{i=1}^n{}&x_i^{1+a} |
| 94 |
&f(x)&=g\left(\frac1x\right) |
| 95 |
&x(t)&y(t) |
| 96 |
&\hskip0.5\wd\fracbox &\clap@math{\left(\frac{x}2\right)} |
| 97 |
\hskip0.5\wd\fracbox |
| 98 |
&&\\ |
| 99 |
&&\sum_{i\mskip\scalemu{\thickmuskip}{0.6}= |
| 100 |
\mskip\scalemu{\thickmuskip}{0.6}1}^n |
| 101 |
{}&x_i^{1\mskip\scalemu{\medmuskip}{0.6}+ |
| 102 |
\mskip\scalemu{\medmuskip}{0.6} a} |
| 103 |
&f(x)&=g{\left(\frac1x\right)} |
| 104 |
&x(t)\mskip\scalemu{\thinmuskip}{0.25}&\mskip\scalemu{\thinmuskip}{0.25}y(t) |
| 105 |
&\hskip0.5\wd\fracbox & \clap@math{\left(\frac{\vphantom{1}x}2\right)} |
| 106 |
\hskip0.5\wd\fracbox |
| 107 |
&& |
| 108 |
\end{flalign} |
| 109 |
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}. |
| 110 |
|
| 111 |
\begin{figure}[p] |
| 112 |
\centerline{\strut\bfseries Table~1: Package Behavior Shown in Equation (2)} |
| 113 |
\begin{tabular*}\textwidth{@{\extracolsep{\fill}}lllll}\toprule |
| 114 |
Part of equation (2) & Summation & Functions & Product & Fraction\\\midrule |
| 115 |
Option shown & |script| & |inner| & |close| & |cover|\\\bottomrule |
| 116 |
\end{tabular*} |
| 117 |
\end{figure} |
| 118 |
|
| 119 |
\begin{figure}[p] |
| 120 |
\centerline{\strut\bfseries Table~2: Package Options for \textsf{innerscript}} |
| 121 |
\begin{tabular*}\hsize{@{\extracolsep{\fill}}l>{\raggedright\arraybackslash}l} |
| 122 |
\toprule |
| 123 |
Package Option & Meaning\\ |
| 124 |
\midrule |
| 125 |
|script| & Change |\scriptstyle| (and cramped style) spacing\\ |
| 126 |
|scriptscript| & Change |\scriptscriptstyle| (and cramped style) spacing\\ |
| 127 |
|inner| & Use |\mathord| spacing for |\mathinner| subformulas\\ |
| 128 |
|close| & Extra space between \vrb\mathclose\vrb\mathord\ pairs\\ |
| 129 |
|cover| & Resizable delimiters (i.e.\ |\left| and |\right|) fully cover contents\\\midrule |
| 130 |
|no-script| & No changes to |\scriptstyle| spacing\\ |
| 131 |
|no-scriptscript| & No changes to |\scriptscriptstyle| spacing\\ |
| 132 |
|no-inner| & No changes to treatment of |\mathinner| subformulas\\ |
| 133 |
|no-close| & No changes to |\mathclose| atoms\\ |
| 134 |
|no-cover| & No changes to resizable delimiters\\ |
| 135 |
\bottomrule |
| 136 |
\end{tabular*} |
| 137 |
\end{figure} |
| 138 |
|
| 139 |
\begin{figure}[p] |
| 140 |
\centerline{\bfseries\strut Table 3: Usual Space Inserted by \TeX\ between Atoms} |
| 141 |
\begin{tabularx}{\textwidth}{Xp{1.1in}Xp{1.1in}}\toprule |
| 142 |
Consecutive Atom Types & Space Added & Consecutive Atom Types & Space Added\\\midrule |
| 143 |
\end{tabularx} |
| 144 |
\hb@xt@\hsize{\hss\bgroup |
| 145 |
\aboverulesep=0.7ex\relax |
| 146 |
\belowrulesep=0.7ex\relax |
| 147 |
\def\arraystretch{1.06} |
| 148 |
\begin{tabularx}{0.495\textwidth}{Xp{1.1in}} |
| 149 |
|\mathord||\mathop| & |\thinmuskip| \\ |
| 150 |
|\mathord||\mathbin| & |\medmuskip| \\ |
| 151 |
|\mathord||\mathrel| & |\thickmuskip| \\ |
| 152 |
|\mathord||\mathinner| & |\thinmuskip| \\\midrule |
| 153 |
|\mathop||\mathord| & |\thinmuskip| \\ |
| 154 |
|\mathop||\mathop| & |\thinmuskip| \\ |
| 155 |
|\mathop||\mathrel| & |\thickmuskip| \\ |
| 156 |
|\mathop||\mathinner| & |\thickmuskip| \\\midrule |
| 157 |
|\mathbin||\mathord| & |\medmuskip| \\ |
| 158 |
|\mathbin||\mathop| & |\medmuskip| \\ |
| 159 |
|\mathbin||\mathopen| & |\medmuskip| \\ |
| 160 |
|\mathbin||\mathinner| & |\medmuskip| \\\midrule |
| 161 |
|\mathrel||\mathord| & |\thickmuskip| \\ |
| 162 |
|\mathrel||\mathop| & |\thickmuskip| \\ |
| 163 |
|\mathrel||\mathopen| & |\thickmuskip| \\ |
| 164 |
|\mathrel||\mathinner| & |\thickmuskip| \\ |
| 165 |
\end{tabularx}\egroup |
| 166 |
\hskip 0.01\textwidth |
| 167 |
\begin{tabularx}{0.495\textwidth}{Xp{1.1in}} |
| 168 |
|\mathclose||\mathop| & |\thinmuskip| \\ |
| 169 |
|\mathclose||\mathbin| & |\medmuskip| \\ |
| 170 |
|\mathclose||\mathrel| & |\thickmuskip| \\ |
| 171 |
|\mathclose||\mathinner| & |\thinmuskip| \\\midrule |
| 172 |
|\mathpunct||\mathord| & |\thinmuskip| \\ |
| 173 |
|\mathpunct||\mathop| & |\thinmuskip| \\ |
| 174 |
|\mathpunct||\mathrel| & |\thinmuskip| \\ |
| 175 |
|\mathpunct||\mathopen| & |\thinmuskip| \\ |
| 176 |
|\mathpunct||\mathclose| & |\thinmuskip| \\ |
| 177 |
|\mathpunct||\mathpunct| & |\thinmuskip| \\ |
| 178 |
|\mathpunct||\mathinner| & |\thinmuskip| \\\midrule |
| 179 |
|\mathinner||\mathord| & |\thinmuskip| \\ |
| 180 |
|\mathinner||\mathop| & |\thinmuskip| \\ |
| 181 |
|\mathinner||\mathbin| & |\medmuskip| \\ |
| 182 |
|\mathinner||\mathrel| & |\thickmuskip| \\ |
| 183 |
|\mathinner||\mathopen| & |\thinmuskip| \\ |
| 184 |
|\mathinner||\mathpunct| & |\thinmuskip| \\ |
| 185 |
|\mathinner||\mathinner| & |\thinmuskip| \\ |
| 186 |
\end{tabularx}} |
| 187 |
\vskip\aboverulesep |
| 188 |
\hrule height \heavyrulewidth |
| 189 |
\end{figure} |
| 190 |
|
| 191 |
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 this package will automate some or all of these changes. |
| 192 |
|
| 193 |
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 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 for spacing purposes. 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. |
| 194 |
|
| 195 |
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}. |
| 196 |
|
| 197 |
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 so after loading the package, some of your changes will not show up in \TeX's automatic interatom spacing. |
| 198 |
|
| 199 |
\end{document} |
| 200 |
\endinput |
| 201 |
%% |
| 202 |
%% End of file `innerscript-user-guide.tex'. |