diff options
author | Karl Berry <karl@freefriends.org> | 2017-07-13 23:10:09 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-07-13 23:10:09 +0000 |
commit | a24a44f88d5468496118875b7187a54cd0944e02 (patch) | |
tree | 17b2ee6f420729b1196c3d1e6533ae21a977821f /Master/texmf-dist/tex | |
parent | 578ec49378824cf4fd10539a2fda81485ef5ab24 (diff) |
marginfit (10jul17)
git-svn-id: svn://tug.org/texlive/trunk@44788 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/marginfit/marginfit.sty | 164 |
1 files changed, 164 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/marginfit/marginfit.sty b/Master/texmf-dist/tex/latex/marginfit/marginfit.sty new file mode 100644 index 00000000000..fbd174526f5 --- /dev/null +++ b/Master/texmf-dist/tex/latex/marginfit/marginfit.sty @@ -0,0 +1,164 @@ +%% +%% This is file `marginfit.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% marginfit.dtx (with options: `package') +%% +%% Copyright 2017 Maurice Leclaire <leclaire@in.tum.de> +%% +%% 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. The latest version of this license is in: +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `author-maintained'. +%% +%% This work consists of the files marginfit.dtx and marginfit.ins +%% and the derived file marginfit.sty. +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{marginfit}[2017/07/07 v1.0 Fit Margin Paragraphs] +\newinsert\marginfit@insert +\count\marginfit@insert0 +\skip\marginfit@insert\z@ +\dimen\marginfit@insert\maxdimen +\newbox\marginfit@reverse +\chardef\marginfit@box0 +\chardef\marginfit@left0 +\chardef\marginfit@right1 +\newcount\c@marginfit@w +\newcount\c@marginfit@r +\newcount\c@marginfit@t +\newdimen\marginfit@top +\newdimen\marginfit@min +\newdimen\marginfit@pos +\def\marginfit@writepos#1{% + \pdfsavepos% + \write\@auxout{\string\@newl@bel{label@marginfit}{#1}{\the\pdflastypos}}% +} +\def\marginfit@boxforeach#1#2{% + \setbox#1\vbox{\unvbox#1 \global\setbox\marginfit@box\lastbox}% + \ifvoid\marginfit@box\else% + #2% + \marginfit@boxforeach#1{#2}% + \fi% +} +\def\marginfit@pass@i{% + \setbox\marginfit@left\hbox{\unhbox\marginfit@box% + \global\setbox\marginfit@right\lastbox}% + \setbox\marginfit@right\hbox{\box\marginfit@right}% + \advance\marginfit@min\ht\marginfit@side% + \advance\marginfit@min\dp\marginfit@side% + \advance\marginfit@min\marginparpush% + \setbox\marginfit@reverse\vbox{\unvbox\marginfit@reverse% + \box\marginfit@side}% +} +\def\marginfit@pass@ii{% + \global\advance\c@marginfit@r\@ne% + \ifcsname label@marginfit@\the\c@marginfit@r @m\endcsname% + \marginfit@pos\csname label@marginfit@\the\c@marginfit@r @m\endcsname sp% + \fi% + \advance\marginfit@pos\ht\marginfit@box% + \ifdim\marginfit@pos<\marginfit@min% + \marginfit@pos\marginfit@min% + \fi% + \advance\marginfit@top-\marginfit@pos% + \ifdim\marginfit@top<\marginparpush% + \advance\marginfit@pos\marginfit@top% + \advance\marginfit@pos-\marginparpush% + \marginfit@top\marginparpush% + \fi% + \vskip\marginfit@top% + \marginfit@top\marginfit@pos% + \advance\marginfit@top-\ht\marginfit@box% + \advance\marginfit@top-\dp\marginfit@box% + \advance\marginfit@min-\ht\marginfit@box% + \advance\marginfit@min-\dp\marginfit@box% + \advance\marginfit@min-\marginparpush% + \hrule height\z@% + \box\marginfit@box% + \hrule height\z@% +}% +\def\marginfit@marginbox{% + \vbox to\@colht {% + \global\advance\c@marginfit@t\@ne% + \expandafter\marginfit@writepos\expandafter{\the\c@marginfit@t @t}% + \ifcsname label@marginfit@\the\c@marginfit@t @t\endcsname% + \marginfit@top\csname label@marginfit@\the\c@marginfit@t @t\endcsname sp% + \fi% + \marginfit@min\marginfit@top% + \advance\marginfit@min-\@colht% + \advance\marginfit@min-\marginparpush% + \advance\marginfit@top\marginparpush% + \vskip-\marginparpush% + \marginfit@boxforeach\marginfit@insert\marginfit@pass@i% + \marginfit@boxforeach\marginfit@reverse\marginfit@pass@ii% + \vfill% + }% +}% +\def\marginfit@leftmargin{% + \let\marginfit@side\marginfit@left% + \hss% + \marginfit@marginbox% + \hskip\marginparsep% + \box\@outputbox% +} +\def\marginfit@rightmargin{% + \let\marginfit@side\marginfit@right% + \box\@outputbox% + \hskip\marginparsep% + \marginfit@marginbox% + \hss% +} +\let\marginfit@makecol\@makecol +\def\@makecol{% + \marginfit@makecol% + \ifvoid\marginfit@insert\else% + \setbox\@outputbox\vbox to\@colht {% + \hbox to\columnwidth {% + \if@twocolumn% + \if@firstcolumn% + \marginfit@leftmargin% + \else% + \marginfit@rightmargin% + \fi% + \else% + \ifodd\c@page% + \marginfit@rightmargin% + \else% + \marginfit@leftmargin% + \fi% + \fi% + }% + }% + \fi% +} +\def\marginpar{% + \global\advance\c@marginfit@w\@ne% + \expandafter\marginfit@writepos\expandafter{\the\c@marginfit@w @m}% + \@ifnextchar[\marginfit@mpar@ii\marginfit@mpar@i% +} +\long\def\marginfit@mpar@i#1{% + \@savemarbox\marginfit@box{#1}% + \setbox\marginfit@box\hbox{\copy\marginfit@box\box\marginfit@box}% + \marginfit@mpar@iii% +} +\long\def\marginfit@mpar@ii[#1]#2{% + \@savemarbox\marginfit@left{#1}% + \@savemarbox\marginfit@right{#2}% + \setbox\marginfit@box\hbox{\box\marginfit@left\box\marginfit@right}% + \marginfit@mpar@iii% +} +\def\marginfit@mpar@iii{% + \insert\marginfit@insert{\box\marginfit@box}% +} +\endinput +%% +%% End of file `marginfit.sty'. |