diff options
author | Karl Berry <karl@freefriends.org> | 2011-11-25 00:10:21 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-11-25 00:10:21 +0000 |
commit | 5e2d6e0ef7921592cad509d5e965de094f0bfd64 (patch) | |
tree | 99d733ed43be7d3997c77e3f57d2b544d5480cd6 /Master/texmf-dist/tex/latex | |
parent | afa0c1517d983115db76442c8f7a9c3a99e3bace (diff) |
magaz 0.3 (22nov11)
git-svn-id: svn://tug.org/texlive/trunk@24650 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/magaz/magaz.sty | 58 |
1 files changed, 35 insertions, 23 deletions
diff --git a/Master/texmf-dist/tex/latex/magaz/magaz.sty b/Master/texmf-dist/tex/latex/magaz/magaz.sty index cfed39252ab..e1a33ec3bf3 100644 --- a/Master/texmf-dist/tex/latex/magaz/magaz.sty +++ b/Master/texmf-dist/tex/latex/magaz/magaz.sty @@ -1,19 +1,20 @@ -% magaz.sty Ver 0.2 04-Sep-2003 "Magazine style" -% Copyright 1999, Donald Arseneau, asnd@triumf.ca, Vancouver, Canada -% This software is free to distribute, unaltered, and to use in any -% application. It may be altered and incorporated in other software freely. +% magaz.sty Ver 0.3 22-Nov-2011 "Magazine style" +% Copyright 1999-2011, Donald Arseneau, asnd@triumf.ca, Vancouver, Canada +% This software may be freely used, transmitted, reproduced, or modified +% provided that the copyright notice and this permission is retained. % -% This version is just a single tool from a larger body of tools I might -% try to implement if I ever have the spare time. I'm writing this part -% now [1999] in response to a request on comp.text.tex. +% This version is just a single tool from a larger body of tools I am +% unlikely to implement. I wrote this in 1999 in response to a request +% on comp.text.tex. % +% Features: % Yes Special formatting for first line of text in a paragraph % No Special formatting for for first n lines (allow each different) % No Also for first character (drop caps) (working together) -% No "Continued on"/"continued from" markers +% No "Continued on"/"continued from" markers (like fwlw) % No wrapfig spanning columns % No wrapfig placed at fixed location on page -% NO! Piecing together fragments of gallies to fit page +% NO! Piecing together fragments of gallies to fit page (maybe flowfram) % % Instructions: % @@ -34,9 +35,11 @@ % as in "\renewcommand\FirstLineFont{\MakeUppercase}". The defult % definition is "\providecommand\FirstLineFont{\scshape}". -\ProvidesPackage{magaz}[2003/09/04 v0.2] +\ProvidesPackage{magaz}[2011/11/22 v0.3] -\newcommand\FirstLine[1]{\begingroup +\newcommand\FirstLine[1]{% + \relax\if@inlabel\noindent\fi % produce a pending list item first + \begingroup % typeset text 3 times: 1) using all breaks to count segments; 2) with % a full first line and \FirstLineFont to get first line and remaining % segments; 3) Using current font, keeping only `remaining segments' @@ -51,36 +54,44 @@ \global\mathchardef\mz@numl\prevgraf }% end vbox "1)" \setbox\@tempboxa\vbox{% 2) first line, plus other segments - \parshape \tw@ \z@\hsize \z@\maxdimen + \parshape \tw@ \z@\linewidth \z@\maxdimen \doublehyphendemerits\z@ \finalhyphendemerits\z@ - \pretolerance\m@ne \parfillskip\fill + \sloppy \pretolerance\m@ne \parfillskip\fill {\FirstLineFont{#1}\@@par}% \ifnum\prevgraf>\tw@ % Bad argument: not simple text or too much text \mz@handlebad{#1}% \else \unskip\unkern\unpenalty \unskip\unkern\unpenalty \ifnum\prevgraf<\tw@ % All text fits on first line - \setbox\z@\lastbox + \setbox\z@\lastbox % Grab that line \global\setbox\mz@firstbox\hbox{\unhbox\z@\unskip}% + %{\message{Entire text fits: }\showhyphens{\unhcopy\mz@firstbox}}% \global\setbox\mz@remains\hbox{}% \else % 2 lines: text fills first line with some left over - \setbox\z@\lastbox + \setbox\z@\lastbox % remainders to \z@ \ifvoid\z@ % could not grab last line \mz@handlebad{#1}% - \else + \else \unskip\unkern\unpenalty \unskip\unkern\unpenalty - \global\setbox\mz@firstbox\lastbox % 2a) break up "other segments" + \global\setbox\mz@firstbox\lastbox % grab first line + %{\message{First line is: }\showhyphens{\unhcopy\mz@firstbox\unskip\unskip}}% + %{\message{Remaining segments are: }\showhyphens{\unhcopy\z@\unskip\unskip}}% + % 2a) break up "other segments": \hsize\z@ \leftskip\z@skip \rightskip\z@skip \parfillskip\fill \parshape\z@ \pretolerance\m@ne \tolerance\@ne - \noindent\nobreak % \nobreak because leftskip adds breakpoint + {\everypar{}\noindent}% mid-par so no \everypar or \parindent + \nobreak % \nobreak because leftskip adds breakpoint \unhbox\z@\unskip\@@par % gives number of "extra segments" + %\message{There are \number\mz@numl\space segments in total and \the\prevgraf\space "remaining segments". }% \@tempcnta\mz@numl \advance\@tempcnta-\prevgraf + %\message{Number of segs in 1st line: \the\@tempcnta. }% \advance\@tempcnta\@ne % number of segs in 1st line plus 1 \edef\@tempa{\the\@tempcnta\space}% 3) Collect "other segments" \@whilenum \@tempcnta>\@ne\do{% build \parshape lines \edef\@tempa{\@tempa \z@\z@}% \advance\@tempcnta\m@ne }% + %\message{Parshape: \@tempa \z@\maxdimen}% \parshape \@tempa \z@\maxdimen #1\@@par \unskip\unkern\unpenalty \unskip\unkern\unpenalty @@ -90,9 +101,10 @@ \fi }% end vbox "2)" \endgroup - \ifvoid\mz@firstbox #1% Error case: just output the text + \ifvoid\mz@firstbox + #1% Error case: just output the text \else - \noindent + {\everypar{}\noindent}\nobreak % everypar was captured in firstbox \unhbox\mz@firstbox\unskip\unskip\unpenalty\break \unhbox\mz@remains\unskip\unskip\unpenalty \spacefactor\mz@spf \fi @@ -107,9 +119,9 @@ % as a fallback method of grabbing lines, and I might allow more or % unusual text in the `remainders' by skipping the step of setting two % lines (instead setting one first line plus many tiny lines all together). -% The following macro would then handle those cases as an error recovery -% mechanism. Right now it just gives an error message and dumps out -% the text. +% The following macro would then handle those cases with a secondary +% algorithm as an error recovery mechanism. Right now it just gives an +% error message and dumps out the text. \def\mz@handlebad{\mz@error} \def\mz@error#1{% |