summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/tensor
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2023-07-18 19:50:54 +0000
committerKarl Berry <karl@freefriends.org>2023-07-18 19:50:54 +0000
commitd91f395622b96ab32de87ff9a386815a87545ebc (patch)
tree1e7d6b3a9789290bbdf12825452b67ffa365b03f /Master/texmf-dist/tex/latex/tensor
parentbc9800f8f351db013125c75b129b2671a137853e (diff)
tensor (18jul23)
git-svn-id: svn://tug.org/texlive/trunk@67667 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/tensor')
-rw-r--r--Master/texmf-dist/tex/latex/tensor/tensor.sty97
1 files changed, 70 insertions, 27 deletions
diff --git a/Master/texmf-dist/tex/latex/tensor/tensor.sty b/Master/texmf-dist/tex/latex/tensor/tensor.sty
index 92c31410fb3..5f2a6994f23 100644
--- a/Master/texmf-dist/tex/latex/tensor/tensor.sty
+++ b/Master/texmf-dist/tex/latex/tensor/tensor.sty
@@ -6,21 +6,34 @@
%%
%% tensor.dtx (with options: `package')
%%
-%% Copyright (C) 2004 by Philip G. Ratcliffe <philip.ratcliffe@uninsubria.it>
+%% Copyright (C) 2023 Philip G. Ratcliffe <philip.ratcliffe@uninsubria.it>
%%
-%% This file may be distributed and/or modified under the conditions of
-%% the LaTeX Project Public License, either version 1.2 of this license
-%% or (at your option) any later version. The latest version of this
-%% license is in:
+%% It 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
%%
-%% and version 1.2 or later is part of all distributions of LaTeX
-%% version 1999/12/01 or later.
+%% This file is part of the "tensor package" (the Work in LPPL)
+%% and all files in that package must be distributed together.
%%
+%% The released version of this package is available from CTAN.
+%%
+%% File: tensor.dtx
+%%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{tensor}
- [2004/12/20 v2.1 tensor indices package (PGR)]
+ [2023/07/18 v2.2 tensor indices package (PGR)]
+\newif\iftnsr@Aln
+\DeclareOption{align}{\tnsr@Alntrue}
+\newif\iftnsr@Txt
+\DeclareOption{text}{\tnsr@Txttrue}
+\newif\iftnsr@Sma \tnsr@Smatrue
+\DeclareOption{nosmash}{\tnsr@Smafalse}
+\newif\iftnsr@Str \tnsr@Strtrue
+\DeclareOption{nostrut}{\tnsr@Strfalse}
+\ProcessOptions
\DeclareRobustCommand\tensor{%
\tnsr@Prp
\@ifstar{\tnsr@Spcfalse\tnsr@Aux}{\tnsr@Spctrue\tnsr@Aux}%
@@ -34,31 +47,35 @@
\ncld@Aux
}
\newcommand\nuclideFont{\mathrm}
+\newcommand\massnumFont{\nuclideFont}
\newtoks\tnsr@Sps
\newtoks\tnsr@Sbs
\newtoks\tnsr@Spe
\newtoks\tnsr@Sbe
\newtoks\ncld@Mno
\newif\iftnsr@Spc
+\newcommand\tnsr@Wrn{}
\newcommand\tnsr@Prp{%
\tnsr@Sps{}%
\tnsr@Sbs{}%
- \let\tnsr@Wrn\relax
+ \def\tnsr@Wrn{}
}
\newcommand\ndcs@Aux[1]{%
- \def\tnsr@Obj{}
+ \tnsr@Erx
+ \def\tnsr@Obj{}%
\tnsr@Set{#1}%
\tnsr@Fin
\tnsr@Wrn
}
\newcommand\tnsr@Aux[3][]{%
+ \tnsr@Erx
\mathpalette{\tnsr@Plt{#1}{#3}}{#2}%
\tnsr@Wrn
}
\newcommand\tnsr@Plt[4]{%
- \def\tnsr@Obj{#3#4}
- \def\reserved@a{#1}%
- \ifx\reserved@a\@empty\else
+ \def\tnsr@Obj{#3#4}%
+ \def\tnsr@Tmp{#1}%
+ \ifx\tnsr@Tmp\@empty\else
\tnsr@Set{#1}%
\hphantom{{}\tnsr@Fin}%
\tnsr@Sps\expandafter{%
@@ -86,12 +103,12 @@
\ifx#1\tnsr@Err
\let\tnsr@Nxt\relax
\else
- \ifx#1*
+ \if#1*
\iftnsr@Spc
\gdef\tnsr@Wrn{%
\PackageWarning{tensor}{%
- `*' not allowed in argument here, I am ignoring it,%
- \MessageBreak remove it or use `\string\tensor*',%
+ '*' not allowed in argument here; I shall ignore it.%
+ \MessageBreak Either remove it or use '\string\tensor*'%
}%
}%
\else
@@ -99,10 +116,10 @@
\fi
\let\tnsr@Nxt\tnsr@Pro
\else
- \ifx#1^
+ \if#1^
\def\tnsr@Nxt{\tnsr@Add{\tnsr@Sps}{\tnsr@Sbs}{\tnsr@Spe}}%
\else
- \ifx#1_
+ \if#1_
\def\tnsr@Nxt{\tnsr@Add{\tnsr@Sbs}{\tnsr@Sps}{\tnsr@Sbe}}%
\else
\tnsr@Err
@@ -124,13 +141,13 @@
\tnsr@Sbs\expandafter\expandafter\expandafter{%
\expandafter\the\expandafter\tnsr@Sbs
\expandafter\kern\the\@tempdima
- }
+ }%
\else
\@tempdima=-\@tempdima
\tnsr@Sps\expandafter\expandafter\expandafter{%
\expandafter\the\expandafter\tnsr@Sps
\expandafter\kern\the\@tempdima
- }
+ }%
\fi
\fi
}
@@ -149,18 +166,44 @@
\makebox[\@tempdima][c]{$\m@th#1\indexmarker$}%
}
\newcommand\indexmarker{}
-\newcommand\tnsr@Fin{^{\the\tnsr@Sps}_{\the\tnsr@Sbs}}
+\newcommand\tnsr@Fin{%
+ ^{\tensorSmash{\the\tnsr@Sps}\tnsr@Str}%
+ _{\tensorSmash{\the\tnsr@Sbs}\tnsr@Str}%
+}
+\let\tensorSmash\relax
+\iftnsr@Aln
+ \iftnsr@Sma
+ \let\tensorSmash\smash
+ \fi
+\fi
+\newcommand\tensorStrut{}
+\let\tnsr@Str\relax
+\iftnsr@Aln
+ \iftnsr@Str
+ \renewcommand\tensorStrut{\vphantom{jl}}
+ \iftnsr@Txt
+ \def\tnsr@Str{\tensorStrut}
+ \else
+ \everydisplay\expandafter{\the\everydisplay\let\tnsr@Str\tensorStrut}
+ \fi
+ \fi
+\fi
\newcommand\ncld@Aux[2][]{%
\ensuremath{%
- \tensor*[^{\nuclideFont{\the\ncld@Mno}}_{\nuclideFont{#1}}]%
+ \tensor*[^{\massnumFont{\the\ncld@Mno}}_{\massnumFont{#1}}]%
{\mkern1mu{\mathit{\nuclideFont{#2}}{}}}{}%
}%
}
-\newcommand\tnsr@Err{%
- \PackageError{tensor}{%
- Sub/Superscript items out of order\on@line,
- \MessageBreak some index tokens may now have been lost%
- }{An index string has an extra or missing `^' or `_' token.}%
+\newcommand\tnsr@Err{}
+\newcommand\tnsr@Erx{%
+ \def\tnsr@Err{%
+ \global\let\tnsr@Err\relax
+ \PackageError{tensor}{%
+ Misordered sub/superscript items\on@line;
+ \MessageBreak index tokens may have been lost.
+ \MessageBreak Press <return> and I shall try to continue%
+ }{Index string probably has extra/missing '^' or '_'.}%
+ }%
}
\endinput
%%