diff options
author | Karl Berry <karl@freefriends.org> | 2017-02-25 21:41:45 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-02-25 21:41:45 +0000 |
commit | 3d797d82462ff8ab78eec8320fae5e4a4b7d0257 (patch) | |
tree | aa21c77586ba7d09db1056295e840c67ac0ee244 /Master | |
parent | 17d62b3172733171d2d37939d4b509f99e4dc065 (diff) |
autobreak (25feb17)
git-svn-id: svn://tug.org/texlive/trunk@43337 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/autobreak/autobreak.pdf | bin | 538686 -> 546943 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/autobreak/autobreak.dtx | 143 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/autobreak/autobreak.ins | 4 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/autobreak/autobreak.sty | 59 |
4 files changed, 187 insertions, 19 deletions
diff --git a/Master/texmf-dist/doc/latex/autobreak/autobreak.pdf b/Master/texmf-dist/doc/latex/autobreak/autobreak.pdf Binary files differindex c61b24d0176..db7a9af0694 100644 --- a/Master/texmf-dist/doc/latex/autobreak/autobreak.pdf +++ b/Master/texmf-dist/doc/latex/autobreak/autobreak.pdf diff --git a/Master/texmf-dist/source/latex/autobreak/autobreak.dtx b/Master/texmf-dist/source/latex/autobreak/autobreak.dtx index f2bc88e2354..21bd1286d6c 100644 --- a/Master/texmf-dist/source/latex/autobreak/autobreak.dtx +++ b/Master/texmf-dist/source/latex/autobreak/autobreak.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright (C) 2016 by Takahiro Ueda <tueda@nikhef.nl> +% Copyright (C) 2016-2017 by Takahiro Ueda <tueda@nikhef.nl> % % This file may be distributed and/or modified under the conditions of % the LaTeX Project Public License, either version 1.3 of this license @@ -34,7 +34,7 @@ This is a generated file. -Copyright (C) 2016 by Takahiro Ueda <tueda@nikhef.nl> +Copyright (C) 2016-2017 by Takahiro Ueda <tueda@nikhef.nl> This file may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 of this license @@ -92,6 +92,7 @@ version 2005/12/01 or later. \documentclass{ltxdoc} \usepackage[T1]{fontenc} \usepackage{lmodern} +\usepackage{color} \usepackage{hypdoc} \usepackage{amsmath} \usepackage{autobreak} @@ -104,6 +105,12 @@ version 2005/12/01 or later. % The default value of IndexColumns=3 never fits in pages. \setcounter{IndexColumns}{2} +\definecolor{hilite}{rgb}{0.2,0.4,0.7} +\makeatletter +\renewcommand{\HDorg@theCodelineNo}{% + \textcolor{hilite}{\rmfamily\scriptsize\arabic{CodelineNo}}} +\makeatother + \providecommand\env[1]{\texttt{#1}} \providecommand\pkg[1]{\textsf{#1}} @@ -193,7 +200,7 @@ version 2005/12/01 or later. %</driver> % \fi % -% \CheckSum{330} +% \CheckSum{409} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -217,7 +224,7 @@ version 2005/12/01 or later. % to \pkg{autobreak}~\fileversion, dated \filedate.}} % \author{Takahiro Ueda} % -% \date{19 June 2016} +% \date{23 February 2017} % % \maketitle % @@ -459,6 +466,47 @@ version 2005/12/01 or later. % In the next run, the layout of the equations will be corrected. % % \begin{decl} +% |\MoveEqLeft|\oarg{number} +% \end{decl} +% This command is desinged to work like \cs{MoveEqLeft} of +% the \pkg{mathtools} package^^A +% \footnote{^^A +% \url{https://www.ctan.org/pkg/mathtools}. +% }. If it is put at the beginning of an \env{autobreak} environment, +% then all subsequent lines after the first line are indented by 2 em +% (the default value). +% \begin{example} +% \begin{align} +% \begin{autobreak} +% \MoveEqLeft +% (n_1+n_2+n_3+n_4)^3 = +% n_1^3 +% + 3 n_1^2 n_2 +% + 3 n_1 n_2^2 +% + n_2^3 +% + 3 n_1^2 n_3 +% + 6 n_1 n_2 n_3 +% + 3 n_2^2 n_3 +% + 3 n_1 n_3^2 +% + 3 n_2 n_3^2 +% + n_3^3 +% + 3 n_1^2 n_4 +% + 6 n_1 n_2 n_4 +% + 3 n_2^2 n_4 +% + 6 n_1 n_3 n_4 +% + 6 n_2 n_3 n_4 +% + 3 n_3^2 n_4 +% + 3 n_1 n_4^2 +% + 3 n_2 n_4^2 +% + 3 n_3 n_4^2 +% + n_4^3 . +% \end{autobreak} +% \end{align} +% \end{example} +% The indent width can be changed by an optional argument of +% the command. +% +% \begin{decl} % |\everybeforeautobreak| \marg{tokens} \\ % |\everyaftereautobreak| \marg{tokens} % \end{decl} @@ -598,7 +646,7 @@ version 2005/12/01 or later. %<*package> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{autobreak}% - [2016/07/03 v0.2 simple line breaking of long formulae] + [2017/02/23 v0.3 simple line breaking of long formulae] % \end{macrocode} % % \subsection{Registers and constants} @@ -886,7 +934,7 @@ version 2005/12/01 or later. \if@autobreak@newlinedef \else \PackageError{autobreak}{% - autobreak is not allowed here + autobreak is not allowed here% }{% Use autobreak inside align. }% @@ -926,6 +974,7 @@ version 2005/12/01 or later. \@autobreak@alltoks={}% \@autobreak@linetoks={}% \@autobreak@lhswidth=\z@ + \let\MoveEqLeft=\@autobreak@MoveEqLeft } % \end{macrocode} % \end{macro} @@ -1003,6 +1052,64 @@ version 2005/12/01 or later. }% } % \end{macrocode} +% Catch \cs{MoveEqLeft}. +% \changes{v0.3}{2017/02/23}{Add \cs{MoveEqLeft} command} +% \begin{macrocode} +\def\@autobreak@scanline@@@{% + \@ifnextchar\MoveEqLeft{% + \@autobreak@scanline@MoveEqLeft + }{% + \@autobreak@scanline@@@@ + }% +} +% \end{macrocode} +% The argument |#1| is \cs{MoveEqLeft}. This command accepts an +% optional number. +% \begin{macrocode} +\def\@autobreak@scanline@MoveEqLeft#1{% + \@ifnextchar[{% + \@autobreak@scanline@MoveEqLeft@ + }{% + \@autobreak@scanline@MoveEqLeft@[2]% + }% +} +% \end{macrocode} +% \begin{macrocode} +\def\@autobreak@scanline@MoveEqLeft@[#1]{% + \ifdim#1\p@>\z@ + \def\@tempa{\@autobreak@scanline@MvEqL@pos}% + \else\ifdim#1\p@=\z@ + \def\@tempa{\@autobreak@scanline@MvEqL@zero}% + \else + \def\@tempa{\@autobreak@scanline@MvEqL@neg}% + \fi\fi + \@tempa{#1}% +} +% \end{macrocode} +% \begin{macrocode} +\def\@autobreak@scanline@MvEqL@pos#1{% + \def\@tempa{\expandafter\@autobreak@scanline\kern#1em}% + \expandafter\@tempa\@autobreak@newlinechar\kern-#1em% +} +% \end{macrocode} +% In the case with |#1| = 0, a special treatment is required because \\ +% \cs{@autobreak@processline} ignores a zero width. Insert a very tiny +% space. +% \begin{macrocode} +\def\@autobreak@scanline@MvEqL@zero#1{% + \def\@tempa{\expandafter\@autobreak@scanline\kern1sp}% + \expandafter\@tempa\@autobreak@newlinechar\kern-1sp% +} +% \end{macrocode} +% In the case with |#1| < 0, put a very tiny space, and then put the +% space with a positive width such that the first line is indented to +% the right. +% \begin{macrocode} +\def\@autobreak@scanline@MvEqL@neg#1{% + \def\@tempa{\expandafter\@autobreak@scanline\kern1sp}% + \expandafter\@tempa\@autobreak@newlinechar\kern-1sp\kern-#1em% +} +% \end{macrocode} % One may expect \cs{input}\marg{file} in \env{autobreak} is expanded by % the file content and \env{autobreak} treats new lines in it correctly. % But it needs more work. Because handling of \cs{input} in the middle @@ -1012,15 +1119,15 @@ version 2005/12/01 or later. % \begin{macrocode} \IfFileExists{catchfile.sty}{ \RequirePackage{catchfile} - \def\@autobreak@scanline@@@{% + \def\@autobreak@scanline@@@@{% \@ifnextchar\input{% \@autobreak@scanline@input }{% \@autobreak@scanline }% - } + }% }{ - \def\@autobreak@scanline@@@{% + \def\@autobreak@scanline@@@@{% \@ifnextchar\input{% \PackageWarning{autobreak}{% Cannot handle new lines in a file via \protect\input, @@ -1028,7 +1135,7 @@ version 2005/12/01 or later. }% }% \@autobreak@scanline - } + }% } % \end{macrocode} % The argument |#1| is \cs{input} and |#2| is the file name. @@ -1040,6 +1147,22 @@ version 2005/12/01 or later. % \end{macrocode} % \end{macro} % +% \begin{macro}{\@autobreak@MoveEqLeft} +% This definition is expanded only when \cs{@autobreak@scanline} cannot +% detect \cs{MoveEqLeft} in an \env{autobreak} environment, in other +% words, when it appears in the middle of a line. +% \begin{macrocode} +\def\@autobreak@MoveEqLeft{% + \PackageError{autobreak}{% + \protect\MoveEqLeft\space is not allowed here% + }{% + \protect\MoveEqLeft\space must be put at the beginning of + an autobreak environment. + }% +} +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\@autobreak@processline} % \changes{v0.2}{2016/07/03}{Fix space calculation around alignment % tabs} diff --git a/Master/texmf-dist/source/latex/autobreak/autobreak.ins b/Master/texmf-dist/source/latex/autobreak/autobreak.ins index 297a2a52133..5b398fba830 100644 --- a/Master/texmf-dist/source/latex/autobreak/autobreak.ins +++ b/Master/texmf-dist/source/latex/autobreak/autobreak.ins @@ -8,7 +8,7 @@ %% %% This is a generated file. %% -%% Copyright (C) 2016 by Takahiro Ueda <tueda@nikhef.nl> +%% Copyright (C) 2016-2017 by Takahiro Ueda <tueda@nikhef.nl> %% %% This file may be distributed and/or modified under the conditions of %% the LaTeX Project Public License, either version 1.3 of this license @@ -28,7 +28,7 @@ This is a generated file. -Copyright (C) 2016 by Takahiro Ueda <tueda@nikhef.nl> +Copyright (C) 2016-2017 by Takahiro Ueda <tueda@nikhef.nl> This file may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 of this license diff --git a/Master/texmf-dist/tex/latex/autobreak/autobreak.sty b/Master/texmf-dist/tex/latex/autobreak/autobreak.sty index cbcae2874de..db28b94b058 100644 --- a/Master/texmf-dist/tex/latex/autobreak/autobreak.sty +++ b/Master/texmf-dist/tex/latex/autobreak/autobreak.sty @@ -8,7 +8,7 @@ %% %% This is a generated file. %% -%% Copyright (C) 2016 by Takahiro Ueda <tueda@nikhef.nl> +%% Copyright (C) 2016-2017 by Takahiro Ueda <tueda@nikhef.nl> %% %% This file may be distributed and/or modified under the conditions of %% the LaTeX Project Public License, either version 1.3 of this license @@ -22,7 +22,7 @@ %% \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{autobreak}% - [2016/07/03 v0.2 simple line breaking of long formulae] + [2017/02/23 v0.3 simple line breaking of long formulae] \newtoks\everybeforeautobreak \newtoks\everyafterautobreak \newtoks\@autobreak@alltoks @@ -132,7 +132,7 @@ \if@autobreak@newlinedef \else \PackageError{autobreak}{% - autobreak is not allowed here + autobreak is not allowed here% }{% Use autobreak inside align. }% @@ -151,6 +151,7 @@ \@autobreak@alltoks={}% \@autobreak@linetoks={}% \@autobreak@lhswidth=\z@ + \let\MoveEqLeft=\@autobreak@MoveEqLeft } \def\@autobreak@end{% \expandafter\@autobreak@addtoks\expandafter\@autobreak@alltoks @@ -200,17 +201,53 @@ \@autobreak@scanline@@@ }% } +\def\@autobreak@scanline@@@{% + \@ifnextchar\MoveEqLeft{% + \@autobreak@scanline@MoveEqLeft + }{% + \@autobreak@scanline@@@@ + }% +} +\def\@autobreak@scanline@MoveEqLeft#1{% + \@ifnextchar[{% + \@autobreak@scanline@MoveEqLeft@ + }{% + \@autobreak@scanline@MoveEqLeft@[2]% + }% +} +\def\@autobreak@scanline@MoveEqLeft@[#1]{% + \ifdim#1\p@>\z@ + \def\@tempa{\@autobreak@scanline@MvEqL@pos}% + \else\ifdim#1\p@=\z@ + \def\@tempa{\@autobreak@scanline@MvEqL@zero}% + \else + \def\@tempa{\@autobreak@scanline@MvEqL@neg}% + \fi\fi + \@tempa{#1}% +} +\def\@autobreak@scanline@MvEqL@pos#1{% + \def\@tempa{\expandafter\@autobreak@scanline\kern#1em}% + \expandafter\@tempa\@autobreak@newlinechar\kern-#1em% +} +\def\@autobreak@scanline@MvEqL@zero#1{% + \def\@tempa{\expandafter\@autobreak@scanline\kern1sp}% + \expandafter\@tempa\@autobreak@newlinechar\kern-1sp% +} +\def\@autobreak@scanline@MvEqL@neg#1{% + \def\@tempa{\expandafter\@autobreak@scanline\kern1sp}% + \expandafter\@tempa\@autobreak@newlinechar\kern-1sp\kern-#1em% +} \IfFileExists{catchfile.sty}{ \RequirePackage{catchfile} - \def\@autobreak@scanline@@@{% + \def\@autobreak@scanline@@@@{% \@ifnextchar\input{% \@autobreak@scanline@input }{% \@autobreak@scanline }% - } + }% }{ - \def\@autobreak@scanline@@@{% + \def\@autobreak@scanline@@@@{% \@ifnextchar\input{% \PackageWarning{autobreak}{% Cannot handle new lines in a file via \protect\input, @@ -218,12 +255,20 @@ }% }% \@autobreak@scanline - } + }% } \def\@autobreak@scanline@input#1#2{% \CatchFileDef\@tempa{#2}{\catcode`\^^M=\active}% \expandafter\@autobreak@scanline\@tempa } +\def\@autobreak@MoveEqLeft{% + \PackageError{autobreak}{% + \protect\MoveEqLeft\space is not allowed here% + }{% + \protect\MoveEqLeft\space must be put at the beginning of + an autobreak environment. + }% +} \def\@autobreak@processline#1{% \ifdim\@autobreak@lhswidth=\z@ \@autobreak@settowidth\@autobreak@lhswidth{#1{}}% |