texlive[56182] Master: leftindex (25aug20)

commits+karl at tug.org commits+karl at tug.org
Tue Aug 25 22:52:29 CEST 2020


Revision: 56182
          http://tug.org/svn/texlive?view=revision&revision=56182
Author:   karl
Date:     2020-08-25 22:52:29 +0200 (Tue, 25 Aug 2020)
Log Message:
-----------
leftindex (25aug20)

Modified Paths:
--------------
    trunk/Master/tlpkg/bin/tlpkg-ctan-check
    trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/leftindex/
    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/
    trunk/Master/texmf-dist/tex/latex/leftindex/leftindex.sty
    trunk/Master/tlpkg/tlpsrc/leftindex.tlpsrc

Added: trunk/Master/texmf-dist/doc/latex/leftindex/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/leftindex/README.md	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/leftindex/README.md	2020-08-25 20:52:29 UTC (rev 56182)
@@ -0,0 +1,29 @@
+leftindex -- left indices with better spacing
+--------------------------------------
+
+The package leftindex provides commands for typesetting left indices. Unlike
+any other similar package I know of, leftindex also indents the left superscript,
+providing much better spacing in general.
+
+----------------------------------------------------------------
+leftindex -- left indices with better spacing
+Version: 0.1beta
+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
+----------------------------------------------------------------
+
+Copyright (C) 2020 by Sebastian Ørsted <sorsted at gmail.com>
+
+The package is loaded via \usepackage{leftindex}
+
+This work may be distributed and/or modified under the
+conditions of the LaTeX Project Public License (LPPL), either
+version 1.3c of this license or (at your option) any later
+version.  The latest version of this license is in the file:
+
+http://www.latex-project.org/lppl.txt
+
+This work is "maintained" (as per LPPL maintenance status) by
+Sebastian Ørsted.
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/doc/latex/leftindex/README.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/leftindex/leftindex.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/leftindex/leftindex.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/leftindex/leftindex.pdf	2020-08-25 20:51:51 UTC (rev 56181)
+++ trunk/Master/texmf-dist/doc/latex/leftindex/leftindex.pdf	2020-08-25 20:52:29 UTC (rev 56182)

Property changes on: trunk/Master/texmf-dist/doc/latex/leftindex/leftindex.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/leftindex/leftindex.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/leftindex/leftindex.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/leftindex/leftindex.tex	2020-08-25 20:52:29 UTC (rev 56182)
@@ -0,0 +1,146 @@
+\documentclass[a4paper,article,oneside,10pt]{memoir}
+
+\usepackage[utf8]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage{babel}
+\usepackage{kpfonts,microtype}
+
+\usepackage{leftindex,listings,showexpl,xspace}
+
+\usepackage[hidelinks]{hyperref}
+
+\frenchspacing
+
+\newcommand\entrydescription[1]{%
+	\textlangle\textrm{\textit{#1}}\textrangle
+}
+
+\catcode`<=\active
+
+\def<#1>{\entrydescription{#1}}
+
+\lstset{
+	language=[LaTeX]TeX,
+	basicstyle=\ttfamily\small,
+	commentstyle=\itshape\ttfamily\small,
+	escapechar=@,
+	alsoletter=\\,
+	breaklines=true,
+	breakindent={0pt},
+	captionpos=t,
+	pos=r,
+	tabsize=2,
+	inputencoding=utf8,
+	extendedchars=true,
+	explpreset={numbers=none,},
+}
+
+\newcommand\pkgleftindex{\texttt{leftindex}\xspace}
+
+\title{\pkgleftindex\ -- left indices with better spacing (v0.1$\beta$)}
+\date{\today}
+\author{Sebastian \O rsted (\href{mailto:sorsted at gmail.com}{sorsted at gmail.com})}
+
+\hypersetup{
+	pdfauthor={Sebastian \O rsted},
+	pdftitle={leftindex -- left indices with better spacing},
+}
+
+\begin{document}
+
+\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:
+\[
+	\leftindex^a_b{f}
+	\qquad\text{(compare to $\leftindex[]^a_b{f}$)}
+	.
+\]
+As \TeX\ provides no metrics for the indentation of left superscripts,
+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
+\begin{center}
+	\url{https://tex.stackexchange.com/questions/557655/low-level-command-for-controlling-left-superscript-spacing/}
+\end{center}
+
+\chapter*{The commands}
+
+The fundamental, user-level command of~\pkgleftindex is called~\lstinline!\leftindex! and has
+the syntax
+\begin{lstlisting}
+\leftindex^{@<left superscript>@}_{@<left subscript>@}{@<symbol>@}
+\end{lstlisting}
+Both the arguments <left superscript> and <left subscript>
+are optional. Let us see it in action:
+\begin{LTXexample}
+$ \leftindex^a_b {f} $,
+$ \leftindex^t {X} $
+$ \leftindex_b {J} $,
+$ \leftindex_v^u {\Pi} $,
+$ \leftindex{A} $,
+\[
+	\leftindex^1_0 { \int }
+		f(x)\, dx
+\]
+\end{LTXexample}
+For the indentaiton of the left superscript, the package always
+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$:
+\begin{LTXexample}
+$ \Gamma^a_b $
+vs.
+$ \leftindex^a_b {\Gamma} $,
+$ L^a_b $
+vs.
+$ \leftindex^a_b {L} $,
+$ P^a_b $
+vs.
+$ \leftindex^a_b {P} $
+\end{LTXexample}
+To solve this issue, \lstinline!\leftindex! takes two
+additional, optional arguments:
+\begin{lstlisting}
+\leftindex[@<slanting phantom>@][@<height phantom>@]
+			^{@<left superscript>@}_{@<left subscript>@}{@<symbol>@}
+\end{lstlisting}
+The package will then use the <slanting phantom> instead of the <symbol> to calculate the indentation of the superscript. The argument can be left empty, in which
+case the left superscript will not be indented at all, which is the right solution for the symbol~$ \Gamma $:
+\begin{LTXexample}
+$\leftindex[]^a_b {\Gamma}$,
+$\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>:
+\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:
+\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!.
+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>
+before <height phantom>.
+Note also that \lstinline!\manualleftindex! does not take a <symbol>;
+you will have to write this yourself afterwards:
+\begin{LTXexample}
+$\manualleftindex{P}{I}{a}{b}$
+vs.
+$\manualleftindex{P}{I}{a}{b} P$
+\end{LTXexample}
+
+\end{document}
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/doc/latex/leftindex/leftindex.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/leftindex/leftindex.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/leftindex/leftindex.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/leftindex/leftindex.sty	2020-08-25 20:52:29 UTC (rev 56182)
@@ -0,0 +1,157 @@
+\RequirePackage{xparse,mathtools}
+\ProvidesExplPackage{leftindex}{2020/08/25}{0.1beta}{}
+
+%----------------------------------------------------------------
+%	leftindex -- left indices with better spacing
+%	Version: 0.1beta
+%	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
+%----------------------------------------------------------------
+
+\DeclareDocumentCommand\manualleftindex { mmmm }
+{
+	% #1 = height phantom
+	% #2 = slanting phantom
+	% #3 = left superscript
+	% #4 = left subscript
+	\mathpalette \__leftindex_auxiliary_mathpalette_command:nn { {#1}{#2}{#3}{#4} }
+}
+
+\ExplSyntaxOff
+
+\DeclareDocumentCommand\leftindex { o o E{^_}{{}{}} m }
+{
+	% #1 = slanting phantom
+	% #2 = height phantom
+	% #3 = left superscript
+	% #4 = left subscript
+	% #5 = symbol
+	\IfValueTF {#1}
+	{
+		\IfValueTF{#2}
+		{
+			\manualleftindex { #2 } { #1 } { #3 } { #4 }
+		}
+		{
+			\manualleftindex { #5 } { #1 } { #3 } { #4 }
+		}
+	}
+	{
+		\manualleftindex { #5 } { #5 } { #3 } { #4 }
+	}
+	#5
+}
+
+\ExplSyntaxOn
+
+\cs_new_protected:Npn\leftindex_kern_horizontal:n#1
+{
+	\kern #1 \relax
+}
+
+\cs_new_protected:Npn\leftindex_set_mathsurround_to_zero:
+{
+	 % This is equivalent to "\m at th"
+	\dim_set:Nn \mathsurround { 0pt }
+}
+
+\cs_new_protected:Npn\__leftindex_auxiliary_mathpalette_command:nn#1#2
+{
+	\__leftindex_auxiliary:nnnnn { #1 } #2
+}
+
+\dim_new:N\l__leftindex_phantom_height_dim
+
+\box_new:N \l__leftindex_slanting_phantom_with_subscript_box
+\dim_new:N \l__leftindex_slanting_phantom_with_subscript_dim
+
+\box_new:N \l__leftindex_slanting_phantom_with_subscript_without_indentation_box
+\dim_new:N \l__leftindex_slanting_phantom_with_subscript_without_indentation_dim
+
+\dim_new:N \l__leftindex_indentation_of_slanting_phantom_subscript
+
+\box_new:N \l__leftindex_superscript_temp_box
+\dim_new:N \l__leftindex_width_of_superscript_dim
+
+\box_new:N \l__leftindex_subscript_temp_box
+\dim_new:N \l__leftindex_width_of_subscript_dim
+
+\cs_new_protected:Npn\__leftindex_auxiliary:nnnnn#1#2#3#4#5
+{
+	\group_begin:
+		\hbox_set:Nn \l__leftindex_slanting_phantom_with_subscript_box
+			{ $ #1 #3 \sb{xxxxxx} $ }
+		\dim_set:Nn \l__leftindex_slanting_phantom_with_subscript_dim
+			{ \box_wd:N \l__leftindex_slanting_phantom_with_subscript_box }
+		\hbox_set:Nn \l__leftindex_slanting_phantom_with_subscript_without_indentation_box
+			{ $ #1 \hbox:n {$ #1 #3 $} \sb{xxxxxx} $ }
+		\dim_set:Nn \l__leftindex_slanting_phantom_with_subscript_without_indentation_dim
+			{ \box_wd:N \l__leftindex_slanting_phantom_with_subscript_without_indentation_box }
+		\dim_set:Nn \l__leftindex_indentation_of_slanting_phantom_subscript
+		{
+			\l__leftindex_slanting_phantom_with_subscript_without_indentation_dim
+			-
+			\l__leftindex_slanting_phantom_with_subscript_dim
+		}
+		\tl_if_blank:nTF { #4 }
+		{
+			\dim_zero:N \l__leftindex_width_of_superscript_dim
+		}
+		{
+			\hbox_set:Nn \l__leftindex_superscript_temp_box
+			{
+				$
+				\leftindex_set_mathsurround_to_zero:
+				#1 \sp { #4 }
+				$
+			}
+			\dim_set:Nn \l__leftindex_width_of_superscript_dim
+			{
+				\box_wd:N \l__leftindex_superscript_temp_box
+				-
+				\l__leftindex_indentation_of_slanting_phantom_subscript
+			}
+		}
+		\tl_if_blank:nTF { #5 }
+		{
+			\dim_zero:N \l__leftindex_width_of_subscript_dim
+		}
+		{
+			\hbox_set:Nn \l__leftindex_subscript_temp_box
+			{
+				$
+				\leftindex_set_mathsurround_to_zero:
+				#1 \sb { #5 }
+				$
+			}
+			\dim_set:Nn \l__leftindex_width_of_subscript_dim
+			{
+				\box_wd:N \l__leftindex_subscript_temp_box
+			}
+		}
+		\leftindex_kern_horizontal:n
+		{
+			\dim_max:nn
+				{ \l__leftindex_width_of_superscript_dim }
+				{ \l__leftindex_width_of_subscript_dim }
+		}
+		\mathop{}
+		\mathopen{ \vphantom { #2 } }
+		\tl_if_blank:nF { #4 }
+		{
+			\sp {
+				\mathmakebox[0pt][l]{
+					\mathmakebox[ \l__leftindex_indentation_of_slanting_phantom_subscript ][r]{ #4 }
+				}
+			}
+		}
+		\tl_if_blank:nF { #5 }
+		{
+			\sb {
+				\mathmakebox[0pt][r]{ #5 }
+			}
+		}
+	\group_end:
+}
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/tex/latex/leftindex/leftindex.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check	2020-08-25 20:51:51 UTC (rev 56181)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check	2020-08-25 20:52:29 UTC (rev 56182)
@@ -435,7 +435,7 @@
     latexmk latexmp latexpand
     latino-sine-flexione lato layaureo layouts lazylist
     lccaps lcd lcg lcyw leading leadsheets leaflet
-    lecturer lectures ledmac leftidx leipzig lengthconvert
+    lecturer lectures ledmac leftidx leftindex leipzig lengthconvert
     letltxmacro letterspacing letterswitharrows lettre lettrine
     levy lewis lexend lexikon lexref
     lfb lgreek lh lhcyr lhelp

Modified: trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc	2020-08-25 20:51:51 UTC (rev 56181)
+++ trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc	2020-08-25 20:52:29 UTC (rev 56182)
@@ -673,6 +673,7 @@
 depend leaflet
 depend lectures
 depend leftidx
+depend leftindex
 depend leipzig
 depend lengthconvert
 depend lettre

Added: trunk/Master/tlpkg/tlpsrc/leftindex.tlpsrc
===================================================================


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