!* -*- Teco -*- Library created and maintained by KMP@MC ! !~Filename~:! !Macros for doing useful TeX Setups! TeXmac !& Setup TeXmac Library:! !& Things to do to set us up ! m(m.m &_Get_Library_Pointer)TeX"e m(m.m Load_Library)TeX' !Insert TeXmac Aux Macros:! !S Insert the macros TeXmac needs! i %_TeXmac_Support %_\noflash{...text...}_makes_a_box_as_wide_as_text,_but_which_is_whitespace \def\noflash#1{\save0\hbox{#1}\hbox_to_1wd0{\hfill}}  !UnSetup Indented TeX Display:! !S Undo a TeX Display ! q{TeX}_..D[..D !* Get TeX brace ..D in effect ! f[vbw f[vz !* Bind virtual buffer ! :l -:s\vbox"e !* Search back for a \vbox ! :i* NTD No_TeX_Display  fserr' .,( fll .)fsbound !* Put bounds around the \vbox ! h m(m.m &_Save_for_Undo) UnSetup_Indented_TeX_Display  j .,( s{ .)k zj -d !* Delete the \vbox ! j <:s\hbox{; fkd !* Search for next backslashed thing! 9f~\noflash{"e 9d !* Kill start of noflash if exists ! < 1a-}"e d 0; ' f_ c >' !* Loop flushing chars in noflash ! ful -d !* Flush end of \hbox ! > !* Come here to iterate ! j  !* Return ! !Setup Indented TeX Display:! !S Makes an indented display from region ! [0[1 [I !* Allocate temp q-reg space ! !* ! f[vbw f[vz !* Bind virtual buffer bounds open ! ff"e .,(w.)ffsbound' !* Maybe Set buffer bounds to region! "# j , fsbound' !* Set bounds to args if given ! !* ! h m(m.m &_Save_for_Undo) Setup_Indented_TeX_Display  !* ! j @f_ l !* Move across indentation ! fsshpos"n !* If there is whitespace here, ! z: !* Set mark at end of buffer ! -(fsshpos( j !* Top line must not be indented ! ))@m(m.m^R_Indent_Rigidly)' !* Now pull whole display backward ! !* ! 0uI !* Q-reg I for indent-related stuff ! !* ! j < .-z; !* Loop until last line ! @f_ l !* Move across whitespace ! fsshpos,qIfuI !* Get max of q0 and hpos in qI ! l > !* Go down and continue ! !* ! qI,_:iI !* Make a buffer of qI chars in qI ! !* ! j < !Top! .-z; !* Loop until last line ! 1a-î"e i\vskip_5pt l oTop' !* Blank lines just do vskip ! .u0 @f_ l !* Move across indentation ! fsshposu1 !* Save current hpos (twice) ! q0,.k !* Kill indentation ! 0,q1:gIu0 !* Get indent-length substr in q0 ! i\hbox{ !* Begin hbox ! q1"n i\noflash{ g0 i} ' !* Maybe yank filler text ! .,(fqI-q1)x0 !* Get rest of line (tail) in q0 ! :l i} !* End hbox ! q1:fI0 !* Merge new tail into qI ! l !* Go down a line ! > !* Continue loop ! !* ! j i\vbox{ zj i} !* Set return point ! j z: !* Set point after region altered !  !* Return !