texlive[44788] Master: marginfit (10jul17)
commits+karl at tug.org
commits+karl at tug.org
Fri Jul 14 01:10:10 CEST 2017
Revision: 44788
http://tug.org/svn/texlive?view=revision&revision=44788
Author: karl
Date: 2017-07-14 01:10:09 +0200 (Fri, 14 Jul 2017)
Log Message:
-----------
marginfit (10jul17)
Modified Paths:
--------------
trunk/Master/tlpkg/bin/tlpkg-ctan-check
trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
Added Paths:
-----------
trunk/Master/texmf-dist/doc/latex/marginfit/
trunk/Master/texmf-dist/doc/latex/marginfit/Makefile
trunk/Master/texmf-dist/doc/latex/marginfit/README
trunk/Master/texmf-dist/doc/latex/marginfit/marginfit.pdf
trunk/Master/texmf-dist/source/latex/marginfit/
trunk/Master/texmf-dist/source/latex/marginfit/marginfit.dtx
trunk/Master/texmf-dist/source/latex/marginfit/marginfit.ins
trunk/Master/texmf-dist/tex/latex/marginfit/
trunk/Master/texmf-dist/tex/latex/marginfit/marginfit.sty
trunk/Master/tlpkg/tlpsrc/marginfit.tlpsrc
Added: trunk/Master/texmf-dist/doc/latex/marginfit/Makefile
===================================================================
--- trunk/Master/texmf-dist/doc/latex/marginfit/Makefile (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/marginfit/Makefile 2017-07-13 23:10:09 UTC (rev 44788)
@@ -0,0 +1,33 @@
+
+PACKAGE := marginfit
+
+TEXMFDIST:=$(shell kpsewhich -var-value TEXMFDIST)
+
+all: sty doc
+
+sty: $(PACKAGE).sty
+$(PACKAGE).sty: $(PACKAGE).dtx $(PACKAGE).ins
+ pdflatex ${PACKAGE}.ins
+
+doc: $(PACKAGE).pdf
+$(PACKAGE).pdf: $(PACKAGE).dtx
+ pdflatex ${PACKAGE}.dtx
+ makeindex -s gind.ist -o $(PACKAGE).ind $(PACKAGE).idx
+ makeindex -s gglo.ist -o $(PACKAGE).gls $(PACKAGE).glo
+ pdflatex ${PACKAGE}.dtx
+ pdflatex ${PACKAGE}.dtx
+
+install: $(PACKAGE).dtx $(PACKAGE).ins $(PACKAGE).sty README $(PACKAGE).pdf
+ install -m 755 -d $(TEXMFDIST)/source/latex/$(PACKAGE)
+ install -m 644 -t $(TEXMFDIST)/source/latex/$(PACKAGE) $(PACKAGE).dtx
+ install -m 644 -t $(TEXMFDIST)/source/latex/$(PACKAGE) $(PACKAGE).ins
+ install -m 755 -d $(TEXMFDIST)/tex/latex/$(PACKAGE)
+ install -m 644 -t $(TEXMFDIST)/tex/latex/$(PACKAGE) $(PACKAGE).sty
+ install -m 755 -d $(TEXMFDIST)/doc/latex/$(PACKAGE)
+ install -m 644 -t $(TEXMFDIST)/doc/latex/$(PACKAGE) README
+ install -m 644 -t $(TEXMFDIST)/doc/latex/$(PACKAGE) $(PACKAGE).pdf
+
+dist: $(PACKAGE).tar.gz
+$(PACKAGE).tar.gz: Makefile README $(PACKAGE).dtx $(PACKAGE).ins $(PACKAGE).pdf
+ tar -cjf $@ --transform "s#^#$(PACKAGE)/#" $^
+
Property changes on: trunk/Master/texmf-dist/doc/latex/marginfit/Makefile
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/marginfit/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/marginfit/README (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/marginfit/README 2017-07-13 23:10:09 UTC (rev 44788)
@@ -0,0 +1,26 @@
+
+marginfit
+---------
+
+The marginfit package fixes various bugs with the margin paragraph
+implementation of LaTeX. Those bugs include margin notes that are attached to
+the wrong side as well as those that stick out of the bottom of the page. This
+package provides a drop-in replacement solution.
+
+Copyright 2017 Maurice Leclaire <leclaire at 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.
+
Property changes on: trunk/Master/texmf-dist/doc/latex/marginfit/README
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/marginfit/marginfit.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/latex/marginfit/marginfit.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/marginfit/marginfit.pdf 2017-07-13 23:09:20 UTC (rev 44787)
+++ trunk/Master/texmf-dist/doc/latex/marginfit/marginfit.pdf 2017-07-13 23:10:09 UTC (rev 44788)
Property changes on: trunk/Master/texmf-dist/doc/latex/marginfit/marginfit.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/source/latex/marginfit/marginfit.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/marginfit/marginfit.dtx (rev 0)
+++ trunk/Master/texmf-dist/source/latex/marginfit/marginfit.dtx 2017-07-13 23:10:09 UTC (rev 44788)
@@ -0,0 +1,581 @@
+% \iffalse meta-comment
+%
+% Copyright 2017 Maurice Leclaire <leclaire at 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.
+%
+% \fi
+%
+% \iffalse
+%<package>\NeedsTeXFormat{LaTeX2e}
+%<package>\ProvidesPackage{marginfit}[2017/07/07 v1.0 Fit Margin Paragraphs]
+%
+%<*driver>
+\documentclass{ltxdoc}
+\CheckSum{0}
+\makeatletter
+\usepackage{mparhack}
+\let\mparhack at addmarginpar\@addmarginpar
+\let\@addmarginpar\mph at orig@addmarginpar
+\let\marginfix at orig@marginpar\marginpar
+\let\marginfix at orig@addmarginpar\@addmarginpar
+\let\marginfix at orig@combinefloats\@combinefloats
+\usepackage{marginfix}
+\let\marginfix at marginpar\marginpar
+\let\marginfix at addmarginpar\@addmarginpar
+\let\marginfix at combinefloats\@combinefloats
+\let\marginpar\marginfix at orig@marginpar
+\let\@addmarginpar\marginfix at orig@addmarginpar
+\let\@combinefloats\marginfix at orig@combinefloats
+\let\marginfit at orig@marginpar\marginpar
+\usepackage{marginfit}
+\let\marginfit at marginpar\marginpar
+\let\marginpar\marginfit at orig@marginpar
+\makeatother
+\usepackage[pass]{geometry}
+\usepackage{minidocument}
+\usepackage{blindtext}
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
+\begin{document}
+\DocInput{marginfit.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \changes{v1.0}{2017/07/07}{Initial version}
+%
+% \GetFileInfo{marginfit.sty}
+%
+% \DoNotIndex{\def,\let,\global,\long,\expandafter}
+% \DoNotIndex{\csname,\endcsname,\advance,\string}
+% \DoNotIndex{\if,\else,\fi,\ifdim,\ifodd,\ifvoid,\ifcsname,\@ifnextchar}
+% \DoNotIndex{\chardef,\count,\dimen,\skip,\box,\setbox,\lastbox,\copy}
+% \DoNotIndex{\hbox,\vbox,\unhbox,\unvbox,\hskip,\vskip,\hss,\hrule,\vfill}
+% \DoNotIndex{\the,\ht,\dp,\@ne,\z@,\maxdimen}
+%
+% \title{The \textsf{marginfit} package}
+% \author{Maurice Leclaire\\\texttt{leclaire at in.tum.de}}
+% \date{\fileversion\ -- \filedate}
+% \maketitle
+%
+% \begin{abstract}
+% The \textsf{marginfit} package fixes various bugs with the margin paragraph
+% implementation of \LaTeX. Those bugs include margin notes that are attached
+% to the wrong side as well as those that stick out of the bottom of the page.
+% This package provides a drop-in replacement solution.
+% \end{abstract}
+%
+% \tableofcontents
+%
+% \def\minidocumentscale{0.3}
+%
+% \newcounter{margin}
+% \def\testmargin{\stepcounter{margin}\rule{0.7em}{0.7em}\marginpar[{
+% \hfill\rule[-0.3em]{\marginparwidth}{1.2em}\hbox to 0pt {\rule[-0.1em]{3\marginparsep}{0.1em}\hss}\hfill\null\\
+% \null\hfill\rule[-0.3em]{\marginparwidth}{1.2em}\hfill\null\\
+% \null\hfill\rule[-0.3em]{\marginparwidth}{1.2em}\hfill\null\\[-0.1em]
+% \null\hfill\rule[-0.3em]{0.3\marginparwidth}{2.5em}\hbox to 0.4\marginparwidth {\hfill\Huge\themargin\hfill}\rule[-0.3em]{0.3\marginparwidth}{2.5em}\hfill\null\\
+% \null\hfill\rule[-0.3em]{\marginparwidth}{1.2em}\hfill\null\\
+% \null\hfill\rule[-0.3em]{\marginparwidth}{1.2em}\hfill\null\\
+% \null\hfill\rule[-0.3em]{\marginparwidth}{1.2em}\hfill\null\\
+% \null\hfill\rule[-0.3em]{\marginparwidth}{1.2em}\hfill\null\\
+% \null\hfill\rule[-0.3em]{\marginparwidth}{1.2em}\hfill\null\\
+% \null\hfill\rule[-0.3em]{\marginparwidth}{1.2em}\hfill\null
+% }]{
+% \hfill\hbox to 0pt {\hss\rule[-0.1em]{3\marginparsep}{0.1em}}\rule[-0.3em]{\marginparwidth}{1.2em}\hfill\null\\
+% \null\hfill\rule[-0.3em]{\marginparwidth}{1.2em}\hfill\null\\
+% \null\hfill\rule[-0.3em]{\marginparwidth}{1.2em}\hfill\null\\[-0.1em]
+% \null\hfill\rule[-0.3em]{0.3\marginparwidth}{2.5em}\hbox to 0.4\marginparwidth {\hfill\Huge\themargin\hfill}\rule[-0.3em]{0.3\marginparwidth}{2.5em}\hfill\null\\
+% \null\hfill\rule[-0.3em]{\marginparwidth}{1.2em}\hfill\null\\
+% \null\hfill\rule[-0.3em]{\marginparwidth}{1.2em}\hfill\null\\
+% \null\hfill\rule[-0.3em]{\marginparwidth}{1.2em}\hfill\null\\
+% \null\hfill\rule[-0.3em]{\marginparwidth}{1.2em}\hfill\null\\
+% \null\hfill\rule[-0.3em]{\marginparwidth}{1.2em}\hfill\null\\
+% \null\hfill\rule[-0.3em]{\marginparwidth}{1.2em}\hfill\null
+% }}
+%
+% \def\testdocument{
+% \begin{minidocument}
+% \newgeometry{
+% twoside,
+% inner=1in,
+% outer=2in,
+% top=1in,
+% bottom=1in,
+% marginparwidth=1in,
+% marginparsep=0.5in
+% }
+% \normalmarginpar
+% \setlength{\marginparpush}{1em}
+% \setcounter{page}{2}
+% \setcounter{margin}{0}
+% \blindtext\par
+% \blindtext\par
+% \blindtext\par
+% \testmargin
+% \blindtext\par
+% \blindtext\par
+% \begin{itemize}
+% \item First formula $$ f(x) = 1 / x$$
+% \item Second formula $$ f(x) = 1 / x$$
+% \item Third formula $$ f(x) = 1 / x$$
+% \end{itemize}
+% \testmargin
+% \blindtext
+% \vfill
+% \blindtext
+% \testmargin
+% \blindtext
+% \blindtext
+% \testmargin
+% \blindtext
+% \testmargin
+% \blindtext
+% \clearpage
+% \end{minidocument}
+% }
+%
+% \newbox\doclatex
+% \newbox\docmparhack
+% \newbox\docmarginfix
+% \newbox\docmarginfit
+%
+% \makeatletter
+% \begingroup
+% \testdocument
+% \endgroup
+% \setbox\doclatex\hbox{\lastminidocument}
+% \Gm at changelayout
+% \makeatother
+%
+% \makeatletter
+% \begingroup
+% \let\@addmarginpar\mparhack at addmarginpar
+% \mph at setcol{ii:2}{1}
+% \mph at setcol{ii:3}{5}
+% \testdocument
+% \endgroup
+% \setbox\docmparhack\hbox{\lastminidocument}
+% \Gm at changelayout
+% \makeatother
+%
+% \makeatletter
+% \begingroup
+% \let\marginpar\marginfix at marginpar
+% \let\@addmarginpar\marginfix at addmarginpar
+% \let\@combinefloats\marginfix at combinefloats
+% \testdocument
+% \endgroup
+% \setbox\docmarginfix\hbox{\lastminidocument}
+% \Gm at changelayout
+% \makeatother
+%
+% \makeatletter
+% \begingroup
+% \let\marginpar\marginfit at marginpar
+% \testdocument
+% \endgroup
+% \setbox\docmarginfit\hbox{\lastminidocument}
+% \Gm at changelayout
+% \makeatother
+%
+% \begin{figure}[p]
+% \hbox to \textwidth {\hss\unhbox\doclatex}
+% \caption{Plain \LaTeX}
+% \label{fig:latex}
+% \end{figure}
+%
+% \begin{figure}[p]
+% \hbox to \textwidth {\hss\unhbox\docmparhack}
+% \caption{\textsf{mparhack} package}
+% \label{fig:mparhack}
+% \end{figure}
+%
+% \begin{figure}[p]
+% \hbox to \textwidth {\hss\unhbox\docmarginfix}
+% \caption{\textsf{marginfix} package}
+% \label{fig:marginfix}
+% \end{figure}
+%
+% \begin{figure}[p]
+% \hbox to \textwidth {\hss\unhbox\docmarginfit}
+% \caption{\textsf{marginfit} package}
+% \label{fig:marginfit}
+% \end{figure}
+%
+% \section{Motivation}
+%
+% The margin paragraph mechanism of \LaTeX\ has two main problems:
+% \begin{enumerate}
+% \item Near after a page break, it can happen that a margin note is placed
+% at the wrong side. See Margin Note~2 in Figure~\ref{fig:latex}.
+% \item Margin notes can stick out the bottom of the page. See Margin
+% Note~5 in Figure~\ref{fig:latex}. This happens if margin notes are too
+% large for the remaining space on the page or if they are shifted down,
+% because they do not fit at the callout position. However, \LaTeX\ does
+% not shift margin notes upwards, even if there would be enough space.
+% \end{enumerate}
+% Those problems are caused by calling the output routine for each margin
+% paragraph and placing it separately, only considering previously placed
+% margin notes. This can lead to wrong assumptions concerning the actual page
+% break, which then results in Problem~1. Further, this mechanism prevents look
+% ahead, which is the reason for Problem~2. Margin notes can be shifted down
+% based on the previous margin notes, but there is no possibility to shift them
+% up, if that would be necessary for later margin notes.
+%
+% The \textsf{mparhack} package\cite{mparhack} addresses Problem~1. This is
+% demonstrated in Figure~\ref{fig:mparhack}. Problem~1 is completely fixed by
+% this package without any known drawbacks and it also works in twocolumn mode.
+% However, the package does not consider problem~2.
+%
+% On the other hand, the \textsf{marginfix} package\cite{marginfix} addresses
+% Problem~2. This is shown in Figure~\ref{fig:marginfix}. However, this comes
+% with a lot of disadvantages:
+% \begin{itemize}
+% \item The \textsf{marginfix} package does not support twocolumn mode.
+% \item The \LaTeX\ Problem~1 manifests itself in another way: Margin notes
+% are attached to the wrong page instead of the wrong side.
+% \item The baseline (of the first line) of the margin note is not aligned
+% with the baseline of the callout position. Instead the top of the margin
+% note is aligned with the top of a strut at the callout position. This
+% gives us the misalignement seen for Margin Note~1 as the height of this
+% margin note is a bit more than that of a strut.
+% \item The margin notes are positioned at the natural height of the
+% callout position. However, the actual height can be different depending on
+% the glue on the page. The \textsf{marginfix} package does not consider
+% this glue and the effect can be seen for Margin Note~3.
+% \end{itemize}
+%
+% In contrast to the packages above, the \textsf{marginfit} package is not a
+% hack to the margin paragraph mechanism of \LaTeX\ but a complete
+% reimplementation. Instead of calling the output routine for each margin note,
+% it uses \TeX\ insertions. Hence, the margin notes are not placed individually
+% at callout time but together at the time a complete column is assembled.
+% Therefore, it does not suffer from the problems described above. The result
+% can be observed in Figure~\ref{fig:marginfit}.
+%
+% \section{Usage}
+%
+% The \textsf{marginfit} package is a drop-in replacement for the normal margin
+% paragraph mechanism. Therefore, putting \verb|\usepackage{marginfit}| into the
+% preamble of your document is sufficient. This package requires the
+% \verb|\pdfsavepos| functionality from pdf\TeX.
+%
+% \StopEventually{
+% \begin{thebibliography}{1}
+% \raggedright
+% \bibitem{mparhack}
+% Tom Sgouros and Stefan Ulrich.
+% \newblock \texttt{mparhack.sty}.
+% \newblock \textsc{ctan}: \url{http://ctan.org/pkg/mparhack}
+% \bibitem{marginfix}
+% Stephen Hicks.
+% \newblock \textsf{marginfix} package documentation.
+% \newblock \textsc{ctan}: \url{http://ctan.org/pkg/marginfix}
+% \end{thebibliography}
+% \PrintChanges
+% \setcounter{IndexColumns}{2}
+% \PrintIndex
+% }
+%
+% \section{Implementation}
+%
+% \begin{macro}{\marginfit at insert}
+% We define a new insertion class named \verb|\marginfit at insert|. All margin
+% paragraphs will be inserted there. At shipout time the respective box will
+% hold all the inserted margins for the respective page or column.
+% \begin{macrocode}
+\newinsert\marginfit at insert
+% \end{macrocode}
+% As a margin note does not account for the page goal, we set the corresponding
+% magnification count to zero.
+% \begin{macrocode}
+\count\marginfit at insert0
+% \end{macrocode}
+% Also the respective skip with the amount of fixed size material is set to
+% 0\,pt.
+% \begin{macrocode}
+\skip\marginfit at insert\z@
+% \end{macrocode}
+% As the magnification factor is zero, we can not track the amount of margin
+% material. Also, we do not want margins to be shifted to another page. Hence,
+% the corresponding dimension with the maximum amount of insertions per page is
+% set to the maximum.
+% \begin{macrocode}
+\dimen\marginfit at insert\maxdimen
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\marginfit at reverse}
+% We allocate a new box register were we store the margin notes in reverse
+% order.
+% \begin{macrocode}
+\newbox\marginfit at reverse
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\marginfit at box}
+% \begin{macro}{\marginfit at left}
+% \begin{macro}{\marginfit at right}
+% We also define a few aliases for temporary box registers.
+% \begin{macrocode}
+\chardef\marginfit at box0
+\chardef\marginfit at left0
+\chardef\marginfit at right1
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\c at marginfit@w}
+% \begin{macro}{\c at marginfit@r}
+% \begin{macro}{\c at marginfit@t}
+% A few counters are needed to enumerate labels. The first counter is used when
+% writing the positions of margin notes to the aux file and the second is used
+% when reading them in again. The third counter is used for the top positions of
+% margin columns.
+% \begin{macrocode}
+\newcount\c at marginfit@w
+\newcount\c at marginfit@r
+\newcount\c at marginfit@t
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\marginfit at top}
+% \begin{macro}{\marginfit at min}
+% \begin{macro}{\marginfit at pos}
+% We need some dimension registers to compute the placement of margin notes.
+% Those are the current top of the margin column, the minimal position the
+% current margin note can be placed in and the callout position of the current
+% margin note.
+% \begin{macrocode}
+\newdimen\marginfit at top
+\newdimen\marginfit at min
+\newdimen\marginfit at pos
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\marginfit at writepos}
+% The following macro saves the current position as a label to the aux file. The
+% parameter takes the number\,/\,name of the label in already expanded form.
+% \begin{macrocode}
+\def\marginfit at writepos#1{%
+ \pdfsavepos%
+ \write\@auxout{\string\@newl at bel{label at marginfit}{#1}{\the\pdflastypos}}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\marginfit at boxforeach}
+% We define a macro that loops over a vbox to execute code for each hbox in
+% that vbox. Due to the limited possibilities to access the inner boxes, we
+% must do that in reverse order. The first parameter is the box register number
+% and the second parameter is the code that should be executed for each hbox.
+% During execution \verb|\marginfit at box| holds the current hbox.
+% \begin{macrocode}
+\def\marginfit at boxforeach#1#2{%
+ \setbox#1\vbox{\unvbox#1 \global\setbox\marginfit at box\lastbox}%
+ \ifvoid\marginfit at box\else%
+ #2%
+ \marginfit at boxforeach#1{#2}%
+ \fi%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\marginfit at pass@i}
+% This is the first pass of the margin positioning routine. For each margin
+% note, the following macro splits the packed hbox to get the left and right
+% version of the margin paragraph. In the following we will use the correct
+% version, due to the setting of \verb|\marginfit at side|. The minimum position
+% is updated based on the size of the margin. The margin notes will be saved in
+% reverse order in the reverse box.
+% \begin{macrocode}
+\def\marginfit at pass@i{%
+ \setbox\marginfit at left\hbox{\unhbox\marginfit at box%
+ \global\setbox\marginfit at right\lastbox}%
+ \setbox\marginfit at right\hbox{\box\marginfit at right}%
+ \advance\marginfit at min\ht\marginfit at side%
+ \advance\marginfit at min\dp\marginfit at side%
+ \advance\marginfit at min\marginparpush%
+ \setbox\marginfit at reverse\vbox{\unvbox\marginfit at reverse%
+ \box\marginfit at side}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\marginfit at pass@ii}
+% This is the second pass of the margin positioning routine. For each margin
+% note, the callout position is read from the aux file. We compute the glue
+% above the margin note. If the minimum position requires it, we shift the
+% margin note upwards. If the current top position requires it, we shift the
+% margin note downwards. Afterwards we update the top and minimum positions.
+% Finally, the margin note is attached to the margin box.
+% \begin{macrocode}
+\def\marginfit at pass@ii{%
+ \global\advance\c at marginfit@r\@ne%
+ \ifcsname label at marginfit@\the\c at marginfit@r @m\endcsname%
+ \marginfit at pos\csname label at marginfit@\the\c at marginfit@r @m\endcsname sp%
+ \fi%
+ \advance\marginfit at pos\ht\marginfit at box%
+ \ifdim\marginfit at pos<\marginfit at min%
+ \marginfit at pos\marginfit at min%
+ \fi%
+ \advance\marginfit at top-\marginfit at pos%
+ \ifdim\marginfit at top<\marginparpush%
+ \advance\marginfit at pos\marginfit at top%
+ \advance\marginfit at pos-\marginparpush%
+ \marginfit at top\marginparpush%
+ \fi%
+ \vskip\marginfit at top%
+ \marginfit at top\marginfit at pos%
+ \advance\marginfit at top-\ht\marginfit at box%
+ \advance\marginfit at top-\dp\marginfit at box%
+ \advance\marginfit at min-\ht\marginfit at box%
+ \advance\marginfit at min-\dp\marginfit at box%
+ \advance\marginfit at min-\marginparpush%
+ \hrule height\z@%
+ \box\marginfit at box%
+ \hrule height\z@%
+}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\marginfit at marginbox}
+% The following macro constructs the margin box. First, at the top of the box
+% the position is saved and read in as \verb|\marginfit at top| if available. Then,
+% \verb|\marginfit at min| is computed as the bottom of the box. The first
+% boxforeach loop is executed on the box with the margin insertions. It computes
+% the real \verb|\marginfit at min| for the first margin note and saves the margin
+% notes in reverse order into the reverse box. The second pass is executed on
+% that reverse box and puts the margins into the right positions.
+% \begin{macrocode}
+\def\marginfit at marginbox{%
+ \vbox to\@colht {%
+ \global\advance\c at marginfit@t\@ne%
+ \expandafter\marginfit at writepos\expandafter{\the\c at marginfit@t @t}%
+ \ifcsname label at marginfit@\the\c at marginfit@t @t\endcsname%
+ \marginfit at top\csname label at marginfit@\the\c at marginfit@t @t\endcsname sp%
+ \fi%
+ \marginfit at min\marginfit at top%
+ \advance\marginfit at min-\@colht%
+ \advance\marginfit at min-\marginparpush%
+ \advance\marginfit at top\marginparpush%
+ \vskip-\marginparpush%
+ \marginfit at boxforeach\marginfit at insert\marginfit at pass@i%
+ \marginfit at boxforeach\marginfit at reverse\marginfit at pass@ii%
+ \vfill%
+ }%
+}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\marginfit at leftmargin}
+% The following macro appends a left margin to the current column.
+% \begin{macrocode}
+\def\marginfit at leftmargin{%
+ \let\marginfit at side\marginfit at left%
+ \hss%
+ \marginfit at marginbox%
+ \hskip\marginparsep%
+ \box\@outputbox%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\marginfit at rightmargin}
+% The following macro appends a right margin to the current column.
+% \begin{macrocode}
+\def\marginfit at rightmargin{%
+ \let\marginfit at side\marginfit at right%
+ \box\@outputbox%
+ \hskip\marginparsep%
+ \marginfit at marginbox%
+ \hss%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@makecol}
+% We redefine \verb|\@makecol| and add the procedure to append a margin to the
+% current column. First, the original \verb|\@makecol| is executed. If we have
+% margin material, we decide on which side the margin column will be and add it
+% to that side.
+% \begin{macrocode}
+\let\marginfit at makecol\@makecol
+\def\@makecol{%
+ \marginfit at makecol%
+ \ifvoid\marginfit at insert\else%
+ \setbox\@outputbox\vbox to\@colht {%
+ \hbox to\columnwidth {%
+ \if at twocolumn%
+ \if at firstcolumn%
+ \marginfit at leftmargin%
+ \else%
+ \marginfit at rightmargin%
+ \fi%
+ \else%
+ \ifodd\c at page%
+ \marginfit at rightmargin%
+ \else%
+ \marginfit at leftmargin%
+ \fi%
+ \fi%
+ }%
+ }%
+ \fi%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\marginpar}
+% We redefine \verb|\marginpar| to do an insertion instead of a call to the
+% output routine. First, we save the callout position to the aux file. Then, we
+% combine the left and right versions of the margin paragraph into an hbox and,
+% finally, make an insertion with that hbox.
+% \begin{macrocode}
+\def\marginpar{%
+ \global\advance\c at marginfit@w\@ne%
+ \expandafter\marginfit at writepos\expandafter{\the\c at marginfit@w @m}%
+ \@ifnextchar[\marginfit at mpar@ii\marginfit at mpar@i%
+}
+\long\def\marginfit at mpar@i#1{%
+ \@savemarbox\marginfit at box{#1}%
+ \setbox\marginfit at box\hbox{\copy\marginfit at box\box\marginfit at box}%
+ \marginfit at mpar@iii%
+}
+\long\def\marginfit at mpar@ii[#1]#2{%
+ \@savemarbox\marginfit at left{#1}%
+ \@savemarbox\marginfit at right{#2}%
+ \setbox\marginfit at box\hbox{\box\marginfit at left\box\marginfit at right}%
+ \marginfit at mpar@iii%
+}
+\def\marginfit at mpar@iii{%
+ \insert\marginfit at insert{\box\marginfit at box}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \iffalse
+\endinput
+% \fi
+%
+% \Finale
Property changes on: trunk/Master/texmf-dist/source/latex/marginfit/marginfit.dtx
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/source/latex/marginfit/marginfit.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/marginfit/marginfit.ins (rev 0)
+++ trunk/Master/texmf-dist/source/latex/marginfit/marginfit.ins 2017-07-13 23:10:09 UTC (rev 44788)
@@ -0,0 +1,25 @@
+\input docstrip.tex
+\keepsilent
+\usedir{tex/latex/marginfit}
+\preamble
+
+Copyright 2017 Maurice Leclaire <leclaire at 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.
+
+\endpreamble
+\generate{\file{marginfit.sty}{\from{marginfit.dtx}{package}}}
+\endbatchfile
Added: trunk/Master/texmf-dist/tex/latex/marginfit/marginfit.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/marginfit/marginfit.sty (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/marginfit/marginfit.sty 2017-07-13 23:10:09 UTC (rev 44788)
@@ -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 at 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 at insert
+\count\marginfit at insert0
+\skip\marginfit at insert\z@
+\dimen\marginfit at insert\maxdimen
+\newbox\marginfit at reverse
+\chardef\marginfit at box0
+\chardef\marginfit at left0
+\chardef\marginfit at right1
+\newcount\c at marginfit@w
+\newcount\c at marginfit@r
+\newcount\c at marginfit@t
+\newdimen\marginfit at top
+\newdimen\marginfit at min
+\newdimen\marginfit at pos
+\def\marginfit at writepos#1{%
+ \pdfsavepos%
+ \write\@auxout{\string\@newl at bel{label at marginfit}{#1}{\the\pdflastypos}}%
+}
+\def\marginfit at boxforeach#1#2{%
+ \setbox#1\vbox{\unvbox#1 \global\setbox\marginfit at box\lastbox}%
+ \ifvoid\marginfit at box\else%
+ #2%
+ \marginfit at boxforeach#1{#2}%
+ \fi%
+}
+\def\marginfit at pass@i{%
+ \setbox\marginfit at left\hbox{\unhbox\marginfit at box%
+ \global\setbox\marginfit at right\lastbox}%
+ \setbox\marginfit at right\hbox{\box\marginfit at right}%
+ \advance\marginfit at min\ht\marginfit at side%
+ \advance\marginfit at min\dp\marginfit at side%
+ \advance\marginfit at min\marginparpush%
+ \setbox\marginfit at reverse\vbox{\unvbox\marginfit at reverse%
+ \box\marginfit at side}%
+}
+\def\marginfit at pass@ii{%
+ \global\advance\c at marginfit@r\@ne%
+ \ifcsname label at marginfit@\the\c at marginfit@r @m\endcsname%
+ \marginfit at pos\csname label at marginfit@\the\c at marginfit@r @m\endcsname sp%
+ \fi%
+ \advance\marginfit at pos\ht\marginfit at box%
+ \ifdim\marginfit at pos<\marginfit at min%
+ \marginfit at pos\marginfit at min%
+ \fi%
+ \advance\marginfit at top-\marginfit at pos%
+ \ifdim\marginfit at top<\marginparpush%
+ \advance\marginfit at pos\marginfit at top%
+ \advance\marginfit at pos-\marginparpush%
+ \marginfit at top\marginparpush%
+ \fi%
+ \vskip\marginfit at top%
+ \marginfit at top\marginfit at pos%
+ \advance\marginfit at top-\ht\marginfit at box%
+ \advance\marginfit at top-\dp\marginfit at box%
+ \advance\marginfit at min-\ht\marginfit at box%
+ \advance\marginfit at min-\dp\marginfit at box%
+ \advance\marginfit at min-\marginparpush%
+ \hrule height\z@%
+ \box\marginfit at box%
+ \hrule height\z@%
+}%
+\def\marginfit at marginbox{%
+ \vbox to\@colht {%
+ \global\advance\c at marginfit@t\@ne%
+ \expandafter\marginfit at writepos\expandafter{\the\c at marginfit@t @t}%
+ \ifcsname label at marginfit@\the\c at marginfit@t @t\endcsname%
+ \marginfit at top\csname label at marginfit@\the\c at marginfit@t @t\endcsname sp%
+ \fi%
+ \marginfit at min\marginfit at top%
+ \advance\marginfit at min-\@colht%
+ \advance\marginfit at min-\marginparpush%
+ \advance\marginfit at top\marginparpush%
+ \vskip-\marginparpush%
+ \marginfit at boxforeach\marginfit at insert\marginfit at pass@i%
+ \marginfit at boxforeach\marginfit at reverse\marginfit at pass@ii%
+ \vfill%
+ }%
+}%
+\def\marginfit at leftmargin{%
+ \let\marginfit at side\marginfit at left%
+ \hss%
+ \marginfit at marginbox%
+ \hskip\marginparsep%
+ \box\@outputbox%
+}
+\def\marginfit at rightmargin{%
+ \let\marginfit at side\marginfit at right%
+ \box\@outputbox%
+ \hskip\marginparsep%
+ \marginfit at marginbox%
+ \hss%
+}
+\let\marginfit at makecol\@makecol
+\def\@makecol{%
+ \marginfit at makecol%
+ \ifvoid\marginfit at insert\else%
+ \setbox\@outputbox\vbox to\@colht {%
+ \hbox to\columnwidth {%
+ \if at twocolumn%
+ \if at firstcolumn%
+ \marginfit at leftmargin%
+ \else%
+ \marginfit at rightmargin%
+ \fi%
+ \else%
+ \ifodd\c at page%
+ \marginfit at rightmargin%
+ \else%
+ \marginfit at leftmargin%
+ \fi%
+ \fi%
+ }%
+ }%
+ \fi%
+}
+\def\marginpar{%
+ \global\advance\c at marginfit@w\@ne%
+ \expandafter\marginfit at writepos\expandafter{\the\c at marginfit@w @m}%
+ \@ifnextchar[\marginfit at mpar@ii\marginfit at mpar@i%
+}
+\long\def\marginfit at mpar@i#1{%
+ \@savemarbox\marginfit at box{#1}%
+ \setbox\marginfit at box\hbox{\copy\marginfit at box\box\marginfit at box}%
+ \marginfit at mpar@iii%
+}
+\long\def\marginfit at mpar@ii[#1]#2{%
+ \@savemarbox\marginfit at left{#1}%
+ \@savemarbox\marginfit at right{#2}%
+ \setbox\marginfit at box\hbox{\box\marginfit at left\box\marginfit at right}%
+ \marginfit at mpar@iii%
+}
+\def\marginfit at mpar@iii{%
+ \insert\marginfit at insert{\box\marginfit at box}%
+}
+\endinput
+%%
+%% End of file `marginfit.sty'.
Property changes on: trunk/Master/texmf-dist/tex/latex/marginfit/marginfit.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check 2017-07-13 23:09:20 UTC (rev 44787)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check 2017-07-13 23:10:09 UTC (rev 44788)
@@ -398,7 +398,7 @@
make4ht makebarcode makebase makebox makecell makecirc makecmds
makedtx makeglos makeplot
makeshape mandi manfnt manfnt-font manuscript margbib
- marginfix marginnote markdown marvosym
+ marginfit marginfix marginnote markdown marvosym
matc3 matc3mem match_parens
math-e math-into-latex-4 mathabx mathabx-type1 mathalfa mathastext
mathcomp mathdesign mathdots mathexam mathpartir mathpunctspace
Modified: trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc 2017-07-13 23:09:20 UTC (rev 44787)
+++ trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc 2017-07-13 23:10:09 UTC (rev 44788)
@@ -632,6 +632,7 @@
depend mandi
depend manfnt
depend manuscript
+depend marginfit
depend marginfix
depend marginnote
depend markdown
Added: trunk/Master/tlpkg/tlpsrc/marginfit.tlpsrc
===================================================================
More information about the tex-live-commits
mailing list