texlive[69660] Master/texmf-dist: leftindex (1feb24)

commits+karl at tug.org commits+karl at tug.org
Thu Feb 1 22:06:33 CET 2024


Revision: 69660
          https://tug.org/svn/texlive?view=revision&revision=69660
Author:   karl
Date:     2024-02-01 22:06:33 +0100 (Thu, 01 Feb 2024)
Log Message:
-----------
leftindex (1feb24)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/leftindex/README.md
    trunk/Master/texmf-dist/doc/latex/leftindex/leftindex.pdf
    trunk/Master/texmf-dist/doc/latex/leftindex/leftindex.tex
    trunk/Master/texmf-dist/tex/latex/leftindex/leftindex.sty

Modified: trunk/Master/texmf-dist/doc/latex/leftindex/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/leftindex/README.md	2024-02-01 21:06:24 UTC (rev 69659)
+++ trunk/Master/texmf-dist/doc/latex/leftindex/README.md	2024-02-01 21:06:33 UTC (rev 69660)
@@ -7,10 +7,11 @@
 
 ----------------------------------------------------------------
 leftindex -- left indices with better spacing
-Version: 0.1beta
+Version: 0.2beta
 Maintained by Sebastian Ørsted
 E-mail: sorsted at gmail.com
 Released under the LaTeX Project Public License v1.3c or later
+
 See http://www.latex-project.org/lppl.txt
 ----------------------------------------------------------------
 

Modified: trunk/Master/texmf-dist/doc/latex/leftindex/leftindex.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/leftindex/leftindex.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/leftindex/leftindex.tex	2024-02-01 21:06:24 UTC (rev 69659)
+++ trunk/Master/texmf-dist/doc/latex/leftindex/leftindex.tex	2024-02-01 21:06:33 UTC (rev 69660)
@@ -5,7 +5,7 @@
 \usepackage{babel}
 \usepackage{kpfonts,microtype}
 
-\usepackage{leftindex,listings,showexpl,xspace}
+\usepackage{leftindex,listings,showexpl}
 
 \usepackage[hidelinks]{hyperref}
 
@@ -35,9 +35,9 @@
 	explpreset={numbers=none,},
 }
 
-\newcommand\pkgleftindex{\texttt{leftindex}\xspace}
+\newcommand\pkgleftindex{\texttt{leftindex}}
 
-\title{\pkgleftindex\ -- left indices with better spacing (v0.1$\beta$)}
+\title{\pkgleftindex\ -- left indices with better spacing (v0.2$\beta$)}
 \date{\today}
 \author{Sebastian \O rsted (\href{mailto:sorsted at gmail.com}{sorsted at gmail.com})}
 
@@ -51,8 +51,8 @@
 \maketitle
 
 \noindent
-The package \pkgleftindex provides commands for typesetting left indices.
-Unlike any other similar package I know of, \pkgleftindex also indents the left superscript, providing much better spacing in general:
+The package \pkgleftindex\ provides commands for typesetting left indices.
+Unlike any other similar package I know of, \pkgleftindex\ also indents the left superscript, producing much better spacing in general:
 \[
 	\leftindex^a_b{f}
 	\qquad\text{(compare to $\leftindex[]^a_b{f}$)}
@@ -62,7 +62,7 @@
 the only way to accomplish this is to measure the negative indentation of the right subscript and then use that value.
 This works well for most symbols, with a few exceptions, which can be dealt with by
 supplying a few extra arguments.
-The package is a generalization of egreg's excellent code on
+The package is a generalization of egreg's excellent code found at
 \begin{center}
 	\url{https://tex.stackexchange.com/questions/557655/low-level-command-for-controlling-left-superscript-spacing/}
 \end{center}
@@ -69,7 +69,7 @@
 
 \chapter*{The commands}
 
-The fundamental, user-level command of~\pkgleftindex is called~\lstinline!\leftindex! and has
+The main user-level command of~\pkgleftindex\ is called~\lstinline!\leftindex! and has
 the syntax
 \begin{lstlisting}
 \leftindex^{@<left superscript>@}_{@<left subscript>@}{@<symbol>@}
@@ -87,7 +87,7 @@
 		f(x)\, dx
 \]
 \end{LTXexample}
-For the indentaiton of the left superscript, the package always
+For the indentaiton of the left superscript, the package by default
 uses the negative indentation of the right subscript. This yields good results
 most of the time, as seen above. However, there are cases where this goes wrong,
 the most notable example being the Greek letter~$ \Gamma $ in many fonts (not in Computer Modern, though). Less serious examples arise with letters like $P$ and $L$:
@@ -115,27 +115,42 @@
 $\leftindex[I]^a_b {L}$,
 $\leftindex[I]^a_b {P}$
 \end{LTXexample}
-The <slanting phantom> will never be used for calculating the height of the indices.
-For this, you can supply a <height phantom>:
+By default, the <slanting phantom> is also used for calculating the height of the indices.
+If this is not the behaviour you want, you can supply an additional <height phantom>:
 \begin{LTXexample}
 $\leftindex[][\Bigg|]^a_b{x}$
 \end{LTXexample}
 I doubt anyone will ever really need this much in practice, but the option is provided for completeness.
 
-I provide a more primitive, underlying command with four mandatory arguments:
+Sometimes, having to include the symbol as a mandatory argument can be a burden. For these cases, I also provide the command~\lstinline!\LeftIndex! with the syntax:
 \begin{lstlisting}
+\LeftIndex[@<slanting phantom>@][@<height phantom>@]
+			^{@<left superscript>@}_{@<left subscript>@}
+\end{lstlisting}
+Here, all arguments are optional.
+With this, we can do stuff like:
+\begin{LTXexample}
+$\LeftIndex^a_b \Gamma $,
+$\LeftIndex[]^a_b L $,
+$\LeftIndex[I]^a_b$,
+$\LeftIndex[I]^a_b$
+\end{LTXexample}
+
+
+I also provide the more primitive, underlying command with four mandatory arguments:
+\begin{lstlisting}
 \manualleftindex{@<height phantom>@}{@<slanting phantom>@}
 			{@<left superscript>@}{@<left subscript>@}
 \end{lstlisting}
 This one is mainly intended for use in commands and by other packages.
 Note that the arguments <height phantom> and <slanting phantom> have
-switched places compared to the command~\lstinline!\leftindex!.
+switched places compared to the commands \lstinline!\leftindex! and~\lstinline!\LeftIndex!.
 This is because <height phantom> is regarded as a ``more important''
 argument than <slanting phantom> from an implementation point of view,
 but the user is probably less likely to change it. Therefore,
-the user-level command~\lstinline!\leftindex! has <slanting phantom>
+the user-level commands \lstinline!\leftindex! and~\lstinline!\LeftIndex! have <slanting phantom>
 before <height phantom>.
-Note also that \lstinline!\manualleftindex! does not take a <symbol>;
+Note also that \lstinline!\manualleftindex! (like \lstinline!\LeftIndex!) does not take a <symbol>;
 you will have to write this yourself afterwards:
 \begin{LTXexample}
 $\manualleftindex{P}{I}{a}{b}$

Modified: trunk/Master/texmf-dist/tex/latex/leftindex/leftindex.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/leftindex/leftindex.sty	2024-02-01 21:06:24 UTC (rev 69659)
+++ trunk/Master/texmf-dist/tex/latex/leftindex/leftindex.sty	2024-02-01 21:06:33 UTC (rev 69660)
@@ -1,9 +1,9 @@
 \RequirePackage{xparse,mathtools}
-\ProvidesExplPackage{leftindex}{2020/08/25}{0.1beta}{}
+\ProvidesExplPackage{leftindex}{2024/01/31}{0.2beta}{}
 
 %----------------------------------------------------------------
 %	leftindex -- left indices with better spacing
-%	Version: 0.1beta
+%	Version: 0.2beta
 %	Maintained by Sebastian Ørsted
 %	E-mail: sorsted at gmail.com
 %	Released under the LaTeX Project Public License v1.3c or later
@@ -35,7 +35,7 @@
 			\manualleftindex { #2 } { #1 } { #3 } { #4 }
 		}
 		{
-			\manualleftindex { #5 } { #1 } { #3 } { #4 }
+			\manualleftindex { #1 } { #1 } { #3 } { #4 }
 		}
 	}
 	{
@@ -44,6 +44,27 @@
 	#5
 }
 
+\DeclareDocumentCommand\LeftIndex { o o E{^_}{{}{}} }
+{
+	% #1 = slanting phantom
+	% #2 = height phantom
+	% #3 = left superscript
+	% #4 = left subscript
+	\IfValueTF {#1}
+	{
+		\IfValueTF{#2}
+		{
+			\manualleftindex { #2 } { #1 } { #3 } { #4 }
+		}
+		{
+			\manualleftindex { #1 } { #1 } { #3 } { #4 }
+		}
+	}
+	{
+		\manualleftindex { } { } { #3 } { #4 }
+	}
+}
+
 \ExplSyntaxOn
 
 \cs_new_protected:Npn\leftindex_kern_horizontal:n#1
@@ -131,6 +152,7 @@
 				\box_wd:N \l__leftindex_subscript_temp_box
 			}
 		}
+		\mathop{}
 		\leftindex_kern_horizontal:n
 		{
 			\dim_max:nn
@@ -137,7 +159,6 @@
 				{ \l__leftindex_width_of_superscript_dim }
 				{ \l__leftindex_width_of_subscript_dim }
 		}
-		\mathop{}
 		\mathopen{ \vphantom { #2 } }
 		\tl_if_blank:nF { #4 }
 		{



More information about the tex-live-commits mailing list.