diff options
author | Karl Berry <karl@freefriends.org> | 2013-11-22 23:06:07 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-11-22 23:06:07 +0000 |
commit | 413dfb22f91764cea55e05185c26ac518e63ec56 (patch) | |
tree | a7f0c96bf6981db626f405b5c84402a14a9be78d /Master/texmf-dist/source | |
parent | 83470ceeb76cf871b770463e5b2a7c4b2d0b2ac3 (diff) |
fouridx (22nov13)
git-svn-id: svn://tug.org/texlive/trunk@32214 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/fouridx/fouridx.dtx | 90 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/fouridx/fouridx.ins | 2 |
2 files changed, 78 insertions, 14 deletions
diff --git a/Master/texmf-dist/source/latex/fouridx/fouridx.dtx b/Master/texmf-dist/source/latex/fouridx/fouridx.dtx index b912b84d9d6..54ddce209fa 100644 --- a/Master/texmf-dist/source/latex/fouridx/fouridx.dtx +++ b/Master/texmf-dist/source/latex/fouridx/fouridx.dtx @@ -1,12 +1,12 @@ % \iffalse meta comment -% File: fouridx.dtx Copyright (C) 2008 Stefan Karrmann +% File: fouridx.dtx Copyright (C) 2008, 2013 Stefan Karrmann % \fi % % \iffalse % %<*package> -\def\fileversion{1.00} -\def\filedate{2008/03/27} +\def\fileversion{2.00} +\def\filedate{2013/11/21} %</package> %<*driver> \documentclass{ltxdoc} @@ -40,7 +40,7 @@ \DoNotIndex{\ifnum,\fi,\expandafter} \CodelineNumbered \RecordChanges -\CheckSum{39} +\CheckSum{138} \begin{document} \DocInput{fouridx.dtx} \end{document} @@ -49,6 +49,9 @@ % % \changes{1.00}{2008/03/27}{Used leftidx.dtx as a template for the % English documentation}% +% \changes{2.00}{2013/11/21}{Bug fixed when line break happens +% directly at the fouridx command. Thanks to Tilman Schr\"oder. +% Respect math styles and enables nested calls.}% % % \maketitle % \begin{abstract} @@ -63,7 +66,7 @@ % \tableofcontents % % \section*{Copyright} -% Copyright 2007 Stefan Karrmann. +% Copyright 2007, 2013 Stefan Karrmann. % % This program can be redistributed and/or modified under the terms % of the LaTeX Project Public License Distributed from CTAN @@ -145,7 +148,43 @@ % \begin{minipage}[c]{0.19\linewidth} % $\fourIdx{(k)}{n}{x}{\overline x\vert}A$ % \end{minipage} -% +% \subsection{Old bugs/regression}{ +% \newcommand{\fourIdxOld}[5]{% +% \setbox1=\hbox{\ensuremath{^{#1}}}% +% \setbox2=\hbox{\ensuremath{_{#2}}}% +% \setbox5=\hbox{\ensuremath{#5}}% +% \hspace{\ifnum\wd1>\wd2\wd1\else\wd2\fi}% +% \ensuremath{\copy5^{\hspace{-\wd1}\hspace{-\wd5}#1\hspace{\wd5}#3}% +% _{\hspace{-\wd2}\hspace{-\wd5}#2\hspace{\wd5}#4}% +% }} +% \def\exA{\fourIdxOld 12345} +% \begin{tabular}[c]{llcc} +% Error & version & old & actual \\ +% \hline +% math style ignored & 1.00 & \(1_{\exA}\) & \(1_{\fourIdx12345}\) \\[1ex] +% \hline +% hang over at left after line breaks & 1.00 &\rule[-3ex]{0cm}{7ex} +% \begin{minipage}{2cm}\noindent\strut\rule{1pt}{2ex}Start of +% line\hfil\break\exA +% \end{minipage} +% & +% \begin{minipage}{2cm}\noindent\rule{1pt}{2ex}Start of +% line\hfil\break$\fourIdx12345$ +% \end{minipage} \\[1ex] +% \hline +% wrong positions if nested & 1.00 & \rule{0cm}{5ex} +% $\vert\fourIdxOld{\fourIdxOld{1}{2}34{51}}{2}{3x}{4}{\fourIdxOld{1}{2}{3}{4}{52}}\vert$ +% & +% $\vert\fourIdx{\fourIdx{1}{2}34{51}}{2}{3x}{4}{\fourIdx{1}{2}{3}{4}{52}}\vert$ +% \\[1ex] +% \hline +% \end{tabular} +% } +% \subsection{Comparison with sideset} +% The command sideset from the amsmath package has similiar functionality. +% It requires that the central box is a math operator an it typesets the +% left super- and subscript left aligned while fourIdx uses right +% alignment. Which suits better depends on the purpose. % \section{Usage of the package} % % One command is provided by the package. @@ -191,16 +230,41 @@ \ProvidesPackage{fouridx}[\filedate\space v\fileversion\space Four indices] % \end{macrocode} % \begin{macro}{\fourIdx} +% \changes{2.00}{2013/11/21}{Bug fix at line breaks, nested calls, and math +% styles}% % \changes{1.00}{2008/03/27}{Implementation simplyfied}% -% Command for left indices. +% Command for left and right indices. % \begin{macrocode} \newcommand{\fourIdx}[5]{% - \setbox1=\hbox{\ensuremath{^{#1}}}% - \setbox2=\hbox{\ensuremath{_{#2}}}% - \setbox5=\hbox{\ensuremath{#5}}% - \hspace{\ifnum\wd1>\wd2\wd1\else\wd2\fi}% - \ensuremath{\copy5^{\hspace{-\wd1}\hspace{-\wd5}#1\hspace{\wd5}#3}% - _{\hspace{-\wd2}\hspace{-\wd5}#2\hspace{\wd5}#4}% + \ensuremath{\mathchoice% + {{\setbox1=\hbox{$\scriptstyle{#1}$}% + \setbox2=\hbox{$\scriptstyle{#2}$}% + \setbox5=\hbox{$\displaystyle{#5}$}% + \hspace*{\ifnum\wd1>\wd2\wd1\else\wd2\fi}% + \copy5^{\scriptstyle\hspace{-\wd1}\hspace{-\wd5}#1\hspace{\wd5}#3}% + _{\scriptstyle\hspace{-\wd2}\hspace{-\wd5}#2\hspace{\wd5}#4}% + }}% display + {{\setbox1=\hbox{$\scriptstyle{#1}$}% + \setbox2=\hbox{$\scriptstyle{#2}$}% + \setbox5=\hbox{$\textstyle{#5}$}% + \hspace*{\ifnum\wd1>\wd2\wd1\else\wd2\fi}% + \copy5^{\scriptstyle\hspace{-\wd1}\hspace{-\wd5}#1\hspace{\wd5}#3}% + _{\scriptstyle\hspace{-\wd2}\hspace{-\wd5}#2\hspace{\wd5}#4}% + }}% text + {{\setbox1=\hbox{$\scriptscriptstyle{#1}$}% + \setbox2=\hbox{$\scriptscriptstyle{#2}$}% + \setbox5=\hbox{$\scriptstyle{#5}$}% + \hspace*{\ifnum\wd1>\wd2\wd1\else\wd2\fi}% + \copy5^{\scriptscriptstyle\hspace{-\wd1}\hspace{-\wd5}#1\hspace{\wd5}#3}% + _{\scriptscriptstyle\hspace{-\wd2}\hspace{-\wd5}#2\hspace{\wd5}#4}% + }}% script + {{\setbox1=\hbox{$\scriptscriptstyle{#1}$}% + \setbox2=\hbox{$\scriptscriptstyle{#2}$}% + \setbox5=\hbox{$\scriptscriptstyle{#5}$}% + \hspace*{\ifnum\wd1>\wd2\wd1\else\wd2\fi}% + \copy5^{\scriptscriptstyle\hspace{-\wd1}\hspace{-\wd5}#1\hspace{\wd5}#3}% + _{\scriptscriptstyle\hspace{-\wd2}\hspace{-\wd5}#2\hspace{\wd5}#4}% + }}% scriptscript }} % \end{macrocode} % \end{macro} diff --git a/Master/texmf-dist/source/latex/fouridx/fouridx.ins b/Master/texmf-dist/source/latex/fouridx/fouridx.ins index 8e2a208d084..2e7022b44f2 100644 --- a/Master/texmf-dist/source/latex/fouridx/fouridx.ins +++ b/Master/texmf-dist/source/latex/fouridx/fouridx.ins @@ -3,7 +3,7 @@ fouridx package - Copyright 2008 Stefan Karrmann + Copyright 2008, 2013 Stefan Karrmann This program can be redistributed and/or modified under the terms of the LaTeX Project Public License Distributed from CTAN |