summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/perfectcut
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-05-03 21:29:26 +0000
committerKarl Berry <karl@freefriends.org>2017-05-03 21:29:26 +0000
commit6f8c3f839a4825897b9fde0318c4fe0137b507b0 (patch)
tree5a7c161949388dc3ecf9d3400d9252049b7e582f /Master/texmf-dist/tex/latex/perfectcut
parent3ffb4c1426edf5831bcf0613d851e5e5eb734b79 (diff)
perfectcut (3may17)
git-svn-id: svn://tug.org/texlive/trunk@44175 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/perfectcut')
-rw-r--r--Master/texmf-dist/tex/latex/perfectcut/perfectcut.sty77
1 files changed, 41 insertions, 36 deletions
diff --git a/Master/texmf-dist/tex/latex/perfectcut/perfectcut.sty b/Master/texmf-dist/tex/latex/perfectcut/perfectcut.sty
index 87baaff7904..672333d6da0 100644
--- a/Master/texmf-dist/tex/latex/perfectcut/perfectcut.sty
+++ b/Master/texmf-dist/tex/latex/perfectcut/perfectcut.sty
@@ -2,23 +2,23 @@
%%%%%%%%%%%%%%%%%%%
%%%
%%% Author: Guillaume Munch-Maccagnoni
-%%% http://www.pps.univ-paris-diderot.fr/~munch/
-%%%
+%%% http://guillaume.munch.name/
+%%%
%%% This work may be distributed and/or modified under the conditions of
%%% the LaTeX Project Public License, either version 1.3 of this license
%%% or (at your option) any later version. Refer to the README file.
-%%%
%%%
-\ProvidesPackage{perfectcut}[03/11/2014 Perfect Cut v2.0]
+%%%
+\ProvidesPackage{perfectcut}[04/22/2017 Perfect Cut v2.2]
%%% Option processing
\newif\ifcut@mathstyle@
-\cut@mathstyle@true
+\cut@mathstyle@false
\newif\ifcut@realVert@
\cut@realVert@false
\newif\ifcut@fixxits@
\cut@fixxits@false
-\DeclareOption{nomathstyle}{\cut@mathstyle@false}
-\let\cutstyle\textstyle
+\DeclareOption{nomathstyle}{\cut@mathstyle@false}%backwards compat
+\DeclareOption{mathstyle}{\cut@mathstyle@true}
\DeclareOption{realVert}{\cut@realVert@true}
\DeclareOption{fixxits}{\cut@fixxits@true}
\ProcessOptions*
@@ -29,6 +29,7 @@
\newmuskip\cutbarskip
\newmuskip\cutinterbarskip
\newmuskip\cutangleouterskip
+\newmuskip\cutcasebarskip
\newif\ifcutdebug
%%% Exported commands
%%See end of file for a more detailed description of the commands
@@ -54,6 +55,7 @@
\cutangleskip=0.0mu plus 8mu minus 1.0mu
\cutangleouterskip=0.0mu plus 8mu minus 0.0mu
\cutinterbarskip=1.4mu plus 0mu minus 0mu
+\cutcasebarskip=3.0mu plus 5.0mu minus 1.5mu
\cutdebugfalse%% print the size after each \rangle?
%%% Various reimplementations of \left, \right and \middle.
%% \nthleft{4}\langle ==> fourth size of \langle; begins at 0
@@ -83,9 +85,12 @@
%% setting up mathstyle
\ifcut@mathstyle@
\RequirePackage{mathstyle}
- \def\currentcutstyle{\currentmathstyle}
+ \def\cut@currentcutstyle{\currentmathstyle}
+ \def\cut@setcurrentcutstyle{}
\else
- \def\currentcutstyle{\cutstyle}
+ \RequirePackage{scalerel}
+ \def\cut@setcurrentcutstyle{\ThisStyle}
+ \def\cut@currentcutstyle{\SavedStyle}
\fi
%% sets the behaviour of delimiters to always grow while evaluating #1
@@ -94,24 +99,24 @@
\global\delimitershortfall=-0.1pt%that's the trick to get perfect growth
\count0=\delimiterfactor%
\global\delimiterfactor=901\relax%
- \hbox{$\m@th\currentcutstyle#1$}%
+ \hbox{$\m@th\cut@currentcutstyle#1$}%
\global\delimitershortfall=\skip0%
\global\delimiterfactor=\count0%
}
%% scale #2 to size #1 (length)
\newcommand{\cut@resizetoheight}[2]{%
- \resizebox{!}{#1}{\hbox{$\m@th\currentcutstyle#2$}}%
+ \resizebox{!}{#1}{\hbox{$\m@th\cut@currentcutstyle#2$}}%
}
\newsavebox\cut@boxi
\newsavebox\cut@boxj
%% scale #2 to the size of #1. Assumes that #1 goes above and below the base line.
\newcommand{\cut@resizetoheightof}[2]{%
- \sbox{\cut@boxi}{$\m@th\currentcutstyle#1$}%
- \sbox{\cut@boxj}{$\m@th\currentcutstyle#2$}%
+ \sbox{\cut@boxi}{$\m@th\cut@currentcutstyle#1$}%
+ \sbox{\cut@boxj}{$\m@th\cut@currentcutstyle#2$}%
\raisebox{-\dp\cut@boxi}{%
- \resizebox{!}{\ht\cut@boxi+\dp\cut@boxi}{%
+ \resizebox{\width}{\ht\cut@boxi+\dp\cut@boxi}{%
\raisebox{\dp\cut@boxj}{\usebox{\cut@boxj}}%
}%
}%
@@ -128,17 +133,17 @@
%% used in order to have vertical bars of the perfect size
\newcommand{\cut@matchingldelim}[2]{\mathopen{\cut@resizetoheightof{#1}{\cut@nextldelim{#2}{#1}}}}
\newcommand{\cut@matchingrdelim}[2]{\mathclose{\cut@resizetoheightof{#1}{\cut@nextrdelim{#2}{#1}}}}
-\newcommand{\cut@matchingmdelim}[2]{\mathrel{\cut@resizetoheightof{#1}{\cut@nextmdelim{#2}{#1}}}}
+\newcommand{\cut@matchingmdelim}[2]{\mathord{\cut@resizetoheightof{#1}{\cut@nextmdelim{#2}{#1}}}}
%% gives the delimiter #2 which is immediately longer than #1 (length)
-\newcommand{\cut@lengthldelim}[2]{\mathopen{\cut@setshortfall{\cut@nextldelim#2{\rule[-0.101pt]{0pt}{#1}}}}}
-\newcommand{\cut@lengthrdelim}[2]{\mathclose{\cut@setshortfall{\cut@nextrdelim#2{\rule[-0.101pt]{0pt}{#1}}}}}
-\newcommand{\cut@lengthmdelim}[2]{\mathrel{\cut@setshortfall{\cut@nextmdelim#2{\rule[-0.101pt]{0pt}{#1}}}}}
+\newcommand{\cut@lengthldelim}[2]{\mathopen{\cut@setcurrentcutstyle{\cut@setshortfall{\cut@nextldelim#2{\rule[-0.101pt]{0pt}{#1}}}}}}
+\newcommand{\cut@lengthrdelim}[2]{\mathclose{\cut@setcurrentcutstyle{\cut@setshortfall{\cut@nextrdelim#2{\rule[-0.101pt]{0pt}{#1}}}}}}
+\newcommand{\cut@lengthmdelim}[2]{\mathord{\cut@setcurrentcutstyle{\cut@setshortfall{\cut@nextmdelim#2{\rule[-0.101pt]{0pt}{#1}}}}}}
-%% like the previous one but resized to exactly match #1 (length)
-\newcommand{\cut@reallengthldelim}[2]{\mathopen{\cut@resizetoheight{#1}{\cut@nextldelim#2{\rule[-0.101pt]{0pt}{#1}}}}}
-\newcommand{\cut@reallengthrdelim}[2]{\mathclose{\cut@resizetoheight{#1}{\cut@nextrdelim#2{\rule[-0.101pt]{0pt}{#1}}}}}
-\newcommand{\cut@reallengthmdelim}[2]{\mathrel{\cut@resizetoheight{#1}{\cut@nextmdelim#2{\rule[-0.101pt]{0pt}{#1}}}}}
+%% like the previous one but resized to exactly match #1 (length)
+\newcommand{\cut@reallengthldelim}[2]{\mathopen{\cut@setcurrentcutstyle{\cut@resizetoheight{#1}{\cut@nextldelim#2{\rule[-0.101pt]{0pt}{#1}}}}}}
+\newcommand{\cut@reallengthrdelim}[2]{\mathclose{\cut@setcurrentcutstyle{\cut@resizetoheight{#1}{\cut@nextrdelim#2{\rule[-0.101pt]{0pt}{#1}}}}}}
+\newcommand{\cut@reallengthmdelim}[2]{\mathord{\cut@setcurrentcutstyle{\cut@resizetoheight{#1}{\cut@nextmdelim#2{\rule[-0.101pt]{0pt}{#1}}}}}}
%I don't get anything about this bug which affects the
%alignment with respect to the math axis
@@ -165,10 +170,10 @@
\def\cut@tempnextdelim{#3{#2}}%
\cut@setshortfall{\cut@iter{#1}\cut@tempnextdelim}%
}
-%% \cut@nthxdelim gives the #1-th size of the delimiter #2
-\newcommand{\cut@nthldelim}[2]{\mathopen{\cut@nthdelim{#1}{#2}{\cut@nextldelim}}}
-\newcommand{\cut@nthrdelim}[2]{\mathclose{\cut@nthdelim{#1}{#2}{\cut@nextrdelim}}}
-\newcommand{\cut@nthmdelim}[2]{\mathrel{\cut@nthdelim{#1}{#2}{\cut@nextmdelim}}}
+%% \cut@nthxdelim gives the #1-th size of the delimiter #2
+\newcommand{\cut@nthldelim}[2]{\mathopen{\cut@setcurrentcutstyle{\cut@nthdelim{#1}{#2}{\cut@nextldelim}}}}
+\newcommand{\cut@nthrdelim}[2]{\mathclose{\cut@setcurrentcutstyle{\cut@nthdelim{#1}{#2}{\cut@nextrdelim}}}}
+\newcommand{\cut@nthmdelim}[2]{\mathord{\cut@setcurrentcutstyle{\cut@nthdelim{#1}{#2}{\cut@nextmdelim}}}}
%%%% now the main algorithm
@@ -209,9 +214,9 @@
%computing recursively
\setcounter{\cut@localheight}{-1}%
\expandafter\sbox\csname\cut@localsavebox{0}\endcsname%
- {$\m@th\currentcutstyle#2$}%
+ {$\m@th\cut@currentcutstyle#2$}%
\expandafter\sbox\csname\cut@localsavebox{1}\endcsname%
- {$\m@th\currentcutstyle#3$}%
+ {$\m@th\cut@currentcutstyle#3$}%
\addtocounter{\cut@localheight}{#1}%
%exporting values outside the local scope
\setcounter{cut@finalheight}{\value{\cut@localheight}}%
@@ -227,7 +232,7 @@
%% Calls to cut primitives inside #2 and #4 will have a smaller height.
%% Arguments #1, #3 and #5 can access the current height in two different
%% forms via \cut@n and \count0.
-\newcommand{\cut@computeBinary@IncreaseHeight}[5]{%
+\newcommand{\cut@computeBinary@IncreaseHeight}[5]{\cut@setcurrentcutstyle{%
\cut@computeBinary@main{1}{#2}{#4}%
\@ifundefined{c@\cut@localheight}{}{% if #2 and #4 did not contain any cut primitive
\ifnum\value{cut@finalheight}>\value{\cut@localheight}%
@@ -241,14 +246,14 @@
#3%
\usebox{\cut@boxright}%
#5%
-}
+}}
%% Displays #1#2#3#4#5. Arguments #2 and #4 can contain other cut primitives.
%% Does not increase the current height computed by cut primitives inside #2
%% and #4.
%% Arguments #1, #3 and #5 can access the current height in two different
%% forms via \cut@n and \count0.
-\newcommand{\cut@computeBinary@CurrentHeight}[5]{%
+\newcommand{\cut@computeBinary@CurrentHeight}[5]{\cut@setcurrentcutstyle{%
\cut@computeBinary@main{0}{#2}{#4}%
\ifnum\value{cut@finalheight}<0%
\setcounter{cut@finalheight}{0}%
@@ -265,14 +270,14 @@
#3%
\usebox{\cut@boxright}%
#5%
-}
+}}
%% Displays #1#2#3#4#5. Arguments #2 and #4 can contain other cut primitives.
%% Does not increase the current height computed by cut primitives inside #2
%% and #4 but the height to display is increased by 1.
%% Arguments #1, #3 and #5 can access the height height in two different
%% forms via \cut@n and \count0.
-\newcommand{\cut@computeBinary@CurrentHeightPlusOne}[5]{%
+\newcommand{\cut@computeBinary@CurrentHeightPlusOne}[5]{\cut@setcurrentcutstyle{%
\cut@computeBinary@main{0}{#2}{#4}
\@ifundefined{c@\cut@localheight}{}{% if #2 and #4 did not contain any cut primitive
\ifnum\value{cut@finalheight}>\value{\cut@localheight}%
@@ -287,7 +292,7 @@
#3%
\usebox{\cut@boxright}%
#5%
-}
+}}
%%% Implementation of the particular delimiters
@@ -382,9 +387,9 @@
{\nthleft{\cut@n}[%
\mskip\cutangleskip}%
{#1}%
- {\mskip\cutbarskip%
+ {\mskip\cutcasebarskip%
\cut@matchvert{\nthleft{\cut@n}[}%
- \mskip\cutbarskip}%
+ \mskip\cutcasebarskip}%
{#2}%
{\mskip\cutangleskip%
\nthright{\cut@n}]}%