diff options
author | Karl Berry <karl@freefriends.org> | 2013-08-06 22:25:47 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-08-06 22:25:47 +0000 |
commit | 31a1ab5cea8b9eecd632b1320274f474b83dad88 (patch) | |
tree | 98712381611794c01f436965d85270b9dfe8ceb2 /Master/texmf-dist/tex/latex/stackengine | |
parent | f7542e8c8eb40cdaf2f500bae11970fa96a3b11b (diff) |
stackengine (6aug13)
git-svn-id: svn://tug.org/texlive/trunk@31367 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/stackengine')
-rw-r--r-- | Master/texmf-dist/tex/latex/stackengine/stackengine.sty | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/Master/texmf-dist/tex/latex/stackengine/stackengine.sty b/Master/texmf-dist/tex/latex/stackengine/stackengine.sty index d58573f55e2..9d900389072 100644 --- a/Master/texmf-dist/tex/latex/stackengine/stackengine.sty +++ b/Master/texmf-dist/tex/latex/stackengine/stackengine.sty @@ -1,6 +1,6 @@ -\def\stackengineversionnumber{v2.0} +\def\stackengineversionnumber{v3.0} \ProvidesPackage{stackengine} -[2013/07/11 \stackengineversionnumber +[2013/08/06 \stackengineversionnumber Stacking text and objects in convenient ways] % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -23,10 +23,10 @@ % -Added \toplap and \bottomlap. % -Disallowed \quietstack for lapping. % -added \abovebaseline - +% V3.0 -Added \stackMath and \stackText macros to treat arguments, +% by default, in math mode or not. \usepackage{calc} \usepackage{readarray} - \newcounter{stackindex} \newlength\boxshift \newlength\stack@tmplength @@ -34,7 +34,6 @@ \newsavebox\addedbox \newsavebox\anchorbox \newsavebox\stackedbox - %% Following 3 lines thanks to Prof. Enrico Gregorio, from: %% http://tex.stackexchange.com/questions/42318/ %% removing-a-backslash-from-a-character-sequence @@ -49,8 +48,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%% THIS VERSION 1.0 SYNTAX WAS PHASED OUT %%%%%%%%%%%%%%%%%%% %%%%% (but can invoke with \usepackage[oldsyntax]{stackengine} ) -\newlength\Sstackgap -\newlength\Lstackgap +\newlength\Sstackgap\newlength\Lstackgap \newcommand\stackgap{\if S\stacktype\the\Sstackgap\else\the\Lstackgap\fi} \global\setlength{\Sstackgap}{3pt} \global\setlength{\Lstackgap}{\baselineskip} @@ -61,12 +59,8 @@ % improve this package. See: % http://tex.stackexchange.com/questions/123443/ % defining-a-length-that-scales-with-fontsize-changes/123470#123470 -\newcommand{\setstackgap}[2]{% - \@namedef{#1stackgap}{#2}% -} -\newcommand\stackgap{% - \@nameuse{\if S\stacktype S\else L\fi stackgap}\relax -} +\newcommand{\setstackgap}[2]{\@namedef{#1stackgap}{#2}} +\newcommand\stackgap{\@nameuse{\if S\stacktype S\else L\fi stackgap}\relax} \setstackgap{S}{3pt}% SHORTSTACKING GAP BETWEEN ITEMS (SAME AS \shortstack) \setstackgap{L}{\baselineskip}% LONGSTACKING GAP BETWEEN ITEMS (def. \baselineskip) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -79,6 +73,10 @@ % L for constant baselineskip longstack \def\usestackstrut{T}% +\global\def\stack@delim{} +\newcommand\stackMath{\global\def\stack@delim{$}} +\newcommand\stackText{\global\def\stack@delim{}} + %\stackengine{\Sstackgap or \Lstackgap or \stackgap or stacklength} % {anchor} % {item} @@ -89,12 +87,12 @@ % {\stacktype or S or L} \newcommand*\stackengine[8]{% \sbox{\stackedbox}{% - \sbox{\anchorbox}{#2}% - \sbox{\addedbox}{#3}% - \settowidth{\stackedboxwidth}{#2}% + \sbox{\anchorbox}{\stack@delim#2\stack@delim}% + \sbox{\addedbox}{\stack@delim#3\stack@delim}% + \settowidth{\stackedboxwidth}{\stack@delim#2\stack@delim}% \if F#7% \ifdim\wd\addedbox>\stackedboxwidth% - \settowidth{\stackedboxwidth}{#3}% + \settowidth{\stackedboxwidth}{\stack@delim#3\stack@delim}% \fi% \fi% \setlength{\boxshift}{#1}% @@ -115,14 +113,14 @@ \usebox{\anchorbox}% \hspace{-.5\wd\anchorbox}% \hspace{-.5\wd\addedbox}% - \raisebox{\boxshift}{#3}% + \raisebox{\boxshift}{\stack@delim#3\stack@delim}% \hspace{-.5\wd\addedbox}% \hspace{.5\stackedboxwidth}% \else% \if l#5% \usebox{\anchorbox}% \hspace{-\wd\anchorbox}% - \raisebox{\boxshift}{#3}% + \raisebox{\boxshift}{\stack@delim#3\stack@delim}% \hspace{-\wd\addedbox}% \hspace{\stackedboxwidth}% \else% @@ -131,7 +129,7 @@ \hspace{-\wd\anchorbox}% \usebox{\anchorbox}% \hspace{-\wd\addedbox}% - \raisebox{\boxshift}{#3}% + \raisebox{\boxshift}{\stack@delim#3\stack@delim}% \fi% \fi% \fi% @@ -164,7 +162,8 @@ \def\@stacksign{}% \def\@stackcondition{\thestackindex < \narg}% \fi% - \sbox{\stackedbox}{\csname arg\roman{stackindex}\endcsname}% + \sbox{\stackedbox}{% + \stack@delim\csname arg\roman{stackindex}\endcsname\stack@delim}% \whiledo{\@stackcondition}{% \addtocounter{stackindex}{\@stacksign 1}% \stackengine{\csname#4stackgap\endcsname}% @@ -228,7 +227,7 @@ {\setlength{\stack@tmplength}{#3}}% \ifthenelse{\equal{#4}{}}{\def\stack@tmp{0pt}}{\def\stack@tmp{#4}}% \def\stack@lroffset{\rule{\stack@tmp}{0pt}}% - \addtolength{\stack@tmplength}{\heightof{#1}}% + \addtolength{\stack@tmplength}{\heightof{\stack@delim#1\stack@delim}}% \stackengine{-\stack@tmplength}{#2}{\stack@lroffset#1\stack@lroffset}% {#5}{\stackalignment}{\quietstack}{\useanchorwidth}{S}% } |