⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 picinpar.sty

📁 一个最容易懂的LaTeX 入门教材。这个文档已经被翻译成很多种语言
💻 STY
📖 第 1 页 / 共 2 页
字号:
% This is picinpar.sty% Macros for making windows with LaTeX%% By Friedhelm Sowa, Heinrich-Heine-University D\"usseldorf,%                    Computing Center%                    In case of emergency try to get the email adress%                    after having checked the input :-)%                    Okay, for those who are too lazy:%                          tex@ze8.rz.uni-duesseldorf.de%                          sowa@convex.rz.uni-duesseldorf.de%% Incorporated are basic ideas of Alan Hoenig (Thanks Alan!)% Thanks to Phil Taylor, who gave some useful hints during his% tutorial at the EURO TeX 92 in Prague.%% Also thanks to Ulrik Vieth, who incorporated the macros for% generating captions within the windows.%%----------------% Known problems:%%    - Don't use \samepage%    - Use \footnotemark within and \footnotetext outside the%      window-environment instead of \footnote%    - When using the epic-package load picinpar before epic%      like \documentstyle[...,picinpar,epic]{...}%----------------%%                       Here we go%% Counts\newcount\br     \newcount\bl\newcount\na     \newcount\nb  \newcount\tcdsav\newcount\tcl    \newcount\tcd \newcount\tcn\newcount\cumtcl \newcount\cumpartcl% Dimens\newdimen\lftside   \newdimen\rtside\newdimen\hpic      \newdimen\vpic\newdimen\strutilg  \newdimen\picwd\newdimen\topheight \newdimen\ilg\newdimen\lpic      \newdimen\cumpar% Tokens\newtoks\twa \newtoks\la \newtoks\ra\newtoks\ha  \newtoks\pictoc% Boxes\newbox\rawtext   \newbox\holder\newbox\windowbox \newbox\wartext\newbox\finaltext \newbox\aslice    \newbox\bslice\newbox\wbox      \newbox\wstrutbox \newbox\picbox\newbox\waslice   \newbox\wbslice   \newbox\fslice% Another strut\def\wstrut{\relax\ifmmode\copy\wstrutbox\else\unhcopy\wstrutbox\fi}%\long\def\window[#1,#2,#3,#4] {%% #1 is an integer---no.  of lines down from par top% #2 is l, r or c what means left, right or centered%    default is, that the picture is printed at the left side% #3 is the material for setting a graphic box% #4 is the explanation for the graphic\vskip\parskip\global\cumpar=0pt\global\cumpartcl=0\global\cumtcl=0    \tcd=#1    \lftside=0pt \rtside=0pt%    \hpic=\linewidth    \twa={} \la={} \ra={} \ha={}\setbox\wbox=\hbox{(}\computeilg\pictoc={#3}\setbox\windowbox=\vbox{\hbox{#3}}\setbox\wbox=\vbox{\hbox{\noindent#4}}\picwd=\wd\windowbox\hpic=\picwd\vpic=\ht\windowbox\advance\vpic\dp\windowbox\if #2c\lftside=\linewidth\advance\lftside-\picwd\rtside=0.5\lftside       \lftside=\rtside\else \if #2r\lftside=\linewidth\advance\lftside-\picwd              \rtside=0pt      \else\rtside=\linewidth\advance\rtside-\picwd           \lftside=0pt      \fi\fi%% In case of a centered picture, that does not allow text beside% we have to add some glue between preceding text, window and% following text.%\if #2c \ifdim\rtside<72pt  \rtside=0pt\lftside=0pt  \setbox\windowbox=\vbox{%    \hrule width\picwd height0pt depth0pt    \vskip.5\parskip\box\windowbox\vskip.5\parskip    \hrule width\picwd height0pt depth0pt}  \vpic=\ht\windowbox\advance\vpic\dp\windowbox \fi \parskip0pt % Within the window area a \parskip>0pt may look ugly\fi\ifnum\picwd=0\setbox\picbox=\vbox{\hbox{\noindent#4}}   % without picture                               \hpic=\wd\picbox % calculate dimensions              \ifnum\lftside=0\rtside=\linewidth\advance\rtside-\hpic              \else\ifnum\rtside=0\lftside=\linewidth\advance\lftside-\hpic              \else\rtside=0.5\linewidth\advance\rtside-0.5\hpic                   \lftside=\rtside              \fi\fi\else\setbox\picbox=\vbox{\hsize=\hpic\vbox to\vpic{\box\windowbox\vfill}%\ifdim\ht\wbox>0pt\vskip\ilg\vbox{\hsize=\hpic\noindent#4%% See above, this is the second part of glue%\if #2c \ifdim\rtside=0pt \ifdim\lftside=0pt \vskip\parskip\hrule width\hpic height0pt depth0pt \fi \fi\fi}\fi}\fi\vpic=\ht\picbox\advance\vpic\dp\picbox\ifdim\lftside>0pt\advance\lftside-0.5\baselineskip\fi  % put in a distance\ifdim\rtside>0pt\advance\rtside-0.5\baselineskip\fi    % between text and                                                        % window\global\br=\rtside \global\bl=\lftside\ifnum\picwd=0\ifdim\vpic>0pt\picwd=\hpic\else\vpic=\ht\picbox\advance\vpic\dp\picbox\fi\fi    \global\tcl=0 \lpic=0pt    \loop\global\advance\tcl by 1 \lpic=\tcl\baselineskip    \ifdim\lpic<\vpic\repeat    \vpic=\lpic    \global\cumtcl=\tcl%% Here we know exactly the number of indented lines and% are able to generate the tokens for the \parshape list%    \ifnum\bl>0\la={ 0pt \lftside}\fi    \ifnum\br>0\ra={ 0pt \rtside}\fi    \ifnum\tcd>0\ha={ 0pt \linewidth}\fi    \ifnum\tcl<1\global\tcl=1\fi    \createparshapespec    \tcd=#1                        % restore the lintel    \global\tcdsav=#1%% This is a very tricky part of the package. Some day there% will exist a detailed documentation.%\ifdim\parskip>0pt    \def\par{\hfill\vadjust{\vskip0pt\vbox to\parskip{\vss}}             \global\advance\cumpartcl by 1             \global\advance\cumpar by \parskip             \global\lpic=\ht\wstrutbox             \global\advance\lpic by \dp\wstrutbox             \ifdim\cumpar<\lpic             \else\advance\cumpar by -\lpic                  \advance\cumtcl by -1             \fi             \egroup\global\tcd=\tcdsav             \setbox\wartext=\vbox{\unvbox\rawtext}\setbox\rawtext=\vbox\bgroup\clubpenalty=0\widowpenalty=0\tolerance=1000\global\lpic=\ht\wstrutbox\global\advance\lpic by \dp\wstrutbox%% Pick up header lines%\ifnum\tcd>0\vbadness=10000\splittopskip0pt \loop\setbox\holder=\vsplit\wartext to \lpic  \hpic=\wd\holder\prune\holder\hpic  \ifdim\ht\holder=\parskip   \hbox{\vrule height\parskip width0pt depth0pt}   \typeout{A paragraph ended within headlines! Please change }   \typeout{the number of headlines for the window environment!}   \global\advance\tcd by -1  \else\hbox{\vbox{\box\holder\unskip}}   \global\advance\tcd by -1  \fi \ifnum\tcd>0\repeat \global\tcd=0 \ifdim\ht\wartext>0pt \ifdim\ht\wartext=\parskip\global\advance\tcdsav by 1       \setbox\holder=\vsplit\wartext to \lpic       \hbox{\vrule height\parskip width0pt depth0pt}       \global\advance\cumpar by -\parskip       \global\advance\cumpartcl by -1 \fi\fi\fi%% Pick up lines beside window, the rest too%\global\tcn=0\topheight=0pt\ifdim\ht\wartext>0pt\vbadness=10000\splittopskip0pt \loop\setbox\holder=\vsplit\wartext to \lpic  \hpic=\wd\holder\prune\holder\hpic  \ifdim\ht\holder=\parskip  \hbox{\vrule height\parskip width0pt depth0pt}  \global\advance\topheight by \parskip  \else   \setbox\fslice=\hbox{\box\holder}    \hpic=\ht\fslice    \advance\hpic by\dp\fslice   \ifdim\hpic>\lpic   \global\advance\topheight by\hpic   \hbox{\vbox{\box\fslice\vss}}   \else\ifdim\hpic=0pt\relax   \else\global\advance\topheight by \lpic   \hbox{\vbox{\box\fslice}}\fi\fi  \fi \ifdim\ht\wartext>0pt\repeat\tcn=0\loop\advance\tcn by 1\advance\topheight by -\lpic\ifdim\topheight>0pt\repeat\hpic=\topheight\ifdim\hpic<0pt\advance\tcn by -1\fi\global\topheight=\tcn\lpic\fi%% If the indented part is not completed we have to generate a% new token for the \parshape list%\ifnum\tcn<\cumtcl\global\tcl=\cumtcl\global\advance\topheight by\cumpartcl\parskip             \global\advance\tcl by -\tcn \global\twa={}             \ifnum\tcl>0\global\vpic=\topheight\global\topheight=\tcl\lpic\global\advance\vpic by \topheight\global\advance\vpic by \lpic             \createparshapespec             \parshape=\tcn \the\twa             \else\parshape=0             \fi\else\parshape=0\fi}\else\def\par{\\}\fi % new definition of \par in case of \parskip>0 ends here%% This is where we start to pick up the paragraph(s)%    \setbox\rawtext=\vbox\bgroup\unvbox\rawtext\unskip    \clubpenalty=0\widowpenalty=0    \tolerance=1000    \parshape=\tcn \the\twa }%\def\endwindow{%    \global\tcd=\tcdsav    \egroup\vskip\parskip\parshape=0 % reset parshape; end \box\rawtext    \vbadness=10000    \splittopskip=0pt%% Typeset the lines above the window%\ifnum\tcd>0\setbox\holder=\vsplit\rawtext to \tcd\baselineskip\tcn=\tcd\loop\advance\tcn -1\setbox\fslice=\vsplit\holder to\baselineskip\prune\fslice\linewidth\topheight=0pt\ifnum\dp\fslice>\dp\wstrutbox       \advance\topheight-\dp\fslice       \advance\topheight\dp\wstrutbox       \advance\topheight\ilg\fi\hbox to\linewidth{\box\fslice}\vskip-\topheight\ifdim\ht\holder>0pt\repeat\fi%% Now we build the boxes beside the window%\global\topheight=\tcl\baselineskip\ifnum\cumpartcl>0\global\tcl=\cumtcl      \global\topheight=\vpic\fi\ifnum\bl>0\ifnum\br>0\multiply\topheight by 2\fi\fi\ifnum\bl>0\setbox\holder=\vsplit\rawtext to\topheight\else\ifnum\br>0\setbox\holder=\vsplit\rawtext to\topheight\fi\fi\tcn=\tcl \na=0 \nb=0\ifnum\bl>0\ifnum\br>0\multiply\tcn by 2\fi\fi\ifnum\bl>0\na=\tcn\ifnum\br>0\divide\na by 2\fi\fi\ifnum\br>0\nb=\tcn\ifnum\bl>0\divide\nb by 2\fi\fi\ifnum\na=0\ifnum\nb=0      \setbox\waslice=\vbox to\vpic{\vss}      \setbox\wbslice=\vbox to\vpic{\vss}      \bl=1\br=1      \vskip\ilg\fi\fi%% both sides%\ifnum\na>0 \ifnum\nb>0\loop\advance\nb -1\advance\na -1\setbox\aslice=\vsplit\holder to\baselineskip\prune\aslice\lftside\setbox\waslice=\vbox{\unvbox\waslice\hboxto\lftside{\box\aslice\hfil}}\setbox\bslice=\vsplit\holder to\baselineskip\prune\bslice\rtside\setbox\wbslice=\vbox{\unvbox\wbslice\hboxto\rtside{\box\bslice\hfil}}\ifnum\nb>0\repeat\fi\fi%% only text on the left side%\ifnum\na>0    \loop\advance\na -1    \setbox\aslice=\vsplit\holder to\baselineskip    \prune\aslice\lftside    \setbox\waslice=\vbox{\unvbox\waslice\hbox    to\lftside{\box\aslice\hfil}}    \ifdim\ht\holder>0pt\repeat\fi%% only text on the right side%\ifnum\nb>0    \loop\advance\nb -1    \setbox\bslice=\vsplit\holder to\baselineskip    \prune\bslice\rtside    \setbox\wbslice=\vbox{\unvbox\wbslice\hbox    to\rtside{\box\bslice\hfil}}    \ifdim\ht\holder>0pt\repeat\fi%% fixing the dimensions of the window part%\ifnum\bl=0\topheight=\ht\wbslice\else\ifnum\br=0\topheight=\ht\waslice      \else\ifdim\ht\waslice>\ht\wbslice\topheight=\ht\waslice            \else\topheight=\ht\wbslice\fi\fi\fi%% ship out the window material to the main vertical list%\setbox\windowbox=\vbox{\hbox to\linewidth{%\ifnum\bl>0\box\waslice\hfill\fi%\vbox to\topheight{\hrule width\picwd height0pt depth0pt\vskip0pt%\vfill\unvbox\picbox%\ifnum\picwd>0\vfill\fi%\vss}\ifnum\br>0\hfill\box\wbslice\fi}}%\unvbox\windowbox%\loop \setbox\bslice=\vsplit\rawtext to\baselineskip \prune\bslice\linewidth \setbox\wbslice=\vbox{\hbox to\linewidth{\box\bslice\hfil}} \unvbox\wbslice \ifdim\ht\rawtext>0pt\repeat}% FINITO%% What else do we need?%\def\prune#1#2{% take a \vbox containing a single \hbox,% \unvbox it, and cancel the \lastskip% put in a \hbox of width #2 \unvbox#1 \setbox#1=\lastbox % \box#1 now is an \hbox \ifdim\ht#1=\parskip \setbox#1=\hbox to#2{\vrule height\parskip depth0pt width0pt\hfill} \else\ifdim\ht#1=0pt\relax \else\setbox#1=\hbox to#2{\wstrut\unhbox#1\unskip}\fi\fi}%% Here the token \twa is generated.% It's not so difficult as it looks like.%\def\createparshapespec{%\global\tcn=0\ifnum\bl>0\global\tcn=\tcl\else\ifnum\br>0\global\tcn=\tcl\fi\fi\na=0 \nb=0\ifnum\bl>0\ifnum\br>0\multiply\tcn by 2\fi\fi

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -